Merge branch 'hjb' of git.kingsome.cn:server/game2006api into hjb
This commit is contained in:
commit
567d5c2489
@ -10,7 +10,7 @@ class AAMarket(object):
|
|||||||
'desc': '获取上架出售的NFTs(瀑布流式api) jwtheader为可选参数',
|
'desc': '获取上架出售的NFTs(瀑布流式api) jwtheader为可选参数',
|
||||||
'group': '!AAMarket',
|
'group': '!AAMarket',
|
||||||
'url': 'https://market-test.kingsome.cn/api/market/product/list/:net_id',
|
'url': 'https://market-test.kingsome.cn/api/market/product/list/:net_id',
|
||||||
'headers': _common.JwtHeader,
|
'headers': _common.MaybeJwtHeader,
|
||||||
'is_json_params': True,
|
'is_json_params': True,
|
||||||
'request_params': [
|
'request_params': [
|
||||||
[':net_id', 0, '链id'],
|
[':net_id', 0, '链id'],
|
||||||
@ -295,13 +295,14 @@ class AAMarket(object):
|
|||||||
'name': '/api/user/:account_address',
|
'name': '/api/user/:account_address',
|
||||||
'desc': '获取用户信息',
|
'desc': '获取用户信息',
|
||||||
'group': '!AAMarket',
|
'group': '!AAMarket',
|
||||||
|
'headers': _common.MaybeJwtHeader,
|
||||||
'url': 'https://market-test.kingsome.cn/api/user/:account_address',
|
'url': 'https://market-test.kingsome.cn/api/user/:account_address',
|
||||||
'params': [
|
'params': [
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
['nickname', '', '昵称'],
|
['nickname', '', '昵称'],
|
||||||
['email', '', 'email'],
|
['email', '', 'email(因为隐私问题jwt关联的地址和:account_address相等时才返回email)'],
|
||||||
['contribution_point', 0, '贡献点'],
|
['contribution_point', 0, '贡献点'],
|
||||||
['gold', '', '金币数'],
|
['gold', '', '金币数'],
|
||||||
['diamond', '', '钻石数'],
|
['diamond', '', '钻石数'],
|
||||||
|
@ -26,6 +26,10 @@ JwtHeader = [
|
|||||||
'Authorization Bearer {JwtToken}'
|
'Authorization Bearer {JwtToken}'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
MaybeJwtHeader = [
|
||||||
|
'Authorization Bearer {JwtToken} 可选参数'
|
||||||
|
]
|
||||||
|
|
||||||
LoginRequired = 'login required'
|
LoginRequired = 'login required'
|
||||||
|
|
||||||
class Union(object):
|
class Union(object):
|
||||||
|
@ -67,11 +67,11 @@ class BigwheelController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
$priceInfo = $this->getPriceInfo($data['drawed_times']);
|
$priceInfo = $this->getPriceInfo($data['drawed_times']);
|
||||||
if (empty($priceInfo)) {
|
if (empty($priceInfo)) {
|
||||||
myself()->_rspErr(500, 'server internal error');
|
myself()->_rspErr(500, 'server internal error1');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($priceInfo['cost_item_id'] != V_ITEM_DIAMOND) {
|
if ($priceInfo['cost_item_id'] != V_ITEM_DIAMOND) {
|
||||||
myself()->_rspErr(500, 'server internal error');
|
myself()->_rspErr(500, 'server internal error2');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$costItemNum = 0;
|
$costItemNum = 0;
|
||||||
@ -280,8 +280,15 @@ class BigwheelController extends BaseAuthedController {
|
|||||||
)
|
)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
$this->sendNotify($drop1[0]['item_id']);
|
myself()->_fireEvent('Bigwheel', 'onWinPrize',
|
||||||
$this->sendNotify($drop2[0]['item_id']);
|
array(
|
||||||
|
'info' => $grid1,
|
||||||
|
'drop' => $drop1
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'info' => $grid2,
|
||||||
|
'drop' => $drop2
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buyS()
|
public function buyS()
|
||||||
@ -437,47 +444,4 @@ class BigwheelController extends BaseAuthedController {
|
|||||||
return $priceInfo;
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -132,12 +132,12 @@ class HashRateController extends BaseAuthedController
|
|||||||
$rewardNum = $reward[0]['item_num'];
|
$rewardNum = $reward[0]['item_num'];
|
||||||
HashRate::add($taskMeta['id'],$currentPeriod['id']);
|
HashRate::add($taskMeta['id'],$currentPeriod['id']);
|
||||||
HashRate::rewardAdd($currentPeriod['id'],$rewardNum);
|
HashRate::rewardAdd($currentPeriod['id'],$rewardNum);
|
||||||
//刷新任务
|
// //刷新任务
|
||||||
$refreshTimes = myself()->_getDailyV(TN_HASH_DAILY_REFRESH_TIMES,0);
|
// $refreshTimes = myself()->_getDailyV(TN_HASH_DAILY_REFRESH_TIMES,0);
|
||||||
$refreshTimesMax = \mt\Parameter::getVal('economy_account_compute_refresh_max',5);
|
// $refreshTimesMax = \mt\Parameter::getVal('economy_account_compute_refresh_max',5);
|
||||||
if ($taskMeta['is_refresh'] == \mt\AchievementsPower::REFRESH_STATE && $refreshTimes < $refreshTimesMax){
|
// if ($taskMeta['is_refresh'] == \mt\AchievementsPower::REFRESH_STATE && $refreshTimes < $refreshTimesMax){
|
||||||
$this->hashRateService->refreshHashRateTask($taskMeta,$currentPeriod['id']);
|
// $this->hashRateService->refreshHashRateTask($taskMeta,$currentPeriod['id']);
|
||||||
}
|
// }
|
||||||
$this->_rspData(array(
|
$this->_rspData(array(
|
||||||
'award' => $reward,
|
'award' => $reward,
|
||||||
));
|
));
|
||||||
|
@ -5,12 +5,9 @@ namespace events;
|
|||||||
class Bigwheel
|
class Bigwheel
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function onWinBigPrize($data)
|
public static function onWinPrize($grid1, $grid2)
|
||||||
{
|
{
|
||||||
//触发(调用)对应对该事件感兴趣的模块
|
myself()->_callServiceStatic('BigwheelService', 'onWinPrize', $grid1, $grid2);
|
||||||
//myself()->_callServiceStatic('A', 'f1', $battleData);
|
|
||||||
//myself()->_callServiceStatic('B', 'f1', $battleData);
|
|
||||||
echo json_encode($data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,12 +6,12 @@ namespace events;
|
|||||||
class Upgrade
|
class Upgrade
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function onHeroUpgrade($params){
|
public static function onHeroUpgrade(){
|
||||||
myself()->_callServiceStatic('HashRateService', 'onUpLvHero', $params);
|
myself()->_callServiceStatic('HashRateService', 'onUpLvHero');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function onChipUpgrade($params){
|
public static function onChipUpgrade(){
|
||||||
myself()->_callServiceStatic('HashRateService', 'onUpLvChip', $params);
|
myself()->_callServiceStatic('HashRateService', 'onUpLvChip');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
namespace models;
|
namespace models;
|
||||||
|
|
||||||
|
require_once('mt/AchievementsPower.php');
|
||||||
|
|
||||||
|
use mt\AchievementsPower;
|
||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
class HashRate extends BaseModel
|
class HashRate extends BaseModel
|
||||||
{
|
{
|
||||||
@ -32,6 +35,7 @@ class HashRate extends BaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function getCount($period){
|
public static function getCount($period){
|
||||||
|
$count = 0;
|
||||||
$rows = SqlHelper::ormSelect(
|
$rows = SqlHelper::ormSelect(
|
||||||
myself()->_getSelfMysql(),
|
myself()->_getSelfMysql(),
|
||||||
't_hash_rate',
|
't_hash_rate',
|
||||||
@ -40,7 +44,13 @@ class HashRate extends BaseModel
|
|||||||
'period' => $period,
|
'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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,12 +39,13 @@ class BattleRandAttribute {
|
|||||||
$strs = explode('|', $randMeta['attributeRange']);
|
$strs = explode('|', $randMeta['attributeRange']);
|
||||||
foreach ($strs as $str){
|
foreach ($strs as $str){
|
||||||
$attrStr = explode(':', $str);
|
$attrStr = explode(':', $str);
|
||||||
$rnd = rand($attrStr[1]*100000 , $attrStr[2]*100000) / 100000;
|
if (count($attrStr) == 3){
|
||||||
// $val = $attrStr[1] + ($attrStr[2] - $attrStr[1]) * $rnd;
|
$rnd = rand($attrStr[1]*100000 , $attrStr[2]*100000) / 100000;
|
||||||
array_push($attrArray,array(
|
array_push($attrArray,array(
|
||||||
"attr_id" => $attrStr[0],
|
"attr_id" => $attrStr[0],
|
||||||
"val" => $rnd,
|
"val" => $rnd,
|
||||||
));
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $attrArray;
|
return $attrArray;
|
||||||
}
|
}
|
||||||
|
66
webapp/services/BigwheelService.php
Normal file
66
webapp/services/BigwheelService.php
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace services;
|
||||||
|
|
||||||
|
require_once('mt/Bigwheel.php');
|
||||||
|
|
||||||
|
use mt;
|
||||||
|
|
||||||
|
class BigwheelService extends BaseService
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function onWinPrize($grid1, $grid2)
|
||||||
|
{
|
||||||
|
$grids = array($grid1, $grid2);
|
||||||
|
foreach ($grids as $grid) {
|
||||||
|
$gridMeta = mt\Bigwheel::get($grid['info']['grid_id']);
|
||||||
|
if ($grid['info']['grid_state'] == 1 && $gridMeta['is_grand_reward']) {
|
||||||
|
self::sendNotify($grid['drop'][0]['item_id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -344,7 +344,8 @@ class HashRateService extends BaseService
|
|||||||
private function randHashRateTaskList($type){
|
private function randHashRateTaskList($type){
|
||||||
$metas = AchievementsPower::getListByType($type);
|
$metas = AchievementsPower::getListByType($type);
|
||||||
$this->hashRateTask['task'.$type] = array();
|
$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];
|
$meta = $metas[$key];
|
||||||
if (count($this->hashRateTask['task'.$type]) >=
|
if (count($this->hashRateTask['task'.$type]) >=
|
||||||
4) {
|
4) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user