From 4b6d3498e64f2ec03bff4f58d7c6a67d5946eb33 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 26 Jun 2024 14:00:57 +0800 Subject: [PATCH] 1 --- .../controller/OutAppNftController.class.php | 2 - webapp/models/GoldBullion.php | 114 ------------------ webapp/services/LoginService.php | 5 - webapp/services/MailApiService.php | 39 ------ 4 files changed, 160 deletions(-) delete mode 100644 webapp/models/GoldBullion.php diff --git a/webapp/controller/OutAppNftController.class.php b/webapp/controller/OutAppNftController.class.php index 07481910..1d393b09 100644 --- a/webapp/controller/OutAppNftController.class.php +++ b/webapp/controller/OutAppNftController.class.php @@ -3,7 +3,6 @@ use phpcommon\SqlHelper; require_once('models/Nft.php'); require_once('models/User.php'); require_once('models/Hero.php'); -require_once('models/GoldBullion.php'); require_once('mt/NftDesc.php'); require_once('mt/Hero.php'); require_once('mt/EconomyAttribute.php'); @@ -11,7 +10,6 @@ require_once('mt/EconomyAttribute.php'); use models\Nft; use models\User; use models\Hero; -use models\GoldBullion; class OutAppNftController extends BaseController { diff --git a/webapp/models/GoldBullion.php b/webapp/models/GoldBullion.php deleted file mode 100644 index c2bf1916..00000000 --- a/webapp/models/GoldBullion.php +++ /dev/null @@ -1,114 +0,0 @@ -_getAddress(); - if (empty($address)) { - return; - } - $rows = SqlHelper::ormSelect( - myself()->_getSelfMysql(), - 't_gold_bullion', - array( - 'open_address' => myself()->_getAddress(), - 'open_status' => self::OPEN_STATUS_PENDING, - 'returned' => 0, - ) - ); - if (count($rows) > 0) { - $confirmedRows = array(); - foreach ($rows as $row) { - $uniqId = self::genUniqId(); - SqlHelper::update( - myself()->_getSelfMysql(), - 't_gold_bullion', - array( - 'idx' => $row['idx'], - 'open_status' => self::OPEN_STATUS_PENDING - ), - array( - 'open_status' => self::OPEN_STATUS_SEND_BEGIN, - 'open_uniqid' => $uniqId - ) - ); - $newRow = SqlHelper::ormSelectOne( - myself()->_getSelfMysql(), - 't_gold_bullion', - array( - 'idx' => $row['idx'], - ) - ); - if (!empty($newRow) && $newRow['open_uniqid'] == $uniqId) { - array_push($confirmedRows, $row); - } - self::doSendAward($confirmedRows); - } - } - } - - public static function doSendAward($confirmedRows) - { - $propertyChgService = new services\PropertyChgService(); - $awardService = new services\AwardService(); - if (empty($confirmedRows)) { - return; - } - foreach ($confirmedRows as $row) { - $items = array( - array( - 'item_id' => V_ITEM_GOLD, - 'item_num' => $row['gold'] - ) - ); - myself()->_addItems($items, $awardService, $propertyChgService); - SqlHelper::update( - myself()->_getSelfMysql(), - 't_gold_bullion', - array( - 'idx' => $row['idx'], - ), - array( - 'account_id' => myself()->_getAccountId(), - 'open_status' => self::OPEN_STATUS_SEND_END, - ) - ); - $content = "[Item Name] has been used successfully, you have received 100,000 gold"; - services\MailApiService::sendOpenGold($row['net_id'], - $row['token_id'], - '', - $content); - } - } - - public static function findByTokenId($tokenId) - { - $row = SqlHelper::ormSelectOne( - myself()->_getSelfMysql(), - 't_gold_bullion', - array( - 'token_id' => $tokenId, - ) - ); - return $row; - } - - private static function genUniqId() - { - $uniqId = uniqid(md5(rand() . rand() . rand() . myself()->_getSessionId()), true); - return $uniqId; - } - -} diff --git a/webapp/services/LoginService.php b/webapp/services/LoginService.php index 851c296d..3a46488a 100644 --- a/webapp/services/LoginService.php +++ b/webapp/services/LoginService.php @@ -2,15 +2,10 @@ namespace services; -require_once('models/GoldBullion.php'); - -use models\GoldBullion; - class LoginService extends BaseService { public function onLogon() { - GoldBullion::onLogin(); } } diff --git a/webapp/services/MailApiService.php b/webapp/services/MailApiService.php index 923abd57..43238b63 100644 --- a/webapp/services/MailApiService.php +++ b/webapp/services/MailApiService.php @@ -8,7 +8,6 @@ class MailApiService extends BaseService { const SELL_UNIKEY_PRE = 'ingame.market.sell:'; const BUY_UNIKEY_PRE = 'ingame.market.buy:'; - const OPEN_GOLD_BULLION_UNIKEY_PRE = 'gold_bullion:open:'; const SELL_MAIL_SUBJECT = 'Item successfully sold'; /* @@ -99,44 +98,6 @@ class MailApiService extends BaseService { ); } - /* - netId: netId - tokenId:tokenid - to:邮件接受方account_id - subject: 邮件标题 - content: 邮件正文 - */ - public function sendOpenGold($netId, $tokenId, $subject, $content) - { - $unikey = self::OPEN_GOLD_BULLION_UNIKEY_PRE . $netId . '_' . $tokenId; - SqlHelper::upsert - (myself()->_getMailMysql(), - 't_sys_mail', - array( - 'unikey' => $unikey - ), - array( - ), - array( - 'unikey' => $unikey, - 'subject' => $subject, - 'content' => $content, - 'recipients' => json_encode(array( - $to - )), - 'attachments' => json_encode(array()), - 'tag1' => 1, - 'tag2' => 3, - 'sendtime' => myself()->_getNowTime(), - 'expiretime' => myself()->_getNowTime() + 3600 * 24 * 365 * 10, - 'user_reg_start_time' => 0, - 'user_reg_end_time' => myself()->_getNowTime() + 3600 * 24 * 365 * 10, - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ) - ); - } - private function adjustAttachments(&$attachments) { if (empty($attachments)) {