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
6c55f147
authored
Mar 08, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
设置运费为0(供测试使用)
parent
6042972e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
0 deletions
app/Http/Controllers/SpecialController.php
app/Http/routes.php
config/params.php
app/Http/Controllers/SpecialController.php
0 → 100644
View file @
6c55f147
<?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 @
6c55f147
...
@@ -126,5 +126,6 @@ Route::group(['middleware' => 'api'], function () {
...
@@ -126,5 +126,6 @@ Route::group(['middleware' => 'api'], function () {
Route
::
get
(
'/api/check/sendsms'
,
'OrderController@checkOrderSendSms'
);
Route
::
get
(
'/api/check/sendsms'
,
'OrderController@checkOrderSendSms'
);
Route
::
get
(
'/api/check/cancelorder'
,
'OrderController@checkOrderCancel'
);
Route
::
get
(
'/api/check/cancelorder'
,
'OrderController@checkOrderCancel'
);
Route
::
get
(
'/api/check/histroyorder'
,
'OrderController@checkHistroyOrder'
);
Route
::
get
(
'/api/check/histroyorder'
,
'OrderController@checkHistroyOrder'
);
Route
::
get
(
'/api/check/changeprice'
,
'SpecialController@changeOrderPrice'
);
});
});
config/params.php
View file @
6c55f147
...
@@ -65,4 +65,9 @@
...
@@ -65,4 +65,9 @@
1
=>
'样品销售'
,
1
=>
'样品销售'
,
2
=>
'仓库损耗'
,
2
=>
'仓库损耗'
,
],
],
// 测试账号
'test_mobile'
=>
[
'15989573440'
,
],
];
];
\ 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