工会web
This commit is contained in:
49
GonghuiWeb/www/dh/dh.php
Normal file
49
GonghuiWeb/www/dh/dh.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
include_once("../../inc/class.php");
|
||||
include_once("../../inc/admin.smarty.php");
|
||||
$db = new myConn;
|
||||
$db->links();
|
||||
$GG=$db->getpost($GG);
|
||||
if($GG['sid'] && $GG['gameid']){
|
||||
$info = $db->fetch_one("select * from Shop where ShopID='".$GG['sid']."'");
|
||||
$userinfo = $db->fetch_one("select a.UserID,a.GameID,a.NickName,c.ConsumeScore,c.InsureScore,c.PlayCount,c.YuanBao from AccountsInfo as a LEFT JOIN QPTreasureDB.dbo.GameScoreInfo AS c ON(a.UserID=c.UserID) where a.GameID='".$GG['gameid']."'");
|
||||
if($userinfo && $info){
|
||||
if($userinfo['YuanBao'] >= $info['YuanBao']){
|
||||
//修改元宝
|
||||
if($info['ShopType'] == 'fk'){
|
||||
$save['InsureScore'] = $userinfo['InsureScore']+$info['ShopHit'];//房卡
|
||||
}
|
||||
$save['YuanBao'] = $userinfo['YuanBao']-$info['YuanBao'];//扣除元宝
|
||||
$db->update('QPTreasureDB.dbo.GameScoreInfo',$save,"UserID='".$userinfo['UserID']."'");
|
||||
//创建日志
|
||||
$savelog = [
|
||||
'ShopID'=>$info['ShopID'],
|
||||
'UserID'=>$userinfo['UserID'],
|
||||
'QYuanBao'=>$userinfo['YuanBao'],
|
||||
'YuanBao'=>$info['YuanBao']
|
||||
];
|
||||
if($info['ShopType'] == 'fk'){
|
||||
$savelog['ShopLogCheck'] = 1;
|
||||
echo "领取房卡成功!<br>请退出游戏,自动领取!";
|
||||
}else{
|
||||
echo "扣除元宝成功!<br>请联系客服领取!";
|
||||
}
|
||||
$db->insert("ShopLog",$savelog);
|
||||
//记录元宝日志
|
||||
$ybd = $db->fetch_one("select * from YuanBaoDay where Day='".date('Y-m-d')."'");
|
||||
if($ybd){
|
||||
$db->update('YuanBaoDay',['XYuanBao'=>$ybd['XYuanBao']+$info['YuanBao']],"YbdID='".$ybd['YbdID']."'");
|
||||
}else{
|
||||
$db->insert("YuanBaoDay",['Day'=>date('Y-m-d'),'XYuanBao'=>$info['YuanBao']]);
|
||||
}
|
||||
}else{
|
||||
echo "您的元宝不够!";
|
||||
}
|
||||
}else{
|
||||
echo "用户错误!";
|
||||
}
|
||||
}else{
|
||||
echo "参数错误!";
|
||||
}
|
||||
unset($GG,$ppxq);
|
||||
?>
|
||||
354
GonghuiWeb/www/dh/index.php
Normal file
354
GonghuiWeb/www/dh/index.php
Normal file
@@ -0,0 +1,354 @@
|
||||
<?php
|
||||
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);
|
||||
$md5 = md5("wn".date('Ym')."mj".$GG['gameid']);
|
||||
if($md5 != $GG['md5']){
|
||||
echo "Error";
|
||||
exit;
|
||||
}
|
||||
$ppxq -> register_function('timename','timename');
|
||||
$ppxq -> assign('GG',$GG);
|
||||
$ppxq -> assign('GradeArr',$GradeArr);
|
||||
$ppxq -> assign('userinfo',$userinfo = $db->fetch_one("select a.UserID,a.GameID,a.NickName,a.SpreaderID,c.ConsumeScore,c.InsureScore,c.PlayCount,c.Grade,c.YuanBao,c.LotteryGame from AccountsInfo as a LEFT JOIN QPTreasureDB.dbo.GameScoreInfo AS c ON(a.UserID=c.UserID) where a.GameID='".$GG['gameid']."'"));
|
||||
if($userinfo['Grade']<100){
|
||||
$mda = 'wn'.date('Ym').'mj'.$GG['gameid'];
|
||||
echo "Upgrades...<br>";
|
||||
exit;
|
||||
}
|
||||
if($GG['ty'] == 'main'){//兑换页面
|
||||
$ppxq -> assign('info',$db->fetch_all("select * from Shop order by ShopSort desc,ShopID asc"));
|
||||
$ppxq -> assign('log',$db->fetch_all("select top 20 convert(char,a.ShopLogTime,120) as Date,b.NickName,c.ShopTitle from ShopLog as a LEFT JOIN AccountsInfo AS b ON(a.UserID=b.UserID) LEFT JOIN Shop AS c ON(a.ShopID=c.ShopID) where a.ShopID>4 and a.YuanBao>0 order by ShopLogID desc"));
|
||||
$ppxq -> display('dh/main.tpl');
|
||||
}elseif($GG['ty'] == 'cj'){//抽奖
|
||||
$zt = date("Y-m-d",time()-86400);
|
||||
$count = $db->fetch_one("select * from YuanBaoDay where Day='".$zt."'");
|
||||
$ppxq -> assign('log',$db->fetch_all("select top 50 convert(char,a.LoTime,120) as Date,a.Types,a.YuanBao,b.NickName from YuanBaoLog as a LEFT JOIN AccountsInfo AS b ON(a.UserID=b.UserID) order by YbID desc"));
|
||||
$ppxq -> assign('logs',$db->fetch_all("select top 3 convert(char,a.LoTime,120) as Date,a.Types,a.YuanBao,b.NickName from YuanBaoLog as a LEFT JOIN AccountsInfo AS b ON(a.UserID=b.UserID) where (Types='lottery' or Types='day' or Types='month') and YuanBao>'49' order by YbID desc"));
|
||||
$ppxq -> assign('count',$count['YuanBao']*8);
|
||||
$ppxq -> display('dh/cj.tpl');
|
||||
}elseif($GG['ty'] == 'day'){//日排行
|
||||
for($i=0;$i<3;$i++){
|
||||
$day[] = date('Y-m-d',strtotime("-".$i." day"));
|
||||
}
|
||||
for($i=0;$i<2;$i++){
|
||||
$month[] = date('Y-m',strtotime("-".$i." month"));
|
||||
}
|
||||
if($GG['time']){
|
||||
$type_num = explode("-",$GG['time']);
|
||||
if(count($type_num) == 2){
|
||||
if(in_array($GG['time'],$month)){
|
||||
$time = $GG['time'];
|
||||
$time_type = 'month';
|
||||
}
|
||||
}else{
|
||||
if(in_array($GG['time'],$day)){
|
||||
$time = $GG['time'];
|
||||
$time_type = 'day';
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$time || !$time_type){
|
||||
$time = date('Y-m-d');
|
||||
$time_type = 'day';
|
||||
}
|
||||
if($GG['sort'] == 'mj'){
|
||||
$order = "Mj";
|
||||
}elseif($GG['sort'] == 'ddz'){
|
||||
$order = "Ddz";
|
||||
}elseif($GG['sort'] == 'nn'){
|
||||
$order = "Niu";
|
||||
}elseif($GG['sort'] == 'pdk'){
|
||||
$order = "Pdk";
|
||||
}elseif($GG['sort'] == 'dz'){
|
||||
$order = "Dz";
|
||||
}elseif($GG['sort'] == 'ss'){
|
||||
$order = "Ss";
|
||||
}elseif($GG['sort'] == 'zjh'){
|
||||
$order = "Zjh";
|
||||
}else{
|
||||
$order = "Pm";
|
||||
}
|
||||
if($time_type == 'month'){
|
||||
$dat = $db->fetch_all("select top 30 a.*,b.GameID,b.NickName,c.HeadHttp,(a.Hit-(a.Niu-a.Niu/4)-(a.Ss-a.Ss/3)-(a.Zjh-a.Zjh/3)) as Pm from CountJf as a LEFT JOIN AccountsInfo AS b ON(a.UserID=b.UserID) LEFT JOIN IndividualDatum as c ON(a.UserID=c.UserID) WHERE Month='".$time."' order by ".$order." desc");
|
||||
}else{
|
||||
$dat = $db->fetch_all("select top 30 a.*,b.GameID,b.NickName,c.HeadHttp,(a.Hit-(a.Niu-a.Niu/4)-(a.Ss-a.Ss/3)-(a.Zjh-a.Zjh/3)) as Pm from CountUserJf as a LEFT JOIN AccountsInfo AS b ON(a.UserID=b.UserID) LEFT JOIN IndividualDatum as c ON(a.UserID=c.UserID) WHERE Days='".$time."' order by ".$order." desc");
|
||||
}
|
||||
foreach($dat as $ka => $va){
|
||||
$dat[$ka]['HeadHttp'] = $dat[$ka]['HeadHttp'];
|
||||
}
|
||||
//虚拟人物
|
||||
foreach($vdata as $k => $v){
|
||||
$xnjs_ar = vmdate($vdata[$k],$time);
|
||||
$xnda[]=[
|
||||
'NickName' => $v['name'],
|
||||
'Mj' => $xnjs_ar['data']['Mj'],
|
||||
'Ddz' => $xnjs_ar['data']['Ddz'],
|
||||
'Niu' => $xnjs_ar['data']['Niu'],
|
||||
'Dz' => $xnjs_ar['data']['Dz'],
|
||||
'Ss' => $xnjs_ar['data']['Ss'],
|
||||
'Zjh' => $xnjs_ar['data']['Zjh'],
|
||||
'Pdk' => $xnjs_ar['data']['Pdk'],
|
||||
'Pm' => ($xnjs_ar['data']['Mj']+$xnjs_ar['data']['Ddz']+$xnjs_ar['data']['Dz']+$xnjs_ar['data']['Pdk']+intval($xnjs_ar['data']['Niu']/4)+intval($xnjs_ar['data']['Ss']/3)+intval($xnjs_ar['data']['Zjh']/3)),
|
||||
'HeadHttp' => $v['tx']
|
||||
];
|
||||
}
|
||||
$data_hb = array_merge($dat,$xnda);
|
||||
$data = $db->array_sort($data_hb,$order,'desc');
|
||||
$ppxq -> assign('time',$time);
|
||||
$ppxq -> assign('day',$day);
|
||||
$ppxq -> assign('month',$month);
|
||||
$ppxq -> assign('data',$data);
|
||||
$ppxq -> display('dh/day.tpl');
|
||||
}elseif($GG['ty'] == 'jf'){//查看自己积分记录
|
||||
$kaig = 0;
|
||||
if($GG['look']){
|
||||
$shopid = 6;
|
||||
$xyyb = 3000;
|
||||
if($userinfo['Grade']>15000 && $GG['gid']==$userinfo['GameID']){
|
||||
$xyyb = 0;
|
||||
$kaig = 1;
|
||||
}
|
||||
}else{
|
||||
$shopid = 5;
|
||||
$xyyb = 1000;
|
||||
if($userinfo['Grade']>6000 && $GG['gid']==$userinfo['GameID']){
|
||||
$xyyb = 0;
|
||||
$kaig = 1;
|
||||
}
|
||||
}
|
||||
if($userinfo['YuanBao'] >= $xyyb){
|
||||
$ppxq -> assign('user', $user = $db->fetch_one("select * from AccountsInfo where GameID='".$GG['gid']."'"));
|
||||
if($kaig==0){
|
||||
//扣除元宝
|
||||
$db->update("QPTreasureDB.dbo.GameScoreInfo",['YuanBao'=>$userinfo['YuanBao']-$xyyb],"UserID='".$userinfo['UserID']."'");
|
||||
//记录元宝日志
|
||||
$ybd = $db->fetch_one("select * from YuanBaoDay where Day='".date('Y-m-d')."'");
|
||||
if($ybd){
|
||||
$db->update('YuanBaoDay',['XYuanBao'=>$ybd['XYuanBao']+$xyyb],"YbdID='".$ybd['YbdID']."'");
|
||||
}else{
|
||||
$db->insert("YuanBaoDay",['Day'=>date('Y-m-d'),'XYuanBao'=>$xyyb]);
|
||||
}
|
||||
}
|
||||
//添加记录
|
||||
$savelog = [
|
||||
'ShopID'=>$shopid,
|
||||
'UserID'=>$userinfo['UserID'],
|
||||
'QYuanBao'=>$userinfo['YuanBao'],
|
||||
'YuanBao'=>$xyyb,
|
||||
'ShopLogCheck'=>1,
|
||||
'ShopTxt'=>$user['NickName']."(".$user['GameID'].")"
|
||||
];
|
||||
$db->insert("ShopLog",$savelog);
|
||||
if($GG['gid']){
|
||||
if($GG['look']){
|
||||
$ppxq -> assign('log',$log = $db->fetch_all("select top 30 * from CountJf where UserID='".$user['UserID']."' order by CjID desc"));
|
||||
}else{
|
||||
$ppxq -> assign('log',$log = $db->fetch_all("select top 30 * from CountUserJf where UserID='".$user['UserID']."' order by CujID desc"));
|
||||
}
|
||||
if($log){
|
||||
foreach ($log as $k => $v) {
|
||||
$zjf += $v['Jf'];
|
||||
}
|
||||
$ppxq -> assign('zjf',$zjf);
|
||||
}
|
||||
}
|
||||
$ppxq -> display('dh/jf.tpl');
|
||||
}else{
|
||||
echo "元宝不够!";
|
||||
}
|
||||
}elseif($GG['ty'] == 'hy'){//我的好友
|
||||
$uid = $userinfo['UserID'];
|
||||
$where = " where a.UserID='".$uid."'";
|
||||
$sql = "SELECT UserID,convert(char,InsertTime,120) as Date,RecordID
|
||||
,(SELECT b.UserID,c.GameID,c.NickName,f.Grade,d.HeadHttp FROM QPTreasureDB.dbo.PrivateGameRecordUserRecordID as b LEFT JOIN AccountsInfo as c ON(b.UserID=c.UserID) LEFT JOIN IndividualDatum as d ON(d.UserID=b.UserID) LEFT JOIN QPTreasureDB.dbo.GameScoreInfo AS f ON(d.UserID=f.UserID) WHERE b.RecordID=a.RecordID order by b.InsertTime asc FOR XML PATH('')) AS users
|
||||
,(SELECT e.UserScore,e.RecordChildID FROM QPTreasureDB.dbo.PrivateGameRecordChild as e WHERE e.RecordID=a.RecordID FOR XML PATH('')) AS log
|
||||
FROM QPTreasureDB.dbo.PrivateGameRecordUserRecordID a ".$where." GROUP BY UserID,RecordID,InsertTime order by InsertTime desc";
|
||||
$data = $db->fetch_all($sql);
|
||||
foreach($data as $k => $v){
|
||||
if($v['users']){
|
||||
$userstr = [];
|
||||
$arr = explode("</HeadHttp>",$v['users']);
|
||||
foreach($arr as $ka => $va){
|
||||
if($va){
|
||||
$userstr[] = str_replace(['</UserID>','</GameID>','</NickName>','</Grade>','<GameID>','<UserID>','<NickName>','<Grade>','<HeadHttp>'],['</>','</>','</>','</>','','','','',''],$va);
|
||||
}
|
||||
}
|
||||
$info[$k]['users'] = $userstr;
|
||||
}
|
||||
$logs = array_filter(explode("</RecordChildID>",str_replace(['</UserScore>','<RecordChildID>','<UserScore>'],['',',',''],$v['log'])));
|
||||
$info[$k]['logs'] = $logs;
|
||||
foreach($logs as $kb => $vb){
|
||||
$ajf = explode(",",$vb);
|
||||
$zf[0] = $zf[0]+$ajf[0];
|
||||
$zf[1] = $zf[1]+$ajf[1];
|
||||
$zf[2] = $zf[2]+$ajf[2];
|
||||
$zf[3] = $zf[3]+$ajf[3];
|
||||
$zhit++;
|
||||
}
|
||||
$info[$k]['zf'] = $zf;
|
||||
$zf = [];
|
||||
//计算总分
|
||||
if($userstr){
|
||||
foreach($userstr as $kzf => $vzf){
|
||||
$arrss = explode("</>",$vzf);
|
||||
if($arrss[0] == $uid){
|
||||
$zzf = $zzf+$info[$k]['zf'][$kzf];
|
||||
}
|
||||
//开房次数
|
||||
if($arrss[0] == $uid && $kzf == 0){
|
||||
$zkf++;
|
||||
}
|
||||
$use[$arrss[0]]['GameID']=$arrss[1];
|
||||
$use[$arrss[0]]['NickName']=$arrss[2];
|
||||
$use[$arrss[0]]['Grade']=$arrss[3];
|
||||
$use[$arrss[0]]['HeadHttp']=$arrss[4];
|
||||
}
|
||||
}
|
||||
}
|
||||
$use = $db->array_sort($use,'Grade','desc');
|
||||
foreach($use as $kp => $vp){
|
||||
if($vp['GameID'] == $userinfo['GameID']){
|
||||
$pm = $kp;
|
||||
}
|
||||
$use[$kp]['HeadHttp'] = $use[$kp]['HeadHttp'];
|
||||
}
|
||||
$ppxq -> register_function('gradetit','gradetit');
|
||||
$ppxq -> assign('pm',$pm+1);//好友排名
|
||||
$ppxq -> assign('zzf',$zzf);//三天内总积分
|
||||
$ppxq -> assign('zkf',$zkf);//三天内创建房间次数
|
||||
$ppxq -> assign('zhit',$zhit);//三天内打牌局数
|
||||
$ppxq -> assign('uses',$use);//好友用户
|
||||
$ppxq -> display('dh/hy.tpl');
|
||||
}elseif($GG['ty'] == 'sj'){//世界排名
|
||||
$sql = "select top 399 a.UserID,c.GameID,c.NickName,b.HeadHttp,a.ConsumeScore,a.InsureScore,a.PlayCount,a.Grade from QPTreasureDB.dbo.GameScoreInfo as a LEFT JOIN IndividualDatum as b ON(a.UserID=b.UserID) LEFT JOIN AccountsInfo AS c ON(a.UserID=c.UserID) where a.Grade>50 order by Grade desc";
|
||||
$data = $db->fetch_all($sql);
|
||||
//虚拟人物
|
||||
foreach($vdata as $k => $v){
|
||||
$top[]=[
|
||||
'NickName' => $v['name'],
|
||||
'Gender' => $v['sex'],
|
||||
'Grade' => vmdata($vdata[$k]),
|
||||
'HeadHttp' => $v['tx']."??"
|
||||
];
|
||||
}
|
||||
$uss = array_merge($top,$data);
|
||||
$use = $db->array_sort($uss,'Grade','desc');
|
||||
foreach($use as $k => $v){
|
||||
if($k<100){
|
||||
$uses[$k]=$v;
|
||||
$uses[$k]['HeadHttp'] = $uses[$k]['HeadHttp'];
|
||||
}
|
||||
if($v['GameID']==$userinfo['GameID']){
|
||||
$pm = $k+1;
|
||||
}
|
||||
}
|
||||
$ppxq -> register_function('gradetit','gradetit');
|
||||
$ppxq -> assign('pm',$pm);//世界排名
|
||||
$ppxq -> assign('uses',$uses);//排名
|
||||
$ppxq -> display('dh/sj.tpl');
|
||||
}elseif($GG['ty'] == 'song'){ //送手机活动
|
||||
$huodong = $db->fetch_all("select * from HuoDong where Hclose=1 order by Hdef desc,Hdid desc");
|
||||
foreach($huodong as $k => $v){
|
||||
$hdat[$v['Hdid']] = $v;
|
||||
if(!$k){
|
||||
$max_hdid = $v['Hdid'];
|
||||
}
|
||||
}
|
||||
if($GG['hdid']){
|
||||
if(in_array($GG['hdid'],array_column($huodong, 'Hdid'))){
|
||||
$hdata = $hdat[$GG['hdid']];
|
||||
}
|
||||
}
|
||||
if(!$hdata){
|
||||
$hdata = $hdat[$max_hdid];
|
||||
}
|
||||
//奖品配置
|
||||
$jp_arr = explode(",",$hdata['HPrize']);
|
||||
$hdy_arr = explode(",",$hdata['Htime']);
|
||||
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'];
|
||||
}
|
||||
}
|
||||
if($user_pp){
|
||||
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']+$xnjs_ar['data']['Pdk']+intval($xnjs_ar['data']['Niu']/4)+intval($xnjs_ar['data']['Ss']/3)+intval($xnjs_ar['data']['Zjh']/3));
|
||||
}
|
||||
$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');
|
||||
}else{
|
||||
$info = $db->fetch_all("select top 30 a.UserID,c.GameID,c.NickName,b.HeadHttp,a.ConsumeScore,a.InsureScore,a.PlayCount,a.Grade from QPTreasureDB.dbo.GameScoreInfo as a LEFT JOIN IndividualDatum as b ON(a.UserID=b.UserID) LEFT JOIN AccountsInfo AS c ON(a.UserID=c.UserID) where a.Grade>50 order by Grade desc");
|
||||
foreach($info as $kb => $vb){
|
||||
$info[$kb]['Pm'] = 0;
|
||||
$info[$kb]['HeadHttp'] = $info[$kb]['HeadHttp'];
|
||||
}
|
||||
//虚拟人物
|
||||
foreach($vdata as $k => $v){
|
||||
$xninfo[]=[
|
||||
'NickName' => $v['name'],
|
||||
'Gender' => $v['sex'],
|
||||
'Pm' => 0,
|
||||
'Grade' => vmdata($vdata[$k]),
|
||||
'HeadHttp' => $v['tx']."??"
|
||||
];
|
||||
}
|
||||
$uss = array_merge($xninfo,$info);
|
||||
$data = $db->array_sort($uss,'Grade','desc');
|
||||
}
|
||||
//我的局数
|
||||
$my = $db->fetch_abc("select SUM(Hit) from CountJf where UserID='".$userinfo['UserID']."' and (".$where.") ");
|
||||
$my_niu = $db->fetch_abc("select SUM(Niu) from CountJf where UserID='".$userinfo['UserID']."' and (".$where.") ");
|
||||
$my_ss = $db->fetch_abc("select SUM(Ss) from CountJf where UserID='".$userinfo['UserID']."' and (".$where.") ");
|
||||
$my_zjh = $db->fetch_abc("select SUM(Zjh) from CountJf where UserID='".$userinfo['UserID']."' and (".$where.") ");
|
||||
$my_nius = $my_niu ? intval($my_niu-intval($my_niu/4)) : 0;
|
||||
$my_sss = $my_ss ? intval($my_ss-intval($my_ss/3)) : 0;
|
||||
$my_zjhs = $my_zjh ? intval($my_zjh-intval($my_zjh/3)) : 0;
|
||||
$xcz = $data[0]['Pm']-($my-$my_nius-$my_sss-$my_zjhs);
|
||||
$ppxq -> assign('xcz',$xcz);//相差局数
|
||||
|
||||
$ppxq -> assign('time',date('Y-m'));
|
||||
$ppxq -> assign('sjks',$hdy_arr[0]);
|
||||
$ppxq -> assign('sjjs',$hdy_arr[(count($hdy_arr)-1)]);
|
||||
$ppxq -> assign('hdy_arr',$hdy_arr);
|
||||
$ppxq -> assign('huodong',$huodong);
|
||||
$ppxq -> assign('jpin',$jp_arr);
|
||||
$ppxq -> assign('hdid',$hdata['Hdid']);
|
||||
$ppxq -> assign('data',$data);//排名
|
||||
$ppxq -> register_function('gradetit','gradetit');
|
||||
$ppxq -> display('dh/song.tpl');
|
||||
}else{
|
||||
$ppxq -> display('dh/index.tpl');
|
||||
}
|
||||
unset($GG,$ppxq);
|
||||
?>
|
||||
97
GonghuiWeb/www/dh/lottery.php
Normal file
97
GonghuiWeb/www/dh/lottery.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
include_once("../../inc/class.php");
|
||||
include_once("../../inc/admin.smarty.php");
|
||||
$db = new myConn;
|
||||
$db->links();
|
||||
$GG=$db->getpost($GG);
|
||||
$lottery = 32;//32局抽奖一次
|
||||
//抽奖方法
|
||||
function prize($arr = '',$prize_arr){
|
||||
if(is_array($arr) || !$arr){
|
||||
$arr = $arr ? $arr : [];
|
||||
$shu = 1;
|
||||
foreach($prize_arr as $val){
|
||||
if(in_array($val['id'],$arr) || !$arr){
|
||||
//$info[] = $val;
|
||||
$item[$val['id']] = $val['pro'];
|
||||
$cj[$val['id']]['min'] = $shu;
|
||||
$shu += $val['pro'];
|
||||
$cj[$val['id']]['max'] = $shu;
|
||||
}
|
||||
}
|
||||
$num = array_sum($item);
|
||||
$rand = mt_rand(1,$num);
|
||||
//print_r($cj);
|
||||
//echo $rand."<br>";
|
||||
foreach ($cj as $k => $v) {
|
||||
//echo $v['min']."<=".$rand." && ".$rand."<".$v['max']."<br>";
|
||||
if($v['min']<=$rand && $rand<$v['max']){
|
||||
return $prize_arr[$k-1];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
return $prize_arr[$arr-1];
|
||||
}
|
||||
}
|
||||
if($GG['gameid']){
|
||||
$userid = $db->fetch_abc("select UserID from AccountsInfo where GameID='".$GG['gameid']."'");
|
||||
$info = $db->fetch_one("select * from QPTreasureDB.dbo.GameScoreInfo where UserID='".$userid."'");
|
||||
if($info['LotteryGame']>=$lottery){
|
||||
$prize_arr = [
|
||||
['id'=>1,"yuanbao"=>"50","pro"=>8],
|
||||
['id'=>2,"yuanbao"=>"1","pro"=>3000],
|
||||
['id'=>3,"yuanbao"=>"5","pro"=>500],
|
||||
['id'=>4,"yuanbao"=>"30","pro"=>10],
|
||||
['id'=>5,"yuanbao"=>"8","pro"=>100],
|
||||
['id'=>6,"yuanbao"=>"2","pro"=>2000],
|
||||
['id'=>7,"yuanbao"=>"60","pro"=>5],
|
||||
['id'=>8,"yuanbao"=>"20","pro"=>20],
|
||||
['id'=>9,"yuanbao"=>"100","pro"=>1],
|
||||
['id'=>10,"yuanbao"=>"3","pro"=>1000],
|
||||
['id'=>11,"yuanbao"=>"10","pro"=>50],
|
||||
['id'=>12,"yuanbao"=>"6","pro"=>200]
|
||||
];
|
||||
if(!$info['LotteryHit']){//第一次 50 30 8 60 20 100 10
|
||||
$dat = prize([1,4,5,7,8,9,11],$prize_arr);
|
||||
}elseif(in_array($info['LotteryHit'],[100,200,600,800,900,1700,2350])){
|
||||
$dat = prize([4],$prize_arr);//30
|
||||
}elseif(in_array($info['LotteryHit'],[30,350,700,2200])){
|
||||
$dat = prize([1],$prize_arr);//50
|
||||
}elseif(in_array($info['LotteryHit'],[1100,1300,2700])){
|
||||
$dat = prize([7],$prize_arr);//60
|
||||
}elseif(in_array($info['LotteryHit'],[500,1000,1500,2000,2500,3000])){
|
||||
$dat = prize([9],$prize_arr);//100
|
||||
}else{
|
||||
$hz = substr($info['LotteryHit'],-1);
|
||||
if($hz == 1){// 5 8 20 3 10 6
|
||||
$dat = prize([3,5,8,10,11,12],$prize_arr);
|
||||
}elseif($hz == 6){//5 8 10 6
|
||||
$dat = prize([3,5,11,12],$prize_arr);
|
||||
}else{//平常 1 5 8 2 3 6
|
||||
$dat = prize([2,3,5,6,10,12],$prize_arr);
|
||||
}
|
||||
}
|
||||
$save=[
|
||||
"YuanBao"=>$info['YuanBao']+$dat['yuanbao'],
|
||||
"LotteryHit"=>$info['LotteryHit']+1,
|
||||
"LotteryGame"=>$info['LotteryGame']-$lottery
|
||||
];
|
||||
$db->update('QPTreasureDB.dbo.GameScoreInfo',$save,"UserID='".$userid."'");
|
||||
//记录日志
|
||||
$db->insert("YuanBaoLog",['Types'=>'lottery','UserID'=>$userid,'QYuanBao'=>$info['YuanBao'],'LotteryHit'=>$info['LotteryHit'],'YuanBao'=>$dat['yuanbao']]);
|
||||
//记录元宝日志
|
||||
$ybd = $db->fetch_one("select * from YuanBaoDay where Day='".date('Y-m-d')."'");
|
||||
if($ybd){
|
||||
$db->update('YuanBaoDay',['YuanBao'=>$ybd['YuanBao']+$dat['yuanbao'],'Lottery'=>$ybd['Lottery']+$dat['yuanbao']],"YbdID='".$ybd['YbdID']."'");
|
||||
}else{
|
||||
$db->insert("YuanBaoDay",['Day'=>date('Y-m-d'),'YuanBao'=>$dat['yuanbao'],'Lottery'=>$dat['yuanbao']]);
|
||||
}
|
||||
echo json_encode(['prize'=>($dat['id']-1),'game'=>$save['LotteryGame'],'yuanbao'=>$dat['yuanbao']]);
|
||||
}else{
|
||||
echo json_encode(["error"=>"no"]);
|
||||
}
|
||||
}else{
|
||||
echo json_encode(["error"=>"error"]);
|
||||
}
|
||||
unset($GG,$ppxq);
|
||||
?>
|
||||
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