Commit 05354937 by 杨树贤

新增询价通知业务员

parent 3c604653
Showing with 22 additions and 2 deletions
......@@ -2,6 +2,7 @@
namespace App\Http\Services;
use App\Models\Cms\CmsUserModel;
use App\Models\InquiryModel;
use App\Models\InquiryItemsModel;
use Carbon\Carbon;
......@@ -15,8 +16,9 @@ class InquiryService
$items = \Arr::get($data, 'items', []);
$items = json_decode($items, true);
$remark = $data['remark'];
$sn = self::generateSn();
$inquiry = [
'inquiry_sn' => self::generateSn(),
'inquiry_sn' => $sn,
'user_id' => $user->id,
'sales_id' => $user->sale_id,
'priority' => InquiryModel::PRIORITY_HIGH,
......@@ -35,7 +37,25 @@ class InquiryService
'remark' => $remark,
];
}
return InquiryItemsModel::addInquiryItems($inquiryItems);
$result = InquiryItemsModel::addInquiryItems($inquiryItems);
if ($result) {
//判断客户类型,如果是个人则取客户名称,如果是公司取公司名称
if ($user->account_properties == 1) {
$name = $user->name;
} else {
$name = $user->company_name;
}
if (empty($user->sale_id)) {
return true;
}
$salesEmail = CmsUserModel::where('userId', $user->sale_id)->value('email');
$data = [
'name' => $name,
'inquiry_sn' => $sn,
];
SendMsg($data, 'semour_inquire', [$salesEmail], 1);
}
return $result;
});
}
......
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