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/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, )); } } 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; + } }