添加客户联系人时如果还没存在的设为默认联系人

This commit is contained in:
hdm 2022-09-25 12:41:59 +08:00
parent 2a0d25a652
commit b3d604d3d8

View File

@ -85,6 +85,10 @@ class Contact extends BaseController
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$count= Db::name('CustomerContact')->where(['cid' => $param['cid'],'delete_time' => 0])->count();
if($count == 0){
$param['is_default'] = 1;
}
$param['admin_id'] = $this->uid;
$param['create_time'] = time();
$insertId = Db::name('CustomerContact')->strict(false)->field(true)->insertGetId($param);