diff --git a/doc/AAMarket.py b/doc/AAMarket.py index 7fac3f90..555e04fd 100644 --- a/doc/AAMarket.py +++ b/doc/AAMarket.py @@ -10,7 +10,7 @@ class AAMarket(object): 'desc': '获取上架出售的NFTs(瀑布流式api) jwtheader为可选参数', 'group': '!AAMarket', 'url': 'https://market-test.kingsome.cn/api/market/product/list/:net_id', - 'headers': _common.JwtHeader, + 'headers': _common.MaybeJwtHeader, 'is_json_params': True, 'request_params': [ [':net_id', 0, '链id'], @@ -295,13 +295,14 @@ class AAMarket(object): 'name': '/api/user/:account_address', 'desc': '获取用户信息', 'group': '!AAMarket', + 'headers': _common.MaybeJwtHeader, 'url': 'https://market-test.kingsome.cn/api/user/:account_address', 'params': [ ], 'response': [ _common.RspHead(), ['nickname', '', '昵称'], - ['email', '', 'email'], + ['email', '', 'email(因为隐私问题jwt关联的地址和:account_address相等时才返回email)'], ['contribution_point', 0, '贡献点'], ['gold', '', '金币数'], ['diamond', '', '钻石数'], diff --git a/doc/_common.py b/doc/_common.py index 411fdea1..3a1592a3 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -26,6 +26,10 @@ JwtHeader = [ 'Authorization Bearer {JwtToken}' ] +MaybeJwtHeader = [ + 'Authorization Bearer {JwtToken} 可选参数' +] + LoginRequired = 'login required' class Union(object): diff --git a/webapp/controller/BigwheelController.class.php b/webapp/controller/BigwheelController.class.php index f2571f0e..bf6d5f28 100644 --- a/webapp/controller/BigwheelController.class.php +++ b/webapp/controller/BigwheelController.class.php @@ -67,11 +67,11 @@ class BigwheelController extends BaseAuthedController { } $priceInfo = $this->getPriceInfo($data['drawed_times']); if (empty($priceInfo)) { - myself()->_rspErr(500, 'server internal error'); + myself()->_rspErr(500, 'server internal error1'); return; } if ($priceInfo['cost_item_id'] != V_ITEM_DIAMOND) { - myself()->_rspErr(500, 'server internal error'); + myself()->_rspErr(500, 'server internal error2'); return; } $costItemNum = 0; @@ -280,8 +280,15 @@ class BigwheelController extends BaseAuthedController { ) )); } - $this->sendNotify($drop1[0]['item_id']); - $this->sendNotify($drop2[0]['item_id']); + myself()->_fireEvent('Bigwheel', 'onWinPrize', + array( + 'info' => $grid1, + 'drop' => $drop1 + ), + array( + 'info' => $grid2, + 'drop' => $drop2 + )); } public function buyS() @@ -437,47 +444,4 @@ class BigwheelController extends BaseAuthedController { return $priceInfo; } - private function sendNotify($itemId) - { - $itemMeta = myself()->_callMtStatic('Item', 'get', $itemId); - if (empty($itemMeta)) { - return; - } - $elements = array(); - array_push($elements, array( - 'ele_type' => 2, - 'color' => '#ffffff', - 'lang_key' => 'Marquee_rewards_get_1', - 'lang_params' => array(), - )); - array_push($elements, array( - 'ele_type' => 1, - //'color' => '#', - 'text' => myself()->_getUserInfo(array('name'))['name'], - )); - array_push($elements, array( - 'ele_type' => 2, - 'color' => '#ffffff', - 'lang_key' => 'Marquee_rewards_get_2', - 'lang_params' => array(), - )); - array_push($elements, array( - 'ele_type' => 2, - 'color' => '#ff3f3f', - 'lang_key' => $itemMeta['name'], - 'lang_params' => array(), - )); - array_push($elements, array( - 'ele_type' => 2, - 'color' => '#ffffff', - 'lang_key' => 'Marquee_rewards_get_3', - 'lang_params' => array(), - )); - error_log(json_encode($elements)); - $content = myself()->_callServiceStatic('NoticeService', 'buildCustom', $elements); - $loop = 1; - $interval = 1; - myself()->_callServiceStatic('NoticeService', 'send', $content, $loop, $interval); - } - } diff --git a/webapp/controller/HashRateController.class.php b/webapp/controller/HashRateController.class.php index 4d58df40..eb16f2dc 100644 --- a/webapp/controller/HashRateController.class.php +++ b/webapp/controller/HashRateController.class.php @@ -132,12 +132,12 @@ class HashRateController extends BaseAuthedController $rewardNum = $reward[0]['item_num']; HashRate::add($taskMeta['id'],$currentPeriod['id']); HashRate::rewardAdd($currentPeriod['id'],$rewardNum); - //刷新任务 - $refreshTimes = myself()->_getDailyV(TN_HASH_DAILY_REFRESH_TIMES,0); - $refreshTimesMax = \mt\Parameter::getVal('economy_account_compute_refresh_max',5); - if ($taskMeta['is_refresh'] == \mt\AchievementsPower::REFRESH_STATE && $refreshTimes < $refreshTimesMax){ - $this->hashRateService->refreshHashRateTask($taskMeta,$currentPeriod['id']); - } +// //刷新任务 +// $refreshTimes = myself()->_getDailyV(TN_HASH_DAILY_REFRESH_TIMES,0); +// $refreshTimesMax = \mt\Parameter::getVal('economy_account_compute_refresh_max',5); +// if ($taskMeta['is_refresh'] == \mt\AchievementsPower::REFRESH_STATE && $refreshTimes < $refreshTimesMax){ +// $this->hashRateService->refreshHashRateTask($taskMeta,$currentPeriod['id']); +// } $this->_rspData(array( 'award' => $reward, )); diff --git a/webapp/events/Bigwheel.php b/webapp/events/Bigwheel.php index be0cb50f..4a63dca0 100644 --- a/webapp/events/Bigwheel.php +++ b/webapp/events/Bigwheel.php @@ -5,12 +5,9 @@ namespace events; class Bigwheel { - public static function onWinBigPrize($data) + public static function onWinPrize($grid1, $grid2) { - //触发(调用)对应对该事件感兴趣的模块 - //myself()->_callServiceStatic('A', 'f1', $battleData); - //myself()->_callServiceStatic('B', 'f1', $battleData); - echo json_encode($data); + myself()->_callServiceStatic('BigwheelService', 'onWinPrize', $grid1, $grid2); } } diff --git a/webapp/events/Upgrade.php b/webapp/events/Upgrade.php index 4d2adf87..bda08725 100644 --- a/webapp/events/Upgrade.php +++ b/webapp/events/Upgrade.php @@ -6,12 +6,12 @@ namespace events; class Upgrade { - public static function onHeroUpgrade($params){ - myself()->_callServiceStatic('HashRateService', 'onUpLvHero', $params); + public static function onHeroUpgrade(){ + myself()->_callServiceStatic('HashRateService', 'onUpLvHero'); } - public static function onChipUpgrade($params){ - myself()->_callServiceStatic('HashRateService', 'onUpLvChip', $params); + public static function onChipUpgrade(){ + myself()->_callServiceStatic('HashRateService', 'onUpLvChip'); } diff --git a/webapp/models/HashRate.php b/webapp/models/HashRate.php index f038ae92..1ed8d793 100644 --- a/webapp/models/HashRate.php +++ b/webapp/models/HashRate.php @@ -3,6 +3,9 @@ namespace models; +require_once('mt/AchievementsPower.php'); + +use mt\AchievementsPower; use phpcommon\SqlHelper; class HashRate extends BaseModel { @@ -32,6 +35,7 @@ class HashRate extends BaseModel } public static function getCount($period){ + $count = 0; $rows = SqlHelper::ormSelect( myself()->_getSelfMysql(), 't_hash_rate', @@ -40,7 +44,13 @@ class HashRate extends BaseModel 'period' => $period, ) ); - return count($rows); + foreach ($rows as $row){ + $hashMeta = AchievementsPower::find($row['task_id']); + if ($hashMeta['task_type'] != AchievementsPower::TYPE5){ + $count += 1; + } + } + return $count; } diff --git a/webapp/mt/BattleRandAttribute.php b/webapp/mt/BattleRandAttribute.php index d8d79ae7..14f4602a 100644 --- a/webapp/mt/BattleRandAttribute.php +++ b/webapp/mt/BattleRandAttribute.php @@ -39,12 +39,13 @@ class BattleRandAttribute { $strs = explode('|', $randMeta['attributeRange']); foreach ($strs as $str){ $attrStr = explode(':', $str); - $rnd = rand($attrStr[1]*100000 , $attrStr[2]*100000) / 100000; -// $val = $attrStr[1] + ($attrStr[2] - $attrStr[1]) * $rnd; - array_push($attrArray,array( - "attr_id" => $attrStr[0], - "val" => $rnd, - )); + if (count($attrStr) == 3){ + $rnd = rand($attrStr[1]*100000 , $attrStr[2]*100000) / 100000; + array_push($attrArray,array( + "attr_id" => $attrStr[0], + "val" => $rnd, + )); + } } return $attrArray; } diff --git a/webapp/services/BigwheelService.php b/webapp/services/BigwheelService.php new file mode 100644 index 00000000..7f7bdded --- /dev/null +++ b/webapp/services/BigwheelService.php @@ -0,0 +1,66 @@ +_callMtStatic('Item', 'get', $itemId); + if (empty($itemMeta)) { + return; + } + $elements = array(); + array_push($elements, array( + 'ele_type' => 2, + 'color' => '#ffffff', + 'lang_key' => 'Marquee_rewards_get_1', + 'lang_params' => array(), + )); + array_push($elements, array( + 'ele_type' => 1, + //'color' => '#', + 'text' => myself()->_getUserInfo(array('name'))['name'], + )); + array_push($elements, array( + 'ele_type' => 2, + 'color' => '#ffffff', + 'lang_key' => 'Marquee_rewards_get_2', + 'lang_params' => array(), + )); + array_push($elements, array( + 'ele_type' => 2, + 'color' => '#ff3f3f', + 'lang_key' => $itemMeta['name'], + 'lang_params' => array(), + )); + array_push($elements, array( + 'ele_type' => 2, + 'color' => '#ffffff', + 'lang_key' => 'Marquee_rewards_get_3', + 'lang_params' => array(), + )); + error_log(json_encode($elements)); + $content = myself()->_callServiceStatic('NoticeService', 'buildCustom', $elements); + $loop = 1; + $interval = 1; + myself()->_callServiceStatic('NoticeService', 'send', $content, $loop, $interval); + } + +} diff --git a/webapp/services/HashRateService.php b/webapp/services/HashRateService.php index 4c849017..c3743b6f 100644 --- a/webapp/services/HashRateService.php +++ b/webapp/services/HashRateService.php @@ -344,7 +344,8 @@ class HashRateService extends BaseService private function randHashRateTaskList($type){ $metas = AchievementsPower::getListByType($type); $this->hashRateTask['task'.$type] = array(); - foreach (array_rand($metas, 4) as $key) { + $count = count($metas) >= 4 ? 4 : count($metas) ; + foreach (array_rand($metas, $count) as $key) { $meta = $metas[$key]; if (count($this->hashRateTask['task'.$type]) >= 4) {