コード例 #1
0
ファイル: sso.php プロジェクト: momoim/momo-api
 /**
  * sso token校验
  * @method POST
  */
 public function token()
 {
     if ($this->get_method() != 'POST') {
         $this->send_response(405, NULL, '请求的方法不存在');
     }
     $post = $this->get_data();
     $appid = $post['appid'] ? intval($post['appid']) : 0;
     $appkey = $post['appkey'] ? trim($post['appkey']) : '';
     $token = $post['token'] ? trim($post['token']) : '';
     if (empty($appid)) {
         $this->send_response(400, NULL, '40011:appid为空');
     }
     if (empty($appkey)) {
         $this->send_response(400, NULL, '40012:appkey为空');
     }
     //检查app合法性
     if (!$this->model->check_app_valid($appid, $appkey)) {
         $this->send_response(400, NULL, $this->model->getResponseMsg());
     }
     //require_once MODPATH.'filesystem/include/Core.php';
     //$auth_token = Core::authcode($token,'DECODE','sdfjk2348*&21234(*3xx');
     //if($auth_token) {
     $result = $this->model->get_token_info($token);
     if ($token && $result) {
         $user_info = sns::getuser($result['ost_usa_id_ref']);
         $this->send_response(200, array('uid' => $user_info['uid'], 'zone_code' => $user_info['zone_code'], 'mobile' => $user_info['mobile'], 'status' => $user_info['status']));
     }
     //}
     $this->send_response(400, NULL, '40022:非法用户');
 }
コード例 #2
0
ファイル: sns.php プロジェクト: momoim/momo-api
 public static function getwho($uid = NULL)
 {
     if ($uid == NULL) {
         $uid = sns::getuid();
         return Kohana::lang('global.me');
     }
     //当前用户的情况下
     // if ($uid == sns::getuid() && !preg_match('|user/[\d]+|', url::current())) return Kohana::lang('global.me');
     if ($uid == sns::getuid()) {
         return Kohana::lang('global.me');
     }
     $data = sns::getuser($uid);
     return $data['sex'] == '2' ? Kohana::lang('global.her') : Kohana::lang('global.his');
 }
コード例 #3
0
ファイル: comment.php プロジェクト: momoim/momo-api
 private function bulid_user_hyperlinks(&$matches)
 {
     $user = sns::getuser($matches[2]);
     $realname = $user['realname'];
     if ($matches[1] == $realname) {
         if ($user['status'] < 2) {
             $this->at2mo[] = array('id' => $matches[2], 'name' => $matches[1]);
         }
         $this->at2id[] = array('id' => $matches[2], 'name' => $matches[1], 'group_id' => $this->group_id);
     } elseif (!empty($realname)) {
         $this->at2id[] = array('id' => $matches[2], 'name' => $realname, 'group_id' => $this->group_id);
     } else {
         $this->at2id[] = array('id' => $matches[2], 'name' => $matches[1], 'group_id' => $this->group_id);
     }
     return ' [@' . (count($this->at2id) - 1) . ']';
 }
コード例 #4
0
ファイル: app_message.php プロジェクト: momoim/momo-api
 private function _user($uid, $avatar_size = 130)
 {
     //外部应用不需获取用户信息
     if ($this->is_app_standalone) {
         return array('id' => $uid, 'name' => '', 'avatar' => '');
     }
     if (!$uid) {
         return array('id' => 0, 'name' => '', 'avatar' => '', 'nick' => array(), 'mobile' => '', 'zone_code' => '');
     }
     if (!$this->_cache_users[$uid]) {
         $user_info = sns::getuser($uid);
         $nicks = Friend_Model::instance()->get_contact_formatted_name($this->uid, $user_info['mobile'], $user_info['zone_code']);
         $mobile = $user_info['mobile'];
         $this->_cache_users[$uid] = array('id' => (int) $uid, 'name' => $user_info['realname'], 'avatar' => sns::getavatar($uid, $avatar_size), 'nick' => $nicks, 'mobile' => $mobile, 'zone_code' => $user_info['zone_code']);
     }
     return $this->_cache_users[$uid];
 }
コード例 #5
0
ファイル: deal.php プロジェクト: momoim/momo-api
 /**
  * 
  * @param $deal_id
  * @return array
  */
 public function item($deal_id, $user_id = 0)
 {
     $result = $this->get($deal_id);
     if ($result) {
         $deal_user_info = sns::getuser($result['uid']);
         $return = array('deal_id' => (int) $result['id'], 'user' => array('id' => (int) $result['uid'], 'name' => $deal_user_info['realname'], 'mobile' => $deal_user_info['mobile'], 'avatar' => sns::getavatar($result['uid'], 'small')), 'status' => (int) $result['status'], 'private' => (int) $result['private'], 'price' => (double) $result['price'], 'location' => array('longitude' => (double) $result['longitude'], 'latitude' => (double) $result['latitude']), 'created_at' => (int) $result['created_at']);
         if ($user_id) {
             $name = $this->_get_relation_contacts_name($user_id, $result['uid']);
             $return['weight'] = $name ? 1 : 0;
             $return['relation']['contact'] = array('name' => $name);
             /*** @todo for deal start ***/
             $units = User_Model::instance()->get_unit_dict(array($user_id, $result['uid']));
             if ($units[$result['uid']] && $units[$user_id]['unitid'] == $units[$result['uid']]['unitid']) {
                 $return['relation']['company'] = array('name' => $units[$result['uid']]['unitname'], 'username' => $units[$result['uid']]['username']);
             }
             /*** @todo for deal end ***/
         }
         $deal_detail = $this->_select_mongo($result['deal_id']);
         if ($deal_detail) {
             $return['sync'] = $deal_detail['sync'] ? $deal_detail['sync'] : array();
             $return['title'] = $deal_detail['title'];
             $return['description'] = $deal_detail['description'];
             $return['image'] = $this->_format_image($deal_detail['image']);
         }
     }
     return $return;
 }
コード例 #6
0
ファイル: message.php プロジェクト: momoim/momo-api
 public function message_opt_friend_apply($data, $message_id, $mini)
 {
     $location = '';
     $sex = 0;
     $together_count = 0;
     $same_friend = array();
     $result = $this->getNoticeInfo(array('id' => $message_id, 'authorid' => $this->uid), true);
     if ($result) {
         $tmp = $result['body'] ? json_decode($result['body'], true) : array("explain" => "");
         //取得共同好友
         $friendModel = new Friend_Model();
         $ffids = $friendModel->getAllFriendIDs($result['authorid'], false);
         $mfids = $friendModel->getAllFriendIDs($this->uid, false);
         $together = array_intersect($ffids, $mfids);
         $data = sns::getuser($result['authorid']);
         $tmp['reside'] = '';
         if ($data['resideprovince'] || $data['residecity']) {
             $config = Kohana::config_load('cityarray');
             //加载城市数组
             $province = isset($data['resideprovince']) ? isset($config['province'][$data['resideprovince']]) ? $config['province'][$data['resideprovince']] : '' : "";
             $city = isset($data['residecity']) ? isset($config['city'][$data['residecity']]) ? $config['city'][$data['residecity']] : '' : "";
             $location = $province . " " . $city;
         }
         $sex = $data['sex'] == 1 ? "男" : "女";
         $tmp['fid'] = $result['authorid'];
         $tmp['explain'] = $tmp['explain'] ? str::unhtmlspecialchars($tmp['explain']) : '';
         unset($data, $ffids, $mfids, $config);
         $str = "";
         $urlpre = url::base();
         $avatar = sns::getavatar($result['authorid']);
         if (!empty($together)) {
             $together_count = count($together);
             $i = 0;
             foreach ($together as $val) {
                 $item = array();
                 $item['id'] = $val;
                 $item['name'] = sns::getrealname($val);
                 $same_friend[] = $item;
                 if (9 < ++$i) {
                     break;
                 }
             }
         }
     }
     return array('location' => $location, 'sex' => $sex, 'together_count' => $together_count, 'together' => $same_friend);
 }
コード例 #7
0
ファイル: feed.php プロジェクト: momoim/momo-api
 /**
  *
  * 评论mo短信
  * @param string $feedid
  * @param array $at
  */
 private function mo_sms_comment($commentid, $feedid, $receiver_uid, $receiver_name, $moid = '', $auto)
 {
     $type = $this->format_type($typeid);
     $sender_uid = $this->uid;
     $sender_name = sns::getrealname($this->uid);
     //检查接收者是否在自己联系人中,并且接收者级别<3
     if (Friend_Model::instance()->check_iscontact($sender_uid, $receiver_uid)) {
         $receiver_status = sns::getstatus($receiver_uid);
         if ($receiver_status >= 3 && $auto == true) {
             return false;
         }
     } else {
         return false;
     }
     //接收者的用户基本要<2x
     if (!$this->is_mo_sms_sent('comment', $feedid, $sender_uid, $receiver_uid, $moid)) {
         $receiver_info = sns::getuser($receiver_uid);
         $url_code = Url_Model::instance()->create('status', $sender_uid, $sender_name, $receiver_uid, $receiver_name, $receiver_info['mobile'], $receiver_info['zone_code'], $feedid);
         $short_url = MO_SMS_JUMP . $url_code;
         $comment_row = $this->comment_new->findOne(array('id' => $commentid));
         if ($comment_row) {
             $content = str::cnSubstr($this->feed_at_format($comment_row['content'], $comment_row['at']), 0, 15) . '..';
             $data = array();
             $data['sender']['id'] = $sender_uid;
             $data['sender']['name'] = $sender_name;
             $data['receiver'][] = $receiver_uid;
             $data['timestamp'] = time();
             $data['content']['text'] = $sender_name . '分享了:' . $content . ',点开互动: ' . $short_url;
             $mq_msg = array("kind" => "mobile_sms", "data" => $data);
             $this->mq_send(json_encode($mq_msg), $this->uid, 'momo_im');
             $this->mo_sms_log('comment', $commentid, $feedid, $this->uid, $receiver_uid, $moid);
             if ($moid) {
                 $this->update_my_mo($moid);
             }
             return true;
         }
     }
 }
コード例 #8
0
ファイル: activity.php プロジェクト: momoim/momo-api
 /**
  * 填充活动列表信息
  * @param array $aidList 活动ID列表
  * @param int $start 开始位置
  * @param int $pos 获取数量
  * return array
  */
 private function _fill_activity_list($aidList, $start, $pos)
 {
     $activityList = array();
     $activityType = array_flip(Kohana::config('activity.type'));
     $activityTypeName = Kohana::config('activity.typeName');
     $nowTime = time();
     $friendModel = new Friend_Model();
     $groupModel = new Group_Model();
     $index = 0;
     foreach ($aidList as $value) {
         $aid = $value['aid'];
         $gidArray = $this->model->getActivityGroupId($aid);
         $activityInfo = $this->model->getActivityInfo($aid);
         if ($activityInfo['creator_id'] != $this->user_id && !$activityInfo['is_allow_invite']) {
             $permit = false;
             foreach ($gidArray as $val) {
                 if ($val['gid'] == -1) {
                     $isFriend = $friendModel->check_isfriend($this->user_id, $activityInfo['creator_id']);
                     if ($isFriend) {
                         $permit = true;
                         break;
                     }
                     continue;
                 }
                 $grade = $groupModel->getMemberGrade($val['gid'], $this->user_id);
                 if ($grade > 0) {
                     $permit = true;
                     break;
                 }
             }
             if (!$permit) {
                 continue;
             }
         }
         if ($pos == 0 || $index >= $start && $index < $start + $pos) {
             $activity = array();
             $activity['id'] = floatval($activityInfo['aid']);
             $user = array();
             $user['id'] = floatval($activityInfo['creator_id']);
             $user['name'] = sns::getrealname($activityInfo['creator_id']);
             $user['avatar'] = sns::getavatar($activityInfo['creator_id']);
             $activity['user'] = $user;
             $activity['title'] = $activityInfo['title'];
             $activity['start_at'] = api::get_date($activityInfo['start_time']);
             $activity['end_at'] = api::get_date($activityInfo['end_time']);
             $activity['spot'] = $activityInfo['spot'];
             //$activity['content'] = $activityInfo['content'];
             $type = $activityType[$activityInfo['type']];
             $activity['type'] = $activityTypeName[$type];
             if ($activityInfo['end_time'] < $nowTime) {
                 $status = Kohana::config('activity.status.end.id');
             } else {
                 if ($activityInfo['start_time'] > $nowTime) {
                     $status = Kohana::config('activity.status.enroll.id');
                 } else {
                     $status = Kohana::config('activity.status.working.id');
                 }
             }
             $activity['status'] = $status;
             $activity['apply_type'] = $this->model->getActivityApplyType($activity['id'], $this->user_id);
             $activity['is_hide'] = -1;
             $result = $this->model->getActivityOrganizer($activity['id']);
             $organizer = array();
             unset($user);
             foreach ($result as $val) {
                 $user = array();
                 $user['id'] = floatval($val['uid']);
                 $userInfo = sns::getuser($val['uid']);
                 $user['name'] = $userInfo['realname'];
                 $user['avatar'] = sns::getavatar($val['uid']);
                 $user['mobile'] = $userInfo['mobile'];
                 $organizer[] = $user;
                 unset($userInfo);
                 unset($user);
             }
             $activity['organizer'] = $organizer;
             $activityList[] = $activity;
             unset($activityInfo);
             unset($activity);
             unset($user);
         }
         $index++;
     }
     return array('data' => $activityList, 'count' => $index);
 }
コード例 #9
0
ファイル: group_member.php プロジェクト: momoim/momo-api
 /**
  * 
  * 添加群成员
  * @param $id
  */
 public function add($id = 0)
 {
     if ($this->get_method() != 'POST') {
         $this->send_response(405, NULL, '请求的方法不存在');
     }
     $data = $this->get_data();
     $uid = $data['uid'] ? $data['uid'] : '';
     if (empty($uid)) {
         $this->send_response(400, NULL, '400403:成员uid为空');
     }
     $uids = explode(',', $uid);
     $groupId = (int) $id;
     if (empty($id)) {
         $this->send_response(400, NULL, '400401:群ID为空');
     }
     $groupInfo = $this->model->getGroupInfo($groupId);
     if (!$groupInfo) {
         $this->send_response(400, NULL, '400402:群不存在');
     }
     $user = sns::getuser($this->user_id);
     /*
         	$grade = $this->model->getMemberGrade($groupId, $this->user_id);
     if($grade < Kohana::config('group.grade.manager')) {
         $this->send_response(400, NULL, '400404:非群管理员,无权限添加成员');
     }
     */
     //查询群组成员总数是否超出最大限制(暂定100)
     $memberNum = $group_info['member_number'];
     if ($group_info['type'] == Kohana::config('group.type.public')) {
         $maxMemberNum = Kohana::config('group.maxMemberNum.public');
     } else {
         $maxMemberNum = Kohana::config('group.maxMemberNum.private');
     }
     if ($memberNum + count($uids) >= $maxMemberNum) {
         $this->send_response(400, NULL, '400110:群成员人数已满');
     }
     $add_uids = array();
     foreach ($uids as $v) {
         $grade = $this->model->getMemberGrade($groupId, $v);
         if (!$grade) {
             $add_uids[] = $v;
         }
     }
     $i = 0;
     $content = $user['realname'] . '将您加入到群"' . $groupInfo['gname'] . '"';
     $opt = array('group' => array('type' => 1, 'id' => $groupId, 'name' => $groupInfo['gname']));
     $xiaomo_uid = Kohana::config('uap.xiaomo');
     if (count($add_uids) > 0) {
         foreach ($add_uids as $u) {
             if ($this->model->addGroupMember($groupId, $u, 1)) {
                 $i++;
                 Tab_Model::instance()->create($u, 1, $groupId);
                 $this->model->addMemberNum($groupId);
                 User_Model::instance()->present_mo_notice($xiaomo_uid, $u, $content, $opt);
             }
         }
     }
     $this->send_response(200, array('num' => $i));
 }
コード例 #10
0
ファイル: deal.php プロジェクト: momoim/momo-api
 /**
  * 
  * @return none
  */
 public function personal($id = NULL)
 {
     if ($this->get_method() != 'GET') {
         $this->send_response(405, NULL, '请求的方法不存在');
     }
     $data = $this->get_data();
     if (empty($id)) {
         $this->send_response(400, NULL, '401307:交易ID为空');
     }
     $id = (int) $id;
     $user_info = sns::getuser($id);
     if (!$user_info) {
         $this->send_response(400, NULL, '401311:用户不存在');
     }
     $stat = $this->model->stat($id);
     $deal_lists = $this->model->personal_lists($id, $this->user_id);
     $this->send_response(200, array('id' => (int) $id, 'name' => $user_info['realname'], 'avatar' => sns::getAvatar($id), 'deal_stat' => array('total' => (int) $stat['total'], 'success' => (int) $stat['success']), 'deal_lists' => $deal_lists, 'relationship' => 0, 'social_account' => array('sina_weibo' => '', 'qq_weibo' => '')));
 }
コード例 #11
0
ファイル: event.php プロジェクト: momoim/momo-api
 /**
  * 
  * 活动报名
  * @param $id
  */
 public function user_apply($id = NULL)
 {
     if ($this->get_method() != 'POST') {
         $this->send_response(405, NULL, '请求的方法不存在');
     }
     if (empty($id)) {
         $this->send_response(400, NULL, '400501:活动ID为空');
     }
     $data = $this->get_data();
     if (!$data) {
         $this->send_response(400, NULL, '400412:活动信息非法');
     }
     $event_info = $this->model->get($id);
     if (!$event_info) {
         $this->send_response(400, NULL, '400506:活动不存在');
     }
     if ($post['apply_type'] == Kohana::config('event.apply_type.joined') && empty($data['user'])) {
         $this->send_response(400, NULL, '400508:活动报名信息为空');
     }
     if ($event_info['organizer'] == $this->user_id && $post['apply_type'] == Kohana::config('event.apply_type.refused')) {
         $this->send_response(400, NULL, '400507:活动创建者不能不参加活动');
     }
     $update_apply_type = false;
     $post = new Validation($data);
     $post->add_rules('apply_type', 'required', 'numeric', array($this, '_check_type_validation'));
     if ($post->validate()) {
         $form = $post->as_array();
         $user_info = sns::getuser($this->user_id);
         $apply_info = $this->model->getApplyInfo(array('eid' => $id, 'pid' => 0, 'uid' => $this->user_id));
         if ($apply_info) {
             $update_apply_type = true;
         } else {
             if (time() > $event_info['deadline']) {
                 $this->send_response(400, NULL, '400509:活动报名已截止');
             }
         }
         $eventUser = array('eid' => $id, 'pid' => 0, 'uid' => $this->user_id, 'name' => $user_info['realname'], 'mobile' => $user_info['mobile'], 'apply_type' => $post['apply_type'], 'apply_time' => time(), 'grade' => Kohana::config('event.grade.normal'));
         if (!empty($post['apply_doc'])) {
             if (!$this->_check_user_apply_doc_valid($id, $post['apply_doc'])) {
                 $this->send_response(400, NULL, '400531:报名信息非法');
             }
             $this->model->addUserApplyDoc($id, $this->user_id, 0, $user_info['realname'], $post['apply_doc']);
         }
         $this->model->applyEvent($eventUser, $update_apply_type);
         //家属报名
         $this->_dependent_apply_event($post['dependent'], $id, $this->user_id, $post['apply_type']);
         if ($post['apply_type'] == Kohana::config('event.apply_type.joined') || $post['apply_type'] == Kohana::config('event.apply_type.interested')) {
             if ($post['apply_type'] == Kohana::config('event.apply_type.joined')) {
                 $content = $user_info['realname'] . '参加了活动"' . $event_info['title'] . '"';
             } else {
                 $content = $user_info['realname'] . '对活动"' . $event_info['title'] . '"表示感兴趣';
             }
             $opt = array('event' => array('id' => $id, 'name' => $event_info['title'], 'cover' => ''), 'no_sign' => 1);
             $this->send_event_mq(Kohana::config('uap.xiaomo'), $event_info['organizer'], $content, $opt);
             $this->_add_group_user($event_info['gid'], $this->user_id, Kohana::config('group.grade.normal'));
         } elseif ($post['apply_type'] == Kohana::config('event.apply_type.refused')) {
             $this->_del_group_user($event_info['gid'], $this->user_id);
         }
         $this->send_response(200);
     }
     $errors = $post->errors();
     foreach ($errors as $key => $value) {
         switch ($key) {
             case 'apply_type':
                 $this->send_response(400, NULL, '400405:活动类型为空');
                 break;
             case 'user_name_empty':
                 $this->send_response(400, NULL, '400502:名字为空');
                 break;
             case 'user_mobile_empty':
                 $this->send_response(400, NULL, '400503:手机号为空');
                 break;
             case 'user_mobile_format':
                 $this->send_response(400, NULL, '400504:手机号格式不正确');
                 break;
         }
     }
 }
コード例 #12
0
ファイル: activity_member.php プロジェクト: momoim/momo-api
 /**
  * 报名活动
  */
 public function create($id = 0)
 {
     $data = $this->get_data();
     $aid = (int) $id;
     $apply_type = (int) $data['type'];
     $webRequest = (int) $data['web'];
     if ($webRequest != 2) {
         $webRequest = 0;
     }
     if ($this->get_method() != 'POST') {
         $this->send_response(405, NULL, '请求的方法不存在');
     }
     if ($id == 0) {
         $this->send_response(400, NULL, '400501:活动id为空');
     }
     if ($apply_type < Kohana::config('activity.apply_type.join') || $apply_type > Kohana::config('activity.apply_type.interest')) {
         $this->send_response(400, NULL, '400508:活动报名类型非法');
     }
     $activity = $this->model->getActivityInfo($aid);
     if (!$activity) {
         $this->send_response(400, NULL, '400502:活动不存在');
     }
     if ($activity['end_time'] < time()) {
         $this->send_response(400, NULL, '活动已结束');
     }
     $permit = $this->_check_activity_view_permission($activity, $this->user_id);
     if (!$permit) {
         $this->send_response(400, NULL, '400510:无权限报名活动');
     }
     if ($webRequest > 0) {
         $types = array_flip(Kohana::config('activity.type'));
         $typeId = $types[$activity['type']];
         $typeNames = Kohana::config('activity.typeName');
         $type = $typeNames[$typeId];
         $view = new View('activity/details');
         $view->webRequest = $webRequest;
         $view->type = $type;
         $user = array();
         $user['id'] = floatval($activity['creator_id']);
         $userInfo = sns::getuser($activity['creator_id']);
         $user['name'] = $userInfo['realname'];
         $user['mobile'] = $userInfo['mobile'];
         $activity['user'] = $user;
         unset($user);
         $organizer = array();
         $organizerList = $this->model->getActivityOrganizer($aid);
         $organizerIdList = array();
         foreach ($organizerList as $value) {
             $user = array();
             $user['id'] = floatval($value['uid']);
             $userInfo = sns::getuser($value['uid']);
             $user['name'] = $userInfo['realname'];
             $user['avatar'] = sns::getavatar($value['uid']);
             $user['mobile'] = $userInfo['mobile'];
             $organizer[] = $user;
             $organizerIdList[] = $user['id'];
             unset($userInfo);
             unset($user);
         }
         $activity['organizer'] = $organizer;
         $view->activity = $activity;
         $view->apply_type = $apply_type;
     }
     $userModel = new User_Model();
     $nowTime = time();
     $feedModel = new Feed_Model();
     //获取用户是否已经参与了报名
     $applyResult = $this->model->getActivityApplyType($aid, $this->user_id);
     if ($applyResult) {
         $tab = $userModel->getTag($this->user_id, 15, $aid);
         if ($applyResult == $apply_type) {
             if ($webRequest > 0) {
                 $view->render(true);
                 exit;
             }
             $this->send_response(200);
         } else {
             if ($applyResult == Kohana::config('activity.apply_type.not_join') && !$tab) {
                 $userModel->insertTag($this->user_id, 15, $aid);
             } else {
                 if ($apply_type == Kohana::config('activity.apply_type.not_join')) {
                     //$userModel->deleteTag($this->user_id, 15, $aid);
                 }
             }
         }
         $activityMember = array('apply_type' => $apply_type, 'apply_time' => $nowTime);
         $grade = $this->model->getMemberGrade($aid, $this->user_id);
         if ($grade == Kohana::config('activity.grade.manager') && $apply_type != Kohana::config('activity.apply_type.join')) {
             $activityMember['grade'] = Kohana::config('activity.group.normal');
         }
         $result = $this->model->updateApplyActivity($aid, $this->user_id, $activityMember);
         $this->_add_feed_comment($activity, $applyResult, $apply_type, $this->user_id);
         $feedModel->addTab($aid, $activity['title'], 15, $this->user_id);
         if ($webRequest > 0) {
             $view->render(true);
             exit;
         }
         $this->send_response(200);
     }
     $activityMember['aid'] = $aid;
     $activityMember['uid'] = $this->user_id;
     $activityMember['apply_type'] = $apply_type;
     $activityMember['apply_time'] = $nowTime;
     $activityMember['grade'] = Kohana::config('activity.grade.normal');
     $this->model->applyActivity($activityMember);
     $userModel->insertTag($this->user_id, 15, $aid);
     $messageModel = new Message_Model();
     $appid = Kohana::config('uap.app.action');
     $tplid = Kohana::config('noticetpl.actionInvite.id');
     while (true) {
         $inviteMsg = $messageModel->getNoticeInfo(array('uid' => $this->user_id, 'appid' => $appid, 'tplid' => $tplid, 'objid' => $aid, 'status' => 0));
         if ($inviteMsg) {
             //修改系统消息模板
             $invite_uid = $inviteMsg['authorid'];
             $nid = $inviteMsg['id'];
             $messageModel->putChangeTplByid($this->user_id, $nid, $apply_type);
             $this->model->setInviteStatus($aid, $invite_uid, $this->user_id);
         } else {
             break;
         }
     }
     if ($apply_type == Kohana::config('activity.apply_type.not_join')) {
         if ($webRequest > 0) {
             $view->render(true);
             exit;
         }
         $this->send_response(200);
     }
     $this->_add_feed_comment($activity, 0, $apply_type, $this->user_id);
     $feedModel->addTab($aid, $activity['title'], 15, $this->user_id);
     if ($webRequest > 0) {
         $view->render(true);
         exit;
     }
     $this->send_response(200);
 }