Commit 0e4f7649 authored by 顾敏's avatar 顾敏

审核图片实时给结果

parent df1ecdf0
......@@ -346,16 +346,21 @@ class CardController extends Controller
$userId = $request->session()->get("uid");
$roleId = $request->input('roleId');
$serverId = $request->input('serverId');
$result = $this->getVerityLogin($userId);
if($result['code'] != 200) return $this->jsonReturn($result['code'], $result['msg']);
if (empty($roleId) || empty($serverId)) return $this->jsonReturn(7002, '参数错误');
$data = [];
if(Cache::has('card:info:'.$userId.':'.$roleId)){
$data = Cache::get('card:info:'.$userId.':'.$roleId);
}else{
$result = $this->getVerityLogin($userId);
if($result['code'] != 200) return $this->jsonReturn($result['code'], $result['msg']);
if (empty($roleId) || empty($serverId)) return $this->jsonReturn(7002, '参数错误');
// if (!Schema::connection('wx_mysql')->hasTable('wx_card_role_'.$serverId)) return redirect(route('index'));
$info = DB::connection('wx_mysql')->table('wx_card_role_'.$serverId)->where('uid',$userId)->where('role_id',$roleId)->where('server_id',$serverId)->first();
}else{
$info = DB::connection('wx_mysql')->table('wx_card_role_'.$serverId)
->where('uid',$userId)
->where('role_id',$roleId)
->where('server_id',$serverId)
->first();
if(!$info) return redirect(route('index'));
$filterElems = ['越狱', 'IOS', 'mg77', '抖音', '硬核', '非硬核', 'zy', '915转移', '转移', '小米', '百度'];
......@@ -364,24 +369,7 @@ class CardController extends Controller
$user = User::where('uid',$userId)->select('uid','account')->first();
$data['userName'] = $user->account ?? '';
$data['serverName'] = $serverName;
$img = WxUserImg::where('uid',$userId)->where('role_id',$info->id)->where('server_id',$info->server_id)->select('id','img_url','status','is_upload')->first();
if($img){
if($img->status == 1){
if($img->is_upload == 1){
$data['userImgStatus'] = 1;
}else{
$data['userImgStatus'] = 0;
}
}else{
$data['userImgStatus'] = $img->status;
}
$data['userImg'] = $img->img_url;
}else{
$data['userImg'] = '';
$data['userImgStatus'] = -1;
}
$data['serverName'] = $serverName;
$armsScore = [];
$armsStrong = [];
......@@ -389,13 +377,6 @@ class CardController extends Controller
if($info->arms_score != '') $armsScore = json_decode($info->arms_score,true);
if($info->arms_strong != '') $armsStrong = json_decode($info->arms_strong,true);
if($info->arms_exciting != '') $armsExciting = json_decode($info->arms_exciting,true);
// $roleScore = '00000';
// if(strlen($info->role_score) == 1) $roleScore = '0000'.(string)$info->role_score;
// if(strlen($info->role_score) == 2) $roleScore = '000'.(string)$info->role_score;
// if(strlen($info->role_score) == 3) $roleScore = '00'.(string)$info->role_score;
// if(strlen($info->role_score) == 4) $roleScore = '0'.(string)$info->role_score;
// if(strlen($info->role_score) == 5) $roleScore = (string)$info->role_score;
$roleScore = str_pad($info->role_score, 5, "0", STR_PAD_LEFT);
......@@ -422,14 +403,7 @@ class CardController extends Controller
}
$data['rank'] = empty($info->max_rank) ? '青铜5' : $info->max_rank;
if(!empty($armsScore)){
// $armsScoreNum = '00000';
// if(strlen($armsScore[0]['score']) == 1) $armsScoreNum = '0000'.(string)$armsScore[0]['score'];
// if(strlen($armsScore[0]['score']) == 2) $armsScoreNum = '000'.(string)$armsScore[0]['score'];
// if(strlen($armsScore[0]['score']) == 3) $armsScoreNum = '00'.(string)$armsScore[0]['score'];
// if(strlen($armsScore[0]['score']) == 4) $armsScoreNum = '0'.(string)$armsScore[0]['score'];
// if(strlen($armsScore[0]['score']) == 5) $armsScoreNum = (string)$armsScore[0]['score'];
if(!empty($armsScore)){
$armsScoreNum = str_pad($armsScore[0]['score'], 5, "0", STR_PAD_LEFT);
$data['armsScoreName'] = $armsScore[0]['name'];
$data['armsScore'] = $armsScoreNum;
......@@ -472,6 +446,27 @@ class CardController extends Controller
}
Cache::put('card:info:'.$userId.':'.$roleId,$data, 86400);
}
$img = WxUserImg::where('uid',$userId)
->where('role_id', $roleId)
->where('server_id', $serverId)
->select('id','img_url','status','is_upload')
->first();
if($img){
if($img->status == 1){
if($img->is_upload == 1){
$data['userImgStatus'] = 1;
}else{
$data['userImgStatus'] = 0;
}
}else{
$data['userImgStatus'] = $img->status;
}
$data['userImg'] = $img->img_url;
}else{
$data['userImg'] = '';
$data['userImgStatus'] = -1;
}
return view('card.card', $data);
}
......
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