2024-08-06 17:46:36 +08:00

65 lines
2.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\api\controller\login;
use app\dict\member\MemberLoginTypeDict;
use app\service\api\login\ConfigService;
use app\service\api\login\RegisterService;
use core\base\BaseController;
use think\Response;
class Register extends BaseController
{
/**
* 账号密码注册
* @return Response
*/
public function account()
{
$data = $this->request->params([
[ 'username', '' ],
[ 'password', '' ],
[ 'mobile', '' ],
]);
//校验登录注册配置
( new ConfigService() )->checkLoginConfig(MemberLoginTypeDict::USERNAME);
//参数验证
$this->validate($data, 'app\validate\member\Member.account_register');
//验证码验证
$result = ( new RegisterService() )->account($data[ 'username' ], $data[ 'password' ], $data[ 'mobile' ]);
return success($result);
}
/**
* 手机号注册
* @return Response
*/
public function mobile()
{
$data = $this->request->params([
[ 'mobile', '' ],
]);
//校验登录注册配置
( new ConfigService() )->checkLoginConfig(MemberLoginTypeDict::MOBILE);
//参数验证
$this->validate($data, [
'mobile' => 'require|mobile'
]);
//验证码验证
$result = ( new RegisterService() )->mobile($data[ 'mobile' ]);
return success($result);
}
}