2023-09-18 09:11:13 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace app\api\controller\user;
|
|
|
|
|
|
|
|
use app\api\controller\BaseApiController;
|
|
|
|
use app\api\logic\UserLogic;
|
|
|
|
use app\common\validate\login\PasswordValidate;
|
|
|
|
use app\common\validate\user\UserValidate;
|
2023-11-13 16:10:19 +08:00
|
|
|
use app\common\validate\user\SystemUserValidate;
|
2023-09-18 09:11:13 +08:00
|
|
|
use think\response\Json;
|
|
|
|
|
|
|
|
class UserController extends BaseApiController
|
|
|
|
{
|
|
|
|
public array $notNeedLogin = ['resetPassword'];
|
|
|
|
|
|
|
|
//重置密码
|
|
|
|
public function resetPassword(): Json
|
|
|
|
{
|
|
|
|
$params = (new PasswordValidate())->post()->goCheck('resetPassword');
|
|
|
|
$result = UserLogic::resetPassword($params);
|
|
|
|
if (true === $result) {
|
2023-09-19 11:47:58 +08:00
|
|
|
return $this->success('操作成功');
|
2023-09-18 09:11:13 +08:00
|
|
|
}
|
|
|
|
return $this->fail(UserLogic::getError());
|
|
|
|
}
|
|
|
|
|
|
|
|
//修改密码
|
|
|
|
public function changePassword(): Json
|
|
|
|
{
|
|
|
|
$params = (new PasswordValidate())->post()->goCheck('changePassword');
|
|
|
|
$result = UserLogic::changePassword($params, $this->userId);
|
|
|
|
if (true === $result) {
|
2023-09-19 11:47:58 +08:00
|
|
|
return $this->success('操作成功');
|
2023-09-18 09:11:13 +08:00
|
|
|
}
|
|
|
|
return $this->fail(UserLogic::getError());
|
|
|
|
}
|
|
|
|
|
|
|
|
//绑定/变更 手机号
|
2023-09-19 11:47:58 +08:00
|
|
|
public function changeMobile(): Json
|
2023-09-18 09:11:13 +08:00
|
|
|
{
|
2023-09-19 11:47:58 +08:00
|
|
|
$params = (new UserValidate())->post()->goCheck('changeMobile');
|
2023-11-13 11:09:47 +08:00
|
|
|
$result = UserLogic::changeMobile($params, $this->userId);
|
2023-09-18 09:11:13 +08:00
|
|
|
if($result) {
|
2023-09-19 11:47:58 +08:00
|
|
|
return $this->success('修改成功');
|
2023-09-18 09:11:13 +08:00
|
|
|
}
|
|
|
|
return $this->fail(UserLogic::getError());
|
|
|
|
}
|
|
|
|
|
2023-11-13 16:10:19 +08:00
|
|
|
//绑定中台系统子应用用户关系
|
|
|
|
public function bindSystemUser(): Json
|
|
|
|
{
|
|
|
|
$params = (new SystemUserValidate())->post()->goCheck('bind');
|
|
|
|
$result = UserLogic::bindSystemUser($params, $this->userInfo);
|
|
|
|
if($result) {
|
|
|
|
return $this->success('操作成功');
|
|
|
|
}
|
|
|
|
return $this->fail(UserLogic::getError());
|
|
|
|
}
|
|
|
|
|
2023-11-13 11:37:37 +08:00
|
|
|
/*
|
2023-09-19 11:47:58 +08:00
|
|
|
// 更新用户信息
|
|
|
|
public function updateUser(): Json
|
|
|
|
{
|
|
|
|
$params = (new UserValidate())->post()->goCheck('edit');
|
|
|
|
$result = UserLogic::updateUser($params,$this->userId);
|
|
|
|
if($result) {
|
|
|
|
return $this->success('更新成功');
|
|
|
|
}
|
|
|
|
return $this->fail(UserLogic::getError());
|
2023-09-18 09:11:13 +08:00
|
|
|
}
|
2023-11-13 11:37:37 +08:00
|
|
|
*/
|
2023-09-18 09:11:13 +08:00
|
|
|
}
|