| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- /**
- * 登录
- * @author wesmiler
- */
- namespace app\api\controller;
- use app\index\service\Users;
- use app\index\validate\UsersValidate;
- class LoginController extends BaseController
- {
- /**
- * 账号注册
- * @throws \think\Exception
- * @throws \think\exception\PDOException
- */
- public function register(){
- $params = input();
- $validate = new UsersValidate();
- if (!$validate->scene('reg')->check($params)) {
- showJson(1002, $validate->getError());
- }
- if(!Users::saveData($params)){
- showJson(1002, 1011);
- }
- showJson(1001, 1012);
- }
- /**
- * 账号注册
- * @throws \think\Exception
- * @throws \think\exception\PDOException
- */
- public function login(){
- $params = input();
- $validate = new UsersValidate();
- if (!$validate->scene('login')->check($params)) {
- showJson(1002, $validate->getError());
- }
- $result = Users::login($params);
- if(!is_array($result)){
- showJson(1002, $result);
- }
- showJson(1001, 1013, $result);
- }
- }
|