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
c0def4f6
authored
Oct 15, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加自营预售订单改预付款
parent
01f7a739
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
0 deletions
app/Http/Controllers/SpecialController.php
app/Http/routes.php
app/Model/OrderPriceModel.php
app/Http/Controllers/SpecialController.php
View file @
c0def4f6
...
@@ -7,12 +7,14 @@ use App\Http\Controllers\Controller;
...
@@ -7,12 +7,14 @@ use App\Http\Controllers\Controller;
use
App\Model\UserMainModel
;
use
App\Model\UserMainModel
;
use
App\Model\UserCompanyModel
;
use
App\Model\UserCompanyModel
;
use
App\Model\OrderModel
;
use
App\Model\OrderModel
;
use
App\Model\OrderPriceModel
;
use
App\Model\OrderInvoiceModel
;
use
App\Model\OrderInvoiceModel
;
use
App\Model\OrderActionLogModel
;
use
App\Model\OrderActionLogModel
;
use
App\Model\PayLogModel
;
use
App\Model\PayLogModel
;
use
DB
;
use
DB
;
use
Excel
;
use
Excel
;
use
Log
;
use
Log
;
use
Exception
;
class
SpecialController
extends
Controller
class
SpecialController
extends
Controller
{
{
...
@@ -255,4 +257,65 @@ class SpecialController extends Controller
...
@@ -255,4 +257,65 @@ class SpecialController extends Controller
dd
(
$data
);
dd
(
$data
);
}
}
// 自营预售订单改预付款
public
function
changeOrderPayType
(
Request
$request
)
{
$order_id
=
$request
->
input
(
'order_id'
,
0
);
if
(
!
$order_id
)
return
'订单ID不存在'
;
DB
::
connection
(
'order'
)
->
transaction
(
function
()
use
(
$order_id
)
{
$OrderModel
=
new
OrderModel
();
$OrderPriceModel
=
new
OrderPriceModel
();
$PayLogModel
=
new
PayLogModel
();
$OrderActionLogModel
=
new
OrderActionLogModel
();
// 查询订单信息
$order_info
=
$OrderModel
->
find
(
$order_id
);
if
(
!
$order_info
)
throw
new
Exception
(
"修改失败,订单不存在"
,
1
);
if
(
$order_info
[
'status'
]
>
2
)
throw
new
Exception
(
"修改失败,订单已支付"
,
1
);
$advance_amount
=
number_format
(
$order_info
[
'order_amount'
]
*
0.3
,
2
);
// 订单表
$order
=
array
();
$order
[
'order_pay_type'
]
=
2
;
$order
[
'advance_amount'
]
=
$advance_amount
;
$order
[
'status'
]
=
3
;
$order
[
'advance_pay_time'
]
=
time
();
$OrderModel
->
where
(
'order_id'
,
$order_id
)
->
update
(
$order
);
// 支付记录表
$pay_log
=
array
();
$pay_log
[
'order_id'
]
=
$order_id
;
$pay_log
[
'pay_id'
]
=
0
;
// 支付方式ID
$pay_log
[
'pay_name'
]
=
'交通银行'
;
// 支付方式名
$pay_log
[
'pay_type'
]
=
2
;
$pay_log
[
'pay_amount'
]
=
$advance_amount
;
$pay_log
[
'is_paid'
]
=
1
;
$pay_log
[
'create_time'
]
=
time
();
$pay_log
[
'pay_time'
]
=
time
();
$PayLogModel
->
insert
(
$pay_log
);
// 价格表
$price
=
array
();
$price
[
'order_id'
]
=
$order_id
;
$price
[
'order_sn'
]
=
'12019101531990'
;
$price
[
'price_type'
]
=
-
2
;
$price
[
'price'
]
=
'-'
.
$advance_amount
;
$price
[
'currency'
]
=
$order_info
[
'currency'
];
$price
[
'create_time'
]
=
time
();
$OrderPriceModel
->
insert
(
$price
);
// 操作日志
$OrderActionLogModel
->
addLog
(
$order_id
,
1000
,
2
,
'手动调整订单支付类型'
);
});
return
'调整成功'
;
}
}
}
\ No newline at end of file
app/Http/routes.php
View file @
c0def4f6
...
@@ -151,5 +151,6 @@ Route::group(['middleware' => 'api'], function () {
...
@@ -151,5 +151,6 @@ Route::group(['middleware' => 'api'], function () {
Route
::
get
(
'/act/clear'
,
'CronController@clearData'
);
// 清除活动统计用户表和缓存
Route
::
get
(
'/act/clear'
,
'CronController@clearData'
);
// 清除活动统计用户表和缓存
Route
::
get
(
'/handle/paylog'
,
'SpecialController@handlePayLog'
);
// 处理支付记录
Route
::
get
(
'/handle/paylog'
,
'SpecialController@handlePayLog'
);
// 处理支付记录
Route
::
get
(
'/act/sendactmsg'
,
'CronController@sendActMsg'
);
// 推送活动短信
Route
::
get
(
'/act/sendactmsg'
,
'CronController@sendActMsg'
);
// 推送活动短信
Route
::
get
(
'/handle/paytype'
,
'SpecialController@changeOrderPayType'
);
// 自营更改预付款支付方式
});
});
app/Model/OrderPriceModel.php
0 → 100644
View file @
c0def4f6
<?php
namespace
App\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
Request
;
use
Excel
;
use
DB
;
class
OrderPriceModel
extends
Model
{
protected
$connection
=
'order'
;
protected
$table
=
'lie_order_price'
;
protected
$primaryKey
=
'price_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