工会web
This commit is contained in:
91
GonghuiWeb/www/dh/song.php
Normal file
91
GonghuiWeb/www/dh/song.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
//ini_set("display_errors", "On");
|
||||
include_once("../../inc/class.php");
|
||||
include_once("../../inc/admin.smarty.php");
|
||||
include_once("../../inc/virtual.php");
|
||||
$db = new myConn;
|
||||
$db->links();
|
||||
$GG=$db->getpost($GG);
|
||||
if($GG['gid'] && $GG['hdid']){
|
||||
$hdata = $db->fetch_one("select * from HuoDong where Hdid='".$GG['hdid']."'");
|
||||
if($hdata){
|
||||
$jp_arr = explode(",",$hdata['HPrize']);
|
||||
$hdy_arr = explode(",",$hdata['Htime']);
|
||||
$jssj = $hdy_arr[(count($hdy_arr)-1)];
|
||||
if(date('Y-m') > $jssj){
|
||||
foreach($hdy_arr as $k => $v){
|
||||
$where .= $where ? " or month='".$v."'" : " month='".$v."'";
|
||||
$use = $db->fetch_all("select top 500 *,(Hit-(Niu-Niu/4)-(Ss-Ss/3)-(Zjh-Zjh/3)) as Pm from CountJf where month='".$v."' order by Pm desc");
|
||||
foreach($use as $ka => $va){
|
||||
$user_pp[$va['UserID']] += $va['Pm'];
|
||||
}
|
||||
}
|
||||
arsort($user_pp);
|
||||
$i = 1;
|
||||
foreach($user_pp as $ka => $va){
|
||||
if($i <=count($jp_arr)){
|
||||
$user[$ka]=$va;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$info = $db->fetch_all("select a.UserID,a.GameID,a.NickName,a.Gender,b.HeadHttp,c.Grade from AccountsInfo as a LEFT JOIN IndividualDatum as b ON(a.UserID=b.UserID) LEFT JOIN QPTreasureDB.dbo.GameScoreInfo AS c ON(a.UserID=c.UserID) where a.UserID in (".implode(',',array_keys($user)).") ");
|
||||
foreach($info as $kb => $vb){
|
||||
$info[$kb]['Pm'] = $user[$vb['UserID']];
|
||||
$info[$kb]['HeadHttp'] = $info[$kb]['HeadHttp'];
|
||||
}
|
||||
//虚拟人物 配置
|
||||
foreach($vdata as $k => $v){
|
||||
$xnjs = 0;
|
||||
foreach($hdy_arr as $ka => $va){
|
||||
$xnjs_ar = vmdate($vdata[$k],$va);
|
||||
$xnjs += ($xnjs_ar['data']['Mj']+$xnjs_ar['data']['Ddz']+$xnjs_ar['data']['Dz']+intval($xnjs_ar['data']['niu']/4));
|
||||
}
|
||||
$xninfo[]=[
|
||||
'NickName' => $v['name'],
|
||||
'Gender' => $v['sex'],
|
||||
'Grade' => vmdata($vdata[$k]),
|
||||
'Pm' => $xnjs,
|
||||
'HeadHttp' => $v['tx']
|
||||
];
|
||||
}
|
||||
$uss = array_merge($xninfo,$info);
|
||||
$data = arraySequence($uss,'Pm');
|
||||
foreach($data as $k => $v){
|
||||
$dat[$v['GameID']] = [
|
||||
'key' => $k,
|
||||
'yuanbao' => $jp_arr[$k],
|
||||
'userid' => $v['UserID']
|
||||
];
|
||||
}
|
||||
$userid = $dat[$GG['gid']]['userid'];
|
||||
$yuanbao = intval($dat[$GG['gid']]['yuanbao']);
|
||||
//判断是否领取
|
||||
$is = $db->fetch_one("select * from HuoDongLog where Hdid='".$GG['hdid']."' and UserID='".$userid."'");
|
||||
if($yuanbao && !$is){
|
||||
$jfs = $db->fetch_one("select * from QPTreasureDB.dbo.GameScoreInfo where UserID='".$userid."'");
|
||||
$db->update("QPTreasureDB.dbo.GameScoreInfo",['YuanBao'=>$jfs['YuanBao']+$yuanbao],"UserID='".$userid."'");
|
||||
//记录日志
|
||||
$db->insert("YuanBaoLog",['Types'=>'month','UserID'=>$userid,'QYuanBao'=>$jfs['YuanBao'],'YuanBao'=>$yuanbao]);
|
||||
$db->insert("HuoDongLog",['UserID'=>$userid,'Hdid'=>$GG['hdid'],'QYuanBao'=>$jfs['YuanBao'],'YuanBao'=>$yuanbao,'Ranking'=>$dat[$GG['gid']]['key']]);
|
||||
//记录元宝日志
|
||||
$ybd = $db->fetch_one("select * from YuanBaoDay where Day='".date('Y-m-d')."'");
|
||||
if($ybd){
|
||||
$db->update('YuanBaoDay',['YuanBao'=>$ybd['YuanBao']+$yuanbao,'Month'=>$ybd['Month']+$yuanbao],"YbdID='".$ybd['YbdID']."'");
|
||||
}else{
|
||||
$db->insert("YuanBaoDay",['Day'=>date('Y-m-d'),'YuanBao'=>$yuanbao,'Month'=>$yuanbao]);
|
||||
}
|
||||
echo json_encode(["yuanbao"=>$yuanbao]);
|
||||
}else{
|
||||
echo json_encode(['error'=>'error']);
|
||||
}
|
||||
}else{
|
||||
echo json_encode(['error'=>'error']);
|
||||
}
|
||||
}else{
|
||||
echo json_encode(['error'=>'error']);
|
||||
}
|
||||
}else{
|
||||
echo json_encode(['error'=>'error']);
|
||||
}
|
||||
unset($GG,$ppxq);
|
||||
?>
|
||||
Reference in New Issue
Block a user