This commit is contained in:
aozhiwei 2024-08-07 11:27:41 +08:00
parent 8b9773308c
commit 38b715e7a3
3 changed files with 70 additions and 45 deletions

View File

@ -281,8 +281,6 @@ class BigwheelController extends BaseAuthedController {
));
}
myself()->_fireEvent('Bigwheel', 'onWinPrize', $grid1, $grid2, $drop1, $drop2);
$this->sendNotify($drop1[0]['item_id']);
$this->sendNotify($drop2[0]['item_id']);
}
public function buyS()
@ -438,47 +436,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);
}
}

View File

@ -7,6 +7,11 @@ class Bigwheel
public static function onWinPrize($grid1, $grid2, $drop1, $drop2)
{
myself()->_callServiceStatic('BigwheelService', 'onWinPrize',
$grid1,
$grid2,
$drop1,
$drop2);
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace services;
require_once('mt/Bigwheel.php');
class BigwheelService extends BaseService
{
public static function onWinPrize($grid1, $grid2, $drop1, $drop2)
{
$grids = array($grid1, $grid2);
foreach ($grids as $grid) {
$gridMeta = mt\Bigwheel::get($grid['grid_id']);
if ($grid['grid_state'] == 1 && $gridMeta['is_grand_reward']) {
self::sendNotify($drop1[0]['item_id']);
self::sendNotify($drop2[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);
}
}