From 2b99b8279ebaf796d3da7aba65555f6c067f0129 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Wed, 26 Jul 2023 15:57:47 +0800 Subject: [PATCH 1/4] 1 --- webapp/controller/RestApiController.class.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/webapp/controller/RestApiController.class.php b/webapp/controller/RestApiController.class.php index 25e83803..94c948d8 100644 --- a/webapp/controller/RestApiController.class.php +++ b/webapp/controller/RestApiController.class.php @@ -21,7 +21,7 @@ class RestApiController extends BaseController { } } } - + /* https://game2006api.cebggame.com/api/nft/$netId/$nftType/$tokenId $netId: 链id(网络id) @@ -63,25 +63,36 @@ class RestApiController extends BaseController { )); $randAttr = emptyReplace(json_decode($heroDb['rand_attr'], true), array()); foreach ($randAttr as $attr){ + switch ($attr['quality']){ + case 1 : $quality = "D";break; + case 2 : $quality = "C";break; + case 3 : $quality = "B";break; + case 4 : $quality = "A";break; + case 5 : $quality = "S";break; + default : $quality = ""; + } switch ($attr['attr_id']){ case kHAT_Hp : { array_push($info['attributes'],array( "trait_type" => "Hp", - "value" => intval($attr['val']), +// "value" => intval($attr['val']), + "value" => $quality, )); } break; case kHAT_Atk : { array_push($info['attributes'],array( "trait_type" => "Atk", - "value" => intval($attr['val']), +// "value" => intval($attr['val']), + "value" => $quality, )); } break; case kHAT_Def : { array_push($info['attributes'],array( "trait_type" => "Def", - "value" => intval($attr['val']), +// "value" => intval($attr['val']), + "value" => $quality, )); } } From 3c9415cfa729f1d3a1ce18baf7b39d2cb988f5f5 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Thu, 27 Jul 2023 18:05:03 +0800 Subject: [PATCH 2/4] 1 --- .../controller/BaseAuthedController.class.php | 6 +++ webapp/services/LogService.php | 43 +++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index c8a63855..79ce9421 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -1,5 +1,6 @@ addItem($item['item_id'], $item['item_num']); } @@ -572,6 +576,8 @@ class BaseAuthedController extends BaseController { public function _decItems($items) { foreach ($items as $item) { + //道具消耗埋点 + LogService::consumeItem($item); if ($this->_isVirtualItem($item['item_id'])) { $this->_decVirtualItem($item['item_id'], $item['item_num']); } else { diff --git a/webapp/services/LogService.php b/webapp/services/LogService.php index bb06f526..9f822d14 100644 --- a/webapp/services/LogService.php +++ b/webapp/services/LogService.php @@ -116,6 +116,35 @@ class LogService extends BaseService 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']; + + $logInfo['properties'] = array_merge($data,$param); + + TGLog::writeToLog(self::PRONAME,self::GAMEID,$logInfo); + } + + public static function productItem($event,$param = []) + { + $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']; + + $logInfo['properties'] = array_merge($data,$param); + TGLog::writeToLog(self::PRONAME,self::GAMEID,$logInfo); + } + private static function userInfo() { @@ -188,4 +217,18 @@ class LogService extends BaseService ]; return $data; } + + private static function ItemRecord(){ + $data = [ + "#account_id" => myself()->_getAccountId(), + "#event_name"=> "item_record", + "#ip"=> $_SERVER['REMOTE_ADDR'], + "#controller"=> getReqVal('c', ''), + "#artion"=> getReqVal('a', ''), + "#time"=> myself()->_getNowTime(), + "#type"=> "track", + "properties"=>'' + ]; + return $data; + } } From e51f7dde6f151c5e3d9c7e10f4c4a353b2087436 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Thu, 27 Jul 2023 18:47:33 +0800 Subject: [PATCH 3/4] 1 --- webapp/controller/UserController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 67f35d87..258c6ada 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -883,7 +883,7 @@ class UserController extends BaseAuthedController { 'level' => 1, 'exp' => 0, 'last_season_id' => $currSeasonMeta ? $currSeasonMeta['id'] : 0, - 'score_modifytime' => $this->_getNowTime(), + 'score_modifytime' => 0, 'best_rank_modifytime' => $this->_getNowTime(), 'createtime' => $this->_getNowTime(), 'modifytime' => $this->_getNowTime(), From 6122f366820e8a4703b953cfa1077bb98d2496e7 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Thu, 27 Jul 2023 19:07:18 +0800 Subject: [PATCH 4/4] 1 --- webapp/controller/UserController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 258c6ada..67f35d87 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -883,7 +883,7 @@ class UserController extends BaseAuthedController { 'level' => 1, 'exp' => 0, 'last_season_id' => $currSeasonMeta ? $currSeasonMeta['id'] : 0, - 'score_modifytime' => 0, + 'score_modifytime' => $this->_getNowTime(), 'best_rank_modifytime' => $this->_getNowTime(), 'createtime' => $this->_getNowTime(), 'modifytime' => $this->_getNowTime(),