Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a486fc48
authored
Jun 16, 2021
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整线上下单提示
parent
9eb7c32f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
12 deletions
app/Http/Controllers/AddOrderController.php
app/Model/CrmModel.php
config/config.php
app/Http/Controllers/AddOrderController.php
View file @
a486fc48
...
...
@@ -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
();
// 收货地址
...
...
app/Model/CrmModel.php
View file @
a486fc48
...
...
@@ -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
config/config.php
View file @
a486fc48
...
...
@@ -45,4 +45,12 @@ return [
// 平台账号变更邮件收件人
'pingtai_mail'
=>
'zjl@ichunt.com'
,
// 用户渠道
'channel_type'
=>
[
1
=>
'线上用户'
,
2
=>
'线下用户'
,
3
=>
'大客户部用户'
,
4
=>
'苏州销售部用户'
,
],
];
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment