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
7efb6fb3
authored
Sep 29, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'zjl_erp_20190923' into development
parents
9d503e30
8ff42998
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
14 deletions
app/Http/Controllers/SpecialController.php
app/Model/OrderInvoiceModel.php
app/Http/Controllers/SpecialController.php
View file @
7efb6fb3
...
...
@@ -4,9 +4,10 @@ namespace App\Http\Controllers;
use
Illuminate\Http\Request
;
use
App\Http\Controllers\Controller
;
use
App\Model\OrderModel
;
use
App\Model\UserMainModel
;
use
App\Model\UserCompanyModel
;
use
App\Model\OrderModel
;
use
App\Model\OrderInvoiceModel
;
use
App\Model\OrderActionLogModel
;
use
App\Model\PayLogModel
;
use
DB
;
...
...
@@ -152,12 +153,14 @@ class SpecialController extends Controller
if
(
!
$v
[
0
]
||
!
$v
[
1
])
continue
;
// 1. 根据手机或邮箱查找客户最近的订单
$
order_id
=
$this
->
getLastOrderId
(
trim
(
$v
[
0
]));
$
res
=
$this
->
getLastOrderId
(
trim
(
$v
[
0
]));
if
(
$
order_id
===
false
)
{
Log
::
info
(
'客户账号:'
.
$v
[
0
]
.
',
客服邮箱:'
.
$v
[
1
]
.
',客户无订单'
);
if
(
$
res
[
'err_code'
]
!=
0
)
{
Log
::
info
(
'客户账号:'
.
$v
[
0
]
.
',
'
.
$res
[
'err_msg'
]
);
continue
;
}
}
$order_id
=
$res
[
'data'
];
// 2. 根据企业邮箱查找sale_id
$sale_id
=
$this
->
getSaleId
(
trim
(
strtolower
(
$v
[
1
])));
...
...
@@ -182,28 +185,34 @@ class SpecialController extends Controller
// 获取客户最近的订单
public
function
getLastOrderId
(
$account
)
{
$UserMainModel
=
new
UserMainModel
();
$UserCompanyModel
=
new
UserCompanyModel
();
$OrderModel
=
new
OrderModel
();
$UserMainModel
=
new
UserMainModel
();
$UserCompanyModel
=
new
UserCompanyModel
();
$OrderModel
=
new
OrderModel
();
$OrderInvoiceModel
=
new
OrderInvoiceModel
();
if
(
strpos
(
$account
,
'@'
)
!==
false
)
{
// 邮箱
$where
[
'email'
]
=
strtolower
(
$account
);
$user_info
=
$UserMainModel
->
where
(
$where
)
->
select
(
'user_id'
)
->
first
();
$user_info
=
$UserMainModel
->
where
(
$where
)
->
select
(
'user_id'
)
->
orderBy
(
'user_id'
,
'desc'
)
->
first
();
}
else
if
(
preg_match
(
'/\d{11}/'
,
$account
))
{
// 手机号码
$where
[
'mobile'
]
=
$account
;
$user_info
=
$UserMainModel
->
where
(
$where
)
->
select
(
'user_id'
)
->
first
();
$user_info
=
$UserMainModel
->
where
(
$where
)
->
select
(
'user_id'
)
->
orderBy
(
'user_id'
,
'desc'
)
->
first
();
}
else
{
// 公司名称
$user_info
=
$UserCompanyModel
->
where
(
'com_name'
,
$account
)
->
select
(
'user_id'
)
->
first
();
// 发票抬头
$order_invoice
=
$OrderInvoiceModel
->
where
(
'tax_title'
,
$account
)
->
select
(
'order_id'
)
->
orderBy
(
'order_id'
,
'desc'
)
->
first
();
if
(
$order_invoice
)
return
[
'err_code'
=>
0
,
'err_msg'
=>
''
,
'data'
=>
$order_invoice
[
'order_id'
]];
$user_info
=
$UserCompanyModel
->
where
(
'com_name'
,
$account
)
->
select
(
'user_id'
)
->
orderBy
(
'com_id'
,
'desc'
)
->
first
();
}
if
(
!
$user_info
)
return
false
;
if
(
!
$user_info
)
return
[
'err_code'
=>
1
,
'err_msg'
=>
'未找到客户'
]
;
// 查找最近的订单
$order
=
$OrderModel
->
where
(
'user_id'
,
$user_info
[
'user_id'
])
->
where
(
'is_type'
,
0
)
->
select
(
'order_id'
)
->
orderBy
(
'order_id'
,
'desc'
)
->
first
();
if
(
!
$order
)
return
false
;
if
(
!
$order
)
return
[
'err_code'
=>
2
,
'err_msg'
=>
'未找到客户订单'
]
;
return
$order
[
'order_id'
];
return
[
'err_code'
=>
0
,
'err_msg'
=>
''
,
'data'
=>
$order
[
'order_id'
]
];
}
// 获取后台业务ID
...
...
app/Model/OrderInvoiceModel.php
0 → 100644
View file @
7efb6fb3
<?php
namespace
App\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
Request
;
use
Excel
;
use
DB
;
class
OrderInvoiceModel
extends
Model
{
protected
$connection
=
'order'
;
protected
$table
=
'lie_order_invoice'
;
protected
$primaryKey
=
'order_inv_id'
;
public
$timestamps
=
false
;
}
\ 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