data_center/app/api/controller/user/UserController.php

72 lines
2.1 KiB
PHP

<?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;
use app\common\validate\user\SystemUserValidate;
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) {
return $this->success('操作成功');
}
return $this->fail(UserLogic::getError());
}
//修改密码
public function changePassword(): Json
{
$params = (new PasswordValidate())->post()->goCheck('changePassword');
$result = UserLogic::changePassword($params, $this->userId);
if (true === $result) {
return $this->success('操作成功');
}
return $this->fail(UserLogic::getError());
}
//绑定/变更 手机号
public function changeMobile(): Json
{
$params = (new UserValidate())->post()->goCheck('changeMobile');
$result = UserLogic::changeMobile($params, $this->userId);
if ($result) {
return $this->success('修改成功');
}
return $this->fail(UserLogic::getError());
}
//绑定中台系统子应用用户关系
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());
}
/*
// 更新用户信息
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());
}
*/
}