Commit d5263e10 authored by 姜登's avatar 姜登

yys

parent e7a260ca
......@@ -61,11 +61,11 @@ class OrderController extends Controller {
async create() {
const { ctx, service } = this;
ctx.validate(this.createRule);
const { appKey, userId, notifyUrl, backUrl, orderId, phone } = ctx.request.body;
// const appKeyInfo = await service.partner.fetchInfo(appKey);
// if (!(appKeyInfo && appKeyInfo.valid === true && appKeyInfo.enableYys === true)) {
// return ctx.fail('未开通此服务');
// }
const { appKey, userId, notifyUrl, backUrl, orderId, phone, netMark } = ctx.request.body;
const appKeyInfo = await service.partner.fetchInfo(appKey);
if (!(appKeyInfo && appKeyInfo.valid === true && appKeyInfo.enableYys === true)) {
return ctx.fail('未开通此服务');
}
const areaInfo = await service.task.phoneArea(phone);
const object = {
orderId,
......@@ -77,6 +77,7 @@ class OrderController extends Controller {
phone,
city: areaInfo.province,
operator: areaInfo.operator,
netMark,
};
if (orderId) {
await service.order.update(object);
......
......@@ -141,8 +141,8 @@ class TaskController extends Controller {
if (!order) {
throw new Error('任务不存在');
}
const { orderId } = order;
await service.washData.wash(result, orderId);
const { orderId, netMark } = order;
await service.washData.wash(result, orderId, netMark);
await service.cache.set({
key: taskId,
value: taskNote,
......
......@@ -66,6 +66,12 @@ module.exports = app => {
allowNull: true,
field: 'status',
},
netMark: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: 0,
field: 'netMark',
},
note: {
type: DataTypes.STRING(8000),
allowNull: true,
......
......@@ -9,13 +9,13 @@ class WashDataService extends Service {
this.washUrl = config.washAPI.host + config.washAPI.washUrl;
this.callbackUrl = config.dataCallbackUrl;
}
async wash(data, orderId) {
async wash(data, orderId, netMark = 0) {
const { app, washUrl, ctx } = this;
const rawdata = {
data,
callbackUrl: this.callbackUrl,
orderId,
netMark: 0,
netMark,
};
const washData = await app.curl(washUrl,
{
......@@ -32,17 +32,6 @@ class WashDataService extends Service {
}
return washData.data;
}
_switchData(data) {
const tmp = data.data;
const bar = {};
bar.taskId = tmp.taskId;
bar.cityId = tmp.cityId;
bar.data = JSON.parse(tmp.data);
bar.orderID = 'ttt';
bar.appKey = '';
return bar;
}
}
module.exports = WashDataService;
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