|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Bside;
|
|
|
|
|
|
|
|
use App\Enums\Common\Code;
|
|
|
|
use App\Http\Logic\Bside\ComLogic;
|
|
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
|
|
|
|
|
/***
|
|
|
|
* 当前为公共类 所有方法均不需要验证登录token
|
|
|
|
*/
|
|
|
|
class ComController extends BaseController
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @name :管理员登录
|
|
|
|
* @return void
|
|
|
|
* @author :liyuhang
|
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function login(){
|
|
|
|
//当前为账号密码登录
|
|
|
|
if($this->param['login_method'] == 1){
|
|
|
|
$rules = [
|
|
|
|
'account'=>'required|string|max:32',
|
|
|
|
'password'=>'required|string|min:6',
|
|
|
|
];
|
|
|
|
//验证的提示信息
|
|
|
|
$message = [
|
|
|
|
'account.required'=>'标题必须填写',
|
|
|
|
'account.string'=>'标题中含有非法文字',
|
|
|
|
'password.required'=>'内容必须填写',
|
|
|
|
'password.string'=>'内容中含有非法文字',
|
|
|
|
'account.max' => 'account不大于32字符.',
|
|
|
|
'password.min' => 'password不小于6字符.',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
$validate = Validator::make($this->param, $rules, $message);
|
|
|
|
if($validate->errors()->first()){
|
|
|
|
return $this->success($validate->errors(),Code::USER_PARAMS_ERROE);
|
|
|
|
}
|
|
|
|
//TODO::参数验证
|
|
|
|
$comLogic = new ComLogic();
|
|
|
|
$rs = $comLogic->login($this->param);
|
|
|
|
if($rs === false){
|
|
|
|
$this->success([],Code::USER_LOGIN_ERROE);
|
|
|
|
}
|
|
|
|
$this->success();
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|