/**
  * 用户主页
  */
 public function home()
 {
     $this->checkLogin();
     $model = new UserModel();
     if (IS_POST) {
         $avatar = I('avatar');
         $nickname = I('nickname');
         $password = I('password');
         if (!$model->create()) {
             $this->error($model->getError());
         }
         $data = ['avatar' => $avatar, 'nickname' => $nickname];
         if (!empty($password)) {
             $data['password'] = $password;
         }
         if ($model->where(array('userId' => $this->user['userId']))->save() === false) {
             $this->error('编辑失败');
         }
         $this->success('编辑成功');
     } else {
         $user = $model->find($this->user['userId']);
         $this->assign('user', $user);
         $this->display();
     }
 }
Ejemplo n.º 2
0
 public function set_password()
 {
     if (IS_POST) {
         $userModel = new UserModel();
         if (!$userModel->verifyCode($this->user['mobile'], I('post.sms_code'))) {
             $this->error($userModel->getError());
         }
         $userMoneyModel = new UserMoneyModel();
         if (!$userMoneyModel->setPassword($this->user['uid'], I('post.password', 'intval'))) {
             $this->error($userMoneyModel->getError());
         }
         $this->success('设置成功', I('to_url') ?: 'index');
     } else {
         $this->display();
     }
 }
Ejemplo n.º 3
0
 public function user_agreement_job_service()
 {
     if (IS_POST) {
         if (empty(I('post.sms_code', ''))) {
             $this->_error('填写验证码');
         }
         if (I('post.agree') != 'on') {
             $this->_error('请选择同意协议');
         }
         $userModel = new UserModel();
         if (!$userModel->verifyCode($this->user->self('mobile'), I('post.sms_code'))) {
             $this->_error($userModel->getError());
         }
         M('job_user')->add(['uid' => $this->user->self('uid'), 'is_agree_contract' => 1], null, true);
         $this->_success($userModel->getError());
     } else {
         return $this->display();
     }
 }