...
This commit is contained in:
parent
3e1df25d7f
commit
141398cfc0
@ -18,8 +18,29 @@ CREATE TABLE `t_bc_order` (
|
||||
UNIQUE KEY `order_id` (`order_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
insert into version (version) values(2023061901);
|
||||
|
||||
alter table t_shop_buy_order change `account_id` `address` VARCHAR(60) NOT NULL COMMENT '账户地址';
|
||||
alter table t_first_topup change `account_id` `address` VARCHAR(60) NOT NULL COMMENT '账户地址';
|
||||
|
||||
CREATE TABLE `t_shop_dailyselection` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`address` varchar(60) NOT NULL COMMENT 'address',
|
||||
`refresh_mode` int(11) NOT NULL COMMENT '0-每日自动刷新时间 1-手动刷新时间',
|
||||
`refresh_time` int(11) NOT NULL DEFAULT '0' COMMENT '刷新时间',
|
||||
`grid_1` int(11) NOT NULL,
|
||||
`grid_2` int(11) NOT NULL,
|
||||
`grid_3` int(11) NOT NULL,
|
||||
`grid_4` int(11) NOT NULL,
|
||||
`grid_5` int(11) NOT NULL,
|
||||
`grid_6` int(11) NOT NULL,
|
||||
`count_1` tinyint(4) NOT NULL,
|
||||
`count_2` tinyint(4) NOT NULL,
|
||||
`count_3` tinyint(4) NOT NULL,
|
||||
`count_4` tinyint(4) NOT NULL,
|
||||
`count_5` tinyint(4) NOT NULL,
|
||||
`count_6` tinyint(4) NOT NULL,
|
||||
PRIMARY KEY (`idx`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8;
|
||||
|
||||
insert into version (version) values(2023061901);
|
||||
|
||||
commit;
|
||||
|
@ -745,9 +745,19 @@ class ShopController extends BaseAuthedController
|
||||
|
||||
public function refreshDailySelection()
|
||||
{
|
||||
$account = $this->_getAccountId();
|
||||
$count = $this->countTodayRefreshTimes($account);
|
||||
$chk = $this->refreshDailySelectionWithMode($account, 1);
|
||||
$address = $this->_getAddress();
|
||||
if (empty($address)) {
|
||||
$this->_rspErr(2, 'address is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
$count = $this->countTodayRefreshTimes($address);
|
||||
if ($count >= 6) {
|
||||
$this->_rspErr(2, 'The maximum number of refreshes has been reached');
|
||||
return;
|
||||
}
|
||||
|
||||
$chk = $this->refreshDailySelectionWithMode($address, 1);
|
||||
if ($chk) {
|
||||
$this->_rspOk();
|
||||
}
|
||||
@ -755,15 +765,19 @@ class ShopController extends BaseAuthedController
|
||||
|
||||
public function getDailySelectionList()
|
||||
{
|
||||
$account = $this->_getAccountId();
|
||||
$address = $this->_getAddress();
|
||||
if (empty($address)) {
|
||||
$this->_rspErr(2, 'address is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
// 不清除过期的每日精选可以避免跨日操作错误
|
||||
// $chk = $this->clearBeforeTodayDailySelections();
|
||||
|
||||
$chk = $this->getTodayLastDailySelection($account);
|
||||
$chk = $this->getTodayLastDailySelection($address);
|
||||
if (!$chk) {
|
||||
$chk = $this->refreshDailySelectionWithMode($account, 0);
|
||||
$chk = $this->getTodayLastDailySelection($account);
|
||||
$chk = $this->refreshDailySelectionWithMode($address, 0);
|
||||
$chk = $this->getTodayLastDailySelection($address);
|
||||
}
|
||||
|
||||
$selection = $chk[0];
|
||||
@ -773,7 +787,7 @@ class ShopController extends BaseAuthedController
|
||||
$goodsList[$i]['count'] = $selection['count_' . $i];
|
||||
}
|
||||
|
||||
$count = $this->countTodayRefreshTimes($account);
|
||||
$count = $this->countTodayRefreshTimes($address);
|
||||
$costs = mt\Parameter::getByName('daily_selection_refresh_cost');
|
||||
$arrCosts = explode('|', $costs['param_value']);
|
||||
$cost = $arrCosts[$count];
|
||||
@ -789,7 +803,12 @@ class ShopController extends BaseAuthedController
|
||||
|
||||
public function buyGoodsDS()
|
||||
{
|
||||
$account = $this->_getAccountId();
|
||||
$address = $this->_getAddress();
|
||||
if (empty($address)) {
|
||||
$this->_rspErr(2, 'address is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
$idx = getReqVal('idx', 0);
|
||||
$grid = getReqVal('grid', 0);
|
||||
$count = getReqVal('count', 0);
|
||||
@ -805,7 +824,7 @@ class ShopController extends BaseAuthedController
|
||||
$params = array(
|
||||
'c' => 'GameItemMall',
|
||||
'a' => 'buy',
|
||||
'account' => $account,
|
||||
'address' => $address,
|
||||
'price' => 100,
|
||||
);
|
||||
if (!phpcommon\HttpClient::get($url, $params, $response)) {
|
||||
@ -855,7 +874,7 @@ class ShopController extends BaseAuthedController
|
||||
return $chk;
|
||||
}
|
||||
|
||||
private function countTodayRefreshTimes($account)
|
||||
private function countTodayRefreshTimes($address)
|
||||
{
|
||||
$self = myself();
|
||||
if (!$self) return;
|
||||
@ -864,14 +883,14 @@ class ShopController extends BaseAuthedController
|
||||
$nowTime = $this->_getNowTime();
|
||||
$dayTime = $this->_getDaySeconds($nowTime);
|
||||
|
||||
$sql = "SELECT COUNT(*) AS cnt FROM t_shop_dailyselection WHERE account_id = '$account' AND refresh_mode = 1 AND refresh_time >= $dayTime";
|
||||
$sql = "SELECT COUNT(*) AS cnt FROM t_shop_dailyselection WHERE address = '$address' AND refresh_mode = 1 AND refresh_time >= $dayTime";
|
||||
|
||||
$row = $conn->execQuery($sql);
|
||||
|
||||
return $row[0]['cnt'];
|
||||
}
|
||||
|
||||
private function getTodayLastDailySelection($account)
|
||||
private function getTodayLastDailySelection($address)
|
||||
{
|
||||
$self = myself();
|
||||
if (!$self) return;
|
||||
@ -880,14 +899,14 @@ class ShopController extends BaseAuthedController
|
||||
$nowTime = $this->_getNowTime();
|
||||
$dayTime = $this->_getDaySeconds($nowTime);
|
||||
|
||||
$sql = "SELECT * FROM t_shop_dailyselection WHERE account_id = '$account' AND refresh_time >= $dayTime ORDER BY idx DESC LIMIT 1";
|
||||
$sql = "SELECT * FROM t_shop_dailyselection WHERE address = '$address' AND refresh_time >= $dayTime ORDER BY idx DESC LIMIT 1";
|
||||
|
||||
$row = $conn->execQuery($sql);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
private function refreshDailySelectionWithMode($account, $mode)
|
||||
private function refreshDailySelectionWithMode($address, $mode)
|
||||
{
|
||||
$selection = $this->randomNewDailySelection();
|
||||
|
||||
@ -901,7 +920,7 @@ class ShopController extends BaseAuthedController
|
||||
$conn,
|
||||
't_shop_dailyselection',
|
||||
array(
|
||||
'account_id' => $account,
|
||||
'address' => $address,
|
||||
'refresh_mode' => $mode,
|
||||
'refresh_time' => $nowTime,
|
||||
'grid_1' => $selection[1]['id'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user