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
8c8a841d
authored
Mar 27, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加已离职人员客户导出
parent
d2f1b0fa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
1 deletions
app/Http/Controllers/SpecialController.php
app/Http/routes.php
app/Http/Controllers/SpecialController.php
View file @
8c8a841d
...
...
@@ -7,6 +7,7 @@ use App\Http\Controllers\Controller;
use
App\Model\OrderModel
;
use
App\Model\OrderActionLogModel
;
use
DB
;
use
Excel
;
class
SpecialController
extends
Controller
{
...
...
@@ -63,4 +64,56 @@ class SpecialController extends Controller
echo
'运费更新成功'
;
}
// 导出已离职人员数据 (业务ID、业务人、关联会员账号、公司名称)
public
function
exportDimission
()
{
// 查找已离职人员
$dimission
=
DB
::
table
(
'user_info'
)
->
where
(
'status'
,
4
)
->
select
(
'userId'
,
'name'
)
->
get
();
if
(
empty
(
$dimission
))
{
echo
'无离职人员'
;
die
;
}
$sales
=
[];
$sale_ids
=
[];
foreach
(
$dimission
as
$v
)
{
$sales
[
$v
->
userId
]
=
$v
->
name
;
$sale_ids
[]
=
$v
->
userId
;
}
// 查找离职人员订单
$OrderModel
=
new
OrderModel
();
$order_info
=
$OrderModel
->
from
(
'lie_order as o'
)
->
leftJoin
(
'lie_user_main as u'
,
'o.user_id'
,
'='
,
'u.user_id'
)
->
leftJoin
(
'lie_user_company as c'
,
'o.user_id'
,
'='
,
'c.user_id'
)
->
whereIn
(
'o.sale_id'
,
$sale_ids
)
->
select
(
'o.order_id'
,
'o.user_id'
,
'o.sale_id'
,
'u.mobile'
,
'u.email'
,
'c.com_name'
)
->
get
();
if
(
empty
(
$order_info
))
{
echo
'无离职人员订单'
;
die
;
}
$cellData
=
[];
foreach
(
$order_info
as
$k
=>
$v
)
{
$cellData
[
$k
][
'sale_id'
]
=
$v
[
'sale_id'
];
$cellData
[
$k
][
'sale_name'
]
=
$sales
[
$v
[
'sale_id'
]];
$cellData
[
$k
][
'account'
]
=
$v
[
'mobile'
]
?
$v
[
'mobile'
]
:
$v
[
'email'
];
$cellData
[
$k
][
'com_name'
]
=
$v
[
'com_name'
];
}
$headerCell
=
[
'业务ID'
,
'业务员名称'
,
'关联会员账号'
,
'公司名称'
];
array_unshift
(
$cellData
,
$headerCell
);
$fileName
=
'已离职人员关联客户'
.
date
(
'_YmdHis'
);
Excel
::
create
(
$fileName
,
function
(
$excel
)
use
(
$cellData
){
$excel
->
sheet
(
'人员导出'
,
function
(
$sheet
)
use
(
$cellData
){
$sheet
->
rows
(
$cellData
);
});
})
->
export
(
'xls'
);
}
}
\ No newline at end of file
app/Http/routes.php
View file @
8c8a841d
...
...
@@ -126,6 +126,7 @@ Route::group(['middleware' => 'api'], function () {
Route
::
get
(
'/api/check/sendsms'
,
'OrderController@checkOrderSendSms'
);
Route
::
get
(
'/api/check/cancelorder'
,
'OrderController@checkOrderCancel'
);
Route
::
get
(
'/api/check/histroyorder'
,
'OrderController@checkHistroyOrder'
);
Route
::
get
(
'/api/check/changeprice'
,
'SpecialController@changeOrderPrice'
);
Route
::
get
(
'/api/check/changeprice'
,
'SpecialController@changeOrderPrice'
);
Route
::
get
(
'/api/check/exportdimission'
,
'SpecialController@exportDimission'
);
});
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