|
|
|
@ -36,10 +36,10 @@ class Personnel extends BaseApiService |
|
|
|
'id'=>$this->member_id, |
|
|
|
]; |
|
|
|
$res = (new PersonnelService())->info($where); |
|
|
|
if(!$res){ |
|
|
|
return fail('账户信息有误'); |
|
|
|
if(!$res['code']){ |
|
|
|
return fail($res['msg']); |
|
|
|
} |
|
|
|
return success($res); |
|
|
|
return success($res['data']); |
|
|
|
} |
|
|
|
|
|
|
|
//员工修改 |
|
|
|
@ -66,114 +66,20 @@ class Personnel extends BaseApiService |
|
|
|
return success([]); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 登录 |
|
|
|
* @return Response |
|
|
|
*/ |
|
|
|
public function login() |
|
|
|
{ |
|
|
|
$data = $this->request->params([ |
|
|
|
['username', ''], |
|
|
|
['password', ''], |
|
|
|
]); |
|
|
|
//校验登录注册配置 |
|
|
|
(new ConfigService())->checkLoginConfig(MemberLoginTypeDict::USERNAME); |
|
|
|
//参数验证 |
|
|
|
//验证码验证 |
|
|
|
$result = (new LoginService())->account($data['username'], $data['password']); |
|
|
|
if (!$result) { |
|
|
|
//账号密码错误, 重置验证码 |
|
|
|
return fail('ACCOUNT_OR_PASSWORD_ERROR'); |
|
|
|
} |
|
|
|
return success($result); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 登出 |
|
|
|
* @return Response |
|
|
|
*/ |
|
|
|
public function logout() |
|
|
|
{ |
|
|
|
(new LoginService)->logout(); |
|
|
|
return success('MEMBER_LOGOUT'); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 创建验证码 |
|
|
|
* @return Response |
|
|
|
*/ |
|
|
|
public function captcha() |
|
|
|
{ |
|
|
|
return success((new CaptchaService())->create()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 发送手机验证码 |
|
|
|
* @param $type |
|
|
|
* @return Response |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
public function sendMobileCode($type) |
|
|
|
{ |
|
|
|
$data = $this->request->params([ |
|
|
|
['mobile', ''], |
|
|
|
]); |
|
|
|
return success((new LoginService())->sendMobileCode($data['mobile'], $type)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 手机号登录 |
|
|
|
* @return Response |
|
|
|
*/ |
|
|
|
public function mobile() |
|
|
|
{ |
|
|
|
$data = $this->request->params([ |
|
|
|
['mobile', ''], |
|
|
|
['nickname', ''], |
|
|
|
['headimg', ''], |
|
|
|
['mobile', ''] |
|
|
|
]); |
|
|
|
//校验登录注册配置 |
|
|
|
(new ConfigService())->checkLoginConfig(MemberLoginTypeDict::MOBILE); |
|
|
|
return success((new LoginService())->mobile($data)); |
|
|
|
//人力资源-人员表 |
|
|
|
public function getPersonnelAll(Request $request){ |
|
|
|
//获取员工信息 |
|
|
|
$where = [ |
|
|
|
'account_type' => $request->param('account_type', ''),//账号类型|teacher=老师,market=销售 |
|
|
|
'personnel_id' => $request->param('personnel_id', ''),//员工id |
|
|
|
]; |
|
|
|
$field = 'id,name'; |
|
|
|
$res = (new PersonnelService())->getAll($where,$field); |
|
|
|
if(!$res){ |
|
|
|
return fail('账户信息有误'); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 重置密码 |
|
|
|
* @return Response |
|
|
|
*/ |
|
|
|
public function resetPassword() |
|
|
|
{ |
|
|
|
$data = $this->request->params([ |
|
|
|
['mobile', ''], |
|
|
|
['password', ''] |
|
|
|
]); |
|
|
|
//参数验证 |
|
|
|
$this->validate($data, 'app\validate\member\Member.reset_password'); |
|
|
|
(new LoginService())->resetPassword($data['mobile'], $data['password']); |
|
|
|
return success('PASSWORD_RESET_SUCCESS'); |
|
|
|
return success($res); |
|
|
|
} |
|
|
|
|
|
|
|
//销售教师人员登陆 |
|
|
|
public function personnelLogin() |
|
|
|
{ |
|
|
|
$data = $this->request->params([ |
|
|
|
['phone', ''], |
|
|
|
['password', ''], |
|
|
|
['login_type', ''],//登陆类型|1=教练,2=销售 |
|
|
|
]); |
|
|
|
//验证码验证 |
|
|
|
$result = (new LoginService())->loginByPersonnel($data); |
|
|
|
|
|
|
|
if(!$result['user_type']){ |
|
|
|
if($data['login_type'] == 1){ |
|
|
|
$msg = '暂无教练权限'; |
|
|
|
}else{ |
|
|
|
$msg = '暂无销售权限'; |
|
|
|
} |
|
|
|
return fail($msg);//code|0错误 |
|
|
|
} |
|
|
|
|
|
|
|
return success($result);//code|1正确 |
|
|
|
} |
|
|
|
} |
|
|
|
|