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
cac76ba0
authored
Apr 13, 2021
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整关联
parent
c4d620fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
app/Http/Controllers/AddOrderController.php
app/Model/CrmModel.php
app/Http/Controllers/AddOrderController.php
View file @
cac76ba0
...
@@ -180,13 +180,16 @@ Class AddOrderController extends Controller
...
@@ -180,13 +180,16 @@ Class AddOrderController extends Controller
if
(
strpos
(
$_SERVER
[
'HTTP_HOST'
],
'sz'
)
===
false
)
{
// 非测试环境下执行
if
(
strpos
(
$_SERVER
[
'HTTP_HOST'
],
'sz'
)
===
false
)
{
// 非测试环境下执行
// 若用户已分配,则判断当前登录客服是否能给用户下单,若没分配,按之前流程,订单生成时分配给当前登录客服
// 若用户已分配,则判断当前登录客服是否能给用户下单,若没分配,按之前流程,订单生成时分配给当前登录客服
$CrmModel
=
new
CrmModel
();
$CrmModel
=
new
CrmModel
();
$sale_id
=
$CrmModel
->
getSaleId
(
$user
->
user_id
);
//
$sale_id = $CrmModel->getSaleId($user->user_id);
if
(
$sale_id
&&
$sale_id
!=
$operator_id
)
{
//if ($sale_id && $sale_id != $operator_id) {
$CmsModel
=
new
CmsModel
();
// $CmsModel = new CmsModel();
$sale_name
=
$CmsModel
->
getUserName
(
$sale_id
);
// $sale_name = $CmsModel->getUserName($sale_id);
return
[
'errcode'
=>
-
1
,
'errmsg'
=>
'该客户由 '
.
$sale_name
.
' 跟进,请联系主管重新指派'
];
// return ['errcode' => -1, 'errmsg' => '该客户由 '.$sale_name.' 跟进,请联系主管重新指派'];
}
//}
$res
=
$CrmModel
->
isBind
(
$user
->
user_id
,
$operator_id
);
if
(
!
$res
)
return
[
'errcode'
=>-
1
,
'errmsg'
=>
'当前用户与登录客服无绑定关系'
];
}
}
$address
=
DB
::
connection
(
'order'
)
->
table
(
'lie_user_address'
)
->
where
(
'user_id'
,
$user
->
user_id
)
->
select
(
'address_id'
,
'consignee'
)
->
get
();
// 收货地址
$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 @
cac76ba0
...
@@ -18,7 +18,19 @@ class CrmModel extends Model
...
@@ -18,7 +18,19 @@ class CrmModel extends Model
$sales
=
$this
->
from
(
'salesman'
)
->
where
(
'user_id'
,
$user
->
user_id
)
->
select
(
'sale_id'
)
->
first
();
$sales
=
$this
->
from
(
'salesman'
)
->
where
(
'user_id'
,
$user
->
user_id
)
->
select
(
'sale_id'
)
->
first
();
return
$sales
?
$sales
->
sale_id
:
0
;
return
$sales
?
$sales
->
sale_id
:
0
;
}
}
// 判断用户与客服是否存在关联关系
public
function
isBind
(
$user_id
,
$sale_id
)
{
$map
=
[];
$map
[
'user_id'
]
=
$user_id
;
$map
[
'sale_id'
]
=
$sale_id
;
$map
[
'status'
]
=
0
;
return
$this
->
from
(
'invoice_com_user'
)
->
where
(
$map
)
->
value
(
'id'
);
}
}
}
\ No newline at end of file
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