本文整理汇总了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);
}
示例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;
}
//.........这里部分代码省略.........