error(__('Invalid parameters')); } //找员工 $userstaff = Db::name('pc_admin')->where('username',$account)->find(); if($userstaff) { $user = \app\common\model\Company::get($userstaff['company_id']); if($user) { $ret = $this->auth->direct($user->id,$userstaff['id']); } } $ret = $this->auth->login($account, $password); if ($ret) { $data = $this->auth->getUserinfo_simple(); $this->success(__('Logged in successful'), $data); } else { $this->error($this->auth->getError()); } } /** * 退出登录 * @ApiMethod (POST) */ public function logout() { if (!$this->request->isPost()) { $this->error(__('Invalid parameters')); } $this->auth->logout(); $this->success(__('Logout successful')); } //用户详细资料 public function getUserinfo($type = 1){ $info = $this->auth->getUserinfo(); if($type == 'return'){ return $info; } $this->success(__('success'),$info); } //用户申请资料 public function getUserapplyinfo(){ $field = [ 'company_name', 'company_code', 'company_registerdate', 'company_address', 'company_image', 'truename', 'idcard', 'idcard_images', 'bank_name', 'bank_branchname', 'bank_account', 'bank_card', ]; $info = Db::name('company')->field($field)->where('id',$this->auth->id)->find(); $info = info_domain_image($info,['company_image','idcard_images']); $this->success(1,$info); } /** * 修改会员个人信息 * * @ApiMethod (POST) * @param string $avatar 头像地址 * @param string $username 用户名 * @param string $nickname 昵称 * @param string $bio 个人简介 */ public function profile() { //检查 $check = Db::name('company')->where('id',$this->auth->id)->find(); if($check['status'] == 1){ $this->success('资料审核通过后需联系客服修改'); } $field = [ 'company_name', 'company_code', 'company_registerdate', 'company_address', 'company_image', 'truename', 'idcard', 'idcard_images', 'bank_name', 'bank_branchname', 'bank_account', 'bank_card', ]; $data = request_post_hub($field); $data['status'] = 0; $update_rs = Db::name('company')->where('id',$this->auth->id)->update($data); $this->success('资料更新完成'); } }