解决UserController冲突

This commit is contained in:
hujiabin 2022-10-18 11:26:30 +08:00
commit c27b97ff4f
3 changed files with 36 additions and 11 deletions

View File

@ -40,11 +40,13 @@ class UserController extends BaseAuthedController {
$avatarUrl = '18003';
$userInfo = $this->_safeGetOrmUserInfo();
if (SERVER_ENV == _ONLINE) {
//测试服
if (!$userInfo) {
$this->createNewUserV2($userName);
$this->addChip(); //测试需要,上线要删除
$this->addFragmentBox(); //测试需要,上线要删除
$userInfo = $this->_getOrmUserInfo();
$this->_setV(TN_RANK_STATUS, 0, 1);
}
@ -59,6 +61,7 @@ class UserController extends BaseAuthedController {
if (!$userInfo) {
$this->createNewUser($userName, $avatarUrl);
$this->addChip(); //测试需要,上线要删除
$this->addFragmentBox(); //测试需要,上线要删除
$userInfo = $this->_getOrmUserInfo();
$this->_setV(TN_RANK_STATUS, 0, 1);
}
@ -72,6 +75,28 @@ class UserController extends BaseAuthedController {
));
$this->_incDailyV(TN_DAILY_LOGINS, 0, 1);
}
private function addFragmentBox(){
$items = array(
array(
'item_id' => V_ITEM_GOLD,
'item_num' => 10000
),array(
'item_id' => V_ITEM_DIAMOND,
'item_num' => 10000
),
);
$boxMeta=\mt\Item::getMetaListByType(15);
foreach ($boxMeta as $box){
array_push($items,array(
'item_id' => $box['id'],
'item_num' => 10
));
}
$awardService = new services\AwardService();
$propertyChgService = new services\PropertyChgService();
$this->_addItems($items,$awardService,$propertyChgService);
}
private function addChip(){
$list1 = [130001,130002,130003,130004,130005,130006,130007,130008,130009,130010];
@ -102,7 +127,7 @@ class UserController extends BaseAuthedController {
}
}
for ($i=16;$i<=30;$i++){
$itemId = $list2[rand(0,7)];
$itemId = $list2[rand(0,5)];
$itemMeta = mt\Item::get($itemId);
if ($itemMeta) {
$tokenType = Nft::getTokenType($itemMeta);

View File

@ -663,7 +663,7 @@ class BattleDataService extends BaseService {
{
$ranked = getReqVal('ranked', 0);
$kills = getReqVal('kills', 0);
$aliveTime = getReqVal('alive_time', 0);
$aliveTime = getReqVal('alive_time', 0)/1000;
$cond = (1 - ($ranked > 30 ? 1 : 0) *
($kills < 1 ? 1 : 0) *
($aliveTime < 30 ? 1 : 0));
@ -756,7 +756,7 @@ class BattleDataService extends BaseService {
{
$ranked = getReqVal('ranked', 0);
$kills = getReqVal('kills', 0);
$aliveTime = getReqVal('alive_time', 0);
$aliveTime = getReqVal('alive_time', 0)/1000;
$log_param = [
'battle_uniid' => getReqVal('battle_uniid', 0),
'match_mode' => getReqVal('match_mode', 0),

View File

@ -53,7 +53,7 @@ class LogService extends BaseService
$logInfo['properties'] = array_merge($data,$nft,$param);
TGLog::writeToLog(self::PRONAME,self::GAMEID,json_encode($logInfo));
TGLog::writeToLog(self::PRONAME,self::GAMEID,$logInfo);
}
public static function consumeCEC($event, $old_nft,$new_nft,$param = [])
@ -69,7 +69,7 @@ class LogService extends BaseService
$nft = self::nftInfo($old_nft,$new_nft);
$logInfo['properties'] = array_merge($data,$nft,$param);
TGLog::writeToLog(self::PRONAME,self::GAMEID,json_encode($logInfo));
TGLog::writeToLog(self::PRONAME,self::GAMEID,$logInfo);
}
public static function productCEG($event,$nft,$param = [])
@ -84,7 +84,7 @@ class LogService extends BaseService
$nftInfo = self::nftProductInfo($nft);
$logInfo['properties'] = array_merge($data,$nftInfo,$param);
TGLog::writeToLog(self::PRONAME,self::GAMEID,json_encode($logInfo));
TGLog::writeToLog(self::PRONAME,self::GAMEID,$logInfo);
}
public static function productFragment($event,$param = [])
@ -97,7 +97,7 @@ class LogService extends BaseService
$data['event_product_item_id'] = $event['item_id'];
$data['event_product_val'] = $event['number'];
$logInfo['properties'] = array_merge($data,$param);
TGLog::writeToLog(self::PRONAME,self::GAMEID,json_encode($logInfo));
TGLog::writeToLog(self::PRONAME,self::GAMEID,$logInfo);
}
public static function LevelUpOrQualityUp( $event, $old_nft,$new_nft)
@ -109,7 +109,7 @@ class LogService extends BaseService
$nft = self::nftInfo($old_nft,$new_nft);
$logInfo['properties'] = array_merge($data,$nft);
TGLog::writeToLog(self::PRONAME,self::GAMEID,json_encode($logInfo));
TGLog::writeToLog(self::PRONAME,self::GAMEID,$logInfo);
}
public static function fragmentSynth($event,$nft)
@ -123,7 +123,7 @@ class LogService extends BaseService
$data['nft_item_id'] = $nft['item_id'];
$data['nft_info'] = json_encode($nft);
$logInfo['properties'] = $data;
TGLog::writeToLog(self::PRONAME,self::GAMEID,json_encode($logInfo));
TGLog::writeToLog(self::PRONAME,self::GAMEID,$logInfo);
}
public static function ConsumableMaterial($event,$params)
@ -135,7 +135,7 @@ class LogService extends BaseService
$data['param'.($k+1)] = $v;
}
$logInfo['properties'] = $data;
TGLog::writeToLog(self::PRONAME,self::GAMEID,json_encode($logInfo));
TGLog::writeToLog(self::PRONAME,self::GAMEID,$logInfo);
}
private static function userInfo()
@ -200,4 +200,4 @@ class LogService extends BaseService
return $data;
}
}
}