Пример #1
0
 public function passSummary()
 {
     $id = \LfRequest::inNum('id');
     $salon = M('e_salon')->where('id=' . $id)->find();
     if ($salon['summary'] == 0) {
         $this->error("未总结");
         exit;
     }
     if ($salon['summary'] == 2) {
         $this->error("已经审核通过");
         exit;
     }
     $res = M('e_salon')->where('id=' . $id)->save(['summary' => 2]);
     if ($res) {
         $particpates = M('e_participate')->where(array('e_id' => $id))->select();
         foreach ($particpates as $s) {
             if ($s['user_id'] == $salon['publish_userid']) {
                 $creditValue = 20;
             } else {
                 $creditValue = 10;
             }
             $credit = new CreditModel();
             $credit->updateCredit($s['user_id'], $creditValue);
         }
         $this->success("审核成功!");
     } else {
         $this->error("审核失败,请重试");
     }
 }
Пример #2
0
 function Auth()
 {
     if (IS_POST) {
         $user = M('e_user');
         $user->student_id = I('student_id');
         $user->student_name = I('student_name');
         $user->major = I('major');
         $user->phone = I('phone');
         $user->email = I('email');
         $user->gender = I('gender');
         $user->school = I('school');
         $user->student_status = I('student_status');
         $user->openid = get_openid();
         if (empty($user->student_id)) {
             $this->error("请输入学号");
         }
         if (empty($user->student_name)) {
             $this->error("请输入姓名");
         }
         $url = "http://222.197.183.98:45003/Xscxjk/xscxjkAction.action?xh=" . $user->student_id . "&xm=" . $user->student_name . "&xslb=" . $user->student_status;
         $result = json_decode(https_request($url));
         switch ($result->result) {
             case "success":
                 break;
             case "xh_fail":
                 $this->error("学号错误");
                 exit;
                 break;
             case "xm_fail":
                 $this->error("姓名错误");
                 exit;
                 break;
             default:
                 $this->error("验证信息出错,请重试");
                 exit;
                 break;
         }
         if ($result->result != "success") {
             $this->error("姓名或学号错误,请重新认证!");
             exit;
         }
         $isAuth = M('e_user')->where('openid = ' . get_openid())->find();
         if (!empty($isAuth)) {
             $this->error("不能重复认证");
             exit;
         }
         $isAuth = M('e_user')->where('student_id = ' . $user->student_id)->find();
         if (!empty($isAuth)) {
             $this->error("不能重复认证");
             exit;
         }
         $id = $user->add();
         $credit = new CreditModel();
         $credit->createCredit($id);
         $this->success("认证成功", addons_url('Salon://Salon/Instruction'));
     } else {
         $isAuth = M('e_user')->where('openid = ' . get_openid())->find();
         if (!empty($isAuth)) {
             redirect(addons_url('Auth://Auth/UserProfile', array("id" => $isAuth["id"])));
             exit;
         }
         $user = '';
         $user['student_id'] = '';
         $user['student_name'] = '';
         $user['major'] = '';
         $user['phone'] = '';
         $user['email'] = '';
         $user['gender'] = '';
         $user['school'] = '';
         $user['student_status'] = '';
         $this->assign('title', "用户认证");
         $this->assign('user', $user);
         $this->display();
     }
 }