Commit a486fc48 by 朱继来

调整线上下单提示

parent 9eb7c32f
......@@ -154,17 +154,9 @@ Class AddOrderController extends Controller
$operator_id = $request->user->userId;
$UserMainModel = new UserMainModel;
// if(!empty($user_id) && strlen($request->input('user_id'))<11 ){
// if(!empty($user_id)){
// $user = $UserMainModel->where('user_id', $user_id)->select('user_id', 'email','mobile', 'is_test')->orderBy('create_time', 'desc')->first();
// }else{
if (preg_match('/@/', $mobile)) {
$user = $UserMainModel->where('email', $mobile)->select('user_id', 'email', 'is_test')->orderBy('create_time', 'desc')->first();
} else {
$user = $UserMainModel->where('mobile', $mobile)->select('user_id', 'mobile', 'is_test')->orderBy('create_time', 'desc')->first();
}
// }
$field = preg_match('/@/', $mobile) ? 'email' : 'mobile';
$user = $UserMainModel->where($field, $mobile)->select('user_id', 'mobile', 'is_test', 'channel_type')->orderBy('create_time', 'desc')->first();
if (empty($user)) return ['errcode' => -1, 'errmsg' => '未找用户信息'];
......@@ -189,7 +181,20 @@ Class AddOrderController extends Controller
// }
$res = $CrmModel->isBind($user->user_id, $operator_id);
if (!$res) return ['errcode'=>-1, 'errmsg'=>'当前用户与登录客服无绑定关系'];
if (!$res) {
// 检查当前用户是否有人跟进
$sale_id = $CrmModel->getUserSaleId($user->user_id);
if ($sale_id) {
$CmsModel = new CmsModel();
$sale_name = $CmsModel->getUserName($sale_id);
return ['errcode'=>-1, 'errmsg'=>'用户账号:'.$mobile.',当前跟进销售:'.$sale_name];
}
$channel = array_get(Config('config.channel_type'), $user->channel_type, '');
return ['errcode'=>-1, 'errmsg'=>'用户账号:'.$mobile.',当前跟进销售:无,用户渠道:'.$channel];
}
}
$address = DB::connection('order')->table('lie_user_address')->where('user_id', $user->user_id)->select('address_id', 'consignee')->get(); // 收货地址
......
......@@ -32,5 +32,10 @@ class CrmModel extends Model
return $this->from('invoice_com_user')->where($map)->value('id');
}
// 获取用户跟进的销售
public function getUserSaleId($user_id)
{
return $this->from('invoice_com_user')->where('user_id', $user_id)->value('sale_id');
}
}
\ No newline at end of file
......@@ -45,4 +45,12 @@ return [
// 平台账号变更邮件收件人
'pingtai_mail' => 'zjl@ichunt.com',
// 用户渠道
'channel_type' => [
1 => '线上用户',
2 => '线下用户',
3 => '大客户部用户',
4 => '苏州销售部用户',
],
];
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