Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yysh5
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
data_server
yysh5
Commits
334a23b9
Commit
334a23b9
authored
Sep 09, 2020
by
何娜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改appkey大小写
parent
ed3d5d7e
Pipeline
#28039
failed with stage
in 25 seconds
Changes
9
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
27 additions
and
27 deletions
+27
-27
order.js
app/controller/order.js
+5
-5
task.js
app/controller/task.js
+2
-2
context.js
app/extend/context.js
+1
-1
cusdata.js
app/model/cusdata.js
+2
-2
nodeLimit.js
app/model/nodeLimit.js
+1
-1
partner.js
app/service/partner.js
+11
-11
schedules.js
app/service/schedules.js
+2
-2
storage.js
app/service/storage.js
+2
-2
mobileV2.hbs
app/view/mobileV2.hbs
+1
-1
No files found.
app/controller/order.js
View file @
334a23b9
...
@@ -6,7 +6,7 @@ class OrderController extends Controller {
...
@@ -6,7 +6,7 @@ class OrderController extends Controller {
constructor
(
ctx
)
{
constructor
(
ctx
)
{
super
(
ctx
);
super
(
ctx
);
this
.
createRule
=
{
this
.
createRule
=
{
app
K
ey
:
'string'
,
app
k
ey
:
'string'
,
userId
:
{
userId
:
{
type
:
'string'
,
type
:
'string'
,
required
:
false
,
required
:
false
,
...
@@ -43,7 +43,7 @@ class OrderController extends Controller {
...
@@ -43,7 +43,7 @@ class OrderController extends Controller {
type
:
'string'
,
type
:
'string'
,
required
:
false
,
required
:
false
,
},
},
app
K
ey
:
'string'
,
app
k
ey
:
'string'
,
timestamp
:
'string'
,
timestamp
:
'string'
,
},
},
},
},
...
@@ -54,7 +54,7 @@ class OrderController extends Controller {
...
@@ -54,7 +54,7 @@ class OrderController extends Controller {
params
:
{
params
:
{
type
:
'object'
,
type
:
'object'
,
rule
:
{
rule
:
{
app
K
ey
:
'string'
,
app
k
ey
:
'string'
,
timestamp
:
'string'
,
timestamp
:
'string'
,
token
:
'string'
,
token
:
'string'
,
},
},
...
@@ -67,11 +67,11 @@ class OrderController extends Controller {
...
@@ -67,11 +67,11 @@ class OrderController extends Controller {
const
{
ctx
,
service
}
=
this
;
const
{
ctx
,
service
}
=
this
;
try
{
try
{
ctx
.
validate
(
this
.
fetchRule
);
ctx
.
validate
(
this
.
fetchRule
);
const
{
app
K
ey
}
=
ctx
.
request
.
body
.
params
;
const
{
app
k
ey
}
=
ctx
.
request
.
body
.
params
;
const
orderId
=
await
service
.
signature
.
createOrderId
(
ctx
.
request
.
body
);
const
orderId
=
await
service
.
signature
.
createOrderId
(
ctx
.
request
.
body
);
await
service
.
order
.
create
({
await
service
.
order
.
create
({
orderId
,
orderId
,
notifyUrl
:
ctx
.
app
.
notifyMap
.
get
(
app
Key
)
&&
ctx
.
app
.
notifyMap
.
get
(
appK
ey
).
notifyUrl
||
''
,
notifyUrl
:
ctx
.
app
.
notifyMap
.
get
(
app
key
)
&&
ctx
.
app
.
notifyMap
.
get
(
appk
ey
).
notifyUrl
||
''
,
appKey
,
appKey
,
status
:
'init'
,
status
:
'init'
,
});
});
...
...
app/controller/task.js
View file @
334a23b9
...
@@ -102,7 +102,7 @@ class TaskController extends Controller {
...
@@ -102,7 +102,7 @@ class TaskController extends Controller {
addTime
:
new
Date
().
getTime
(),
addTime
:
new
Date
().
getTime
(),
type
:
'ws'
,
type
:
'ws'
,
state
:
'open'
,
state
:
'open'
,
app
K
ey
,
app
k
ey
,
netMark
,
netMark
,
});
});
try
{
try
{
...
@@ -145,7 +145,7 @@ class TaskController extends Controller {
...
@@ -145,7 +145,7 @@ class TaskController extends Controller {
addTime
:
new
Date
().
getTime
(),
addTime
:
new
Date
().
getTime
(),
type
:
'ws'
,
type
:
'ws'
,
state
:
'open'
,
state
:
'open'
,
app
K
ey
,
app
k
ey
,
netMark
,
netMark
,
});
});
try
{
try
{
...
...
app/extend/context.js
View file @
334a23b9
...
@@ -29,7 +29,7 @@ module.exports = {
...
@@ -29,7 +29,7 @@ module.exports = {
this
.
body
=
{
code
:
-
1
,
msg
:
'请求参数有误'
};
this
.
body
=
{
code
:
-
1
,
msg
:
'请求参数有误'
};
return
;
return
;
}
}
if
(
!
/token|app
K
ey/
.
test
(
err
.
message
))
{
if
(
!
/token|app
k
ey/
.
test
(
err
.
message
))
{
if
(
/
[
a-zA-Z
]
+/
.
test
(
err
.
message
))
{
if
(
/
[
a-zA-Z
]
+/
.
test
(
err
.
message
))
{
this
.
body
=
{
code
:
err
.
code
||
-
1
,
msg
:
'系统错误, 请稍后再试'
};
this
.
body
=
{
code
:
err
.
code
||
-
1
,
msg
:
'系统错误, 请稍后再试'
};
return
;
return
;
...
...
app/model/cusdata.js
View file @
334a23b9
...
@@ -18,10 +18,10 @@ module.exports = app => {
...
@@ -18,10 +18,10 @@ module.exports = app => {
primaryKey
:
true
,
primaryKey
:
true
,
field
:
'orderId'
,
field
:
'orderId'
,
},
},
app
K
ey
:
{
app
k
ey
:
{
type
:
DataTypes
.
STRING
(
255
),
type
:
DataTypes
.
STRING
(
255
),
allowNull
:
false
,
allowNull
:
false
,
field
:
'app
K
ey'
,
field
:
'app
k
ey'
,
},
},
type
:
{
type
:
{
type
:
DataTypes
.
STRING
(
255
),
type
:
DataTypes
.
STRING
(
255
),
...
...
app/model/nodeLimit.js
View file @
334a23b9
...
@@ -11,7 +11,7 @@ module.exports = app => {
...
@@ -11,7 +11,7 @@ module.exports = app => {
primaryKey
:
true
,
primaryKey
:
true
,
field
:
'id'
,
field
:
'id'
,
},
},
app
K
ey
:
{
app
k
ey
:
{
type
:
DataTypes
.
STRING
(
255
),
type
:
DataTypes
.
STRING
(
255
),
allowNull
:
false
,
allowNull
:
false
,
defaultValue
:
''
,
defaultValue
:
''
,
...
...
app/service/partner.js
View file @
334a23b9
...
@@ -38,13 +38,13 @@ class PartnerService extends Service {
...
@@ -38,13 +38,13 @@ class PartnerService extends Service {
return
;
return
;
}
}
async
appKeyLimit
(
app
K
ey
)
{
async
appKeyLimit
(
app
k
ey
)
{
const
{
ctx
,
partnerAPI
:
{
redisappKeyLimitPrefix
}
}
=
this
;
const
{
ctx
,
partnerAPI
:
{
redisappKeyLimitPrefix
}
}
=
this
;
let
data
=
await
this
.
app
.
redis
.
get
(
redisappKeyLimitPrefix
);
let
data
=
await
this
.
app
.
redis
.
get
(
redisappKeyLimitPrefix
);
if
(
data
)
{
if
(
data
)
{
data
=
JSON
.
parse
(
data
);
data
=
JSON
.
parse
(
data
);
if
(
data
.
includes
(
app
K
ey
))
{
if
(
data
.
includes
(
app
k
ey
))
{
let
limit
=
await
this
.
app
.
redis
.
get
(
redisappKeyLimitPrefix
+
app
K
ey
);
let
limit
=
await
this
.
app
.
redis
.
get
(
redisappKeyLimitPrefix
+
app
k
ey
);
if
(
limit
)
{
if
(
limit
)
{
limit
=
JSON
.
parse
(
limit
);
limit
=
JSON
.
parse
(
limit
);
if
(
limit
.
currentCount
>=
limit
.
limitCount
)
{
if
(
limit
.
currentCount
>=
limit
.
limitCount
)
{
...
@@ -52,30 +52,30 @@ class PartnerService extends Service {
...
@@ -52,30 +52,30 @@ class PartnerService extends Service {
}
else
{
}
else
{
// limit.currentCount++;
// limit.currentCount++;
// await this.app.redis.set(redisappKeyLimitPrefix + appKey, JSON.stringify({ currentCount: limit.currentCount, limitCount: limit.limitCount }), 'EX', 300);
// await this.app.redis.set(redisappKeyLimitPrefix + appKey, JSON.stringify({ currentCount: limit.currentCount, limitCount: limit.limitCount }), 'EX', 300);
await
ctx
.
model
.
query
(
'UPDATE node_limit set currentCount = currentCount + 1 where app
K
ey = ?'
,
{
await
ctx
.
model
.
query
(
'UPDATE node_limit set currentCount = currentCount + 1 where app
k
ey = ?'
,
{
type
:
'UPDATE'
,
type
:
'UPDATE'
,
replacements
:
[
app
K
ey
],
replacements
:
[
app
k
ey
],
});
});
}
}
}
}
}
}
}
else
{
}
else
{
const
dbRes
=
await
ctx
.
model
.
NodeLimit
.
findAll
({
const
dbRes
=
await
ctx
.
model
.
NodeLimit
.
findAll
({
attributes
:
[
'app
K
ey'
,
'currentCount'
,
'limitCount'
],
attributes
:
[
'app
k
ey'
,
'currentCount'
,
'limitCount'
],
where
:
{
type
:
'yys'
},
where
:
{
type
:
'yys'
},
});
});
if
(
dbRes
)
{
if
(
dbRes
)
{
const
appKeyArray
=
[];
const
appKeyArray
=
[];
for
(
const
item
of
dbRes
)
{
for
(
const
item
of
dbRes
)
{
const
{
app
K
ey
,
currentCount
,
limitCount
}
=
item
;
const
{
app
k
ey
,
currentCount
,
limitCount
}
=
item
;
appKeyArray
.
push
(
app
K
ey
);
appKeyArray
.
push
(
app
k
ey
);
await
this
.
app
.
redis
.
set
(
redisappKeyLimitPrefix
+
app
K
ey
,
JSON
.
stringify
({
currentCount
,
limitCount
}),
'EX'
,
300
);
await
this
.
app
.
redis
.
set
(
redisappKeyLimitPrefix
+
app
k
ey
,
JSON
.
stringify
({
currentCount
,
limitCount
}),
'EX'
,
300
);
}
}
await
this
.
app
.
redis
.
set
(
redisappKeyLimitPrefix
,
JSON
.
stringify
(
appKeyArray
),
'EX'
,
300
);
await
this
.
app
.
redis
.
set
(
redisappKeyLimitPrefix
,
JSON
.
stringify
(
appKeyArray
),
'EX'
,
300
);
if
(
appKeyArray
.
includes
(
app
K
ey
))
{
if
(
appKeyArray
.
includes
(
app
k
ey
))
{
await
ctx
.
model
.
query
(
'UPDATE node_limit set currentCount = currentCount + 1 where appKey = ?'
,
{
await
ctx
.
model
.
query
(
'UPDATE node_limit set currentCount = currentCount + 1 where appKey = ?'
,
{
type
:
'UPDATE'
,
type
:
'UPDATE'
,
replacements
:
[
app
K
ey
],
replacements
:
[
app
k
ey
],
});
});
}
}
}
}
...
...
app/service/schedules.js
View file @
334a23b9
...
@@ -7,13 +7,13 @@ class ScheduleService extends Service {
...
@@ -7,13 +7,13 @@ class ScheduleService extends Service {
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
const
appKeylists
=
new
Map
();
const
appKeylists
=
new
Map
();
const
ret
=
await
ctx
.
model
.
NodeLimit
.
findAll
({
const
ret
=
await
ctx
.
model
.
NodeLimit
.
findAll
({
attributes
:
[
'app
K
ey'
,
'text2'
,
'currentCount'
,
'limitCount'
,
'customerUrl'
],
attributes
:
[
'app
k
ey'
,
'text2'
,
'currentCount'
,
'limitCount'
,
'customerUrl'
],
where
:
{
type
:
'thxd'
},
where
:
{
type
:
'thxd'
},
});
});
ctx
.
logger
.
info
(
'【Schedule】appKeylists'
,
ret
.
length
)
ctx
.
logger
.
info
(
'【Schedule】appKeylists'
,
ret
.
length
)
if
(
ret
.
length
>
0
)
{
if
(
ret
.
length
>
0
)
{
ret
.
map
(
customer
=>
{
ret
.
map
(
customer
=>
{
appKeylists
.
set
(
customer
.
app
K
ey
,
{
appKeylists
.
set
(
customer
.
app
k
ey
,
{
text2
:
customer
.
text2
,
text2
:
customer
.
text2
,
customerUrl
:
customer
.
customerUrl
,
customerUrl
:
customer
.
customerUrl
,
});
});
...
...
app/service/storage.js
View file @
334a23b9
...
@@ -42,7 +42,7 @@ class StorageService extends Service {
...
@@ -42,7 +42,7 @@ class StorageService extends Service {
return
;
return
;
}
}
async
read
(
orderId
,
app
K
ey
)
{
async
read
(
orderId
,
app
k
ey
)
{
const
{
readUrl
,
ctx
}
=
this
;
const
{
readUrl
,
ctx
}
=
this
;
const
result
=
await
this
.
_request
(
`
${
readUrl
}${
orderId
}
`
,
{
const
result
=
await
this
.
_request
(
`
${
readUrl
}${
orderId
}
`
,
{
method
:
'get'
,
method
:
'get'
,
...
@@ -55,7 +55,7 @@ class StorageService extends Service {
...
@@ -55,7 +55,7 @@ class StorageService extends Service {
ctx
.
throw
(
400
,
{
message
:
result
.
data
.
msg
});
ctx
.
throw
(
400
,
{
message
:
result
.
data
.
msg
});
}
}
await
ctx
.
model
.
Cusdata
.
create
({
await
ctx
.
model
.
Cusdata
.
create
({
app
K
ey
,
app
k
ey
,
orderId
,
orderId
,
type
:
'yys'
,
type
:
'yys'
,
});
});
...
...
app/view/mobileV2.hbs
View file @
334a23b9
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
<script
type=
"text/javascript"
src=
"https://r.51gjj.com/cdn/yys/public/js/query.js"
></script>
<script
type=
"text/javascript"
src=
"https://r.51gjj.com/cdn/yys/public/js/query.js"
></script>
<script
id=
"constant"
type=
"text/json"
>
<script
id=
"constant"
type=
"text/json"
>
{
"project_root"
:
"
\
/yysh5
\
/"
,
"script_root"
:
"
\
/yysh5
\
/"
,
"debug"
:
false
,
"developer"
:
true
,
"user_id"
:
"1000000000"
,
"hasclick"
:
false
,
"orderState"
:
"
{{
State
}}
"
,
"orderNum"
:
"
{{
OrderNum
}}
"
,
"taskId"
:
"
{{
TaskId
}}
"
,
"redirectUrl"
:
"
{{{
redirectUrl
}}}
"
,
"phone"
:
"
{{{
phone
}}}
"
,
"app
Key"
:
"
{{{
appK
ey
}}}
"
,
"scriptId"
:
"
{{{
scriptId
}}}
"
}
{
"project_root"
:
"
\
/yysh5
\
/"
,
"script_root"
:
"
\
/yysh5
\
/"
,
"debug"
:
false
,
"developer"
:
true
,
"user_id"
:
"1000000000"
,
"hasclick"
:
false
,
"orderState"
:
"
{{
State
}}
"
,
"orderNum"
:
"
{{
OrderNum
}}
"
,
"taskId"
:
"
{{
TaskId
}}
"
,
"redirectUrl"
:
"
{{{
redirectUrl
}}}
"
,
"phone"
:
"
{{{
phone
}}}
"
,
"app
key"
:
"
{{{
appk
ey
}}}
"
,
"scriptId"
:
"
{{{
scriptId
}}}
"
}
</script>
</script>
<style>
.footer
{
<style>
.footer
{
...
...
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