94 lines
3.1 KiB
PHP
94 lines
3.1 KiB
PHP
|
|
<?php
|
|||
|
|
//ini_set('display_errors','On');
|
|||
|
|
include_once("../../../inc/admin.inc.php");
|
|||
|
|
include_once("../../../inc/class.php");
|
|||
|
|
include_once("../../../inc/admin.smarty.php");
|
|||
|
|
include_once("../../../inc/admin.power.php");
|
|||
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>¼
|
|||
|
|
/*
|
|||
|
|
$db->links('old');
|
|||
|
|
$init = $db->fetch_all("select * from QPTreasureDB.dbo.GameUnion order by UnionID asc");
|
|||
|
|
$db->links();
|
|||
|
|
foreach($init as $k => $v){
|
|||
|
|
$db->insert("QPTreasureDB.dbo.GameUnionInit",[
|
|||
|
|
'UnionID'=>$v['UnionID'],
|
|||
|
|
'UnionCard'=>$v['UnionCard']
|
|||
|
|
]);
|
|||
|
|
}
|
|||
|
|
echo "ok";
|
|||
|
|
exit;*/
|
|||
|
|
|
|||
|
|
$uid = $GG['uid'];
|
|||
|
|
if($uid){
|
|||
|
|
$init = $db->fetch_abc("select UnionCard from QPTreasureDB.dbo.GameUnionInit where UnionID='".$uid."'");
|
|||
|
|
if(!$init){
|
|||
|
|
if($GG['bw']){
|
|||
|
|
$db->insert("QPTreasureDB.dbo.GameUnionInit",[
|
|||
|
|
'UnionID' => $uid,
|
|||
|
|
'UnionCard' => 50
|
|||
|
|
]);
|
|||
|
|
}
|
|||
|
|
$init = 50;
|
|||
|
|
}
|
|||
|
|
$union = $db->fetch_one("select * from QPTreasureDB.dbo.GameUnion where UnionID='".$uid."' ");
|
|||
|
|
$fk_day = $db->fetch_abc("select sum(FCount) from QPTreasureDB.dbo.GameUnionDay where UnionID='".$uid."'");
|
|||
|
|
$fk_month = $db->fetch_abc("select sum(FCount) from QPTreasureDB.dbo.GameUnionMonth where UnionID='".$uid."'");
|
|||
|
|
$fk_jhz = $db->fetch_abc("select sum(ConsumerCode) from QPTreasureDB.dbo.GameUnionConsumer where UnionID='".$uid."' and GameOK>'0' and Bj='0'");
|
|||
|
|
$fk_rec = $db->fetch_abc("select sum(OperCard) from QPTreasureDB.dbo.GameUnionCard where UnionID='".$uid."'");
|
|||
|
|
$fk = $init + intval($fk_rec) - intval($fk_day) - intval($fk_jhz);
|
|||
|
|
//<2F><>¼<EFBFBD>ſ<EFBFBD><C5BF>쳣
|
|||
|
|
if($fk != $union['UnionCard']){
|
|||
|
|
$error = [
|
|||
|
|
'js' => $fk,
|
|||
|
|
'union' => $union['UnionCard'],
|
|||
|
|
'init' => $init,
|
|||
|
|
'cz' => intval($fk_rec),
|
|||
|
|
'day' => intval($fk_day),
|
|||
|
|
'month' => intval($fk_month),
|
|||
|
|
'jhz' => intval($fk_jhz)
|
|||
|
|
];
|
|||
|
|
$save_fk = $fk-$union['UnionCard'];
|
|||
|
|
}
|
|||
|
|
//<2F><>һ<EFBFBD><D2BB>UID
|
|||
|
|
$next = $db->fetch_one("select UnionID from QPTreasureDB.dbo.GameUnion where UnionID>'".$uid."' order by UnionID asc");
|
|||
|
|
if($next['UnionID']){
|
|||
|
|
$nid = $next['UnionID'];
|
|||
|
|
}else{
|
|||
|
|
$nid = 0;
|
|||
|
|
}
|
|||
|
|
if($error){
|
|||
|
|
$ers = $db->fetch_one("select * from ErrorUnion where UnionID='".$uid."' and Fk='".$save_fk."'");
|
|||
|
|
if(count($ers) == 0){
|
|||
|
|
//<2F><>¼<EFBFBD>쳣
|
|||
|
|
$db->insert("ErrorUnion",[
|
|||
|
|
'UnionID' => $uid,
|
|||
|
|
'Fk' => $save_fk,
|
|||
|
|
'Error' => json_encode($error)
|
|||
|
|
]);
|
|||
|
|
$ret = "error";
|
|||
|
|
}else{
|
|||
|
|
$ret = "fail";
|
|||
|
|
}
|
|||
|
|
if($GG['bk']){//<2F><><EFBFBD><EFBFBD>
|
|||
|
|
$db->update('QPTreasureDB.dbo.GameUnion',['UnionCard'=>($union['UnionCard']+$save_fk)],"UnionID='".$uid."'");
|
|||
|
|
$db->deldate("ErrorUnion","EUid='".$ers['EUid']."'");
|
|||
|
|
}
|
|||
|
|
if($GG['bw']){//<2F><>λ
|
|||
|
|
$db->update('QPTreasureDB.dbo.GameUnionInit',['UnionCard'=>($init-$save_fk)],"UnionID='".$uid."'");
|
|||
|
|
$db->deldate("ErrorUnion","EUid='".$ers['EUid']."'");
|
|||
|
|
}
|
|||
|
|
}else{
|
|||
|
|
$ret = "ok";
|
|||
|
|
}
|
|||
|
|
echo json_encode(['UnionID'=>$uid,'ret'=>$ret,'next'=>$nid]);
|
|||
|
|
if($GG['bk'] || $GG['bw']){
|
|||
|
|
echo "<script>location.href='jcgh.php';</script>";
|
|||
|
|
}
|
|||
|
|
}else{
|
|||
|
|
$ppxq -> assign('uid',$db->fetch_abc("select UnionID from QPTreasureDB.dbo.GameUnion order by UnionID asc"));
|
|||
|
|
$ppxq -> assign('count',$db->fetch_abc("select count(*) from QPTreasureDB.dbo.GameUnion"));
|
|||
|
|
$ppxq -> display('user/jcgh_star.tpl');
|
|||
|
|
$db->close();
|
|||
|
|
unset($GG,$ppxq,$db);
|
|||
|
|
}
|
|||
|
|
?>
|