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 { ...@@ -6,7 +6,7 @@ class OrderController extends Controller {
constructor(ctx) { constructor(ctx) {
super(ctx); super(ctx);
this.createRule = { this.createRule = {
appKey: 'string', appkey: '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,
}, },
appKey: 'string', appkey: '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: {
appKey: 'string', appkey: '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 { appKey } = ctx.request.body.params; const { appkey } = 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(appKey) && ctx.app.notifyMap.get(appKey).notifyUrl || '', notifyUrl: ctx.app.notifyMap.get(appkey) && ctx.app.notifyMap.get(appkey).notifyUrl || '',
appKey, appKey,
status: 'init', status: 'init',
}); });
......
...@@ -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',
appKey, appkey,
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',
appKey, appkey,
netMark, netMark,
}); });
try { try {
......
...@@ -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|appKey/.test(err.message)) { if (!/token|appkey/.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;
......
...@@ -18,10 +18,10 @@ module.exports = app => { ...@@ -18,10 +18,10 @@ module.exports = app => {
primaryKey: true, primaryKey: true,
field: 'orderId', field: 'orderId',
}, },
appKey: { appkey: {
type: DataTypes.STRING(255), type: DataTypes.STRING(255),
allowNull: false, allowNull: false,
field: 'appKey', field: 'appkey',
}, },
type: { type: {
type: DataTypes.STRING(255), type: DataTypes.STRING(255),
......
...@@ -11,7 +11,7 @@ module.exports = app => { ...@@ -11,7 +11,7 @@ module.exports = app => {
primaryKey: true, primaryKey: true,
field: 'id', field: 'id',
}, },
appKey: { appkey: {
type: DataTypes.STRING(255), type: DataTypes.STRING(255),
allowNull: false, allowNull: false,
defaultValue: '', defaultValue: '',
......
...@@ -38,13 +38,13 @@ class PartnerService extends Service { ...@@ -38,13 +38,13 @@ class PartnerService extends Service {
return; return;
} }
async appKeyLimit(appKey) { async appKeyLimit(appkey) {
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(appKey)) { if (data.includes(appkey)) {
let limit = await this.app.redis.get(redisappKeyLimitPrefix + appKey); let limit = await this.app.redis.get(redisappKeyLimitPrefix + appkey);
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 appKey = ?', { await ctx.model.query('UPDATE node_limit set currentCount = currentCount + 1 where appkey = ?', {
type: 'UPDATE', type: 'UPDATE',
replacements: [appKey], replacements: [appkey],
}); });
} }
} }
} }
} else { } else {
const dbRes = await ctx.model.NodeLimit.findAll({ const dbRes = await ctx.model.NodeLimit.findAll({
attributes: ['appKey', 'currentCount', 'limitCount'], attributes: ['appkey', '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 { appKey, currentCount, limitCount } = item; const { appkey, currentCount, limitCount } = item;
appKeyArray.push(appKey); appKeyArray.push(appkey);
await this.app.redis.set(redisappKeyLimitPrefix + appKey, JSON.stringify({ currentCount, limitCount }), 'EX', 300); await this.app.redis.set(redisappKeyLimitPrefix + appkey, 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(appKey)) { if (appKeyArray.includes(appkey)) {
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: [appKey], replacements: [appkey],
}); });
} }
} }
......
...@@ -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: ['appKey', 'text2', 'currentCount', 'limitCount', 'customerUrl'], attributes: ['appkey', '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.appKey, { appKeylists.set(customer.appkey, {
text2: customer.text2, text2: customer.text2,
customerUrl: customer.customerUrl, customerUrl: customer.customerUrl,
}); });
......
...@@ -42,7 +42,7 @@ class StorageService extends Service { ...@@ -42,7 +42,7 @@ class StorageService extends Service {
return; return;
} }
async read(orderId, appKey) { async read(orderId, appkey) {
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({
appKey, appkey,
orderId, orderId,
type: 'yys', type: 'yys',
}); });
......
...@@ -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}}}","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> </script>
<style>.footer { <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