diff --git a/webapp/services/MailApiService.php b/webapp/services/MailApiService.php index 763a203f..91bb2983 100644 --- a/webapp/services/MailApiService.php +++ b/webapp/services/MailApiService.php @@ -4,9 +4,13 @@ namespace services; class MailApiService extends BaseService { + const SELL_UNIKEY_PRE = 'ingame.market.sell:'; + const BUY_UNIKEY_PRE = 'ingame.market.buy:'; + /* orderId:订单id to:邮件接受方account_id + subject: 邮件标题 content: 邮件正文 attachments: 邮件附件 [ @@ -16,14 +20,39 @@ class MailApiService extends BaseService { } ] */ - public function sendSellMail($orderId, $to, $content, $attachments) + public function sendSellMail($orderId, $to, $subject, $content, $attachments) { - + $unikey = self::SELL_UNIKEY_PRE . $oderId; + SqlHelper::upsert + (myself()->_getMailMysql(), + 't_used_name', + array( + 'unikey' => $unikey + ), + array( + ), + array( + 'unikey' => $unikey, + 'subject' => $subject, + 'content' => $content, + 'recipients' => array( + array( + 'account_id' => $to, + ) + ), + 'attachments' => json_encode($attachments), + 'sendtime' => myself()->_getNowTime(), + 'expiretime' => myself()->_getNowTime() + 3600 * 24 * 365 * 10, + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ) + ); } /* orderId:订单id to:邮件接受方account_id + subject: 邮件标题 content: 邮件正文 attachments: 邮件附件 [ @@ -33,7 +62,7 @@ class MailApiService extends BaseService { } ] */ - public function sendBuyMail($orderId, $to, $content, $attachments) + public function sendBuyMail($orderId, $to, $subject, $content, $attachments) { }