1
This commit is contained in:
parent
fc3aabebb6
commit
5b4e6113d1
@ -1442,6 +1442,7 @@ CREATE TABLE `t_ingame_mall` (
|
|||||||
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品itemId',
|
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品itemId',
|
||||||
`item_num` bigint NOT NULL DEFAULT '0' COMMENT '物品数量',
|
`item_num` bigint NOT NULL DEFAULT '0' COMMENT '物品数量',
|
||||||
`price` bigint NOT NULL DEFAULT '0' COMMENT '价格',
|
`price` bigint NOT NULL DEFAULT '0' COMMENT '价格',
|
||||||
|
`unit_price` decimal(10, 2) NOT NULL DEFAULT '0' COMMENT '单价',
|
||||||
`status` int(11) NOT NULL DEFAULT '0' COMMENT 'status',
|
`status` int(11) NOT NULL DEFAULT '0' COMMENT 'status',
|
||||||
`buyer` varchar(60) NOT NULL DEFAULT '' COMMENT '购买成功者',
|
`buyer` varchar(60) NOT NULL DEFAULT '' COMMENT '购买成功者',
|
||||||
`buy_ok_time` int(11) NOT NULL DEFAULT '0' COMMENT '购买成功时间',
|
`buy_ok_time` int(11) NOT NULL DEFAULT '0' COMMENT '购买成功时间',
|
||||||
@ -1867,3 +1868,18 @@ CREATE TABLE `t_gold_bullion_return` (
|
|||||||
UNIQUE KEY `idx_token_id_net_id` (`token_id`, `net_id`)
|
UNIQUE KEY `idx_token_id_net_id` (`token_id`, `net_id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `t_server_task_battle_count`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
|
CREATE TABLE `t_server_task_battle_count` (
|
||||||
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
|
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id',
|
||||||
|
`period` int(11) NOT NULL DEFAULT '0' COMMENT '周期',
|
||||||
|
`state` int(11) NOT NULL DEFAULT '0' COMMENT '1:总计数 2:循环计数',
|
||||||
|
`val` bigint(20) NOT NULL DEFAULT '0' COMMENT 'val',
|
||||||
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
|
PRIMARY KEY (`idx`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
25
sql/gamedb2006_migrate_240710_01.sql
Normal file
25
sql/gamedb2006_migrate_240710_01.sql
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `t_hero_skin`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
|
CREATE TABLE `t_hero_skin` (
|
||||||
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
|
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id',
|
||||||
|
`skin_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄皮肤id',
|
||||||
|
`hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄id',
|
||||||
|
`skin_state` int(11) NOT NULL DEFAULT '0' COMMENT '英雄皮肤状态 0=封装,1=解封',
|
||||||
|
`get_from` int(11) NOT NULL DEFAULT '0' COMMENT '获得方式 0 = 系统赠送 1 = 金币购买',
|
||||||
|
`consume_num` int(11) NOT NULL DEFAULT '0' COMMENT '消耗货币的具体数量',
|
||||||
|
`try_expire_at` int(11) NOT NULL DEFAULT '0' COMMENT '试用截止时间',
|
||||||
|
`rand_attr` mediumblob COMMENT '随机属性',
|
||||||
|
`wealth_attr` mediumblob COMMENT '财富值属性',
|
||||||
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
|
PRIMARY KEY (`idx`),
|
||||||
|
UNIQUE KEY `account_id_skinid` (`account_id`, `skin_id`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
|
||||||
|
insert into version (version) values(2024052101);
|
||||||
|
|
||||||
|
commit;
|
18
sql/gamedb2006_migrate_240711_01.sql
Normal file
18
sql/gamedb2006_migrate_240711_01.sql
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
alter table t_ingame_mall add column `unit_price` decimal(10, 2) NOT NULL DEFAULT '0' COMMENT '单价';
|
||||||
|
|
||||||
|
CREATE TABLE `t_server_task_battle_count` (
|
||||||
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
|
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id',
|
||||||
|
`period` int(11) NOT NULL DEFAULT '0' COMMENT '周期',
|
||||||
|
`state` int(11) NOT NULL DEFAULT '0' COMMENT '1:总计数 2:循环计数',
|
||||||
|
`val` bigint(20) NOT NULL DEFAULT '0' COMMENT 'val',
|
||||||
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
|
PRIMARY KEY (`idx`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
|
||||||
|
insert into version (version) values(2024052101);
|
||||||
|
|
||||||
|
commit;
|
@ -83,7 +83,7 @@ class InGameMallController extends BaseAuthedController {
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
$orderBy = 'ORDER BY length(price) ' . $orderAsc . ', price ' . $orderAsc;
|
$orderBy = 'ORDER BY length(unit_price) ' . $orderAsc . ', unit_price ' . $orderAsc;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -557,7 +557,8 @@ EOD;
|
|||||||
myself()->_rspErr(1, 'Not the seller');
|
myself()->_rspErr(1, 'Not the seller');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
InGameMall::modifyPrice($orderId, $priceBn);
|
$unitPrice = $priceBn / $goodsDb['item_num'];
|
||||||
|
InGameMall::modifyPrice($orderId, $priceBn,$unitPrice);
|
||||||
myself()->_rspOk();
|
myself()->_rspOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -576,7 +577,7 @@ EOD;
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
$orderBy = 'ORDER BY length(price) ' . $orderAsc . ', price ' . $orderAsc;
|
$orderBy = 'ORDER BY length(unit_price) ' . $orderAsc . ', unit_price ' . $orderAsc;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -622,7 +623,7 @@ EOD;
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
$orderBy = 'ORDER BY length(price) ' . $orderAsc . ', price ' . $orderAsc;
|
$orderBy = 'ORDER BY length(unit_price) ' . $orderAsc . ', unit_price ' . $orderAsc;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -46,13 +46,14 @@ class InGameMall extends BaseModel {
|
|||||||
'item_num' => $itemNum,
|
'item_num' => $itemNum,
|
||||||
'price' => $price,
|
'price' => $price,
|
||||||
'order1' => $orderField,
|
'order1' => $orderField,
|
||||||
|
'unit_price' => $price/$itemNum,
|
||||||
'last_modify_price_time' => myself()->_getNowTime(),
|
'last_modify_price_time' => myself()->_getNowTime(),
|
||||||
'createtime' => myself()->_getNowTime(),
|
'createtime' => myself()->_getNowTime(),
|
||||||
'modifytime' => myself()->_getNowTime(),
|
'modifytime' => myself()->_getNowTime(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function modifyPrice($orderId, $price)
|
public static function modifyPrice($orderId, $price,$unitPrice)
|
||||||
{
|
{
|
||||||
SqlHelper::update
|
SqlHelper::update
|
||||||
(myself()->_getMysql(''),
|
(myself()->_getMysql(''),
|
||||||
@ -62,6 +63,7 @@ class InGameMall extends BaseModel {
|
|||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'price' => $price,
|
'price' => $price,
|
||||||
|
'unit_price' => $unitPrice,
|
||||||
'last_modify_price_time' => myself()->_getNowTime(),
|
'last_modify_price_time' => myself()->_getNowTime(),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
70
webapp/models/ServerTaskBattleCount.php
Normal file
70
webapp/models/ServerTaskBattleCount.php
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace models;
|
||||||
|
|
||||||
|
use mt;
|
||||||
|
use phpcommon\SqlHelper;
|
||||||
|
class ServerTaskBattleCount extends BaseModel
|
||||||
|
{
|
||||||
|
const TOTAL_COUNT = 1; //总计数
|
||||||
|
const LOOP_COUNT = 2; //循环计数
|
||||||
|
|
||||||
|
public static function getV($period, $state, $defVal = 0)
|
||||||
|
{
|
||||||
|
$valData = self::internalGetV($period, $state, $defVal);
|
||||||
|
return $valData['val'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setV($period, $state, $defVal)
|
||||||
|
{
|
||||||
|
self::internalSetV($period, $state, $defVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function incV($period, $state, $val)
|
||||||
|
{
|
||||||
|
$oldVal = self::getV($period, $state);
|
||||||
|
self::internalSetV($period, $state, $oldVal + $val);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function internalGetV($period, $state, $defVal = 0){
|
||||||
|
$row = SqlHelper::ormSelectOne(
|
||||||
|
myself()->_getSelfMysql(),
|
||||||
|
't_server_task_battle_count',
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'period' => $period,
|
||||||
|
'state' => $state,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return array(
|
||||||
|
'val' => $row ? $row['val'] : $defVal,
|
||||||
|
'modifytime' => $row ? $row['modifytime'] : myself()->_getNowTime(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function internalSetV($period,$state, $val)
|
||||||
|
{
|
||||||
|
SqlHelper::upsert
|
||||||
|
(myself()->_getSelfMysql(),
|
||||||
|
't_server_task_battle_count',
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'period' => $period,
|
||||||
|
'state' => $state
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'val' => $val,
|
||||||
|
'modifytime' => myself()->_getNowTime()
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'period' => $period,
|
||||||
|
'state' => $state,
|
||||||
|
'val' => $val,
|
||||||
|
'createtime' => myself()->_getNowTime(),
|
||||||
|
'modifytime' => myself()->_getNowTime()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,10 @@
|
|||||||
namespace services;
|
namespace services;
|
||||||
|
|
||||||
require_once('mt/LootConfig.php');
|
require_once('mt/LootConfig.php');
|
||||||
|
require_once('mt/ServerTaskTime.php');
|
||||||
|
require_once('models/ServerTaskBattleCount.php');
|
||||||
|
|
||||||
|
use models\ServerTaskBattleCount;
|
||||||
use mt;
|
use mt;
|
||||||
|
|
||||||
class LootService
|
class LootService
|
||||||
@ -75,8 +78,13 @@ class LootService
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static function disposeDropContent4($lootMeta,&$depth,&$items) {
|
private static function disposeDropContent4($lootMeta,&$depth,&$items) {
|
||||||
$totalTimes = myself()->_getV(TN_TOTAL_LOOT_TIMES,0);
|
$serverTaskMeta = mt\ServerTaskTime::getCurrentTime();
|
||||||
$recycleTimes = myself()->_getV(TN_TOTAL_LOOT_TIMES,1);
|
$period = $serverTaskMeta?$serverTaskMeta['id']:0;
|
||||||
|
|
||||||
|
// $totalTimes = myself()->_getV(TN_TOTAL_LOOT_TIMES,0);
|
||||||
|
$totalTimes = ServerTaskBattleCount::getV($period,ServerTaskBattleCount::TOTAL_COUNT);
|
||||||
|
// $recycleTimes = myself()->_getV(TN_TOTAL_LOOT_TIMES,1);
|
||||||
|
$recycleTimes = ServerTaskBattleCount::getV(0,ServerTaskBattleCount::LOOP_COUNT);
|
||||||
$contentArr = explode("|",$lootMeta['content']);
|
$contentArr = explode("|",$lootMeta['content']);
|
||||||
$initTimes = $contentArr[0];
|
$initTimes = $contentArr[0];
|
||||||
$po = $contentArr[1];
|
$po = $contentArr[1];
|
||||||
@ -89,12 +97,15 @@ class LootService
|
|||||||
}
|
}
|
||||||
$p = min($po + ($recycleTimes-1) * $pd,$pm) * 100 ;
|
$p = min($po + ($recycleTimes-1) * $pd,$pm) * 100 ;
|
||||||
$rnd = rand(1,100);
|
$rnd = rand(1,100);
|
||||||
myself()->_incV(TN_TOTAL_LOOT_TIMES,0,1);
|
// myself()->_incV(TN_TOTAL_LOOT_TIMES,0,1);
|
||||||
|
ServerTaskBattleCount::incV($period,ServerTaskBattleCount::TOTAL_COUNT,1);
|
||||||
if ($rnd <= $p){
|
if ($rnd <= $p){
|
||||||
myself()->_setV(TN_TOTAL_LOOT_TIMES,1,1);
|
// myself()->_setV(TN_TOTAL_LOOT_TIMES,1,1);
|
||||||
|
ServerTaskBattleCount::setV(0,ServerTaskBattleCount::LOOP_COUNT,1);
|
||||||
self::disposeLootIndex($index1,$depth,$items);
|
self::disposeLootIndex($index1,$depth,$items);
|
||||||
}else{
|
}else{
|
||||||
myself()->_incV(TN_TOTAL_LOOT_TIMES,1,1);
|
// myself()->_incV(TN_TOTAL_LOOT_TIMES,1,1);
|
||||||
|
ServerTaskBattleCount::incV(0,ServerTaskBattleCount::LOOP_COUNT,1);
|
||||||
self::disposeLootIndex($index2,$depth,$items);
|
self::disposeLootIndex($index2,$depth,$items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user