工会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);
|
||||
?>
|
||||
Reference in New Issue
Block a user