recharge present

This commit is contained in:
yangduo 2024-12-31 16:22:36 +08:00
parent 78dc2ee5f3
commit 98b1abbd12
2 changed files with 70 additions and 2 deletions

View File

@ -337,4 +337,15 @@ CREATE TABLE `draw` (
PRIMARY KEY (`idx`),
UNIQUE KEY `accountid_drawid` (`accountid`, `id`)
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `recharge`;
CREATE TABLE `recharge` (
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`accountid` varchar(60) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '账号id',
`first_data` mediumblob COMMENT '首充数据',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `accountid` (`accountid`)
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- Dump completed on 2015-08-19 18:51:22

View File

@ -121,7 +121,63 @@ class RechargeController{
return;
}
$diamond_num = $userrow['diamond_num'] + $diamonds;
$diamond_present = 0;
$shopgoods_conf = metatable\getShopGoodsConf();
if ($shopgoods_conf) {
$goodsid = 0;
for ($i = 1; $i <= count($shopgoods_conf); $i++) {
if ($diamonds < $shopgoods_conf[$i]['item_num']) {
continue;
}
if ($shopgoods_conf[$i]['first_present'] > $diamond_present) {
$diamond_present = $shopgoods_conf[$i]['first_present'];
$goodsid = $shopgoods_conf[$i]['shop_id'];
}
}
if ($goodsid > 0 && $diamond_present > 0) {
$rechargerow = $conn->execQueryOne(
'SELECT first_data FROM recharge WHERE accountid=:accountid;',
array(
':accountid' => $account_id
)
);
if (!$rechargerow) {
$ret = $conn->execScript('INSERT INTO recharge(accountid, first_data, create_time, modify_time) ' .
' VALUES(:account_id, :first_data, :create_time, :modify_time) ' .
' ON DUPLICATE KEY UPDATE accountid=:account_id, first_data=:first_data, modify_time=:modify_time;',
array(
':account_id' => $account_id,
':first_data' => $goodsid,
':create_time' => time(),
':modify_time' => time()
));
} else {
$firstlist = explode(',', $rechargerow['first_data']);
$firstrecharge = true;
for ($i = 0; $i < count($firstlist); $i++) {
if ($firstlist[$i] == $goodsid) {
$firstrecharge = false;
}
}
if ($firstrecharge) {
$ret = $conn->execScript('UPDATE recharge SET first_data=:first_data, modify_time=:modify_time' .
' WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
':first_data' => $rechargerow['first_data'].','.$goodsid,
':modify_time' => time()
));
} else {
$diamond_present = 0;
}
}
}
}
$diamond_num = $userrow['diamond_num'] + $diamonds + $diamond_present;
$ret = $conn->execScript('UPDATE user SET diamond_num=:diamond_num' .
' WHERE accountid=:accountid;',
@ -139,7 +195,8 @@ class RechargeController{
'errcode' => $response['errcode'],
'errmsg'=> $response['errmsg'],
'order_id' => $response['order_id'],
'diamond_nums' => $diamond_num
'diamond_nums' => $diamond_num,
'diamond_present' => $diamond_present
));
}
}