Commit 67713314 by hcy001

邮件或者短信

parent ddfd9d7f
...@@ -148,9 +148,9 @@ class CommonModel extends Model ...@@ -148,9 +148,9 @@ class CommonModel extends Model
* 发送短信、邮件 * 发送短信、邮件
* @param [type] $userId [指定发送人的后台ID] * @param [type] $userId [指定发送人的后台ID]
* @param [type] $contents [发送内容] * @param [type] $contents [发送内容]
* @return [type] [description] * @param int $types 短信还是邮件: 1 发送邮件+短信 2 只发短信 3 只发邮件
*/ */
public function send_msg($userId, $contents) public function send_msg($userId, $contents,$types = 1)
{ {
//调用消息接口 //调用消息接口
$url = Config('website.api_domain').'msg/sendmessagebyauto'; $url = Config('website.api_domain').'msg/sendmessagebyauto';
...@@ -180,7 +180,7 @@ class CommonModel extends Model ...@@ -180,7 +180,7 @@ class CommonModel extends Model
]; ];
// 短信 // 短信
if ($user_id) { if ($user_id && $types != 3) {
$msgData['keyword'] = $keyword_text; $msgData['keyword'] = $keyword_text;
$msgData['touser'] = $user_id; $msgData['touser'] = $user_id;
...@@ -190,7 +190,7 @@ class CommonModel extends Model ...@@ -190,7 +190,7 @@ class CommonModel extends Model
} }
// 邮件 // 邮件
if ($email) { if ($email && $types != 2) {
$msgData['keyword'] = $keyword_email; $msgData['keyword'] = $keyword_email;
$msgData['touser'] = json_encode([$email]); $msgData['touser'] = json_encode([$email]);
$msgData['is_ignore'] = 1; $msgData['is_ignore'] = 1;
......
...@@ -554,13 +554,13 @@ class QuoteModel extends Model ...@@ -554,13 +554,13 @@ class QuoteModel extends Model
$con->commit(); $con->commit();
// 推送消息 // 推送消息
// $inquiry_id = InquiryItemsModel::where('id', $inquiry_items_id)->value('inquiry_id'); $inquiry_id = InquiryItemsModel::where('id', $inquiry_items_id)->value('inquiry_id');
//
// $InquiryModel = new InquiryModel; $InquiryModel = new InquiryModel;
// $inquiry_uid = $InquiryModel->where('id', $inquiry_id)->value('create_uid'); // 询价人 $inquiry_uid = $InquiryModel->where('id', $inquiry_id)->value('create_uid'); // 询价人
//
// $contents = '您有新报价,请及时查看!'; $contents = '您有新报价,请及时查看!';
// $CommonModel->send_msg($inquiry_uid, $contents); $CommonModel->send_msg($inquiry_uid, $contents,2);
return [0, "新增成功"]; return [0, "新增成功"];
} catch (\Exception $e) { } catch (\Exception $e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment