record recharge
This commit is contained in:
parent
8302a392ce
commit
dcaab66a00
@ -343,6 +343,7 @@ CREATE TABLE `recharge` (
|
|||||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
`accountid` varchar(60) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '账号id',
|
`accountid` varchar(60) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '账号id',
|
||||||
`first_data` mediumblob COMMENT '首充数据',
|
`first_data` mediumblob COMMENT '首充数据',
|
||||||
|
`recharge_diamond` int(11) NOT NULL DEFAULT '0' COMMENT '累计充值钻石',
|
||||||
`present_diamond` int(11) NOT NULL DEFAULT '0' COMMENT '充值赠送钻石总量',
|
`present_diamond` int(11) NOT NULL DEFAULT '0' COMMENT '充值赠送钻石总量',
|
||||||
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
|
@ -126,8 +126,8 @@ class RechargeController
|
|||||||
|
|
||||||
$diamond_present = 0;
|
$diamond_present = 0;
|
||||||
$shopgoods_conf = metatable\getShopGoodsConf();
|
$shopgoods_conf = metatable\getShopGoodsConf();
|
||||||
if ($shopgoods_conf) {
|
|
||||||
$goodsid = 0;
|
$goodsid = 0;
|
||||||
|
if ($shopgoods_conf) {
|
||||||
for ($i = 1; $i <= count($shopgoods_conf); $i++) {
|
for ($i = 1; $i <= count($shopgoods_conf); $i++) {
|
||||||
if ($diamonds < $shopgoods_conf[$i]['item_num']) {
|
if ($diamonds < $shopgoods_conf[$i]['item_num']) {
|
||||||
continue;
|
continue;
|
||||||
@ -138,22 +138,24 @@ class RechargeController
|
|||||||
$goodsid = $shopgoods_conf[$i]['shop_id'];
|
$goodsid = $shopgoods_conf[$i]['shop_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($goodsid > 0 && $diamond_present > 0) {
|
|
||||||
$rechargerow = $conn->execQueryOne(
|
$rechargerow = $conn->execQueryOne(
|
||||||
'SELECT first_data FROM recharge WHERE accountid=:accountid;',
|
'SELECT first_data FROM recharge WHERE accountid=:accountid;',
|
||||||
array(
|
array(
|
||||||
':accountid' => $account_id
|
':accountid' => $account_id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$rechargerow) {
|
if (!$rechargerow) {
|
||||||
$ret = $conn->execScript(
|
$ret = $conn->execScript(
|
||||||
'INSERT INTO recharge(accountid, first_data, present_diamond, create_time, modify_time) ' .
|
'INSERT INTO recharge(accountid, first_data, recharge_diamond, present_diamond, create_time, modify_time) ' .
|
||||||
' VALUES(:account_id, :first_data, :present_diamond, :create_time, :modify_time) ' .
|
' VALUES(:account_id, :first_data, :recharge_diamond, :present_diamond, :create_time, :modify_time) ' .
|
||||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, first_data=:first_data, present_diamond=:present_diamond, modify_time=:modify_time;',
|
' ON DUPLICATE KEY UPDATE accountid=:account_id, first_data=:first_data, recharge_diamond=:recharge_diamond, present_diamond=:present_diamond, modify_time=:modify_time;',
|
||||||
array(
|
array(
|
||||||
':account_id' => $account_id,
|
':account_id' => $account_id,
|
||||||
':first_data' => $goodsid,
|
':first_data' => $goodsid,
|
||||||
|
':recharge_diamond' => $diamonds,
|
||||||
':present_diamond' => $diamond_present,
|
':present_diamond' => $diamond_present,
|
||||||
':create_time' => time(),
|
':create_time' => time(),
|
||||||
':modify_time' => time()
|
':modify_time' => time()
|
||||||
@ -168,22 +170,24 @@ class RechargeController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$firstdata = $rechargerow['first_data'];
|
||||||
if ($firstrecharge) {
|
if ($firstrecharge) {
|
||||||
|
$firstdata = $rechargerow['first_data'] . ',' . $goodsid;
|
||||||
|
} else {
|
||||||
|
$diamond_present = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$ret = $conn->execScript(
|
$ret = $conn->execScript(
|
||||||
'UPDATE recharge SET first_data=:first_data, present_diamond=:present_diamond, modify_time=:modify_time' .
|
'UPDATE recharge SET first_data=:first_data, recharge_diamond:=recharge_diamond, present_diamond=:present_diamond, modify_time=:modify_time' .
|
||||||
' WHERE accountid=:accountid;',
|
' WHERE accountid=:accountid;',
|
||||||
array(
|
array(
|
||||||
':accountid' => $account_id,
|
':accountid' => $account_id,
|
||||||
':first_data' => $rechargerow['first_data'] . ',' . $goodsid,
|
':first_data' => $firstdata,
|
||||||
|
':recharge_diamond' => $rechargerow['recharge_diamond'] + $diamonds,
|
||||||
':present_diamond' => $rechargerow['present_diamond'] + $diamond_present,
|
':present_diamond' => $rechargerow['present_diamond'] + $diamond_present,
|
||||||
':modify_time' => time()
|
':modify_time' => time()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
$diamond_present = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$diamond_num = $userrow['diamond_num'] + $diamonds + $diamond_present;
|
$diamond_num = $userrow['diamond_num'] + $diamonds + $diamond_present;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user