Esempio n. 1
0
 /**
  * 评论匿名回复
  *
  * @param  string $id        文章id
  * @param  string $commentId 评论id
  * @return todo
  */
 public function anonymousReply($id, $commentId)
 {
     // 校验验证码
     MultiplexController::verifyCaptcha();
     $this->user = MultiplexController::anonymousUser(Request::ip());
     return $this->replyResponse($commentId);
 }
 protected static function associateLocalUser($uuid)
 {
     $user = DB::collection('user');
     $exist = $user->where('uuid', $uuid)->first();
     if ($exist) {
         return $exist['_id'];
     }
     $avatarUrl = MultiplexController::getAvatarUrl();
     $insertData = ['uuid' => $uuid, 'avatar_url' => $avatarUrl, 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')];
     // todo
     // $insertId = $user->
     var_dump($user);
     exit;
 }
Esempio n. 3
0
 public function sendEmail()
 {
     MultiplexController::verifyCaptcha();
     $email = request('email');
     $this->models['user'] = DB::collection('user');
     $user = $this->models['user']->where('email', $email)->first();
     $displayName = $this->getDisplayName($user);
     $confirmedCode = MultiplexController::uuid();
     $updateData = ['password_email' => ['confirmed_code' => $confirmedCode, 'expired_at' => date('Y-m-d H:i:s', time() + 12 * 60 * 60)]];
     $this->models['user']->update($updateData);
     // 传递到邮件内容模板的视图变量
     $emailData = ['display_name' => $displayName, 'confirmed' => $confirmedCode];
     Mail::send('email.view', $emailData, function ($message) use($email) {
         $message->to($email)->subject('重设密码');
     });
 }
 public function weixinCallback()
 {
     if (Input::get('state') !== 'STATE') {
         // todo
         return;
     }
     $this->type = 'weixin';
     $openId = $this->getOpenId();
     $result = $this->hasOpenId($openId);
     if ($result) {
         return 'See open id ' . $result;
     }
     // 拉取第三方用户信息
     $user = $this->fetchUser($openId);
     $avatarUrl = $user->headimgurl;
     $tmpToken = MultiplexController::temporaryToken();
     $this->storeOpenId($openId, $tmpToken);
     return 'QueryString ?avatar_url=' . $avatarUrl . '&token=' . $tmpToken;
 }
Esempio n. 5
0
 public function myInformation()
 {
     $uid = $this->authorizer->getResourceOwnerId();
     $model = $this->dbRepository('mongodb', 'information')->where('content.comment.user._id', $uid)->orderBy('created_at', 'desc');
     // 增加数据分页
     MultiplexController::addPagination($model);
     return $model->get();
 }
 public function testGetWebServiceClient()
 {
     $response = MultiplexController::getWebServiceClient();
     $this->assertEquals('object', gettype($response));
 }
 public function modify()
 {
     $uid = $this->authorizer->getResourceOwnerId();
     $this->prepareModify($uid);
     $user = User::find($uid);
     $allowedFields = ['avatar_url', 'display_name', 'gender', 'email', 'company'];
     array_walk($allowedFields, function ($item) use($user, $uid) {
         $v = Request::input($item);
         if ($v && $item !== 'avatar_url') {
             $user->{$item} = $v;
         }
         if (Request::hasFile('avatar_url')) {
             $user->avatar_url = MultiplexController::uploadAvatar($uid);
         }
     });
     $user->save();
     return $this->dbRepository('mongodb', 'user')->find($uid);
 }
Esempio n. 8
0
 public function team()
 {
     $teamModel = $this->dbRepository('sqlsrv', 'expert')->select('expert_id as id', 'expert_photo as avatar_url', 'expert_name as name', 'expert_title as position', 'expert_Description as description')->where('expert_language', 'zh-cn')->whereIn('expert_type', ['领导', '研究人员'])->orderBy('expert_order', 'desc');
     MultiplexController::addPagination($teamModel);
     $members = $teamModel->get();
     foreach ($members as $member) {
         $member->avatar_url = $this->addImagePrefixUrl($member->avatar_url);
     }
     return $members;
 }