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
08a1ea85
authored
Mar 12, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
fix
parents
a652d430
c4128182
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
4 deletions
app/Http/Controllers/SpecialController.php
app/Http/routes.php
app/Model/OrderModel.php
config/params.php
public/js/add_order.js
app/Http/Controllers/SpecialController.php
0 → 100644
View file @
08a1ea85
<?php
namespace
App\Http\Controllers
;
use
Illuminate\Http\Request
;
use
App\Http\Controllers\Controller
;
use
App\Model\OrderModel
;
use
App\Model\OrderActionLogModel
;
use
DB
;
class
SpecialController
extends
Controller
{
// 订单特殊处理,用于测试调整运费
public
function
changeOrderPrice
(
Request
$request
)
{
$mobile
=
$request
->
input
(
'mobile'
,
''
);
$order_id
=
$request
->
input
(
'order_id'
,
''
);
if
(
!
$mobile
||
!
$order_id
)
{
echo
'参数缺失'
;
die
;
}
// 检查是否为测试账号
$test_mobile
=
Config
(
'params.test_mobile'
);
if
(
!
in_array
(
$mobile
,
$test_mobile
))
{
echo
'非测试账号'
;
die
;
}
DB
::
connection
(
'order'
)
->
beginTransaction
();
$order
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order_price'
)
->
where
(
'order_id'
,
$order_id
)
->
where
(
'price_type'
,
3
)
->
first
();
if
(
!
$order
)
{
echo
'运费不存在'
;
die
;
}
$data
[
'price'
]
=
0
;
$update
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order_price'
)
->
where
(
'order_id'
,
$order_id
)
->
where
(
'price_type'
,
3
)
->
update
(
$data
);
if
(
!
$update
)
{
DB
::
connection
(
'order'
)
->
rollback
();
echo
'运费更新失败'
;
die
;
}
$OrderModel
=
new
OrderModel
();
$order_info
=
$OrderModel
->
find
(
$order_id
);
$intracode
=
DB
::
table
(
'lie_intracode'
)
->
where
(
'user_id'
,
$order_info
[
'user_id'
])
->
select
(
'admin_id'
)
->
first
();
$sale_id
=
$intracode
?
$intracode
->
admin_id
:
0
;
// 操作记录
$OrderActionLogModel
=
new
OrderActionLogModel
();
$actionLog
=
$OrderActionLogModel
->
addLog
(
$order_id
,
$sale_id
,
2
,
'调整运费为0'
);
if
(
!
$actionLog
)
{
DB
::
connection
(
'order'
)
->
rollback
();
echo
'添加运费更新日志失败'
;
die
;
}
DB
::
connection
(
'order'
)
->
commit
();
echo
'运费更新成功'
;
}
}
\ No newline at end of file
app/Http/routes.php
View file @
08a1ea85
...
...
@@ -126,5 +126,6 @@ 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'
);
});
app/Model/OrderModel.php
View file @
08a1ea85
...
...
@@ -352,7 +352,7 @@ class OrderModel extends Model
if
(
$order
[
$i
][
'order_goods_type'
]
==
2
)
{
$tmp
[
$i
][
'sale_type'
]
=
$order
[
$i
][
'sale_type'
]
==
1
?
'现卖'
:
'预售'
;
$tmp
[
$i
][
'business_type'
]
=
Config
(
'params.business_type'
)[
$order
[
$i
][
'business_type'
]]
;
// 自营其他业务类型
$tmp
[
$i
][
'business_type'
]
=
$order
[
$i
][
'business_type'
]
?
Config
(
'params.business_type'
)[
$order
[
$i
][
'business_type'
]]
:
'正常订单'
;
// 自营其他业务类型
}
$tmp
[
$i
][
'user_account'
]
=
$order
[
$i
][
'mobile'
]
?
$order
[
$i
][
'mobile'
]
:
$order
[
$i
][
'email'
];
...
...
config/params.php
View file @
08a1ea85
...
...
@@ -61,8 +61,12 @@
// 特殊业务类型
'business_type'
=>
[
0
=>
'正常订单'
,
1
=>
'样品销售'
,
2
=>
'仓库损耗'
,
],
// 测试账号
'test_mobile'
=>
[
'15989573440'
,
],
];
\ No newline at end of file
public/js/add_order.js
View file @
08a1ea85
...
...
@@ -38,9 +38,9 @@
// 自营其他订单类型---仓库损耗
if
(
mobile
==
'15022222222'
)
{
$
(
'#business_type'
).
val
(
2
);
$
(
'#business_type'
).
val
(
2
)
.
attr
(
'disabled'
,
true
)
;
}
else
{
$
(
'#business_type'
).
val
(
1
);
$
(
'#business_type'
).
val
(
1
)
.
attr
(
'disabled'
,
false
)
;
}
$
.
ajax
({
...
...
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