This commit is contained in:
aozhiwei 2024-04-28 21:48:53 +08:00
commit ed9948048d
18 changed files with 171 additions and 155 deletions

View File

@ -11,7 +11,7 @@ LABEL description="This is custom Docker Image for \
# 6 70
RUN apt update
RUN apt install -y tzdata
RUN apt install -y net-tools curl iputils-ping vim mariadb-client redis php php-fpm php-pdo php-mysql php-redis php-mbstring
RUN apt install -y net-tools curl iputils-ping vim mariadb-client redis php php-fpm php-pdo php-mysql php-redis php-mbstring php7.4-curl
ENV SERVER_ENV=TEST
#php-pecl-libsodium
#RUN sh -c '/bin/echo -e "\n6\n70" | apt install -y net-tools iputils-ping mariadb-client php php-fpm'

View File

@ -148,14 +148,6 @@ class AvatarController extends BaseAuthedController {
return;
}
$this->_decItems($costItems);
{
//埋点
$event = [
'name' => LogService::BUY_HERO_AVATAR,
'val' => $itemMeta['diamond']
];
LogService::consumeDiamond($event);
}
Avatar::addAvatar($itemMeta);
$propertyChgService = new services\PropertyChgService();
$propertyChgService->addUserChg();

View File

@ -218,15 +218,9 @@ class BagController extends BaseAuthedController {
'item_num' => mt\Parameter::getVal('rename_diamond_cost', 0)
)
));
{
//埋点
$event = [
'name' => LogService::USER_RENAME,
'val' => mt\Parameter::getVal('rename_diamond_cost', 0)
];
LogService::consumeDiamond($event);
myself()->_incV(TN_TOTAL_DIAMOND_CONSUME, 0, mt\Parameter::getVal('rename_diamond_cost', 0));
}
myself()->_incV(TN_TOTAL_DIAMOND_CONSUME, 0, mt\Parameter::getVal('rename_diamond_cost', 0));
$this->propertyChgService->addUserChg();
} else {
$this->_decItems(array(
@ -384,7 +378,8 @@ class BagController extends BaseAuthedController {
private function openBattleBox($itemDb,$itemMeta,$itemNum){
$lootMeta = mt\LootConfig::find($itemMeta['loot']);
if ($lootMeta['isAffected']){
$lucky = Hero::getAccountLucky(myself()->_getAddress());
// $lucky = Hero::getAccountLucky(myself()->_getAddress());
$lucky = Hero::getAccountLuckyTemp();
$luckyParam = \mt\Parameter::getVal('economy_account_luck_K',0);
$luckyMaxPro = \mt\Parameter::getVal('economy_account_luck_E',0);
$prob = $luckyMaxPro * ($lucky / ($lucky+$luckyParam));
@ -492,6 +487,15 @@ class BagController extends BaseAuthedController {
Hero::recoverUsedTime($heroUniId);
$this->propertyChgService->addBagChg();
$this->propertyChgService->addHeroChg();
$event = array(
'ID' => 'hero',
'SUB_ID' => 'restore',
'SUB_KEY' => 'hero_restore',
'before' => $heroDb,
'result' => 1,
'after' => Hero::find($heroUniId),
);
LogService::burialPointEvent($event);
$this->_rspData(array(
'property_chg' => $this->propertyChgService->toDto(),
));
@ -527,6 +531,15 @@ class BagController extends BaseAuthedController {
));
$this->propertyChgService->addBagChg();
$this->propertyChgService->addHeroChg();
$event = array(
'ID' => 'hero',
'SUB_ID' => 'lock',
'SUB_KEY' => 'hero_lock',
'before' => $heroDb,
'result' => 1,
'after' => Hero::find($heroUniId),
);
LogService::burialPointEvent($event);
$this->_rspData(array(
'property_chg' => $this->propertyChgService->toDto(),
));
@ -558,6 +571,10 @@ class BagController extends BaseAuthedController {
$this->_decItems($costItems);
Bag::addItem(V_ITEM_GOLDS,1);
$this->awardService->addItem(V_ITEM_GOLDS, 1);
$outcome = array(
'item_id' => V_ITEM_GOLDS,
'item_num' => 1,
);
}
break;
case V_ITEM_GOLDBRICK :{
@ -575,9 +592,14 @@ class BagController extends BaseAuthedController {
$this->_decItems($costItems);
Bag::addItem(V_ITEM_GOLDBRICK,1);
$this->awardService->addItem(V_ITEM_GOLDBRICK, 1);
$outcome = array(
'item_id' => V_ITEM_GOLDBRICK,
'item_num' => 1,
);
}
break;
default:{
$outcome = array();
$this->_rspErr(1,"param error");
return ;
}
@ -585,6 +607,14 @@ class BagController extends BaseAuthedController {
$propertyChgService = new services\PropertyChgService();
$propertyChgService->addUserChg();
$propertyChgService->addBagChg();
$event = array(
'ID' => 'gold',
'SUB_ID' => 'synthesis',
'SUB_KEY' => 'gold_synthesis',
'cost_gold' => $costItems,
'outcome' => $outcome,
);
LogService::burialPointEvent($event);
$this->_rspData(array(
'award' => $this->awardService->toDto(),
'property_chg' => $propertyChgService->toDto(),

View File

@ -212,12 +212,6 @@ class DailySelectionController extends BaseAuthedController {
LogService::consumeGold($event);
}
break;
case mt\Shop::TOKEN_TYPE_DIAMOND:
{
LogService::consumeDiamond($event);
myself()->_incV(TN_TOTAL_DIAMOND_CONSUME, 0, $costItems[0]['item_num']);
}
break;
default:
{
break;

View File

@ -117,8 +117,28 @@ class FragmentController extends BaseAuthedController
// }else{
Hero::addSyntheticHero($heroMeta,$itemMeta['quality']);
$lastIdx = SqlHelper::getLastInsertId( myself()->_getSelfMysql());
$heroInfo = Hero::toDto(Hero::find($lastIdx));
// }
}
$event = array(
'ID' => 'hero',
'SUB_ID' => 'synthesis',
'SUB_KEY' => 'hero_synthesis',
'cost_fragment' => array(
'item_id' => $itemId,
'item_num' => $itemNum,
'item_quality' => $itemMeta['quality'],
),
'cost_gold' => array(
'item_id' => V_ITEM_GOLD,
'item_num' => $manufactureMeta['gold']
),
'chance' => $weight,
'result' => $status,
'outcome_hero' => isset($heroInfo) ? $heroInfo : array(),
);
LogService::burialPointEvent($event);
$this->_rspData(array(
'item_id' => $heroMeta['id'],
'status' => $status,
@ -181,7 +201,27 @@ class FragmentController extends BaseAuthedController
$status = 1;
Chip::addSyntheticChip($chipMeta,$itemMeta['quality']);
$propertyChgService->addChip();
$lastIdx = SqlHelper::getLastInsertId( myself()->_getSelfMysql());
$chipInfo = Chip::toDto(Chip::find($lastIdx));
}
$event = array(
'ID' => 'chip',
'SUB_ID' => 'synthesis',
'SUB_KEY' => 'chip_synthesis',
'cost_fragment' => array(
'item_id' => $itemId,
'item_num' => $itemNum,
'item_quality' => $itemMeta['quality'],
),
'cost_gold' => array(
'item_id' => V_ITEM_GOLD,
'item_num' => $manufactureMeta['gold']
),
'chance' => $weight,
'result' => $status,
'outcome_chip' => isset($chipInfo) ? $chipInfo : array(),
);
LogService::burialPointEvent($event);
$this->_rspData(array(
'item_id' => $chipMeta['id'],
'status' => $status,

View File

@ -277,8 +277,38 @@ class HeroController extends BaseAuthedController {
'unseal_time' => $unseal_time_new,
'wealth_attr' => json_encode($attribute),
));
$heroNew = Hero::toDto(Hero::find($heroUniId));
$propertyChgService->addHeroChg();
$event = array(
'ID' => 'luck',
'SUB_ID' => 'change',
'SUB_KEY' => 'luck_change',
'change' => Hero::getAccountLuckyTemp(),
'reason' => 'hero_advanced',
);
LogService::burialPointEvent($event);
}
$itemMeta = \mt\Item::get($itemId);
$event = array(
'ID' => 'hero',
'SUB_ID' => 'advanced',
'SUB_KEY' => 'hero_advanced',
'cost_hero' => $heroDb,
'cost_fragment' => array(
'item_id' => $itemId,
'item_num' => $itemNum,
'item_quality' => $itemMeta['quality'],
),
'cost_gold' => array(
'item_id' => V_ITEM_GOLD,
'item_num' => $manufactureMeta['gold']
),
'chance' => $weight,
'result' => $status,
'outcome_hero' => isset($heroNew) ? $heroNew : array(),
);
LogService::burialPointEvent($event);
$this->_rspData(array(
'status' => $status,
'property_chg' => $propertyChgService->toDto(),
@ -302,6 +332,15 @@ class HeroController extends BaseAuthedController {
));
$propertyChgService = new services\PropertyChgService();
$propertyChgService->addHeroChg();
$event = array(
'ID' => 'hero',
'SUB_ID' => 'unlock',
'SUB_KEY' => 'hero_unlock',
'before' => $heroDb,
'result' => 1,
'after' => Hero::find($heroUniId),
);
LogService::burialPointEvent($event);
$this->_rspData(array(
'property_chg' => $propertyChgService->toDto(),
));

View File

@ -270,12 +270,6 @@ class PassController extends BaseAuthedController
return;
}
$this->_decItems($costItems);
//埋点
$event = [
'name' => LogService::BUY_BATTLE_PASS,
'val' => \mt\Parameter::getVal('battlepass_price', '')
];
LogService::consumeDiamond($event);
myself()->_incV(TN_TOTAL_DIAMOND_CONSUME, 0, \mt\Parameter::getVal('battlepass_price', ''));
//激活白金通行证状态
User::update(array(
@ -310,12 +304,6 @@ class PassController extends BaseAuthedController
return;
}
$this->_decItems($costItems);
//埋点
$event = [
'name' => LogService::BUY_PASS_EXP,
'val' => $celPrice
];
LogService::consumeDiamond($event);
myself()->_incV(TN_TOTAL_DIAMOND_CONSUME, 0, $celPrice);
//提升通行证等级
$items = array(

View File

@ -24,6 +24,7 @@ require_once('services/PropertyChgService.php');
require_once('services/SeasonService.php');
require_once('services/NameService.php');
require_once('services/ChipPageService.php');
require_once('services/LogService.php');
use phpcommon\SqlHelper;
use models\User;
@ -33,7 +34,7 @@ use models\SignLog;
use models\UserHonor;
use models\GlobalData;
use models\HeroPreset;
use services\LogService;
class UserController extends BaseAuthedController {
private $init_rank = 'rank_init_rank';
@ -72,6 +73,14 @@ class UserController extends BaseAuthedController {
}
$this->_updateLastSeason($userInfo);
$this->_sign();
$event = array(
'ID' => 'luck',
'SUB_ID' => 'change',
'SUB_KEY' => 'luck_change',
'change' => Hero::getAccountLuckyTemp(),
'reason' => 'login',
);
LogService::burialPointEvent($event);
$this->_rspData(array(
'info' => User::show($userInfo),
));
@ -568,7 +577,7 @@ class UserController extends BaseAuthedController {
}
$userInfo = User::Info($userDb);
{
$userInfo['total_lucky'] = Hero::getAccountLucky($userInfo['address']);
$userInfo['total_lucky'] = Hero::getAccountLuckyTemp();
$userInfo['admission_item_num'] = myself()->_getItemCount(900006, $userInfo);
}
$heroDb = Hero::findByAccountId(myself()->_getAccountId(), $heroUniId);

View File

@ -6,10 +6,12 @@ require_once('mt/Item.php');
require_once('mt/AttrHelper.php');
require_once('services/NftService.php');
require_once('services/LogService.php');
use mt;
use phpcommon\SqlHelper;
use services\NftService;
use services\LogService;
class Bag extends BaseModel {
@ -210,6 +212,16 @@ class Bag extends BaseModel {
if ($itemNum <= 0) {
return;
}
$event = array(
'ID' => 'Item',
'SUB_ID' => 'change',
'SUB_KEY' => 'Item_change',
'change' => array(
'item_id' => $itemId,
'item_num' => $itemNum
),
);
LogService::burialPointEvent($event);
$itemMeta = mt\Item::get($itemId);
if (!$itemMeta) {
return;
@ -260,6 +272,16 @@ class Bag extends BaseModel {
public static function decItem($itemId, $itemNum)
{
$event = array(
'ID' => 'Item',
'SUB_ID' => 'change',
'SUB_KEY' => 'Item_change',
'change' => array(
'item_id' => $itemId,
'item_num' => $itemNum
),
);
LogService::burialPointEvent($event);
SqlHelper::update
(myself()->_getSelfMysql(),
't_bag',

View File

@ -621,13 +621,16 @@ class Hero extends BaseModel {
'lock_type' => self::NO_LOCK,
'unlock_time' => 0,
'unlock_trade_time' => 0,
'activate' => $activate,
'activate_time' => $activate_time,
// 'activate' => $activate,
// 'activate_time' => $activate_time,
'wealth_attr' => json_encode($attribute),
'seal_type' => $seal_type,
'unseal_time' => $unseal_time,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
'activate' => 1,
'activate_time' => myself()->_getNowTime(),
);
if ($accountId) {
$fieldsKv['account_id'] = $accountId;

View File

@ -12,17 +12,9 @@ use models\User;
use phpcommon\TGLog;
class LogService extends BaseService
{
const USER_RENAME = "user_rename"; //用户改名
const HERO_LEVEL_UP = "hero_level_Up"; //英雄升级
const CHIP_LEVEL_UP = "chip_level_Up"; //芯片升级
const BUY_BATTLE_PASS = "buy_battle_pass"; //通行证购买
const BUY_PASS_EXP = "buy_pass_exp"; //购买通行证经验
const BUY_HERO_AVATAR = "buy_hero_avatar"; //购买英雄装饰
const REFRESH_MISSION = "refresh_mission"; //刷新每日任务
const SHOP_BUY_ITEM = "shop_buy_item_normal"; //商城购买物品
const REFRESH_MISSION = "refresh_mission"; //刷新每日任务
const SHOP_BUY_ITEM_DAILY = "shop_buy_item_daily"; //商城每日精选购买物品
const SHOP_BUY_ITEM_BLIND_BOX = "shop_buy_item_blind_box"; //商城限购购买物品
const CONSUME_TYPE = 0; //消耗 ↑
const PRODUCT_TYPE = 1; //产出 ↓
@ -32,10 +24,6 @@ class LogService extends BaseService
const BATTLE_PASS_AWARD = "battle_pass_award"; //通行证奖励
const SIGN_AWARD = "sign_award"; //签到奖励
const CEBG_TO_DIAMOND = "cebg_to_diamond"; //CEBG兑换钻石
const RECHARGE_DIAMOND = "recharge_diamond"; //充值钻石
const RECHARGE_CEBG_BONUS = "recarge_cebg_bonus"; //充值CEBG奖励
const MARKET_SELL_GOLD = "market_sell_gold"; //市场出售金币
const MARKET_CANCEL_SELL_GOLD = "market_cancel_sell_gold"; //市场取消出售金币
const MARKET_BUY_GOLD = "market_buy_gold"; //市场购买金币
@ -46,6 +34,12 @@ class LogService extends BaseService
const GOLD_TYPE = 0;
const DIAMOND_TYPE = 1;
public static function burialPointEvent($event){
$logInfo = self::ItemRecord();
$logInfo['properties'] = $event;
TGLog::writeToLog(self::PRONAME,self::GAMEID,$logInfo);
}
public static function consumeGold($event,$param = [])
{
$logInfo = self::goldRecord($param);
@ -61,21 +55,6 @@ class LogService extends BaseService
TGLog::writeToLog(self::PRONAME,self::GAMEID,$logInfo);
}
public static function consumeDiamond($event,$param = [])
{
$logInfo = self::diamondRecord(myself()->_getAccountId());
$data = self::userInfo();
$data['type'] = self::CONSUME_TYPE;
$data['event_name'] = $event['name'];
$data['event_type'] = self::DIAMOND_TYPE;
$data['event_demand'] = 'diamond';
$data['event_demand_val'] = $event['val'];
$logInfo['properties'] = array_merge($data,$param);
TGLog::writeToLog(self::PRONAME,self::GAMEID,$logInfo);
}
public static function productGold($event,$param = [])
{
$logInfo = self::goldRecord($param);
@ -103,28 +82,11 @@ class LogService extends BaseService
TGLog::writeToLog(self::PRONAME,self::GAMEID,$logInfo);
}
public static function productDiamondCallback($base, $event,$param = [])
{
$logInfo = self::diamondRecord($base['account_id']);
$data = self::userInfoByAccountId($base['account_id']);
$data['type'] = self::PRODUCT_TYPE;
$data['event_name'] = $event['name'];
$data['event_type'] = self::DIAMOND_TYPE;
$data['event_product'] = 'diamond';
$data['event_product_val'] = $event['val'];
$logInfo['properties'] = array_merge($data,$param);
TGLog::writeToLog(self::PRONAME,self::GAMEID,$logInfo);
}
public static function consumeItem($event,$param = [])
{
$logInfo = self::ItemRecord();
$data = self::userInfo();
$data['type'] = self::CONSUME_TYPE;
// $data['event_name'] = $event['name'];
// $data['event_type'] = self::GOLD_TYPE;
$data['item_id'] = $event['item_id'];
$data['item_num'] = $event['item_num'];
@ -138,8 +100,6 @@ class LogService extends BaseService
$logInfo = self::ItemRecord();
$data = self::userInfo();
$data['type'] = self::PRODUCT_TYPE;
// $data['event_name'] = $event['name'];
// $data['event_type'] = self::GOLD_TYPE;
$data['item_id'] = $event['item_id'];
$data['item_num'] = $event['item_num'];
@ -193,9 +153,6 @@ class LogService extends BaseService
} else {
$account_id = myself()->_getAccountId();
}
// $logInfo['log_class'] = $logInfo['log_class'];
// unset($logInfo['log_class']);
$data = array(
"#account_id" => $account_id,
"#event_name"=> "gold_record",
@ -207,19 +164,6 @@ class LogService extends BaseService
return $data;
}
private static function diamondRecord($account_id)
{
$data = [
"#account_id" => $account_id,
"#event_name"=> "diamond_record",
"#ip"=> $_SERVER['REMOTE_ADDR'],
"#time"=> myself()->_getNowTime(),
"#type"=> "track",
"properties"=>''
];
return $data;
}
private static function ItemRecord(){
$data = [
"#account_id" => myself()->_getAccountId(),

View File

@ -137,7 +137,8 @@ class RoomBattleDataService extends BaseService {
if ($mapModeMeta){
$baseGold = 0;
$gold = 0;
$accountLucky = Hero::getAccountLucky($userDb['address']);
// $accountLucky = Hero::getAccountLucky($userDb['address']);
$accountLucky = Hero::getAccountLuckyTemp();
$rewardMeta = mt\BattleReward::find($mapModeMeta['rewardMode'],$accountLucky);
if (!$rewardMeta){
return ;
@ -148,8 +149,8 @@ class RoomBattleDataService extends BaseService {
}
//金币模式检验
if ($this->mapMode == mt\MapMode::GOLD_MODE &&
($goldModeTimes >= $mapModeMeta['rewards_max_time'] )){
// (!Hero::verifyValid($heroDb) || $goldModeTimes >= $mapModeMeta['rewards_max_time'] )){
// ($goldModeTimes >= $mapModeMeta['rewards_max_time'] )){
(!Hero::verifyValid($heroDb) || $goldModeTimes >= $mapModeMeta['rewards_max_time'] )){
error_log("金币模式:出战英雄没有打金时间或每日打金场次上限");
}else{
if (!empty($rewardMeta['goldLoot'])){

View File

@ -720,7 +720,8 @@ class TameBattleDataService extends BaseService {
$mapModeMeta = mt\MapMode::findByMapMode($room_mode);
if ($mapModeMeta){
$gold = 0;
$accountLucky = Hero::getAccountLucky($userDb['address']);
// $accountLucky = Hero::getAccountLucky($userDb['address']);
$accountLucky = Hero::getAccountLuckyTemp();
$rewardMeta = mt\BattleReward::find($mapModeMeta['rewardMode'],$accountLucky);
if (!$rewardMeta){
return ;

View File

@ -85,13 +85,6 @@ class BuyShopGoodsCbService
}
error_log("callback buynormal address: $address, order_id: $order_id, goods_id: $item_id, goods_num: $item_num");
if ($item_id == V_ITEM_DIAMOND) {
$event = [
'name' => LogService::CEBG_TO_DIAMOND,
'val' => $item_num
];
LogService::productDiamondCallback(['account_id' => $account_id], $event);
}
$this->_addGoods($address, array(
'goods_id' => $item_id,

View File

@ -91,15 +91,6 @@ class GameItemMallBuyOk {
));
$itemId = $orderDb['item_id'];
$itemNum = $orderDb['item_num'];
if ($itemId == V_ITEM_DIAMOND) {
$event = [
'name' => LogService::CEBG_TO_DIAMOND,
'val' => $itemNum
];
LogService::productDiamondCallback(
['account_id' => $accountId],
$event);
}
$itemService->addItemByAccountId($accountId, $itemId, $itemNum);
myself()->_addLogEx($accountId, "shopBuyNormal", "end", array(
'param1' => $orderDb['order_id'],

View File

@ -130,12 +130,6 @@ class InAppPurchase {
$itemNum = $goodsMeta['item_num'];
if ($itemId == V_ITEM_DIAMOND) {
InAppRecord::addAmountOk($orderDb['account_id'], $orderDb['price']);
$event = [
'name' => LogService::RECHARGE_DIAMOND,
'val' => $itemNum
];
error_log('InAppPurchase senditem ' . $itemId . ' ' . $itemNum);
LogService::productDiamondCallback(['account_id' => $orderDb['account_id']], $event);
$addItemService = new ShopAddItemService();
$addItemService->addItemByAccountId($orderDb['account_id'], $itemId, $itemNum);
myself()->_addLogEx($orderDb['account_id'], 'InAppPurchase', 'ok',

View File

@ -83,15 +83,6 @@ class OutAppPurchase {
$itemMeta = mt\Item::get($itemId);
if ($itemMeta && $itemNum > 0) {
if ($itemId == V_ITEM_DIAMOND) {
$event = [
'name' => LogService::RECHARGE_CEBG_BONUS,
'val' => $itemNum
];
LogService::productDiamondCallback(
array(
'account_id' => $orderDb['account_id']
),
$event);
$addItemService = new ShopAddItemService();
$addItemService->addItemByAccountId($orderDb['account_id'], $itemId, $itemNum);
} else {

View File

@ -125,14 +125,6 @@ class ShopInappPurchaseDiamonds
return;
}
if ($item_id == V_ITEM_DIAMOND) {
$event = [
'name' => LogService::RECHARGE_DIAMOND,
'val' => $item_num
];
LogService::productDiamondCallback(['account_id' => $account_id], $event);
}
$this->_addGoods($address, array(
'goods_id' => $item_id,
'goods_num' => $item_num,
@ -177,14 +169,6 @@ class ShopInappPurchaseDiamonds
return;
}
if ($item_id == V_ITEM_DIAMOND) {
$event = [
'name' => LogService::RECHARGE_DIAMOND,
'val' => -$item_num
];
LogService::productDiamondCallback(['account_id' => $account_id], $event);
}
$this->_decGoods($address, array(
'goods_id' => $item_id,
'goods_num' => $item_num,