ComController.php
1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
namespace App\Http\Controllers\Bside;
use App\Enums\Common\Code;
use App\Http\Logic\Bside\ComLogic;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
/***
* 当前为公共类 所有方法均不需要验证登录token
*/
class ComController extends BaseController
{
/**
* @name :管理员登录
* @return void
* @author :liyuhang
* @method
*/
public function login(){
$rules = [
'mobile'=>'required|string|max:12',
'password'=>'required|string|min:5',
];
//验证的提示信息
$message = [
'mobile.required'=>'标题必须填写',
'mobile.string'=>'标题中含有非法文字',
'password.required'=>'内容必须填写',
'password.string'=>'内容中含有非法文字',
'mobile.max' => 'account不大于12字符.',
'password.min' => 'password不小于5字符.',
];
$validate = Validator::make($this->param, $rules, $message);
if($validate->errors()->first()){
return $this->response($validate->errors()->first(),Code::USER_ERROR,$this->param);
}
//TODO::参数验
$comLogic = new ComLogic();
$res = $comLogic->login($this->param);
$this->token = $res['token'];
if($res === false){
$this->response('请求失败',Code::USER_ERROR,[]);
}
$this->response('请求成功',Code::SUCCESS,$res);
}
/**
* @name :获取当前用户权限菜单列表
* @return void
* @author :liyuhang
* @method
*/
public function get_menu(){
$menu_lists = [];
$this->response('当前用户菜单列表',Code::SUCCESS,$menu_lists);
}
}