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
14c4531a
authored
Oct 31, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
temp1
parent
a162353e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
12 deletions
app/Http/Controllers/Controller.php
app/Http/Controllers/OrderController.php
app/Http/Controllers/Controller.php
View file @
14c4531a
...
...
@@ -7,6 +7,8 @@ use Illuminate\Routing\Controller as BaseController;
use
Illuminate\Foundation\Validation\ValidatesRequests
;
use
Illuminate\Foundation\Auth\Access\AuthorizesRequests
;
use
Session
;
use
Route
;
use
Symfony\Component\HttpKernel\Exception\HttpException
;
class
Controller
extends
BaseController
{
...
...
@@ -25,34 +27,37 @@ class Controller extends BaseController
*/
private
function
formResubmitKeyProcess
(
$key
)
{
if
(
empty
(
$key
)){
//默认使用当前路由的uri为key
return
$this
->
formResubmitPrefix
.
Route
::
current
()
->
uri
;
}
else
{
return
$this
->
formResubmitPrefix
.
$key
;
if
(
empty
(
$key
))
{
$route
=
Route
::
current
()
->
getActionName
();
$action_name
=
explode
(
'@'
,
$route
)[
1
];
return
$this
->
formResubmitPrefix
.
$action_name
.
'_'
.
md5
(
microtime
(
true
));
//默认使用当前方法名为key
}
else
{
return
$this
->
formResubmitPrefix
.
$key
.
'_'
.
md5
(
microtime
(
true
));
}
}
/**
* 在初始化表单前调用
(如上面分步实现中的showRegistrationForm()方法中)
* 在初始化表单前调用
* @param unknown $key
*/
protected
function
formInit
(
$key
=
null
)
{
$key
=
$this
->
formResubmitKeyProcess
(
$key
);
dd
(
$key
);
Session
::
put
(
$key
,
time
());
}
/**
* 在处理表单提交的方法中调用
(如上面分步实现中的register()方法)
* 在处理表单提交的方法中调用
* @param string $message
* @param unknown $key
* @throws HttpException
*/
protected
function
formSubmited
(
string
$message
=
'请忽重复提交!'
,
$key
=
null
)
protected
function
formSubmited
(
$key
=
null
,
string
$message
=
'请忽重复提交!'
)
{
$key
=
$this
->
formResubmitKeyProcess
(
$key
);
if
(
Session
::
has
(
$key
))
{
if
(
Session
::
has
(
$key
)
&&
Session
::
get
(
$key
)
!==
null
)
{
Session
::
forget
(
$key
);
}
else
{
throw
new
HttpException
(
403
,
$message
);
...
...
@@ -60,11 +65,11 @@ class Controller extends BaseController
}
/**
* 在处理表单提交的方法中调用
(如上面分步实现中的register()方 法)
,该方法方便自定义重复提交时的提示页面,可以在子类中if判断一下,如果发生重复提交,响应自定义的界面
* 在处理表单提交的方法中调用,该方法方便自定义重复提交时的提示页面,可以在子类中if判断一下,如果发生重复提交,响应自定义的界面
* @param string $message
* @param unknown $key
*/
protected
function
formSubmitIsRepetition
(
string
$message
=
'请勿重复提交!'
,
$key
=
null
)
protected
function
formSubmitIsRepetition
(
$key
=
null
,
string
$message
=
'请勿重复提交!'
)
{
$key
=
$this
->
formResubmitKeyProcess
(
$key
);
if
(
Session
::
has
(
$key
))
{
...
...
@@ -74,12 +79,13 @@ class Controller extends BaseController
return
response
()
->
view
(
'errors.403'
,
[
'message'
=>
$message
],
403
);
}
}
/**
* 该方法用于ajax请求,返回的数据是数组
* @param string $message
* @param unknown $key
*/
protected
function
formSubmitedForAjax
(
string
$message
=
'请勿重复提交!'
,
$key
=
null
)
protected
function
formSubmitedForAjax
(
$key
=
null
,
string
$message
=
'请勿重复提交!'
)
{
$key
=
$this
->
formResubmitKeyProcess
(
$key
);
if
(
Session
::
has
(
$key
))
{
...
...
app/Http/Controllers/OrderController.php
View file @
14c4531a
...
...
@@ -17,6 +17,7 @@ use App\Model\UserMainModel;
use
App\Model\OrderActionLogModel
;
use
App\Model\OrderReturnModel
;
use
App\Model\OrderItemsTrackModel
;
use
Session
;
// 获取订单优惠券金额
function
getCoupon
(
$order_id
)
...
...
@@ -886,6 +887,9 @@ Class OrderController extends Controller
return
array
(
'errcode'
=>
Error
::
E_NOT_EXISTS
,
'errmsg'
=>
'参数不存在'
);
}
$res
=
$this
->
formSubmited
(
'sendsales'
);
dump
(
Session
::
get
(
'f_sendsales'
));
dd
(
$res
);
$url
=
Config
(
'website.api_domain'
)
.
'order/sendSales'
;
$check
[
'k1'
]
=
time
();
...
...
@@ -906,6 +910,8 @@ Class OrderController extends Controller
return
array
(
'errcode'
=>
$temp
[
'err_code'
],
'errmsg'
=>
$temp
[
'err_msg'
]);
}
$this
->
formInit
(
'sendsales'
);
dump
(
Session
::
get
(
'f_sendsales'
));
$info
=
$this
->
orderDetail
(
$request
,
$id
);
$this
->
pageHeader
(
$request
,
$info
,
'推送业务员'
,
[
"title"
=>
'推送业务员'
,
"href"
=>
'#'
]);
...
...
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