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

53 lines
1.5 KiB
PHP
Raw Normal View History

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;
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('操作成功', [], 1, 1);
}
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('操作成功', [], 1, 1);
}
return $this->fail(UserLogic::getError());
}
//绑定/变更 手机号
public function bindMobile(): Json
{
$params = (new UserValidate())->post()->goCheck('bindMobile');
$params['user_id'] = $this->userId;
$result = UserLogic::bindMobile($params);
if($result) {
return $this->success('绑定成功', [], 1, 1);
}
return $this->fail(UserLogic::getError());
}
// 实名认证
public function identifiy() {
//todo
}
}