工会web
This commit is contained in:
94
GonghuiWeb/www/adminxx/user/jcgh_star.php
Normal file
94
GonghuiWeb/www/adminxx/user/jcgh_star.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?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");
|
||||
//初始化记录
|
||||
/*
|
||||
$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);
|
||||
//记录放卡异常
|
||||
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'];
|
||||
}
|
||||
//下一个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){
|
||||
//记录异常
|
||||
$db->insert("ErrorUnion",[
|
||||
'UnionID' => $uid,
|
||||
'Fk' => $save_fk,
|
||||
'Error' => json_encode($error)
|
||||
]);
|
||||
$ret = "error";
|
||||
}else{
|
||||
$ret = "fail";
|
||||
}
|
||||
if($GG['bk']){//补卡
|
||||
$db->update('QPTreasureDB.dbo.GameUnion',['UnionCard'=>($union['UnionCard']+$save_fk)],"UnionID='".$uid."'");
|
||||
$db->deldate("ErrorUnion","EUid='".$ers['EUid']."'");
|
||||
}
|
||||
if($GG['bw']){//补位
|
||||
$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);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user