Esempio n. 1
0
 /**
  * 验证准备注册
  * @method verify
  * @access public
  * @author NewFuture[newfuture@yunyin.org]
  * @return bool|null
  */
 public function verify($number, $password, $sch_id = null, $code = null)
 {
     $info = array('number' => $number, 'password' => $password, 'sch_id' => $sch_id);
     $code and $info['code'] = $code;
     //验证码
     /*黑名单*/
     $black = isset($this->reg_schools) ? $this->reg_schools : [];
     if (!($result = School::verify($info, $black))) {
         return false;
     } elseif ($result = array_filter($result)) {
         /*验证成功*/
         $reg = array('number' => $info['number'], 'password' => md5($info['password']), 'name' => current($result), 'sch_id' => key($result));
         $sid = Session::start();
         Session::set('reg', $reg);
         unset($reg['password']);
         $reg['school'] = SchoolModel::getName($reg['sch_id']);
         $this->response(2, ['sid' => $sid, 'user' => $reg, 'msg' => '验证成功', 'url' => '/user/']);
         return true;
     }
 }