工会web
This commit is contained in:
211
GonghuiWeb/www/gh/cl.php
Normal file
211
GonghuiWeb/www/gh/cl.php
Normal file
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
include_once("../../inc/class.php");
|
||||
include_once("../../inc/admin.smarty.php");
|
||||
$db = new myConn;
|
||||
$db->links();
|
||||
$GG=$db->getpost($GG);
|
||||
$userinfo = $db->fetch_one("select a.UserID,a.GameID,a.NickName,a.SpreaderID,c.ConsumeScore,c.InsureScore,c.PlayCount,c.Grade,c.YuanBao,c.UnionID from AccountsInfo as a LEFT JOIN QPTreasureDB.dbo.GameScoreInfo AS c ON(a.UserID=c.UserID) where a.GameID='".$GG['gameid']."'");
|
||||
if(!$userinfo){
|
||||
echo "没有找到用户";//系统错误
|
||||
exit;
|
||||
}
|
||||
if($GG['ty'] == 'join'){//加入工会
|
||||
$union = $db->fetch_one("select * from QPTreasureDB.dbo.GameUnion where UserID='".$userinfo['UserID']."'");
|
||||
if(!$union){
|
||||
echo "工会出错!";
|
||||
exit;
|
||||
}
|
||||
if($union['People'] >= 300){
|
||||
echo "您的公会人数<br>已经超出300人限制!";
|
||||
exit;
|
||||
}
|
||||
$user = $db->fetch_one("select a.UserID,c.UnionID from AccountsInfo as a LEFT JOIN QPTreasureDB.dbo.GameScoreInfo AS c ON(a.UserID=c.UserID) where a.GameID='".$GG['gid']."'");
|
||||
if(!$user){
|
||||
echo "没有找到游戏ID!";
|
||||
exit;
|
||||
}
|
||||
$un_user = $db->fetch_one("select UserID from QPTreasureDB.dbo.GameUnionMember where UserID='".$user['UserID']."' and UnionID='".$union['UnionID']."'");
|
||||
if($un_user){
|
||||
echo "该玩家已经是您公会成员!";
|
||||
exit;
|
||||
}
|
||||
$open = $GG['opens'] ? 1 : 0;
|
||||
$db->insert("QPTreasureDB.dbo.GameUnionMember",[
|
||||
"UnionID"=>$union['UnionID'],
|
||||
"UserID"=>$user['UserID'],
|
||||
"UnionOpen"=>$open
|
||||
]);
|
||||
$db->update("QPTreasureDB.dbo.GameUnion",["People"=>$union['People']+1],"UnionID='".$union['UnionID']."'");
|
||||
if(!$user['UnionID']){//修改UnionID
|
||||
$db->update("QPTreasureDB.dbo.GameScoreInfo",["UnionID"=>$union['UnionID']],"UserID='".$user['UserID']."'");
|
||||
}
|
||||
echo "ok";
|
||||
exit;
|
||||
}elseif($GG['ty'] == 'add' && $GG['uname'] && $GG['ucard']){//创建工会
|
||||
$bxkf = 80;//最少房卡
|
||||
$uname = trim(str_replace([' ',' ','\'','"'], "", iconv("utf-8", "gbk", $GG['uname'])));
|
||||
if($userinfo['InsureScore'] < $bxkf){
|
||||
echo "必须要有".$bxkf."张房卡!<br>请联系客服充卡";
|
||||
exit;
|
||||
}
|
||||
if($userinfo['InsureScore'] < intval($GG['ucard'])){
|
||||
echo "您的当前房卡少于".intval($GG['ucard'])."张<br>请联系客服充卡";
|
||||
exit;
|
||||
}
|
||||
if(in_array("integer",$GG['ucard'])){
|
||||
echo "房卡输入错误";
|
||||
exit;
|
||||
}
|
||||
if(intval($GG['ucard']) < $bxkf){
|
||||
echo "输入房卡必须大于".$bxkf."张";
|
||||
exit;
|
||||
}
|
||||
$notice = $db->fetch_one("select * from QPTreasureDB.dbo.GameUnion where UnionName='".$uname."'");
|
||||
if($notice){
|
||||
echo "公会名称,已被注册";
|
||||
}else{
|
||||
if($userinfo['UnionID']){
|
||||
echo "已经是公会成员";
|
||||
exit;
|
||||
}
|
||||
$db->insert("QPTreasureDB.dbo.GameUnion",[
|
||||
"UserID"=>$userinfo['UserID'],
|
||||
"UnionCode"=>$userinfo['GameID'],
|
||||
"UnionCard"=>intval($GG['ucard']+50),
|
||||
"UnionName"=>$uname,
|
||||
"People"=>1
|
||||
]);
|
||||
$card = $userinfo['InsureScore']-intval($GG['ucard']);
|
||||
$idd = $db->fetch_abc("select UnionID from QPTreasureDB.dbo.GameUnion where UserID='".$userinfo['UserID']."'");
|
||||
$db->insert("QPTreasureDB.dbo.GameUnionMember",[
|
||||
"UnionID"=>$idd,
|
||||
"UserID"=>$userinfo['UserID'],
|
||||
"UnionOpen"=>1
|
||||
]);
|
||||
$db->update("QPTreasureDB.dbo.GameScoreInfo",['InsureScore'=>$card,"UnionID"=>$idd],"UserID='".$userinfo['UserID']."'");
|
||||
//添加转卡记录
|
||||
$db->insert("QPTreasureDB.dbo.GameUnionCard",[
|
||||
"UnionID"=>$idd,
|
||||
"UserID"=>$userinfo['UserID'],
|
||||
"Fang"=>$userinfo['InsureScore'],
|
||||
"LeftCard"=>0,
|
||||
"OperCard"=>intval($GG['ucard'])
|
||||
]);
|
||||
echo "ok";
|
||||
}
|
||||
}elseif($GG['ty'] == 'edit'){//修改公会信息
|
||||
$union = $db->fetch_one("select * from QPTreasureDB.dbo.GameUnion where UserID='".$userinfo['UserID']."'");
|
||||
if(!$union){
|
||||
echo "工会出错!";
|
||||
exit;
|
||||
}
|
||||
if(!$GG['names']){
|
||||
echo "请输入公会名称!";
|
||||
exit;
|
||||
}
|
||||
$uname = trim(iconv('UTF-8','GBK',$GG['names']));
|
||||
if($union['UnionName'] != $uname){
|
||||
$notice = $db->fetch_one("select * from QPTreasureDB.dbo.GameUnion where UnionName='".$uname."'");
|
||||
if($notice){
|
||||
echo "公会名称已被注册!";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$db->update("QPTreasureDB.dbo.GameUnion",[
|
||||
"UnionName"=>$uname
|
||||
],"UnionID='".$union['UnionID']."'");
|
||||
echo "ok";
|
||||
}elseif($GG['ty'] == 'out' && $GG['uid'] && $GG['unid']){//退出公会
|
||||
$union = $db->fetch_one("select * from QPTreasureDB.dbo.GameUnion where UnionID='".$GG['unid']."'");
|
||||
$userr = $db->fetch_one("select UserID,UnionID from QPTreasureDB.dbo.GameScoreInfo where UserID='".$GG['uid']."'");
|
||||
if($union && $userr){
|
||||
$db->update("QPTreasureDB.dbo.GameUnion",["People"=>$union['People']-1],"UnionID='".$union['UnionID']."'");
|
||||
$db->deldate("QPTreasureDB.dbo.GameUnionMember","UnionID='".$union['UnionID']."' and UserID='".$userr['UserID']."'");
|
||||
if($userr['UnionID'] == $union['UnionID']){
|
||||
$uid = $db->fetch_abc("select UnionID from QPTreasureDB.dbo.GameUnionMember where UserID='".$userr['UserID']."'");
|
||||
if(!$uid){
|
||||
$uid = 0;
|
||||
}
|
||||
$db->update("QPTreasureDB.dbo.GameScoreInfo",["UnionID"=>$uid],"UserID='".$userr['UserID']."'");
|
||||
}
|
||||
echo "ok";
|
||||
}else{
|
||||
echo "公会已解散";
|
||||
}
|
||||
}elseif($GG['ty'] == 'zhuan'){//用户房卡转公会房卡
|
||||
$union = $db->fetch_one("select * from QPTreasureDB.dbo.GameUnion where UserID='".$userinfo['UserID']."'");
|
||||
if(!$union){
|
||||
echo "工会出错!";
|
||||
exit;
|
||||
}
|
||||
if(intval($GG['fang']) < 10){
|
||||
echo "转入房卡最少10张起";
|
||||
exit;
|
||||
}
|
||||
if(intval($userinfo['InsureScore']) < 10){
|
||||
echo "您的当前房卡少于10张";
|
||||
exit;
|
||||
}
|
||||
if(intval($userinfo['InsureScore']) < intval($GG['fang'])){
|
||||
echo "您没有".intval($GG['fang'])."张房卡!";
|
||||
exit;
|
||||
}
|
||||
$card = $userinfo['InsureScore']-intval($GG['fang']);
|
||||
$db->update("QPTreasureDB.dbo.GameScoreInfo",["InsureScore"=>$card],"UserID='".$userinfo['UserID']."'");
|
||||
$fang = $union['UnionCard']+intval($GG['fang']);
|
||||
$db->update("QPTreasureDB.dbo.GameUnion",["UnionCard"=>$fang],"UnionID='".$union['UnionID']."'");
|
||||
//添加转卡记录
|
||||
$db->insert("QPTreasureDB.dbo.GameUnionCard",[
|
||||
"UnionID"=>$union['UnionID'],
|
||||
"UserID"=>$userinfo['UserID'],
|
||||
"Fang"=>$userinfo['InsureScore'],
|
||||
"LeftCard"=>$union['UnionCard'],
|
||||
"OperCard"=>intval($GG['fang'])
|
||||
]);
|
||||
echo "ok";
|
||||
}elseif($GG['ty'] == 'huan'){//修改欢乐场游戏配置
|
||||
$union = $db->fetch_one("select * from QPTreasureDB.dbo.GameUnion where UserID='".$userinfo['UserID']."'");
|
||||
if(!$union){
|
||||
echo "工会出错!";
|
||||
exit;
|
||||
}
|
||||
if($GG['tys'] == 'limit'){
|
||||
$save = ['UnionGoldLimit'=>intval($GG['va'])];
|
||||
}elseif($GG['tys'] == 'score'){
|
||||
$save = ['ScoreMultiple'=>intval($GG['va'])];
|
||||
}else{
|
||||
$save = ['GameGold'=>intval($GG['va'])];
|
||||
}
|
||||
$db->update("QPTreasureDB.dbo.GameUnionKind",$save,"UnionID='".$union['UnionID']."' and KindID='".$GG['kid']."'");
|
||||
echo "ok";
|
||||
}elseif($GG['ty'] == 'goldopen'){//开启关闭欢乐场
|
||||
$union = $db->fetch_one("select * from QPTreasureDB.dbo.GameUnion where UserID='".$userinfo['UserID']."'");
|
||||
if(!$union){
|
||||
echo "工会出错!";
|
||||
exit;
|
||||
}
|
||||
$kind_arr = ['2'=>'牛牛','6'=>'炸金花','200'=>'斗地主','430'=>'打炸','502'=>'十三张','558'=>'麻将'];
|
||||
if($union['UnionGoldOpen']){
|
||||
$hsave=['UnionGoldOpen'=>0];
|
||||
//关闭欢乐场
|
||||
$db->deldate("QPTreasureDB.dbo.GameUnionKind","UnionID='".$union['UnionID']."'");
|
||||
}else{
|
||||
$hsave=['UnionGoldOpen'=>1];
|
||||
//开启欢乐场
|
||||
foreach ($kind_arr as $key => $val){
|
||||
$db->insert("QPTreasureDB.dbo.GameUnionKind",['UnionID' => $union['UnionID'],
|
||||
'KindID' => $key,
|
||||
'UnionGoldLimit' => 100,
|
||||
'ScoreMultiple' => 1,
|
||||
'GameGold' => 3]);
|
||||
}
|
||||
}
|
||||
$db->update('QPTreasureDB.dbo.GameUnion',$hsave,"UnionID='".$union['UnionID']."'");
|
||||
echo "ok";
|
||||
}elseif($GG['ty'] == 'dels'){//解散公会
|
||||
|
||||
}else{
|
||||
echo "系统错误";
|
||||
}
|
||||
unset($GG,$ppxq);
|
||||
?>
|
||||
165
GonghuiWeb/www/gh/index.php
Normal file
165
GonghuiWeb/www/gh/index.php
Normal file
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
include_once("../../inc/class.php");
|
||||
include_once("../../inc/admin.smarty.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.Zjf,c.Grade,c.YuanBao,c.UnionID from AccountsInfo as a LEFT JOIN QPTreasureDB.dbo.GameScoreInfo AS c ON(a.UserID=c.UserID) where a.GameID='".$GG['gameid']."'"));
|
||||
if($userinfo['UnionID']){
|
||||
$ppxq -> assign('union',$union = $db->fetch_one("select * from QPTreasureDB.dbo.GameUnion where UnionID='".$userinfo['UnionID']."'"));
|
||||
}
|
||||
//群主权限
|
||||
if($union && $union['UserID'] == $userinfo['UserID']){
|
||||
$union_ok = 1;
|
||||
$ppxq -> assign('union_ok','1');
|
||||
}
|
||||
if($GG['ty'] == 'main'){
|
||||
if($union){
|
||||
if(intval($GG['idd'])){
|
||||
$ppxq -> assign('union_a',$union_a = $db->fetch_one("select * from QPTreasureDB.dbo.GameUnion where UnionID='".$GG['idd']."'"));
|
||||
$sort = explode('-',$GG['sort']);
|
||||
if($sort[0] == 'open'){//开房权限
|
||||
if(intval($sort[1]) && $union_a['UserID'] == $userinfo['UserID']){
|
||||
$openid = $db->fetch_abc("select UnionOpen from QPTreasureDB.dbo.GameUnionMember where UnionMemberID='".$sort[1]."'");
|
||||
if($openid){
|
||||
$open_id = 0;
|
||||
}else{
|
||||
$open_id = 1;
|
||||
}
|
||||
$db->update("QPTreasureDB.dbo.GameUnionMember",["UnionOpen"=>$open_id],"UnionMemberID='".$sort[1]."'");
|
||||
}
|
||||
}
|
||||
if($GG['sort'] == 'qx'){
|
||||
$sort = "UnionOpen desc";
|
||||
}elseif($GG['sort'] == 'xf'){
|
||||
$sort = "ConsumeScore desc";
|
||||
}elseif($GG['sort'] == 'yx'){
|
||||
$sort = "PlayCount desc";
|
||||
}elseif($GG['sort'] == 'log'){
|
||||
$sort = "LastDate desc";
|
||||
}elseif($GG['sort'] == 'gold'){
|
||||
$sort = "UnionMemberGold desc";
|
||||
}else{
|
||||
$sort = "Grade desc";
|
||||
}
|
||||
$datas = $db->fetch_all("select a.UnionMemberID,a.UserID,a.UnionOpen,a.UnionMemberGold,c.GameID,c.NickName,c.Gender,b.HeadHttp,d.ConsumeScore,d.InsureScore,d.PlayCount,d.Grade,convert(char,d.LastLogonDate,120) as LastDate from QPTreasureDB.dbo.GameUnionMember as a LEFT JOIN QPTreasureDB.dbo.GameScoreInfo as d ON(a.UserID=d.UserID) LEFT JOIN IndividualDatum as b ON(a.UserID=b.UserID) LEFT JOIN AccountsInfo AS c ON(a.UserID=c.UserID) where a.UnionID='".$GG['idd']."' order by ".$sort);
|
||||
if($datas){
|
||||
$gold = 0;
|
||||
foreach($datas as $k=>$v){
|
||||
$info[$k] = $v;
|
||||
$info[$k]['HeadHttp'] = $info[$k]['HeadHttp'];
|
||||
$info[$k]['LastDate'] = strtotime($info[$k]['LastDate']);
|
||||
$gold += $info[$k]['UnionMemberGold'];
|
||||
}
|
||||
}
|
||||
$ppxq -> assign('gold',$gold);
|
||||
$ppxq -> assign('info',$info);
|
||||
}else{
|
||||
$data = $db->fetch_all("select a.UnionOpen,a.UnionMemberGold,a.UserID as UID,b.*,d.GameID,d.NickName,c.HeadHttp from QPTreasureDB.dbo.GameUnionMember as a LEFT JOIN QPTreasureDB.dbo.GameUnion as b ON(a.UnionID=b.UnionID) LEFT JOIN IndividualDatum as c ON(b.UserID=c.UserID) LEFT JOIN AccountsInfo AS d ON(b.UserID=d.UserID) where a.UserID='".$userinfo['UserID']."' order by UnionMemberID asc");
|
||||
$ppxq -> assign('data',$data);
|
||||
}
|
||||
}
|
||||
$ppxq -> register_function('gradetit','gradetit');
|
||||
$ppxq -> display('gh/main.tpl');
|
||||
}elseif($GG['ty'] == 'my'){//我的数据
|
||||
if($GG['idd'] == 'month'){
|
||||
$ppxq -> assign('log',$log = $db->fetch_all("select top 30 * from CountJf where UserID='".$userinfo['UserID']."' order by CjID desc"));
|
||||
}elseif($GG['idd'] == 'gold'){
|
||||
$ppxq -> assign('gold',$db->fetch_all("select top 30 a.*,convert(char,a.InsertTime,120) as Date,b.UnionName from QPTreasureDB.dbo.GameUnionGold as a LEFT JOIN QPTreasureDB.dbo.GameUnion as b ON(a.UnionID=b.UnionID) where a.UserID='".$userinfo['UserID']."' order by UnionGoldID desc"));
|
||||
}else{
|
||||
$ppxq -> assign('log',$log = $db->fetch_all("select top 30 * from CountUserJf where UserID='".$userinfo['UserID']."' order by CujID desc"));
|
||||
if($log){
|
||||
foreach ($log as $k => $v) {
|
||||
$zjf += $v['Jf'];
|
||||
}
|
||||
$ppxq -> assign('zjf',$zjf);
|
||||
}
|
||||
}
|
||||
$ppxq -> display('gh/my.tpl');
|
||||
}elseif($GG['ty'] == 'data'){//开房数据
|
||||
$day = date('Y-m-d');
|
||||
$month = date('Y-m');
|
||||
$smonth = date('Y-m',strtotime("-1 month"));
|
||||
$user_union = $db->fetch_one("select * from QPTreasureDB.dbo.GameUnion where UserID='".$userinfo['UserID']."'");
|
||||
if($GG['idd'] == 'by' || $GG['idd'] == 'sy'){
|
||||
if($GG['idd'] == 'by'){
|
||||
$where = "and convert(char(7),InsertTime,120)='".$month."'";
|
||||
}else{
|
||||
$where = "and convert(char(7),InsertTime,120)='".$smonth."'";
|
||||
}
|
||||
$data = $db->fetch_all("select UserIDa,b.num,b.gold,b.card,c.NickName,d.HeadHttp,convert(char,c.LastLogonDate,120) as LastDate from QPTreasureDB.dbo.GameUnionConsumer as a,
|
||||
(select min(UnionConsumerID) as id,count(*) as num,sum(GameGold) as gold,sum(ConsumerCode) as card from QPTreasureDB.dbo.GameUnionConsumer where UnionID=".$user_union['UnionID']." and GameOK>'1' ".$where." group by UserIDa) b,
|
||||
(select NickName,LastLogonDate,UserID from AccountsInfo) c,
|
||||
(select HeadHttp,UserID from IndividualDatum) d WHERE a.UnionConsumerID=b.id and a.UserIDa=c.UserID and a.UserIDa=d.UserID ORDER BY b.card desc");
|
||||
if($data){
|
||||
foreach($data as $k=>$v){
|
||||
$info[$k] = $v;
|
||||
$info[$k]['Time'] = strtotime($info[$k]['LastDate']);
|
||||
}
|
||||
}
|
||||
$ppxq -> assign('data',$info);
|
||||
}elseif($GG['idd'] == 'day' || $GG['idd'] == 'month'){
|
||||
if($GG['idd'] == 'day'){
|
||||
$sql = "select top 30 * from QPTreasureDB.dbo.GameUnionDay where UnionID='".$userinfo['UnionID']."' ORDER BY UnionDayID desc";
|
||||
|
||||
}else{
|
||||
$sql = "select top 12 * from QPTreasureDB.dbo.GameUnionMonth where UnionID='".$userinfo['UnionID']."' ORDER BY UnionMonthID desc";
|
||||
}
|
||||
$data = $db->fetch_all($sql);
|
||||
$ppxq -> assign('data',$data);
|
||||
}elseif($GG['idd'] == 'gold'){
|
||||
$sql = "select top 200 a.*,convert(char,a.InsertTime,120) as Date,c.GameID,c.NickName,c.Gender,b.HeadHttp from QPTreasureDB.dbo.GameUnionGold as a LEFT JOIN IndividualDatum as b ON(a.UserID=b.UserID) LEFT JOIN AccountsInfo AS c ON(a.UserID=c.UserID) where a.UnionID='".$userinfo['UnionID']."' ORDER BY UnionGoldID desc";
|
||||
$data = $db->fetch_all($sql);
|
||||
if($data){
|
||||
foreach($data as $k=>$v){
|
||||
$info[$k] = $v;
|
||||
$info[$k]['Time'] = strtotime($info[$k]['Date']);
|
||||
}
|
||||
}
|
||||
$ppxq -> assign('data',$info);
|
||||
}else{
|
||||
$data = $db->fetch_all("select top 300 a.*,convert(char,a.InsertTime,120) as addTime,b.HeadHttp,c.NickName,d.NickName as Named,e.NickName as Namee,f.NickName as Namef,g.NickName as Nameg from QPTreasureDB.dbo.GameUnionConsumer as a LEFT JOIN IndividualDatum as b ON(a.UserIDa=b.UserID)
|
||||
LEFT JOIN AccountsInfo AS c ON(a.UserIDa=c.UserID)
|
||||
LEFT JOIN AccountsInfo AS d ON(a.UserIDb=d.UserID)
|
||||
LEFT JOIN AccountsInfo AS e ON(a.UserIDc=e.UserID)
|
||||
LEFT JOIN AccountsInfo AS f ON(a.UserIDd=f.UserID)
|
||||
LEFT JOIN AccountsInfo AS g ON(a.UserIDe=g.UserID)
|
||||
where a.GameOK>'1' and a.UnionID='".$userinfo['UnionID']."' order by UnionConsumerID desc");
|
||||
if($data){
|
||||
foreach($data as $k=>$v){
|
||||
$info[$k] = $v;
|
||||
$info[$k]['Time'] = strtotime($info[$k]['addTime']);
|
||||
}
|
||||
}
|
||||
$ppxq -> assign('data',$info);
|
||||
}
|
||||
$ppxq -> display('gh/data.tpl');
|
||||
}elseif($GG['ty'] == 'adm'){
|
||||
$ppxq -> display('gh/adm.tpl');
|
||||
}elseif($GG['ty'] == 'huan'){
|
||||
$game_kid = ['558'=>'万年麻将','430'=>'万年打炸','2'=>'牛牛','200'=>'斗地主','6'=>'炸金花','502'=>'十三张'];
|
||||
$data = $db->fetch_all("select * from QPTreasureDB.dbo.GameUnionKind where UnionID='".$userinfo['UnionID']."'");
|
||||
if($data){
|
||||
foreach($data as $k=>$v){
|
||||
$info[$v['KindID']] = $v;
|
||||
$info[$v['KindID']]['name'] = $game_kid[$v['KindID']];
|
||||
}
|
||||
$ppxq -> assign('data',$info);
|
||||
}
|
||||
$ppxq -> assign('kind',$game_kid);
|
||||
$ppxq -> display('gh/huan.tpl');
|
||||
}elseif($GG['ty'] == 'js'){
|
||||
$ppxq -> display('gh/js.tpl');
|
||||
}else{
|
||||
$ppxq -> display('gh/index.tpl');
|
||||
}
|
||||
unset($GG,$ppxq);
|
||||
?>
|
||||
75
GonghuiWeb/www/gh/mgold.php
Normal file
75
GonghuiWeb/www/gh/mgold.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
include_once("../../inc/class.php");
|
||||
include_once("../../inc/admin.smarty.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;
|
||||
}
|
||||
$union = $db->fetch_one("select * from QPTreasureDB.dbo.GameUnion where UnionID='".$GG['idd']."'");
|
||||
$users = $db->fetch_one("select a.*,c.NickName from QPTreasureDB.dbo.GameUnionMember as a LEFT JOIN AccountsInfo AS c ON(a.UserID=c.UserID) where a.UnionID='".$union['UnionID']."' and a.UserID='".$GG['sort']."'");
|
||||
if(!$union || !$users){
|
||||
echo "Error";
|
||||
exit;
|
||||
}
|
||||
if($GG['type']){
|
||||
if($GG['type'] == 'plus'){
|
||||
$gold = $users['UnionMemberGold']+$GG['gold'];
|
||||
$sgold = $GG['gold'];
|
||||
}else{
|
||||
$gold = $users['UnionMemberGold']-$GG['gold'];
|
||||
$sgold = 0-$GG['gold'];
|
||||
}
|
||||
if($gold < 0){
|
||||
echo "扣除分数出错!";
|
||||
exit;
|
||||
}
|
||||
$db->update("QPTreasureDB.dbo.GameUnionMember",["UnionMemberGold"=>$gold],"UserID='".$users['UserID']."' and UnionMemberID='".$users['UnionMemberID']."'");
|
||||
$save = [
|
||||
'UnionID' => $union['UnionID'],
|
||||
'UserID' => $users['UserID'],
|
||||
'UnionGold' => $sgold,
|
||||
'UnionGoldAfter' => $gold
|
||||
];
|
||||
$db->insert("QPTreasureDB.dbo.GameUnionGold",$save);
|
||||
echo "ok";
|
||||
exit;
|
||||
}
|
||||
//欢乐分操作记录
|
||||
$gold = $db->fetch_all("select top 20 *,convert(char,InsertTime,120) as addTime from QPTreasureDB.dbo.GameUnionGold where UnionID='".$union['UnionID']."' and UserID='".$users['UserID']."' order by UnionGoldID desc");
|
||||
if($gold){
|
||||
foreach($gold as $k=>$v){
|
||||
$golds[$k] = $v;
|
||||
$golds[$k]['Time'] = strtotime($v['addTime']);
|
||||
}
|
||||
}
|
||||
$ppxq -> assign('gold',$golds);
|
||||
//欢乐分输赢记录
|
||||
$consumer = $db->fetch_all("select top 20 *,convert(char,InsertTime,120) as addTime from QPTreasureDB.dbo.GameUnionConsumer where GameOK='2' and GameGold>'0' and (UserIDa='".$users['UserID']."' or UserIDb='".$users['UserID']."' or UserIDc='".$users['UserID']."' or UserIDd='".$users['UserID']."' or UserIDe='".$users['UserID']."') order by UnionConsumerID desc");
|
||||
if($consumer){
|
||||
foreach($consumer as $k=>$v){
|
||||
//$info[$k] = $v;
|
||||
if($v['UserIDa'] == $users['UserID']){
|
||||
$info[$k]['Gold'] = $v['Golda'];
|
||||
}elseif($v['UserIDb'] == $users['UserID']){
|
||||
$info[$k]['Gold'] = $v['Goldb'];
|
||||
}elseif($v['UserIDc'] == $users['UserID']){
|
||||
$info[$k]['Gold'] = $v['Goldc'];
|
||||
}elseif($v['UserIDd'] == $users['UserID']){
|
||||
$info[$k]['Gold'] = $v['Goldd'];
|
||||
}elseif($v['UserIDe'] == $users['UserID']){
|
||||
$info[$k]['Gold'] = $v['Golde'];
|
||||
}
|
||||
$info[$k]['Time'] = strtotime($v['addTime']);
|
||||
}
|
||||
}
|
||||
$ppxq -> assign('consumer',$info);
|
||||
$ppxq -> assign('users',$users);
|
||||
$ppxq -> assign('union',$union);
|
||||
$ppxq -> register_function('timename','timename');
|
||||
$ppxq -> display('gong/mgold.tpl');
|
||||
unset($GG,$ppxq);
|
||||
?>
|
||||
Reference in New Issue
Block a user