Commit 334a23b9 authored by 何娜's avatar 何娜

修改appkey大小写

parent ed3d5d7e
Pipeline #28039 failed with stage
in 25 seconds
......@@ -6,7 +6,7 @@ class OrderController extends Controller {
constructor(ctx) {
super(ctx);
this.createRule = {
appKey: 'string',
appkey: 'string',
userId: {
type: 'string',
required: false,
......@@ -43,7 +43,7 @@ class OrderController extends Controller {
type: 'string',
required: false,
},
appKey: 'string',
appkey: 'string',
timestamp: 'string',
},
},
......@@ -54,7 +54,7 @@ class OrderController extends Controller {
params: {
type: 'object',
rule: {
appKey: 'string',
appkey: 'string',
timestamp: 'string',
token: 'string',
},
......@@ -67,11 +67,11 @@ class OrderController extends Controller {
const { ctx, service } = this;
try {
ctx.validate(this.fetchRule);
const { appKey } = ctx.request.body.params;
const { appkey } = ctx.request.body.params;
const orderId = await service.signature.createOrderId(ctx.request.body);
await service.order.create({
orderId,
notifyUrl: ctx.app.notifyMap.get(appKey) && ctx.app.notifyMap.get(appKey).notifyUrl || '',
notifyUrl: ctx.app.notifyMap.get(appkey) && ctx.app.notifyMap.get(appkey).notifyUrl || '',
appKey,
status: 'init',
});
......
......@@ -102,7 +102,7 @@ class TaskController extends Controller {
addTime: new Date().getTime(),
type: 'ws',
state: 'open',
appKey,
appkey,
netMark,
});
try {
......@@ -145,7 +145,7 @@ class TaskController extends Controller {
addTime: new Date().getTime(),
type: 'ws',
state: 'open',
appKey,
appkey,
netMark,
});
try {
......
......@@ -29,7 +29,7 @@ module.exports = {
this.body = { code: -1, msg: '请求参数有误' };
return;
}
if (!/token|appKey/.test(err.message)) {
if (!/token|appkey/.test(err.message)) {
if (/[a-zA-Z]+/.test(err.message)) {
this.body = { code: err.code || -1, msg: '系统错误, 请稍后再试' };
return;
......
......@@ -18,10 +18,10 @@ module.exports = app => {
primaryKey: true,
field: 'orderId',
},
appKey: {
appkey: {
type: DataTypes.STRING(255),
allowNull: false,
field: 'appKey',
field: 'appkey',
},
type: {
type: DataTypes.STRING(255),
......
......@@ -11,7 +11,7 @@ module.exports = app => {
primaryKey: true,
field: 'id',
},
appKey: {
appkey: {
type: DataTypes.STRING(255),
allowNull: false,
defaultValue: '',
......
......@@ -38,13 +38,13 @@ class PartnerService extends Service {
return;
}
async appKeyLimit(appKey) {
async appKeyLimit(appkey) {
const { ctx, partnerAPI: { redisappKeyLimitPrefix } } = this;
let data = await this.app.redis.get(redisappKeyLimitPrefix);
if (data) {
data = JSON.parse(data);
if (data.includes(appKey)) {
let limit = await this.app.redis.get(redisappKeyLimitPrefix + appKey);
if (data.includes(appkey)) {
let limit = await this.app.redis.get(redisappKeyLimitPrefix + appkey);
if (limit) {
limit = JSON.parse(limit);
if (limit.currentCount >= limit.limitCount) {
......@@ -52,30 +52,30 @@ class PartnerService extends Service {
} else {
// limit.currentCount++;
// 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 appKey = ?', {
await ctx.model.query('UPDATE node_limit set currentCount = currentCount + 1 where appkey = ?', {
type: 'UPDATE',
replacements: [appKey],
replacements: [appkey],
});
}
}
}
} else {
const dbRes = await ctx.model.NodeLimit.findAll({
attributes: ['appKey', 'currentCount', 'limitCount'],
attributes: ['appkey', 'currentCount', 'limitCount'],
where: { type: 'yys' },
});
if (dbRes) {
const appKeyArray = [];
for (const item of dbRes) {
const { appKey, currentCount, limitCount } = item;
appKeyArray.push(appKey);
await this.app.redis.set(redisappKeyLimitPrefix + appKey, JSON.stringify({ currentCount, limitCount }), 'EX', 300);
const { appkey, currentCount, limitCount } = item;
appKeyArray.push(appkey);
await this.app.redis.set(redisappKeyLimitPrefix + appkey, JSON.stringify({ currentCount, limitCount }), 'EX', 300);
}
await this.app.redis.set(redisappKeyLimitPrefix, JSON.stringify(appKeyArray), 'EX', 300);
if (appKeyArray.includes(appKey)) {
if (appKeyArray.includes(appkey)) {
await ctx.model.query('UPDATE node_limit set currentCount = currentCount + 1 where appKey = ?', {
type: 'UPDATE',
replacements: [appKey],
replacements: [appkey],
});
}
}
......
......@@ -7,13 +7,13 @@ class ScheduleService extends Service {
const { ctx } = this;
const appKeylists = new Map();
const ret = await ctx.model.NodeLimit.findAll({
attributes: ['appKey', 'text2', 'currentCount', 'limitCount', 'customerUrl'],
attributes: ['appkey', 'text2', 'currentCount', 'limitCount', 'customerUrl'],
where: { type: 'thxd' },
});
ctx.logger.info('【Schedule】appKeylists', ret.length)
if (ret.length > 0) {
ret.map(customer => {
appKeylists.set(customer.appKey, {
appKeylists.set(customer.appkey, {
text2: customer.text2,
customerUrl: customer.customerUrl,
});
......
......@@ -42,7 +42,7 @@ class StorageService extends Service {
return;
}
async read(orderId, appKey) {
async read(orderId, appkey) {
const { readUrl, ctx } = this;
const result = await this._request(`${readUrl}${orderId}`, {
method: 'get',
......@@ -55,7 +55,7 @@ class StorageService extends Service {
ctx.throw(400, { message: result.data.msg });
}
await ctx.model.Cusdata.create({
appKey,
appkey,
orderId,
type: 'yys',
});
......
......@@ -21,7 +21,7 @@
<script type="text/javascript" src="https://r.51gjj.com/cdn/yys/public/js/query.js"></script>
<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}}}","appKey":"{{{appKey}}}","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}}}","appkey":"{{{appkey}}}","scriptId":"{{{scriptId}}}"}
</script>
<style>.footer {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment