private function _inviteCheck($res, $code, $device, $accessToken, $accessSecret, $activityId) { global $_G; // 获取邀请注册活动的配置 $config = ActivityUtils::getInviteConfig($activityId); // 验证是否能进行参数活动 $checkInvite = ActivityUtils::checkInvite($config, $_G['uid'], $device); if ($checkInvite['rs'] == 0) { return $this->makeErrorInfo($res, $checkInvite['errcode']); } $isSelf = AppbymeActivityInviteUser::getCheckByUidCode($_G['uid'], $code); if ($isSelf) { // 输入的是自己的验证码 return $this->makeErrorInfo($res, 'mobcent_check_code_self'); } $checkCode = AppbymeActivityInviteUser::checkCode($code); if (!$checkCode) { // 兑换码验证失败 return $this->makeErrorInfo($res, 'mobcent_check_code_self'); } if ($checkCode) { AppbymeActivityInviteUser::checkCodeSuccess($activityId, $code, $_G['uid']); } return $res; }
private function _inviteActiv($res, $accessToken, $accessSecret, $device, $activityId) { // 获取邀请注册活动的配置 $config = ActivityUtils::getInviteConfig($activityId); if (empty($config) || !$config['is_run']) { return $this->makeErrorInfo($res, 'mobcent_activity_invalid'); } $res['body']['sponsor'] = (string) $config['sponsor']; $res['body']['startTime'] = (string) $config['start_time'] . '000'; $res['body']['stopTime'] = (string) $config['stop_time'] . '000'; $res['body']['firstReward'] = (int) $config['first_reward']; $res['body']['inviteReward'] = (int) $config['invite_reward']; $res['body']['isShowCheck'] = 0; $res['body']['exchangeNum'] = ''; $res['body']['activityRule'] = (string) $config['activity_rule']; $res['body']['shareAppUrl'] = (string) $config['share_appurl']; if ($accessToken !== '' && $accessSecret !== '') { $uid = AppbymeUserAccess::getUserIdByAccess($accessToken, $accessSecret); if ($uid) { // 当前登录用户参加活动信息|appbyme_activity_invite_user $exchangeInfo = AppbymeActivityInviteUser::getExchangeInfo($uid); if ($exchangeInfo) { $checkInvite = ActivityUtils::checkInvite($config, $uid, $device); if ($checkInvite['rs']) { $res['body']['isShowCheck'] = 1; } $res['body']['exchangeNum'] = $exchangeInfo['exchange_num']; } else { $checkInvite = ActivityUtils::checkInvite($config, $uid, $device); $userInfo = getuserbyuid($uid); $username = $userInfo['username']; $rewardSum = $config['first_reward']; $availableReward = $config['first_reward']; $exchangeNum = $this->getUniqueNum($uid); $joining = 0; if (empty($checkInvite['rs'])) { $joining = 1; } $insertUser = array('uid' => $uid, 'activity_id' => $activityId, 'username' => $username, 'reward_sum' => $rewardSum, 'available_reward' => $availableReward, 'exchange_num' => $exchangeNum, 'device' => $device, 'joining' => $joining); if (AppbymeActivityInviteUser::insertUser($insertUser)) { if ($checkInvite['rs']) { $res['body']['isShowCheck'] = 1; } $res['body']['exchangeNum'] = (string) $exchangeNum; } } } } return $res; }