_getMailMysql(), 't_sys_mail', array( 'unikey' => $unikey ), array( ), array( 'unikey' => $unikey, 'subject' => $subject, 'content' => $content, 'recipients' => json_encode(array( $to )), 'attachments' => json_encode($attachments), 'tag1' => 1, 'tag2' => 1, '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() ) ); } /* orderId:订单id to:邮件接受方account_id subject: 邮件标题 content: 邮件正文 attachments: 邮件附件 [ { "itemid": 0, //道具id "itemnum": 0, //道具数量 } ] */ public function sendBuyMail($orderId, $to, $subject, $content, $attachments) { $unikey = self::BUY_UNIKEY_PRE . $orderId; 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($attachments), 'tag1' => 1, 'tag2' => 2, '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)) { $attachments = ''; return; } foreach ($attachments as &$val) { $val['itemid'] = intval($val['itemid']); $val['itemnum'] = intval($val['itemnum']); } } }