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
19c8198a
authored
Sep 29, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'zjl_erp_20190923'
parents
f3f88798
8ff42998
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
10 deletions
app/Http/Controllers/SpecialController.php
app/Model/OrderInvoiceModel.php
app/Http/Controllers/SpecialController.php
View file @
19c8198a
...
@@ -4,9 +4,10 @@ namespace App\Http\Controllers;
...
@@ -4,9 +4,10 @@ namespace App\Http\Controllers;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
App\Http\Controllers\Controller
;
use
App\Http\Controllers\Controller
;
use
App\Model\OrderModel
;
use
App\Model\UserMainModel
;
use
App\Model\UserMainModel
;
use
App\Model\UserCompanyModel
;
use
App\Model\UserCompanyModel
;
use
App\Model\OrderModel
;
use
App\Model\OrderInvoiceModel
;
use
App\Model\OrderActionLogModel
;
use
App\Model\OrderActionLogModel
;
use
App\Model\PayLogModel
;
use
App\Model\PayLogModel
;
use
DB
;
use
DB
;
...
@@ -152,13 +153,15 @@ class SpecialController extends Controller
...
@@ -152,13 +153,15 @@ class SpecialController extends Controller
if
(
!
$v
[
0
]
||
!
$v
[
1
])
continue
;
if
(
!
$v
[
0
]
||
!
$v
[
1
])
continue
;
// 1. 根据手机或邮箱查找客户最近的订单
// 1. 根据手机或邮箱查找客户最近的订单
$
order_id
=
$this
->
getLastOrderId
(
trim
(
$v
[
0
]));
$
res
=
$this
->
getLastOrderId
(
trim
(
$v
[
0
]));
if
(
$
order_id
===
false
)
{
if
(
$
res
[
'err_code'
]
!=
0
)
{
Log
::
info
(
'客户账号:'
.
$v
[
0
]
.
',
客服邮箱:'
.
$v
[
1
]
.
',客户无订单'
);
Log
::
info
(
'客户账号:'
.
$v
[
0
]
.
',
'
.
$res
[
'err_msg'
]
);
continue
;
continue
;
}
}
$order_id
=
$res
[
'data'
];
// 2. 根据企业邮箱查找sale_id
// 2. 根据企业邮箱查找sale_id
$sale_id
=
$this
->
getSaleId
(
trim
(
strtolower
(
$v
[
1
])));
$sale_id
=
$this
->
getSaleId
(
trim
(
strtolower
(
$v
[
1
])));
...
@@ -185,25 +188,31 @@ class SpecialController extends Controller
...
@@ -185,25 +188,31 @@ class SpecialController extends Controller
$UserMainModel
=
new
UserMainModel
();
$UserMainModel
=
new
UserMainModel
();
$UserCompanyModel
=
new
UserCompanyModel
();
$UserCompanyModel
=
new
UserCompanyModel
();
$OrderModel
=
new
OrderModel
();
$OrderModel
=
new
OrderModel
();
$OrderInvoiceModel
=
new
OrderInvoiceModel
();
if
(
strpos
(
$account
,
'@'
)
!==
false
)
{
// 邮箱
if
(
strpos
(
$account
,
'@'
)
!==
false
)
{
// 邮箱
$where
[
'email'
]
=
strtolower
(
$account
);
$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
))
{
// 手机号码
}
else
if
(
preg_match
(
'/\d{11}/'
,
$account
))
{
// 手机号码
$where
[
'mobile'
]
=
$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
{
// 公司名称
}
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
();
$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
// 获取后台业务ID
...
...
app/Model/OrderInvoiceModel.php
0 → 100644
View file @
19c8198a
<?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