75 lines
2.7 KiB
PHP
75 lines
2.7 KiB
PHP
|
|
<?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 "<EFBFBD>۳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD>ֲַ<D6B7><D6B2><EFBFBD><EFBFBD><EFBFBD>¼
|
|||
|
|
$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);
|
|||
|
|
//<2F><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>Ӯ<EFBFBD><D3AE>¼
|
|||
|
|
$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);
|
|||
|
|
?>
|