Commit 3ea7e31e by 杨树贤

优化逻辑

parent d87b5672
Showing with 30 additions and 29 deletions
...@@ -86,36 +86,37 @@ class SupplierApplyService ...@@ -86,36 +86,37 @@ class SupplierApplyService
'audit_uid' => request()->user->userId, 'audit_uid' => request()->user->userId,
]); ]);
$apply = SupplierApplyModel::where('id', $applyId)->first()->toArray(); $apply = SupplierApplyModel::where('id', $applyId)->first()->toArray();
if ($result) { if ($result ) {
$existAccount = SupplierAccountModel::where('supplier_code', $apply['supplier_code'])->exists(); if ($status == SupplierApplyModel::STATUS_PASS) {
//如果没有供应商账号,那么就要新增供应商账号 $existAccount = SupplierAccountModel::where('supplier_code', $apply['supplier_code'])->exists();
if (!$existAccount) { //如果没有供应商账号,那么就要新增供应商账号
SupplierAccountModel::where('supplier_code', $apply['supplier_code'])->update([ if ($existAccount) {
'mobile' => $apply['mobile'], SupplierAccountModel::where('supplier_code', $apply['supplier_code'])->update([
'email' => $apply['email'], 'mobile' => $apply['mobile'],
'contacts_name' => $apply['contact_name'], 'email' => $apply['email'],
'password_raw' => 123456, 'contacts_name' => $apply['contact_name'],
'password' => Hash::make(123456), 'password_raw' => 123456,
'create_time' => time(), 'password' => Hash::make(123456),
'a_type' => 1, 'create_time' => time(),
'create_uid' => 1000, 'a_type' => 1,
'source' => 2, 'create_uid' => 1000,
]); 'source' => 2,
}else{ ]);
//如果是通过并且已经存在,那么就要替换掉对应供应商的账号和密码 }else{
SupplierAccountModel::insert([ //如果是通过并且已经存在,那么就要替换掉对应供应商的账号和密码
'supplier_id' => $apply['supplier_id'], SupplierAccountModel::insert([
'supplier_code' => $apply['supplier_code'], 'supplier_id' => $apply['supplier_id'],
'mobile' => $apply['mobile'], 'supplier_code' => $apply['supplier_code'],
'update_time' => time(), 'mobile' => $apply['mobile'],
'email' => $apply['email'], 'update_time' => time(),
'contacts_name' => $apply['contact_name'], 'email' => $apply['email'],
'password_raw' => 123456, 'contacts_name' => $apply['contact_name'],
'password' => Hash::make(123456), 'password_raw' => 123456,
'source' => 2, 'password' => Hash::make(123456),
]); 'source' => 2,
]);
}
} }
//无论是否通过,都要发短信通知 //无论是否通过,都要发短信通知
if ($status == SupplierApplyModel::STATUS_REJECT) { if ($status == SupplierApplyModel::STATUS_REJECT) {
$message = "${apply['contact_name']} 先生/女生您好,您的“云芯入驻申请”已收到,审核结果为:不通过,原因为:${auditReason},如对审核结果有疑问,可联系您在猎芯的专属渠道经理(周强),联系电话:13512343214,联系邮箱:qiang@ichunt.com"; $message = "${apply['contact_name']} 先生/女生您好,您的“云芯入驻申请”已收到,审核结果为:不通过,原因为:${auditReason},如对审核结果有疑问,可联系您在猎芯的专属渠道经理(周强),联系电话:13512343214,联系邮箱:qiang@ichunt.com";
......
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