コード例 #1
0
 /**
  * 移除微吧用户(管理员操作)
  */
 public function delWeibaUser()
 {
     $uid = empty($this->user_id) ? $this->mid : $this->user_id;
     $weiba_id = intval($this->data['weiba_id']);
     if (!isWeibaAdmin($uid, $weiba_id)) {
         $this->error('你没有权限移除用户');
     }
     $userId = intval($this->data['userId']);
     $rst = model('WeibaApply')->delWeibaUser($userId, $weiba_id);
     $rst['status'] ? $this->success($rst['info']) : $this->error($rst['info']);
 }
コード例 #2
0
 /**
  * 设置帖子状态
  */
 public function setPost()
 {
     $post_id = intval($this->data['post_id']);
     $type = t($this->data['type']);
     $set = intval($this->data['set']);
     $typeArr = array('top', 'digest');
     if (empty($type) || !in_array($type, $typeArr)) {
         $this->error('类型不正确');
     }
     $uid = empty($this->user_id) ? $this->mid : $this->user_id;
     $exist = M('weiba_post')->where(array('post_id' => $post_id))->find();
     if (!$exist) {
         $this->error('帖子已被删除');
     }
     switch ($type) {
         case 'top':
             //置顶
             $title = '置顶';
             $config['typename'] = "吧内置顶";
             $field = 'top';
             $credit_str = 'top_topic_weiba';
             break;
         case 'digest':
             //精华
             $title = '设置精华';
             $config['typename'] = "设置精华";
             $field = 'digest';
             $credit_str = 'dist_topic';
             break;
     }
     if (!isWeibaAdmin($uid, $exist['weiba_id'])) {
         $this->error('你没有权限' . $title);
     }
     $result = D('weiba_post')->where('post_id=' . $post_id)->setField($field, $set);
     //吧内置顶为1
     if ($result) {
         $config['post_name'] = $exist['title'];
         $config['post_url'] = '<a href="' . U('weiba/Index/postDetail', array('post_id' => $post_id)) . '" target="_blank">' . $exist['title'] . '</a>';
         model('Notify')->sendNotify($exist['post_uid'], 'weiba_post_set', $config);
         //添加积分
         model('Credit')->setUserCredit($exist['post_uid'], $credit_str);
         $this->success($title . '成功');
     } else {
         $this->error($title . '失败');
     }
 }