Commit cc364e2e authored by zhoujun's avatar zhoujun

图片上传

parents 68012029 252bc6c1
Pipeline #1584 passed with stage
in 11 seconds
......@@ -3,6 +3,8 @@
namespace App\Exceptions;
use Illuminate\Session\TokenMismatchException;
use Psy\Exception\ErrorException;
use Illuminate\Database\QueryException;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
......@@ -54,9 +56,16 @@ class Handler extends ExceptionHandler
if ($exception instanceof TokenMismatchException) {
$exception = new TokenMismatchException("网络异常,请稍后刷新重试");
}
if ($exception instanceof \ErrorException) {
return redirect(route("login"));
if ($exception instanceof QueryException) {
return new JsonResponse(['error' => 5001, 'message' => '网络错误']);
}
if ($exception instanceof ErrorException) {
return redirect(route('index'));
}
return parent::render($request, $exception);
}
}
......@@ -36,6 +36,7 @@ class AdminController extends Controller
*/
public function getLogin()
{
if(Auth::check()) return redirect(route('checkImg'));
$data['ERROR'] = Session::get('error','');
return $this->view('admin.login',$data);
}
......@@ -74,7 +75,7 @@ class AdminController extends Controller
$pageNum = 20;
$startTime = $postData['startTime'] ?? '';
$endTime = $postData['endTime'] ?? '';
$status = $postData['status'] ?? 0;
$status = $postData['status'] ?? 1;
$userName = $postData['user'] ?? '';
$paginateAppends['status'] = $status;
......@@ -85,11 +86,16 @@ class AdminController extends Controller
}else{
return $query->where('uid','-1');
}
})->when($status > 0, function ($query) use ($status) {
$imgStatus = $status - 1;
return $query->where('status',$imgStatus);
})->when($startTime != '', function ($query) use ($startTime) {
return $query->where('updated_at','>',$startTime);
})->when($endTime != '', function ($query) use ($endTime) {
return $query->where('updated_at','<',$endTime);
})->where('status',$status)->orderBy('id','ASC')->select('id', 'uid', 'img_url', 'status', 'updated_at')->paginate($pageNum);
})->when($status == 0, function ($query) use ($status) {
return $query->orderBy('status','ASC');
})->orderBy('updated_at','DESC')->select('id', 'uid', 'img_url', 'status', 'updated_at')->paginate($pageNum);
if($startTime != '') $paginateAppends['startTime'] = $startTime;
if($endTime != '') $paginateAppends['endTime'] = $endTime;
if($userName != '') $paginateAppends['user'] = $userName;
......@@ -122,10 +128,25 @@ class AdminController extends Controller
if($id < 1 || !in_array($status,[1,2])) return $this->getErrorMsg('10060', '参数错误');
$row = WxUserImg::find($id);
if(!$row) return $this->getErrorMsg('10061', '数据异常');
if($row->status > 0) return $this->getErrorMsg('10062', '请勿重复审核');
$row->status = $status;
if($row->save()) return $this->getSuccessMsg([]);
return $this->getErrorMsg('10063', '审核失败');
}
/**
* 批量审核图片
* @date 2021/06/07
* @author live
*/
public function getSaveStatusAll(Request $request)
{
$postData = $request->all();
$ids = explode('#',$postData['ids']);
$status = $postData['status'];
if(!in_array($status,[1,2]) || empty($ids)) return $this->getErrorMsg('10060', '参数错误');
$result = WxUserImg::whereIn('id',$ids)->update(['status' => $status]);
if($result) return $this->getSuccessMsg([]);
return $this->getErrorMsg('10063', '审核失败');
}
}
\ No newline at end of file
......@@ -21,6 +21,8 @@ use App\Models\GameUserRoleTime;
use App\Models\BaseItem;
use App\Models\WxUserImg;
use App\Services\UploadServer;
use App\Models\User;
use Illuminate\Support\Facades\Log;
class CardController extends Controller
{
......@@ -100,7 +102,8 @@ class CardController extends Controller
$verity = DB::connection('wx_mysql')->table($tableName)->where('uid',$userId)->where('role_id',$roleId)->select('id')->first();
if($verity) return $this->jsonReturn(0, '角色绑定成功');
$insert = $this->getInsertRoleInfo($userId,$roleId,$serverId,$serverName,$tableName);
return $this->jsonReturn(0, '角色绑定成功');
if($insert['code'] == 200) return $this->jsonReturn(0, '角色绑定成功');
return $this->jsonReturn($insert['code'], $insert['msg']);
}
/**
......@@ -115,7 +118,6 @@ class CardController extends Controller
$targetRole = [];
$roleIdsKey = "user_roleIds:" . $userId;
$roleList = json_decode(Redis::get($roleIdsKey), true);
if (!isset($roleList[$serverId])){
$array['code'] = 7003;
$array['msg'] = '请选择正确的服务器';
......@@ -133,18 +135,7 @@ class CardController extends Controller
$array['msg'] = '请刷新重新选择角色';
return $array;
}
$duelTotal = 0;
$duelWin = 0;
$maxRank = '';
$win = GameUserPvpCount::where('server_id',$serverId)->where('role_id',$roleId)->select('role_id','total_pvp_num','pvp_win_num')->first();
if($win){
$duelTotal = $win->total_pvp_num;
$duelWin = $win->pvp_win_num;
}
$rank = GameUserPvp::where('server_id',$serverId)->where('role_id',$roleId)->select('role_id','level')->first();
if($rank) $maxRank = $rank->level;
$gmService = new AldGmService();
$roleInfo = $gmService->getCPRoleInfo($serverId,$targetRole['userId'],$roleId);
if(!$roleInfo){
......@@ -153,7 +144,18 @@ class CardController extends Controller
return $array;
}
$roleScore = $roleInfo['RoleScore'] ?? 0;
$duelTotal = $roleInfo['PKTotalNum'] ?? 0;
$duelWin = $roleInfo['PkWinNum'] ?? 0;
$maxRank = '';
$seasonLevelID = $roleInfo['SeasonLevelID'] ?? 0;
$rankConfig = config('sign.rank');
if($seasonLevelID){
$first = substr($seasonLevelID,0,1);
$second = 50 - substr($seasonLevelID,1,2);
if($second == 0) $second = '';
$first = $rankConfig[$first] ?? '';
if($first != '') $maxRank = $first.$second;
}
$armsIds = [];
$armsScore = [];
$armsStrong = [];
......@@ -219,8 +221,8 @@ class CardController extends Controller
if($braveTime < 1) $braveTime = 0;
if($mercenaryScore < 1) $mercenaryScore = 0;
$array = ['uid'=>$userId,'server_id'=>$serverId,'server_name'=>$serverName,'user_id'=>$targetRole['userId'],'role_id'=>$roleId,'role_name'=>$targetRole['roleName'],'job'=>$targetRole['occupation'],'guild'=>$targetRole['guild'],'online_time'=>$targetRole['onlineTime'],'register_time'=>date('Y-m-d H:i:s',$targetRole['createTime']),'role_score'=>$roleScore,'arms_score'=>$armsScoreArr,'arms_strong'=>$armsStrongArr,'arms_exciting'=>$armsExcitingArr,'duel_total'=>$duelTotal,'duel_win'=>$duelWin,'duel_continuity_win'=>$duelContinuityWin,'max_rank'=>$maxRank,'brave_num'=>$braveNum,'brave_time'=>$braveTime,'mercenary_score'=>$mercenaryScore,'created_at'=>$time,'updated_at'=>$time];
$result = DB::connection('wx_mysql')->table($tableName)->insert($array);
$arrayData = ['uid'=>$userId,'server_id'=>$serverId,'server_name'=>$serverName,'user_id'=>$targetRole['userId'],'role_id'=>$roleId,'role_name'=>$targetRole['roleName'],'job'=>$targetRole['occupation'],'guild'=>$targetRole['guild'],'online_time'=>$targetRole['onlineTime'],'register_time'=>date('Y-m-d H:i:s',$targetRole['createTime']),'role_score'=>$roleScore,'arms_score'=>$armsScoreArr,'arms_strong'=>$armsStrongArr,'arms_exciting'=>$armsExcitingArr,'duel_total'=>$duelTotal,'duel_win'=>$duelWin,'duel_continuity_win'=>$duelContinuityWin,'max_rank'=>$maxRank,'brave_num'=>$braveNum,'brave_time'=>$braveTime,'mercenary_score'=>$mercenaryScore,'created_at'=>$time,'updated_at'=>$time];
$result = DB::connection('wx_mysql')->table($tableName)->insert($arrayData);
if($result) return $array;
$array['code'] = 10052;
......@@ -276,7 +278,10 @@ class CardController extends Controller
*/
public function getUploadImg(Request $request)
{
Log::info("图片上传日志:" , json_encode($request->file('imgFile')));
$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']);
$postData = $request->all();
......@@ -285,8 +290,10 @@ class CardController extends Controller
$upload = new UploadServer();
$result = $upload->getUpload($postData,$file);
if($result['code'] != 200) return $this->jsonReturn($result['code'], $result['msg']);
$img = $this->getUpdateImg($result['data'],$userId);
$tableName = 'wx_card_role_'.$serverId;
$role = DB::connection('wx_mysql')->table($tableName)->where('uid',$userId)->where('role_id',$roleId)->select('id')->first();
$img = $this->getUpdateImg($result['data'],$userId,$role->id,$serverId);
if($img) return $this->jsonReturn(0, '上传成功',['src'=>$result['data']]);
return $this->jsonReturn(10060, '上传失败');
}
......@@ -298,9 +305,9 @@ class CardController extends Controller
* @date 2021/06/01
* @author live
*/
public function getUpdateImg($data,$userId)
public function getUpdateImg($data,$userId,$roleId,$serverId)
{
$img = WxUserImg::where('uid',$userId)->first();
$img = WxUserImg::where('uid',$userId)->where('role_id',$roleId)->where('server_id',$serverId)->first();
if($img){
$img->loacl_url = $data['url'];
$img->img_url = $data['yunUrl'];
......@@ -309,6 +316,8 @@ class CardController extends Controller
}else{
$row = new WxUserImg();
$row->uid = $userId;
$row->role_id = $roleId;
$row->server_id = $serverId;
$row->loacl_url = $data['url'];
$row->img_url = $data['yunUrl'];
$row->status = 0;
......@@ -325,16 +334,27 @@ class CardController extends Controller
*/
public function getCardHtml(Request $request)
{
Log::info("请求日志:测试" , []);
$userId = $request->session()->get("uid");
$result = $this->getVerityLogin($userId);
if($result['code'] != 200) return $this->jsonReturn($result['code'], $result['msg']);
$roleId = $request->input('roleId','3804433377408900301');
$serverId = $request->input('serverId',269);
$roleId = $request->input('roleId');
$serverId = $request->input('serverId');
if (empty($roleId) || empty($serverId)) return $this->jsonReturn(7002, '参数错误');
$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('cardIndex'));
if(!$info) return redirect(route('index'));
$serverName = '';
if($info->server_name != ''){
$serverName = str_replace('非硬核-','',$info->server_name);
$serverName = str_replace('硬核-','',$serverName);
$serverName = str_replace('越狱-','',$serverName);
}
$user = User::where('uid',$userId)->select('uid','account')->first();
$data['userName'] = $user->account ?? '';
$data['serverName'] = $serverName;
$img = WxUserImg::where('uid',$userId)->select('id','img_url','status')->first();
$img = WxUserImg::where('uid',$userId)->where('role_id',$info->id)->where('server_id',$info->server_id)->select('id','img_url','status')->first();
if($img){
$data['userImgStatus'] = $img->status;
$data['userImg'] = $img->img_url;
......@@ -362,23 +382,21 @@ class CardController extends Controller
$data['roleScore'] = $roleScore;
$data['jobImg'] = $jobInco[$info->job] ?? '';
if($info->mercenary_score > 4999 && $info->mercenary_score < 12000){
if($info->mercenary_score == 2){
$data['ybImg'] = 'img-B';
}elseif($info->mercenary_score > 11999 && $info->mercenary_score < 17000){
}elseif($info->mercenary_score == 3){
$data['ybImg'] = 'img-A';
}elseif($info->mercenary_score > 16999 && $info->mercenary_score < 20000){
}elseif($info->mercenary_score == 4){
$data['ybImg'] = 'img-S';
}elseif($info->mercenary_score > 19999 && $info->mercenary_score < 24000){
}elseif($info->mercenary_score == 5){
$data['ybImg'] = 'img-SS';
}elseif($info->mercenary_score > 23999){
}elseif($info->mercenary_score == 6){
$data['ybImg'] = 'img-SSS';
}else{
$data['ybImg'] = 'img-C';
}
$data['rank'] = '';
$rank = explode('-',$info->max_rank);
if(!empty($rank)) $data['rank'] = $rank[0] ?? '';
$data['rank'] = $info->max_rank ?? '';
if(!empty($armsScore)){
$armsScoreNum = '00000';
if(strlen($armsScore[0]['score']) == 1) $armsScoreNum = '0000'.(string)$armsScore[0]['score'];
......
......@@ -9,6 +9,8 @@ use Exception;
use Carbon\Carbon;
use Illuminate\Validation\Rule;
use App\Services\UtilService;
use App\Models\User;
class HomeController extends Controller
{
......@@ -26,9 +28,19 @@ class HomeController extends Controller
*/
public function getHome(Request $request)
{
$data = [];
$isWx = UtilService::getIsWx($_SERVER['HTTP_USER_AGENT']);
if(!$isWx) return redirect(route("wxIndex"));
$data['isWx'] = $isWx;
if($request->session()->get('uid')){
$userId = $request->session()->get('uid');
$data['isLogin'] = 1;
$user = User::where('uid',$userId)->select('uid','account')->first();
$data['userName'] = $user->account ?? '';
}else{
$data['userName'] = '';
$data['isLogin'] = 0;
}
return view('card.index', $data);
}
......
......@@ -126,9 +126,10 @@ class AldUserController extends Controller
if (empty($userExtra->aldzn_info)) {
return $this->jsonReturn(4003, "请您先绑定Orange识别码后再来领取哦~");
}
$gmService = new AldGmService();
$aldzn_info = json_decode($userExtra->aldzn_info, true);
//修补没有serverId的数据
if (!isset($aldzn_info['serverId']) || empty($aldzn_info['serverId'])) {
......@@ -143,7 +144,7 @@ class AldUserController extends Controller
$serverId = $aldzn_info['serverId'];
$userId = $aldzn_info['userId'];
$channel = $aldzn_info['channel'];
if(!in_array($aldzn_info['channel'],config('sign.channel'))) return $this->jsonReturn(80001, '您暂未获取活动资格');
$roleList = $gmService->getRoles($serverId, $userId, $channel);
if ($roleList === false) {
......
......@@ -42,9 +42,9 @@ class ToolController extends Controller
return $this->jsonReturn(4003, "当天手机发送短信达上限");
}
$authcode = $this->genAuthCode(6);
//$authcode = $this->genAuthCode(6);
// $authcode = 666666;
$authcode = 666666;
Cache::put("sms_auth_code:" . $mobile, $authcode, $expireSeconds);
Cache::put("sms:limit_mobile:" . $mobile, 1, 60);
......@@ -53,9 +53,9 @@ class ToolController extends Controller
Cache::put("sms:limit_mobile_daily:" . $mobile . ":" . $todayDate, $mobileDayLimit +1, 3600*24);
$aliyunsms = new Aliyunsms();
$ret = $aliyunsms->send($mobile, $authcode);
// $ret = 1;
//$aliyunsms = new Aliyunsms();
//$ret = $aliyunsms->send($mobile, $authcode);
$ret = 1;
if ($ret == 1) {
return $this->jsonReturn(0, "验证码发送成功");
}else {
......
......@@ -194,7 +194,6 @@ class UtilService
public static function getIsWx($httpUserAgent)
{
return true;
if (strpos($httpUserAgent, 'MicroMessenger') !== false) {
return true;
} else {
......
......@@ -106,33 +106,35 @@ return [
'OSS_ACCESS_KEY' => 'EeXzbGCqPdpLYrnHm3FpjsSmk68NQL',
'OSS_ENDPOINT' => 'oss-cn-shanghai.aliyuncs.com',
'OSS_DOMAIN' => 'http://aldzn-img.oss-cn-shanghai.aliyuncs.com/',
'OSS_CDN' => 'http://static-card.aldzn.cn/',
'OSS_CDN' => 'https://static-card-cdn.aldzn.cn/',
'jobInco' => [
'爆裂玫瑰' => 'https://static-platform.srccwl.com/ucCard/1.png',
'爆灭者' => 'https://static-platform.srccwl.com/ucCard/2.png',
'苍穹之影' => 'https://static-platform.srccwl.com/ucCard/3.png',
'法师' => 'https://static-platform.srccwl.com/ucCard/4.png',
'飞影' => 'https://static-platform.srccwl.com/ucCard/5.png',
'光明使者' => 'https://static-platform.srccwl.com/ucCard/6.png',
'猎魔人' => 'https://static-platform.srccwl.com/ucCard/7.png',
'龙纹法师' => 'https://static-platform.srccwl.com/ucCard/8.png',
'乱舞者' => 'https://static-platform.srccwl.com/ucCard/9.png',
'秘术法师' => 'https://static-platform.srccwl.com/ucCard/10.png',
'明王' => 'https://static-platform.srccwl.com/ucCard/11.png',
'念武者' => 'https://static-platform.srccwl.com/ucCard/12.png',
'女枪手' => 'https://static-platform.srccwl.com/ucCard/13.png',
'枪手' => 'https://static-platform.srccwl.com/ucCard/14.png',
'神谕者' => 'https://static-platform.srccwl.com/ucCard/15.png',
'弑神' => 'https://static-platform.srccwl.com/ucCard/6.png',
'武斗家' => 'https://static-platform.srccwl.com/ucCard/17.png',
'武器专家' => 'https://static-platform.srccwl.com/ucCard/18.png',
'武术师' => 'https://static-platform.srccwl.com/ucCard/19.png',
'驭灵法师' => 'https://static-platform.srccwl.com/ucCard/20.png',
'战士' => 'https://static-platform.srccwl.com/ucCard/21.png',
'阵魔' => 'https://static-platform.srccwl.com/ucCard/22.png',
'爆裂玫瑰' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/1.png',
'爆灭者' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/2.png',
'苍穹之影' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/3.png',
'法师' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/4.png',
'飞影' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/5.png',
'光明使者' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/6.png',
'猎魔人' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/7.png',
'龙纹法师' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/8.png',
'乱舞者' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/9.png',
'秘术法师' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/10.png',
'明王' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/11.png',
'念武者' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/12.png',
'女枪手' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/13.png',
'枪手' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/14.png',
'神谕者' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/15.png',
'弑神' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/6.png',
'武斗家' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/17.png',
'武器专家' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/18.png',
'武术师' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/19.png',
'驭灵法师' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/20.png',
'战士' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/21.png',
'阵魔' => 'https://aldzn-ios-cdn.aldzn.cn/ucCard/images/role/22.png',
],
'WX_APPID' => 'wx2db57391553aa064',
'WX_AppSecret' => 'f6d533f6d0851c629da52cd10fab910b',
'rank' => [1=>'青铜',2=>'白银',3=>'黄金',4=>'铂金',5=>'钻石',6=>'最强王者']
];
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This image diff could not be displayed because it is too large. You can view the blob instead.
var card = {
relationRole:{},
clickFlag:true,
bindInfo:{}
bindInfo:{},
bindFlag : true
};
card.ajax = function (data, callback) {
data.data['_token'] = $('meta[name="token"]').attr("value");
......@@ -57,30 +58,30 @@ card.handleGetRoleList = function (params){
type:'POST',
data:params
},function (res){
if(res.error == 80001){
alert(res.message);
return false;
}
var data = res.data,
html = '',
sArr = [];
// data={
// 269:{
// name:'越狱-月光酒馆-打的',list:[{
// roleId:1,
// roleName:'aaaa'
// }]
// },
// 270:{
// name:'越狱aaa',list:[{
// roleId:1,
// roleName:'bbb'
// }]
// }
// }
card.relationRole = data;
for(var key in data){
sArr.push({id:key,name:data[key].name});
}
html='<option value="-1">请选择</option>'
$(sArr).each(function (index,item){
html+='<option value="'+item.id+'">'+item.name+'</option>';
var name = '';
if(item.name.indexOf('非硬核-')>-1){
name = item.name.replace('非硬核-','')
}else if(item.name.indexOf('硬核-')>-1){
name = item.name.replace('硬核-','')
}else if(item.name.indexOf('越狱-')>-1){
name = item.name.replace('越狱-','')
}else{
name = item.name
}
html+='<option value="'+item.id+'">'+name+'</option>';
})
$('.server-select').html(html);
$('.loading').hide();
......@@ -89,6 +90,7 @@ card.handleGetRoleList = function (params){
}
// 绑定角色
card.bindRole = function (params){
card.bindFlag = false;
this.ajax({
url:'/bind/ald/role',
type:'POST',
......@@ -98,7 +100,7 @@ card.bindRole = function (params){
$('.dialog').hide();
location.href='/card/html?roleId='+params.roleId+'&serverId='+params.serverId;
}else{
alert(res.msg)
alert(res.message)
}
})
}
......@@ -130,12 +132,19 @@ $(function (){
serverName:serverName,
roleName:roleName
}
if(card.clickFlag){
if(card.bindFlag){
setTimeout(function(){
card.bindFlag = true;
},3000)
card.bindRole(params);
}
});
$('.server-select').change(function (){
var serverId = $(this).val();
if(serverId == -1){
$('.role-select').html('');
return false;
}
initRoleList(serverId);
});
})
\ No newline at end of file
var card={relationRole:{},clickFlag:!0,bindInfo:{}};card.ajax=function(e,a){e.data._token=$('meta[name="token"]').attr("value"),$.ajax({type:e.type?e.type:"GET",url:location.origin+e.url,dataType:"json",data:e.data,error:function(e){try{var a=e.responseText;alert(a.message)}catch(e){alert("系统开小差~~")}},success:function(e){return 1019==e.error?(location.href="/login",!1):4003==e.error?(location.href="/bind/ald/code",!1):void a(e)}}),setTimeout(function(){card.clickFlag=!0},1e3)},card.handleGetServer=function(e){$(".loading").show(),this.ajax({url:"/ald_bind_info",type:"get",data:{}},function(e){card.bindInfo=e.data;var a={serverId:e.data.serverId,userId:e.data.userId};card.handleGetRoleList(a)})},card.handleGetRoleList=function(e){this.ajax({url:"/get_role_list",type:"POST",data:e},function(e){var a=e.data,t="",r=[];card.relationRole=a;for(var o in a)r.push({id:o,name:a[o].name});t='<option value="-1">请选择</option>',$(r).each(function(e,a){t+='<option value="'+a.id+'">'+a.name+"</option>"}),$(".server-select").html(t),$(".loading").hide(),$(".dialog-server").fadeIn()})},card.bindRole=function(e){this.ajax({url:"/bind/ald/role",type:"POST",data:e},function(a){0===a.error?($(".dialog").hide(),location.href="/card/html?roleId="+e.roleId+"&serverId="+e.serverId):alert(a.msg)})};var initRoleList=function(e){var a=card.relationRole[e].list,t='<option value="-1">请选择</option>';$(a).each(function(e,a){t+='<option value="'+a.roleId+'">'+a.roleName+"</option>"}),$(".role-select").html(t)};$(function(){$(".btn-card-bind-role").click(function(){var e=$(".server-select option:selected").val(),a=$(".server-select option:selected").text(),t=$(".role-select option:selected").val();if(roleName=$(".role-select option:selected").text(),!e||"-1"==e)return alert("请选择服务器"),!1;if(!t||"-1"==t)return alert("请选择角色"),!1;var r={roleId:t,serverId:e,serverName:a,roleName:roleName};card.clickFlag&&card.bindRole(r)}),$(".server-select").change(function(){var e=$(this).val();initRoleList(e)})});
\ No newline at end of file
var card={relationRole:{},clickFlag:!0,bindInfo:{},bindFlag:!0};card.ajax=function(e,a){e.data._token=$('meta[name="token"]').attr("value"),$.ajax({type:e.type?e.type:"GET",url:location.origin+e.url,dataType:"json",data:e.data,error:function(e){try{var a=e.responseText;alert(a.message)}catch(e){alert("系统开小差~~")}},success:function(e){return 1019==e.error?(location.href="/login",!1):4003==e.error?(location.href="/bind/ald/code",!1):void a(e)}}),setTimeout(function(){card.clickFlag=!0},1e3)},card.handleGetServer=function(e){$(".loading").show(),this.ajax({url:"/ald_bind_info",type:"get",data:{}},function(e){card.bindInfo=e.data;var a={serverId:e.data.serverId,userId:e.data.userId};card.handleGetRoleList(a)})},card.handleGetRoleList=function(e){this.ajax({url:"/get_role_list",type:"POST",data:e},function(e){if(80001==e.error)return alert(e.message),!1;var a=e.data,r="",t=[];card.relationRole=a;for(var n in a)t.push({id:n,name:a[n].name});r='<option value="-1">请选择</option>',$(t).each(function(e,a){var t="";t=a.name.indexOf("非硬核-")>-1?a.name.replace("非硬核-",""):a.name.indexOf("硬核-")>-1?a.name.replace("硬核-",""):a.name.indexOf("越狱-")>-1?a.name.replace("越狱-",""):a.name,r+='<option value="'+a.id+'">'+t+"</option>"}),$(".server-select").html(r),$(".loading").hide(),$(".dialog-server").fadeIn()})},card.bindRole=function(e){card.bindFlag=!1,this.ajax({url:"/bind/ald/role",type:"POST",data:e},function(a){0===a.error?($(".dialog").hide(),location.href="/card/html?roleId="+e.roleId+"&serverId="+e.serverId):alert(a.message)})};var initRoleList=function(e){var a=card.relationRole[e].list,r='<option value="-1">请选择</option>';$(a).each(function(e,a){r+='<option value="'+a.roleId+'">'+a.roleName+"</option>"}),$(".role-select").html(r)};$(function(){$(".btn-card-bind-role").click(function(){var e=$(".server-select option:selected").val(),a=$(".server-select option:selected").text(),r=$(".role-select option:selected").val();if(roleName=$(".role-select option:selected").text(),!e||"-1"==e)return alert("请选择服务器"),!1;if(!r||"-1"==r)return alert("请选择角色"),!1;var t={roleId:r,serverId:e,serverName:a,roleName:roleName};card.bindFlag&&(setTimeout(function(){card.bindFlag=!0},3e3),card.bindRole(t))}),$(".server-select").change(function(){var e=$(this).val();if(-1==e)return $(".role-select").html(""),!1;initRoleList(e)})});
\ No newline at end of file
......@@ -21,9 +21,10 @@
</div>
<div class="col-lg-2">
<select class="form-control" name="status" >
<option value="0" @if(@$SEARCH['status'] == 0) selected="selected" @endif>待审核</option>
<option value="1" @if(@$SEARCH['status'] == 1) selected="selected" @endif>审核通过</option>
<option value="2" @if(@$SEARCH['status'] == 2) selected="selected" @endif>审核拒绝</option>
<option value="0" @if(@$SEARCH['status'] == 0) selected="selected" @endif>全部</option>
<option value="1" @if(@$SEARCH['status'] == 1) selected="selected" @endif>待审核</option>
<option value="2" @if(@$SEARCH['status'] == 2) selected="selected" @endif>审核通过</option>
<option value="3" @if(@$SEARCH['status'] == 3) selected="selected" @endif>审核拒绝</option>
</select>
</div>
<div class="col-lg-2">
......@@ -39,6 +40,7 @@
<table id="basic-table2" class="data-table table table-striped nowrap table-hover" cellspacing="0" width="100%">
<thead>
<tr>
<th>操作 <input type="checkbox" value="all" onclick="return imgCheck(this);"/><label class="ml-sm">全选</label><button type="button" class="btn btn-success" onclick="return setAllStatus();">审核</button></th>
<th>编号</th>
<th>用户名</th>
<th>审核</th>
......@@ -51,11 +53,14 @@
<tbody>
@foreach($LIST as $li)
<tr>
<td> <input type="checkbox" name="ids[]" value="{{ $li->id }}" class="imgIDCheckbox" /></td>
<td>{{ @$li->id }}</td>
<td>{{ $USER_INFO[$li->uid] ?? '' }}</td>
<td>
@if($li->status == 0)
<button type="button" class="btn btn-success" onclick="return setStatus({{ $li->id }});">审核</button>
@else
<button type="button" class="btn btn-success" onclick="return setStatus({{ $li->id }});">重新审核</button>
@endif
<td>
@if($li->status == 0) 待审核 @endif
......@@ -88,19 +93,121 @@
<script src="/html/javascripts/My97DatePicker/WdatePicker.js"></script>
@include('admin.common.foot')
<script>
function setAllStatus(){
$('#ALL_VERITY').modal('show')
}
function saveStatusAll(){
var ids = '';
var box =document.getElementsByClassName('imgIDCheckbox');
for (i=0; i< box.length; i++){
if(box[i].checked){
if(ids == ''){
ids = box[i].value;
}else{
ids = ids + '#'+box[i].value;
}
}
}
if(ids == ''){
alert('请选择渠道');
return false;
}
var token = $("input[name='_token']").val();
var status = $("input:radio[name='imgStatusAll']:checked").val();
$('#change_status_all').attr("disabled",true);
$('#cancel_change_status_all').attr("disabled",true);
if(status == 2){
$('#ALL_VERITY').modal('hide');
$('#CONFIRM_ALL').modal('show');
}else{
$.ajax({
type: 'POST',
url: '/admin/save/status/all',
data: {_token:token,ids:ids,status:status},
success:function(data){
$('#show_error_info').html(data.info);
$('#show_success_info').html(data.info);
$('#change_status_all').attr("disabled",false);
$('#cancel_change_status_all').attr("disabled",false);
$('#ALL_VERITY').modal('hide')
if(data.code == 200){
$('#message-success-modal').modal('show')
}else{
$("#message-error-modal").modal('show');
}
}
});
}
}
function saveStatusAllCir(){
var ids = '';
var box =document.getElementsByClassName('imgIDCheckbox');
for (i=0; i< box.length; i++){
if(box[i].checked){
if(ids == ''){
ids = box[i].value;
}else{
ids = ids + '#'+box[i].value;
}
}
}
var token = $("input[name='_token']").val();
var status = $("input:radio[name='imgStatusAll']:checked").val();
$('#change_status_all_cir').attr("disabled",true);
$('#caacel_change_status_all_cir').attr("disabled",true);
$.ajax({
type: 'POST',
url: '/admin/save/status/all',
data: {_token:token,ids:ids,status:status},
success:function(data){
$('#show_error_info').html(data.info);
$('#show_success_info').html(data.info);
$('#change_status_all_cir').attr("disabled",false);
$('#caacel_change_status_all_cir').attr("disabled",false);
$('#CONFIRM_ALL').modal('hide')
if(data.code == 200){
$('#message-success-modal').modal('show')
}else{
$("#message-error-modal").modal('show');
}
}
});
}
function imgCheck(obj){
var box =document.getElementsByClassName('imgIDCheckbox');
for (i=0; i< box.length; i++){
if(obj.checked){
box[i].checked = true;
}else{
box[i].checked = false;
}
}
}
function setStatus(id){
$('#img_id').val(id);
$('#VERITY').modal('show')
}
function saveStatus(){
function saveStatusCir()
{
var id = $('#img_id').val();
var token = $("input[name='_token']").val();
var status = $("input:radio[name='imgStatus']:checked").val();
var status = 2;
$('#change_status').attr("disabled",true);
$('#cancel_change_status').attr("disabled",true);
$.ajax({
type: 'POST',
url: '/admin/save/status',
......@@ -112,7 +219,7 @@
$('#change_status').attr("disabled",false);
$('#cancel_change_status').attr("disabled",false);
$('#VERITY').modal('hide')
$('#CONFIRM').modal('hide')
if(data.code == 200){
$('#message-success-modal').modal('show')
}else{
......@@ -122,6 +229,39 @@
});
}
function saveStatus(){
var id = $('#img_id').val();
var token = $("input[name='_token']").val();
var status = $("input:radio[name='imgStatus']:checked").val();
$('#change_status').attr("disabled",true);
$('#cancel_change_status').attr("disabled",true);
if(status == 2){
$('#VERITY').modal('hide');
$('#CONFIRM').modal('show');
}else{
$.ajax({
type: 'POST',
url: '/admin/save/status',
data: {_token:token,id:id,status:status},
success:function(data){
$('#show_error_info').html(data.info);
$('#show_success_info').html(data.info);
$('#change_status').attr("disabled",false);
$('#cancel_change_status').attr("disabled",false);
$('#VERITY').modal('hide')
if(data.code == 200){
$('#message-success-modal').modal('show')
}else{
$("#message-error-modal").modal('show');
}
}
});
}
}
function showImg(img)
{
$('#showImg').attr('src',img);
......
......@@ -46,4 +46,64 @@
</div>
</div>
<div class="modal fade" id="CONFIRM" tabindex="-1" role="dialog" aria-labelledby="modal-error-label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header state modal-danger">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-error-label"><i class="fa fa-warning"></i>确认框</h4>
</div>
<div class="modal-body" id="change_info">确认拒绝?</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" onclick="return saveStatusCir();" id="change_status">确认</button>
<button type="button" class="btn btn-default" onclick="return cir_cancel('CONFIRM');" id="cancel_change_status">取消</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="ALL_VERITY" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">审核图片</h4>
</div>
<div class="modal-body">
<div class="panel-content">
<div class="row">
<div class="form-group col-lg-12">
<h6>审核状态</h6>
<input type="radio" value="1" name="imgStatusAll" checked="checked"/><label class="ml-sm">通过</label>
<input type="radio" value="2" name="imgStatusAll"/><label class="ml-sm">拒绝</label>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary active" id="change_status_all" onclick="return saveStatusAll();">提交</button>
<button type="button" class="btn btn-default active" id="cancel_change_status_all" onclick="return cir_cancel('ALL_VERITY');">关闭</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="CONFIRM_ALL" tabindex="-1" role="dialog" aria-labelledby="modal-error-label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header state modal-danger">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-error-label"><i class="fa fa-warning"></i>确认框</h4>
</div>
<div class="modal-body" id="change_info">确认拒绝?</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" onclick="return saveStatusAllCir();" id="change_status_all_cir">确认</button>
<button type="button" class="btn btn-default" onclick="return cir_cancel('CONFIRM_ALL');" id="caacel_change_status_all_cir">取消</button>
</div>
</div>
</div>
</div>
......@@ -23,15 +23,15 @@
alert(e)
}
</script>
<link rel="stylesheet" href="{{ asset('postcard/css/style.css') }}">
<link rel="stylesheet" href="{{ asset('postcard/css/style.css?v=20210607') }}">
<script src="{{ asset('js/jquery.2.1.3.min.js') }}"></script>
<script src="{{ asset('postcard/js/html2canvas.js') }}"></script>
</head>
<body>
<div class="container postcard-container" id="test">
{{-- <div class="login-info">--}}
{{-- 欢迎您,<a href="/login">【登录】</a><a href="/loginout">【注销】</a>--}}
{{-- </div>--}}
<div class="login-info">
欢迎您,{{ $userName }}<a href="/logout">【注销】</a>
</div>
<!--角色信息-->
<div class="role-container">
<span class="icon-red"></span>
......@@ -46,7 +46,7 @@
</div>
<ul>
<li class="role1"><span>{{ $info->role_name ?? '' }}</span></li>
<li class="role2"><span>{{ $info->server_name ?? '' }}</span></li>
<li class="role2"><span>{{ $serverName }}</span></li>
</ul>
</div>
<div class="right">
......@@ -77,12 +77,27 @@
<!--武器信息-->
<div class="arms-container">
<div class="arms">
<em class="name1">{{ $armsStrongName }}</em>
<div id="wq1"></div>
<em class="name2">{{ $armsExcitingName }}</em>
<div id="wq2"></div>
<em class="name3">{{ $armsScoreName }}</em>
<div id="wq3"></div>
<div class="left">
<li><span>武器名</span><em>{{ $armsStrongName }}</em></li>
<li><span>武器名</span><em>{{ $armsExcitingName }}</em></li>
<li><span>武器名</span><em>{{ $armsScoreName }}</em></li>
</div>
<div class="right">
<ul>
<li>
<em>当前武器最高强化等级</em>
<div id="wq1"></div>
</li>
<li>
<em>当前武器最高激化等级</em>
<div id="wq2"></div>
</li>
<li>
<em>当前武器最高评分</em>
<div id="wq3"></div>
</li>
</ul>
</div>
</div>
</div>
<!--佣兵团信息-->
......@@ -114,12 +129,18 @@
<!--高光时刻-->
<div class="ggsk-container">
@if($userImgStatus == -1) <img src="{{ asset('postcard/images/img_add.jpg') }}" class="img img-add" alt="">
<input type="file" id="file"> @endif
@if($userImgStatus == 0) <img src="{{ asset('postcard/images/img_sh.jpg') }}" class="img img-sh" alt=""> @endif
@if($userImgStatus == 1) <img src="{{ $userImg }}" class="img img-sh" alt=""> @endif
@if($userImgStatus == 2) <img src="{{ asset('postcard/images/sh_fail.jpg') }}" class="img img-sh" alt="">
<input type="file" id="file"> @endif
<div class="img-container">
@if($userImgStatus == -1) <img src="{{ asset('postcard/images/img_add.jpg') }}" class="img img-add" alt="">
<input type="file" id="file" accept="image/jpg, image/jpeg, image/png"> @endif
@if($userImgStatus == 0) <img src="{{ asset('postcard/images/img_sh.jpg') }}" class="img img-sh" alt=""> @endif
@if($userImgStatus == 1) <img src="{{ $userImg }}" class="img img-sh" alt=""> @endif
@if($userImgStatus == 2) <img src="{{ asset('postcard/images/sh_fail.jpg') }}" class="img img-sh" alt="">
<input type="file" id="file" accept="image/jpg, image/jpeg, image/png"> @endif
</div>
@if($userImgStatus != 1)
<span>建议尺寸(710*414px)jpg,jpeg,png</span>
@endif
</div>
<div class="bottom-container">
<!--分享-->
......@@ -150,6 +171,19 @@
<script>
$(function () {
var isWeixin = function () {
//判断是否是微信
var ua = navigator.userAgent.toLowerCase();
return ua.match(/MicroMessenger/i) == "micromessenger";
};
function getQueryString(name) {
let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
let r = window.location.search.substr(1).match(reg);
if (r != null) {
return decodeURIComponent(r[2]);
}
return null;
}
function renderHtml(dom, num) {
var str = num.toString();
var arr = str.split("");
......@@ -159,11 +193,10 @@
})
$(dom).html(html);
}
@if($info->online_time > 0)
renderHtml('#bNum',{{ ceil($info->online_time / 86400 ) }});
@if($info->register_time != '')
renderHtml('#bNum',{{ ceil((strtotime(date('Y-m-d H:i:s')) - strtotime($info->register_time)) / 86400 ) }});
@else
renderHtml('#bNum', 0);
renderHtml('#bNum', 0);
@endif
renderHtml('#rangeNums', '{{ (string)$roleScore }}');
renderHtml('#wq1', '{{ $armsStrong }}');
......@@ -174,17 +207,25 @@
var formData = new FormData();
var file = $("#file")[0].files[0];
var acceptFileTypes = /^image\/(gif|jpe?g|png)$/i;
//文件类型判断
if (file.type.length && !acceptFileTypes.test(file.type)) {
alert('请上传gif、jpg、jpeg或png格式的文件');
return false;
}
//文件大小判断
if (file.size > (2 * 1024 * 1024)) {
alert('请上传不超过2M的文件');
return false;
var roleId = getQueryString('roleId');
var serverId = getQueryString('serverId');
try{
// //文件类型判断
if (file && file.type && !acceptFileTypes.test(file.type)) {
alert('请上传jpg、jpeg或png格式的文件');
return false;
}
//文件大小判断
if (file && file.size > (2 * 1024 * 1024)) {
alert('请上传不超过2M的文件');
return false;
}
}catch (e) {
console.log(e)
}
formData.append("imgFile", file);
formData.append("roleId", roleId);
formData.append("serverId", serverId);
formData.append("_token", "{{ csrf_token() }}")
$.ajax({
url: "/upload/img",
......@@ -196,7 +237,7 @@
dataType: "json",
success: function (data) {
$('.img-add').hide();
$('.ggsk-container').html('<img src="{{ asset('postcard/images/img_sh.jpg') }}" class="img img-sh" alt=""><input type="file" id="file">');
$('.img-container').html('<img src="{{ asset('postcard/images/img_sh.jpg') }}" class="img img-sh" alt="">');
},
error: function (data) {
......@@ -207,13 +248,14 @@
function baseImageUrl() {
setTimeout(function () {
html2canvas(document.querySelector("#test"), { //关键在于new
useCORS: true,
removeContainer: true,
allowTaint: false,
width: window.screen.availWidth,
windowWidth: document.body.scrollWidth,
x: 0,
y: 0,
useCORS: true,
logging:true
}).then(canvas => {
var image = canvas.toDataURL('image/jpeg', 1.0);
var img = '<img src="' + image + '">';
......@@ -226,28 +268,29 @@
}
$('.btn-save').click(function () {
var height = $('.postcard-container').height();
$('.postcard-container').height(height);
$('.loading').show();
$('.btn-save,.btn-share').hide();
$('.btn-save,.btn-share,.login-info').hide();
$('html,body').animate({
scrollTop: 0
}, 0);
baseImageUrl();
$('.postcard-container').addClass('fixed');
});
$('.dialog-img,.share-img').click(function () {
$(this).fadeOut();
$('.btn-save,.btn-share').show();
$('.btn-save,.btn-share,.login-info').show();
$('.postcard-container').removeClass('fixed');
});
$('.btn-share').click(function () {
$('.share-img').show();
if(isWeixin()){
$('.share-img').show();
}
});
var isWeixin = function () {
//判断是否是微信
var ua = navigator.userAgent.toLowerCase();
return ua.match(/MicroMessenger/i) == "micromessenger";
};
function _wechatConfig(o) {
wx.config({
......@@ -318,7 +361,7 @@
var title = '阿拉德之怒',
link = 'http://uc-card.aldzn.cn',
img = "http://uc-card.aldzn.cn/static/postcard/images/default_img.png",
desc = "阿拉德之怒";
desc = "阿拉德之怒-明信片";
wx_share(title,link,img,desc);
});
......
......@@ -19,15 +19,17 @@
reSizeRem();
}
</script>
<link rel="stylesheet" href="{{ asset('postcard/css/style.css') }}">
<link rel="stylesheet" href="{{ asset('postcard/css/style.css?v=20210607') }}">
<script src="{{ asset('js/jquery.2.1.3.min.js') }}"></script>
<script src="{{ asset('postcard/js/main.js') }}"></script>
<script src="{{ asset('postcard/js/main.js?v=20210607') }}"></script>
</head>
<body>
<div class="container home-container">
{{-- <div class="login-info">--}}
{{-- 欢迎您,<a href="/login">【登录】</a><a href="/loginout">【注销】</a>--}}
{{-- </div>--}}
<div class="login-info">
欢迎您,
@if($isLogin == 1) {{ $userName }} <a href="/logout">【注销】</a> @endif
@if($isLogin == 0) <a href="/login">【登录】</a> @endif
</div>
<div class="header-avatar">
<span></span>
<img src="{{ asset('postcard/images/default_img.png') }}" alt="">
......@@ -62,6 +64,7 @@
<script>
$(function(){
$('.close').click(function (){
$('select').html('');
$('.dialog').fadeOut();
});
$('.btn-start').click(function (){
......@@ -142,7 +145,7 @@
var title = '阿拉德之怒',
link = 'http://uc-card.aldzn.cn',
img = "http://uc-card.aldzn.cn/static/postcard/images/default_img.png",
desc = "阿拉德之怒";
desc = "阿拉德之怒-明信片";
wx_share(title,link,img,desc);
});
......
......@@ -21,7 +21,7 @@
</script>
<script src="{{ asset('js/jquery.2.1.3.min.js') }}"></script>
<script src="{{ asset('js/toast.js') }}"></script>
<script src="{{ asset('js/main.min.js?v=20210528') }}"></script>
<script src="{{ asset('js/main.min.js?v=20210607') }}"></script>
</head>
<body>
@yield("content")
......
......@@ -33,6 +33,7 @@ Route::prefix('admin')->namespace('Admin')->group(function() {
Route::prefix('admin')->namespace('Admin')->middleware('check.adminLogin')->group(function() {
Route::get('/image/list', 'AdminController@getImgList')->name('checkImg');
Route::post('/save/status', 'AdminController@getSaveStatus');
Route::post('/save/status/all', 'AdminController@getSaveStatusAll');
});
......@@ -55,6 +56,7 @@ Route::namespace('Platform')->group(function() {
});
Route::namespace('Platform')->middleware('check.login')->group(function () {
Route::get('/logout', 'UserController@logout')->name('logout');
Route::post('/user/bind_aldzn', 'UserController@bindALD');
Route::any('/get_role_list', 'AldUserController@getRoleList');
Route::post('/send_role_gift', 'AldUserController@sendRoleGift');
......
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