This commit is contained in:
aozhiwei 2024-06-11 16:46:34 +08:00
parent 3121e7dfb4
commit 7d7df2f41d
2 changed files with 46 additions and 0 deletions

View File

@ -4,6 +4,7 @@ namespace models;
require_once('services/AwardService.php');
require_once('services/PropertyChgService.php');
require_once('services/MailApiService.php');
class GoldBullion extends BaseModel {
@ -80,9 +81,15 @@ class GoldBullion extends BaseModel {
'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);
}
}

View File

@ -8,6 +8,7 @@ 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';
/*
@ -98,6 +99,44 @@ class MailApiService extends BaseService {
);
}
/*
netId: netId
tokenIdtokenid
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)) {