public function dislike_get()
 {
     if (!$this->uid) {
         $this->responseError(new CommonException('200102'));
     }
     $uid = I('get.uid', 0, 'intval');
     if (!$uid || $uid == $this->uid) {
         $this->responseError(new CommonException('200201'));
     }
     $user_infos = Privilege::canIntereact($this->uid, $uid);
     //除了权限还要判断是否是介绍人,介绍人身份无法给其他人点赞
     if (!$user_infos || $user_infos[0]['user_info']['is_single'] != 1) {
         $this->responseError(new CommonException('200101'));
     }
     D('Like')->where(array('from_uid' => $this->uid, 'to_uid' => $uid))->save(array('like_status' => 0, 'like_time' => time()));
     $this->responseSuccess(array('result' => 1));
 }
 public function generate_code_get()
 {
     if (!$this->uid) {
         $this->responseError(new CommonException('200102'));
     }
     $userInfo = Privilege::isValidUser($this->uid);
     $generatedCount = D('InviteCode')->where(array('from_uid' => $this->uid))->count();
     if ($generatedCount >= $userInfo['allow_invite_count']) {
         $this->responseError(new CommonException('200104'));
     }
     $max_tried_time = 0;
     while ($max_tried_time++ < 10) {
         $code = rand(10000000, 99999999);
         $exist = D('InviteCode')->where(array('code' => $code))->find();
         if ($exist) {
             continue;
         }
         D('InviteCode')->add(array('code' => $code, 'from_uid' => $this->uid, 'create_time' => time()));
         $this->responseSuccess(array('code' => $code));
     }
     $this->responseError(new CommonException('200401'));
 }