public function censorUserProfileStudent($id)
 {
     $check = Input::get('check');
     try {
         $tmp = TmpUserProfileBase::find($id);
         $base = UserProfileBase::find($id);
         $log = new LogUserProfileCensors();
         $log->u_id = $id;
         $log->cate = 'base';
         $log->admin_id = Tools::getAdminId();
         if ($check == 1) {
             $tmp->u_is_student_verified = 1;
             if (!empty($base)) {
                 $base->u_is_student_verified = 1;
             }
             if ($tmp->u_is_id_verified) {
                 $user = User::find($id);
                 $user->u_is_verified = 1;
                 $user->save();
             }
             $log->content = '认证用户学生证信息: 通过';
         } else {
             $tmp->u_is_student_verified = 2;
             if (!empty($base)) {
                 $base->u_is_student_verified = 2;
             }
             $log->content = '认证用户学生证信息: 不通过';
         }
         $msg = new MessageDispatcher($id);
         $msg->fireTextToUser($log->content);
         $log->addLog();
         $tmp->save();
         if (!empty($base)) {
             $base->save();
         }
         $re = Tools::reTrue('审核用户身份证信息成功');
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '审核用户身份证信息失败:' . $e->getMessage());
     }
     return Response::json($re);
 }
Esempio n. 2
0
 public function listBoothFollow($id)
 {
     $u_id = Input::get('u_id', 0);
     $school = Input::get('school', 0);
     $profession = Input::get('prof', 0);
     $entry_year = Input::get('entry_year', 0);
     $gender = Input::get('gender', 0);
     $key = Input::get('key', '');
     $per_page = Input::get('per_page', 30);
     try {
         $user = User::find($u_id);
         $user_contact = UserProfileBase::find($u_id);
         $query = BoothFollow::with(['follower', 'follower.school'])->where('b_id', '=', $id)->select('booth_follows.*')->leftJoin('users', function ($q) {
             $q->on('users.u_id', '=', 'booth_follows.u_id');
         })->leftJoin('users_contact_peoples', function ($q) {
             $q->on('users_contact_peoples.u_id', '=', 'booth_follows.u_id');
         })->leftJoin('dic_schools', function ($q) {
             $q->on('users.u_school_id', '=', 'dic_schools.t_id');
         });
         if ($school) {
             $query = $query->where('users.u_school_id', '=', $user->u_school_id);
         }
         if (!empty($user_contact)) {
             if ($profession) {
                 $query = $query->where('users_contact_peoples.u_prof', '=', $user_contact->u_prof);
             }
             if ($entry_year) {
                 $query = $query->where('users_contact_peoples.u_entry_year', '=', $user_contact->u_entry_year);
             }
         }
         if ($gender) {
             $query = $query->where('users.u_sex', '=', $gender);
         }
         if ($key) {
             $query = $query->where('users.u_name', 'LIKE', '%' . $key . '%')->orWhere('users.u_nickname', 'LIKE', '%' . $key . '%')->orWhere('dic_schools.t_name', 'LIKE', '%' . $key . '%');
         }
         $list = $query->groupBy('users.u_id')->paginate($per_page);
         $data = [];
         foreach ($list as $key => $follow) {
             $data[] = $follow->follower->showInList();
         }
         $re = Tools::reTrue('获取粉丝成功', $data, $list);
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '获取粉丝失败:' . $e->getMessage());
     }
     return Response::json($re);
 }