|
@@ -0,0 +1,40 @@
|
|
|
+<?php
|
|
|
+/**
|
|
|
+ * Created by PhpStorm
|
|
|
+ * User:林志杰
|
|
|
+ * Email:[email protected]
|
|
|
+ * Motto:纵有疾风起,人生不言弃!
|
|
|
+ * Time:2020/2/8 1:10
|
|
|
+ */
|
|
|
+
|
|
|
+declare(strict_types=1);
|
|
|
+
|
|
|
+namespace app\api\controller;
|
|
|
+
|
|
|
+use app\api\validate\User as UserValidate;
|
|
|
+use app\BaseController;
|
|
|
+use app\common\business\User as UserBusiness;
|
|
|
+
|
|
|
+class Login extends BaseController
|
|
|
+{
|
|
|
+ public function index(): object
|
|
|
+ {
|
|
|
+ $phoneNumber = $this->request->param("phone_number", '', 'trim');
|
|
|
+ $code = input('param.code', 0, 'intval');
|
|
|
+ $type = input('param.type', 0, 'intval');
|
|
|
+ // 参数校验
|
|
|
+ $data = [
|
|
|
+ 'phoneNumber' => $phoneNumber,
|
|
|
+ 'code' => $code,
|
|
|
+ 'type' => $type,
|
|
|
+ ];
|
|
|
+ $validate = new UserValidate();
|
|
|
+ if (!$validate->scene('login')->check($data)) {
|
|
|
+ return show(config('status.error'), $validate->getError());
|
|
|
+ }
|
|
|
+
|
|
|
+ $result = (new UserBusiness())->login($data);
|
|
|
+
|
|
|
+ return show(config('status.success'), "登陆成功");
|
|
|
+ }
|
|
|
+}
|