$activity = $a->getOne($id); $prepare = $this->prepareActivity($activity, array('user' => $user)); if (is_error($prepare)) { $error = $prepare; if ($error['errno'] != '-2') { exit($error['message']); } } if (!$this->checkSubscribe()) { exit('请关注我们后参加活动'); } if ($activity['type'] == 'direct') { $got = $a->getRecord($user['uid'], $activity['actid']); if (empty($got)) { if (empty($error)) { $ret = $a->grap($user, $activity); if (is_error($ret)) { exit($ret['message']); } elseif ($ret['status'] == 'none') { exit('这一轮没有抢到红包, 请期待我们下一次活动'); } else { $got = $a->getRecord($user['uid'], $activity['actid']); $ret = $this->send($activity, $got, $user); if (is_error($ret)) { exit('红包发放失败, 你可以在活动结束之前重新领取. 活动结束后无法领取, 请注意'); exit($ret['message']); } exit('success'); } } } else {
public function doMobileRedSend() { global $_W, $_GPC; require_once WWX_FXXT_ROOT . '/class/Activity.class.php'; $user = $this->redauth(); ///74.判断红包领取及用户信息记录。 $id = $_GPC['actid']; $id = intval($id); $a = new Activity(); $activity = $a->getOne($id); /**Activity:2.根据活动ID查询活动内容及设置等**/ $prepare = $this->prepareActivity($activity, array('user' => $user)); ///75.查询红包活动的所有限制条件并输出。 if (is_error($prepare)) { $error = $prepare; if ($error['errno'] != '-2') { exit($error['message']); } } if (!$this->checkSubscribe()) { ///76.判断用户是否已经关注。 exit('请关注我们后参加活动'); } if ($activity['type'] == 'direct') { $got = $a->getRecord($user['uid'], $activity['actid']); /**Activity:8.查询活动红包领取信息。**/ if (empty($got)) { if (empty($error)) { $ret = $a->grap($user, $activity); /**Activity:10.抢红包。**/ if (is_error($ret)) { exit($ret['message']); } elseif ($ret['status'] == 'none') { exit('这一轮没有抢到红包, 请期待我们下一次活动'); } else { $got = $a->getRecord($user['uid'], $activity['actid']); /**Activity:8.查询活动红包领取信息。**/ $ret = $this->redsend($activity, $got, $user); ///77.发送用户红包。 if (is_error($ret)) { exit('红包发放失败, 你可以在活动结束之前重新领取. 活动结束后无法领取, 请注意'); exit($ret['message']); } exit('success'); } } } else { if ($got['status'] == 'created') { $ret = $this->redsend($activity, $got, $user); ///77.发送用户红包。 if (is_error($ret)) { exit('红包发放失败, 你可以在活动结束之前重新领取. 活动结束后无法领取, 请注意'); exit($ret['message']); } exit('success'); } } } if ($activity['type'] == 'shared') { require_once WWX_FXXT_ROOT . '/class/Shared.class.php'; $s = new Shared($activity); $count = $s->helpsCount($user['uid']); /**Shared:2.获取指定用户的被助力总数**/ if ($count < $activity['tag']['helps']) { exit('还没达到领取礼品的条件'); } $got = $a->getRecord($user['uid'], $activity['actid']); /**Activity:8.查询活动红包领取信息。**/ if (empty($got)) { if (empty($error)) { $ret = $a->grap($user, $activity); /**Activity:10.抢红包。**/ if (is_error($ret)) { exit($ret['message']); } elseif ($ret['status'] == 'none') { exit('这一轮没有抢到红包, 请期待我们下一次活动'); } else { $got = $a->getRecord($user['uid'], $activity['actid']); /**Activity:8.查询活动红包领取信息。**/ $ret = $this->redsend($activity, $got, $user); ///77.发送用户红包。 if (is_error($ret)) { exit('红包发放失败, 你可以在活动结束之前重新领取. 活动结束后无法领取, 请注意'); exit($ret['message']); } exit('success'); } } } else { if ($got['status'] == 'created') { $ret = $this->redsend($activity, $got, $user); ///77.发送用户红包。 if (is_error($ret)) { exit('红包发放失败, 你可以在活动结束之前重新领取. 活动结束后无法领取, 请注意'); exit($ret['message']); } exit('success'); } } } exit('没有领取到红包'); }
} $api = new Api(); $current = $api->getCurrent(); $info = array(); $info['distance'] = $current['distance']; $info['device'] = $current['device']['id']; if ($activity['type'] == 'direct') { $rid = intval($_GPC['rid']); if (!empty($rid)) { $record = $a->getOneRecord($rid); if (empty($record) || $record['activity'] != $activity['actid'] || $record['uid'] != $user['uid']) { exit('非法的访问'); } $ret = $record; } else { $ret = $a->grap($user, $activity, $info); } if (is_error($ret)) { exit($ret['message']); } elseif ($ret['status'] == 'none') { exit('none'); } else { $ret = $this->send($activity, $ret, $user); if (is_error($ret)) { exit('礼品发放失败, 你可以在活动结束之前重新领取. 活动结束后无法领取, 请注意'); exit($ret['message']); } exit('success'); } } exit('没有领取到红包');