Commit 9211204c authored by yinxiaoling's avatar yinxiaoling

多个用户可登录代码修改

parent dd3fa044
...@@ -24,11 +24,11 @@ class LoginApiController extends Controller ...@@ -24,11 +24,11 @@ class LoginApiController extends Controller
} */ } */
//固定登录用户 //固定登录用户
//$allowLoginUser = ['user_name'=>'yxl001','user_sn'=>'SYSUSER|9da548a2e392a679eb274a0b2abeb627','parent_sn'=>'ljs']; //$allowLoginUser = ['user_name'=>'yxl001','user_sn'=>'SYSUSER|9da548a2e392a679eb274a0b2abeb627','parent_sn'=>'ljs'];
$allowLoginUser = $this->getAllowLoginUser();
if(empty($param['username']) || empty($param['password'] )){ if(empty($param['username']) || empty($param['password'] )){
return $this->errorWithInfo('用户名、密码必填', 401); return $this->errorWithInfo('用户名、密码必填', 401);
} }
if($param['username'] != $allowLoginUser['user_name']){ //固定登录用户 $allowLoginUser = $this->getAllowLoginUser($param['username'],'user_name');
if(!$allowLoginUser && $param['username'] != $allowLoginUser['user_name']){ //固定登录用户
return $this->errorWithInfo('用户名不正确', 401); return $this->errorWithInfo('用户名不正确', 401);
} }
......
...@@ -6,12 +6,23 @@ use Illuminate\Support\Facades\Auth; ...@@ -6,12 +6,23 @@ use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route; */ use Illuminate\Support\Facades\Route; */
trait Tool trait Tool
{ {
public function getAllowLoginUser(){ public function getAllowLoginUser($filedValue='',$filed='user_sn'){
//return ['user_name'=>'yxl001','user_sn'=>'SYSUSER|9da548a2e392a679eb274a0b2abeb627','parent_sn'=>'ljs']; //return ['user_name'=>'yxl001','user_sn'=>'SYSUSER|9da548a2e392a679eb274a0b2abeb627','parent_sn'=>'ljs'];
return [ if (empty($filedValue)){
return false;
}
//$allowLoginUser = ['yxl001','yxl002'];
$loginUserInfo = [
['user_name'=>'yxl001','user_sn'=>'SYSUSER|9da548a2e392a679eb274a0b2abeb627','parent_sn'=>'ljs'], ['user_name'=>'yxl001','user_sn'=>'SYSUSER|9da548a2e392a679eb274a0b2abeb627','parent_sn'=>'ljs'],
['user_name'=>'yxl002','user_sn'=>'SYSUSER|a15f5d51a8b0156d14f2d8ad2d39e111','parent_sn'=>'ljs'], ['user_name'=>'yxl002','user_sn'=>'SYSUSER|a15f5d51a8b0156d14f2d8ad2d39e111','parent_sn'=>'ljs'],
]; ];
foreach ($loginUserInfo as $k=>$v){
if ($v[$filed] == $filedValue){
return $v;
}
}
return false;
} }
public function getAllowProjects($style=0){ public function getAllowProjects($style=0){
$projectInfo = [['sn'=>'projects|a3a4259352c8e964ad6ea6c5ee8a7208','name'=>'liuy-转人工测试'],['sn'=>'projects|17a71649f886bce050d637e86a3c85e8','name'=>'小贷-测试林俊生']]; $projectInfo = [['sn'=>'projects|a3a4259352c8e964ad6ea6c5ee8a7208','name'=>'liuy-转人工测试'],['sn'=>'projects|17a71649f886bce050d637e86a3c85e8','name'=>'小贷-测试林俊生']];
......
...@@ -44,9 +44,7 @@ class StrategySetController extends Controller ...@@ -44,9 +44,7 @@ class StrategySetController extends Controller
} }
public function store(Request $request,StrategyService $StrategyService){ public function store(Request $request,StrategyService $StrategyService){
try{ try{
$allowLoginUser = $this->getAllowLoginUser();
$validator = Validator::make($request->all(), [ $validator = Validator::make($request->all(), [
'strategy_name' => 'required|max:30', 'strategy_name' => 'required|max:30',
'user_sn' => 'required', 'user_sn' => 'required',
...@@ -91,6 +89,8 @@ class StrategySetController extends Controller ...@@ -91,6 +89,8 @@ class StrategySetController extends Controller
$params['total'] = $successTotal; $params['total'] = $successTotal;
} }
$allowLoginUser = $this->getAllowLoginUser($request->user_sn);
$strategySn = $this->uidd(); $strategySn = $this->uidd();
$params['strategy_sn'] = $strategySn; $params['strategy_sn'] = $strategySn;
$params['user_name'] = $allowLoginUser['user_name']; $params['user_name'] = $allowLoginUser['user_name'];
...@@ -127,8 +127,8 @@ class StrategySetController extends Controller ...@@ -127,8 +127,8 @@ class StrategySetController extends Controller
} }
} }
//子账号列表 //子账号列表
public function getUsersList(){ public function getUsersList(Request $request){
$usersInfo = $this->getAllowLoginUser(); $usersInfo = $this->getAllowLoginUser($request->user_sn);
return $this->successWithInfo($usersInfo); return $this->successWithInfo($usersInfo);
} }
//项目列表 //项目列表
......
...@@ -330,7 +330,6 @@ class StrategyService ...@@ -330,7 +330,6 @@ class StrategyService
//创建任务 //创建任务
public function createdTask($strategySn=''){ public function createdTask($strategySn=''){
$userInfo = $this->getAllowLoginUser();
$today = date('Y-m-d'); $today = date('Y-m-d');
$whereArr = [['is_created',0],['call_date',$today],['created_fail_number','<=','3']]; $whereArr = [['is_created',0],['call_date',$today],['created_fail_number','<=','3']];
if (empty($strategySn)){ if (empty($strategySn)){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment