Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
cd3d8c10
Commit
cd3d8c10
authored
Jun 06, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重复提交控制
parent
2f51ab30
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
12 deletions
+69
-12
OrderLog.php
application/api_broker/controller/OrderLog.php
+13
-4
LookShopService.php
application/api_broker/service/LookShopService.php
+1
-6
VerifyRepetitionService.php
application/api_broker/service/VerifyRepetitionService.php
+49
-0
RedisExt.php
application/extra/RedisExt.php
+6
-2
No files found.
application/api_broker/controller/OrderLog.php
View file @
cd3d8c10
...
@@ -6,6 +6,8 @@ use app\api_broker\extend\Basic;
...
@@ -6,6 +6,8 @@ use app\api_broker\extend\Basic;
use
app\api_broker\service\HouseNumUpdateService
;
use
app\api_broker\service\HouseNumUpdateService
;
use
app\api_broker\service\OrderLogService
;
use
app\api_broker\service\OrderLogService
;
use
app\api_broker\service\PushMessageService
;
use
app\api_broker\service\PushMessageService
;
use
app\api_broker\service\VerifyRepetitionService
;
use
app\extra\RedisExt
;
use
app\model\AAgents
;
use
app\model\AAgents
;
use
app\model\OBargainModel
;
use
app\model\OBargainModel
;
use
app\model\OMarchInModel
;
use
app\model\OMarchInModel
;
...
@@ -25,6 +27,7 @@ class OrderLog extends Basic
...
@@ -25,6 +27,7 @@ class OrderLog extends Basic
private
$o_march_in_model
;
private
$o_march_in_model
;
private
$o_refund_model
;
private
$o_refund_model
;
private
$service_
;
private
$service_
;
private
$verifyService_
;
function
__construct
(
$request
=
null
)
function
__construct
(
$request
=
null
)
{
{
...
@@ -32,6 +35,7 @@ class OrderLog extends Basic
...
@@ -32,6 +35,7 @@ class OrderLog extends Basic
$this
->
o_march_in_model
=
new
OMarchInModel
();
$this
->
o_march_in_model
=
new
OMarchInModel
();
$this
->
o_refund_model
=
new
ORefundModel
();
$this
->
o_refund_model
=
new
ORefundModel
();
$this
->
service_
=
new
OrderLogService
();
$this
->
service_
=
new
OrderLogService
();
$this
->
verifyService_
=
new
VerifyRepetitionService
();
}
}
...
@@ -60,7 +64,10 @@ class OrderLog extends Basic
...
@@ -60,7 +64,10 @@ class OrderLog extends Basic
);*/
);*/
// $params["reception_id"] = $this->agentName;
// $params["reception_id"] = $this->agentName;
$is_execute
=
$this
->
verifyService_
->
verifyStart
(
1
,
$params
[
"reception_id"
],
$params
[
"order_id"
]);
if
(
!
$is_execute
)
{
return
$this
->
response
(
"101"
,
"请不要重复提交"
);
}
$is_ok
=
$this
->
o_march_in_model
->
addMarchIn
(
$params
);
$is_ok
=
$this
->
o_march_in_model
->
addMarchIn
(
$params
);
if
(
$is_ok
>
0
)
{
if
(
$is_ok
>
0
)
{
$pushMarchIn
=
new
PushMessageService
();
$pushMarchIn
=
new
PushMessageService
();
...
@@ -69,6 +76,8 @@ class OrderLog extends Basic
...
@@ -69,6 +76,8 @@ class OrderLog extends Basic
}
else
{
}
else
{
return
$this
->
response
(
"101"
,
"request faild"
);
return
$this
->
response
(
"101"
,
"request faild"
);
}
}
}
}
/**
/**
...
@@ -426,9 +435,9 @@ class OrderLog extends Basic
...
@@ -426,9 +435,9 @@ class OrderLog extends Basic
{
{
header
(
'Access-Control-Allow-Origin:*'
);
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
$params
=
$this
->
params
;
/* $params = array(
/* $params = array(
"bargain_id" => 469,
"bargain_id" => 469,
);*/
);*/
if
(
!
isset
(
$params
[
"bargain_id"
]))
{
if
(
!
isset
(
$params
[
"bargain_id"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
}
...
...
application/api_broker/service/LookShopService.php
View file @
cd3d8c10
...
@@ -30,12 +30,7 @@ class LookShopService
...
@@ -30,12 +30,7 @@ class LookShopService
public
function
__construct
()
public
function
__construct
()
{
{
try
{
$this
->
redis
=
RedisExt
::
getRedis
();
$this
->
redis
=
RedisExt
::
getRedis
();
}
catch
(
RedisException
$exception
)
{
$this
->
redis
=
false
;
}
$this
->
nowTime
=
date
(
"Y-m-d"
,
time
());
$this
->
nowTime
=
date
(
"Y-m-d"
,
time
());
$this
->
gHousesToAgentsModel
=
new
GHousesToAgents
();
$this
->
gHousesToAgentsModel
=
new
GHousesToAgents
();
$this
->
agentsModel
=
new
AAgents
();
$this
->
agentsModel
=
new
AAgents
();
...
...
application/api_broker/service/VerifyRepetitionService.php
0 → 100644
View file @
cd3d8c10
<?php
namespace
app\api_broker\service
;
use
app\extra\RedisExt
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/6/6
* Time : 10:28
* Intro:
*/
class
VerifyRepetitionService
{
private
$redis_
;
const
MARCH_IN_KEY
=
"_march_in_"
;
const
TIME_OUT
=
60
;
// 超时时间1分钟
public
function
__construct
()
{
$this
->
redis_
=
RedisExt
::
getRedis
();
}
public
function
verifyStart
(
int
$type
,
int
$agent_id
,
int
$order_id
)
:
bool
{
if
(
!
$this
->
redis_
){
return
true
;
}
$key
=
""
;
switch
(
$type
){
case
1
:
//进场
$key
=
self
::
MARCH_IN_KEY
;
break
;
case
2
:
break
;
case
3
:
break
;
default
:
}
if
(
$this
->
redis_
->
get
(
$agent_id
.
$key
.
$order_id
)){
return
false
;
}
else
{
$this
->
redis_
->
set
(
$agent_id
.
$key
.
$order_id
,
1
,
self
::
TIME_OUT
);
return
true
;
}
}
}
\ No newline at end of file
application/extra/RedisExt.php
View file @
cd3d8c10
...
@@ -44,8 +44,12 @@ class RedisExt
...
@@ -44,8 +44,12 @@ class RedisExt
public
static
function
getRedis
()
public
static
function
getRedis
()
{
{
if
(
!
self
::
$_instance
)
{
try
{
new
self
;
if
(
!
self
::
$_instance
)
{
new
self
;
}
}
catch
(
RedisException
$exception
)
{
return
false
;
}
}
return
self
::
$_instance
;
return
self
::
$_instance
;
...
...
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