當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User_Model::insertTag方法代碼示例

本文整理匯總了PHP中User_Model::insertTag方法的典型用法代碼示例。如果您正苦於以下問題:PHP User_Model::insertTag方法的具體用法?PHP User_Model::insertTag怎麽用?PHP User_Model::insertTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在User_Model的用法示例。


在下文中一共展示了User_Model::insertTag方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: agree_group

 public function agree_group()
 {
     $data = $this->get_data();
     $message_id = $data['id'];
     if (empty($message_id)) {
         $this->send_response(400, NULL, '400102:消息id非法');
     }
     $result = $this->model->getNoticeInfo(array('id' => $message_id, 'uid' => $this->user_id), true);
     if (!$result) {
         $this->send_response(400, NULL, '400101:消息體不存在或已經被處理');
     }
     $group_tmp = json_decode($result['title'], true);
     $gid = $group_tmp['group'][0]['id'];
     $gname = $group_tmp['group'][0]['name'];
     $grade = $this->groupModel->getmembergrade($gid, $this->user_id);
     if ($grade > 0) {
         $this->model->putChangeTplByid($this->user_id, $message_id, 1);
         $this->send_response(400, NULL, '400108:您已經是群成員了');
     }
     $group_info = $this->groupModel->getGroupInfo($gid);
     if (!$group_info) {
         $this->model->putChangeTplByid($this->user_id, $message_id, 4);
         $this->send_response(400, NULL, '400109:群不存在');
     }
     //查詢群組成員總數是否超出最大限製(暫定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 >= $maxMemberNum) {
         $this->model->putChangeTplByid($this->user_id, $message_id, 3);
         $this->send_response(400, NULL, '400110:群成員人數已滿');
     }
     $result = $this->groupModel->addGroupMember($gid, $this->user_id, 1);
     $this->groupModel->addMemberNum($gid);
     $feedModel = new Feed_Model();
     if ($group_info['type'] == Kohana::config('group.type.private')) {
         $dateline = time();
         try {
             //添加群組通訊錄聯係人
             $this->groupContactModel->addGroupContactByUserCard($gid, $this->user_id, $dateline);
         } catch (Exception $exc) {
             $this->send_response(400, NULL, '400111:導入個人名片到群組通訊錄聯係人失敗');
         }
         $ginfo['modify_time'] = $dateline;
         $ret = $this->groupModel->modifyGroup($gid, $ginfo);
     } else {
         if ($group_info['type'] == Kohana::config('group.type.public')) {
             //發送加入公開群組動態
             $application = array('id' => floatval($gid), 'title' => '查看群組', 'url' => 'group/' . $gid);
             $feedModel->addFeed($this->user_id, 2, $text = '加入了群組:' . $group_info['gname'], $this->get_source(), $application, $at = array(), $images = array(), $sync = array(), $group_type = 0, $group_id = 0, $retweet_id = 0, $allow_rt = 0, $allow_comment = 1, $allow_praise = 1, $allow_del = 1, $allow_hide = 1);
         }
     }
     $commentModel = new Comment_Model();
     if ($group_info['feed_id']) {
         $friendModel = Friend_Model::instance();
         $isFriend = $friendModel->check_isfriend($this->user_id, $group_info['creator_id']);
         if ($isFriend) {
             $commentModel->saveComment($group_info['feed_id'], '加入了本群', $group_info['creator_id']);
         }
     }
     if ($group_info['group_feed_id']) {
         $commentModel->saveComment($group_info['group_feed_id'], '加入了本群', $group_info['creator_id']);
     }
     //添加群到首頁tab列表
     $userModel = new User_Model();
     $userModel->insertTag($this->user_id, 7, $gid);
     $feedModel->addTab($gid, $group_info['gname'], 7, $this->user_id);
     //刪除邀請表對應的記錄
     $this->model->putChangeTplByid($this->user_id, $message_id, 1);
     $this->send_response(200);
 }
開發者ID:momoim,項目名稱:momo-api,代碼行數:74,代碼來源:message.php

示例2: create

 /**
  * 報名活動
  */
 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;
         }
//.........這裏部分代碼省略.........
開發者ID:momoim,項目名稱:momo-api,代碼行數:101,代碼來源:activity_member.php


注:本文中的User_Model::insertTag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。