Commit 1279b1f1 by 庄冰

needinfo-sub_status

parent f5e8b9b0
...@@ -59,7 +59,7 @@ class APIBase { ...@@ -59,7 +59,7 @@ class APIBase {
this.logClient.log(pobj, req, rtn); this.logClient.log(pobj, req, rtn);
if(rtn && rtn.status === 0 ){ if(rtn && rtn.status === 0 ){
//保存缓存 //保存缓存
await this.redisClient.setWithEx(shaStr, JSON.stringify(rtn), 30); // await this.redisClient.setWithEx(shaStr, JSON.stringify(rtn), 30);
} }
return rtn; return rtn;
} catch (e) { } catch (e) {
......
...@@ -77,7 +77,7 @@ class Template extends APIBase { ...@@ -77,7 +77,7 @@ class Template extends APIBase {
let result = await this.forminfoSve.findOne({id:pobj.id},[]); let result = await this.forminfoSve.findOne({id:pobj.id},[]);
// 将数据保存到redis中 // 将数据保存到redis中
await this.redisClient.set(shaStr, JSON.stringify(result)); await this.redisClient.set(shaStr, JSON.stringify(result));
this.formCache[shaStr] = JSON.stringify(result); // this.formCache[shaStr] = JSON.stringify(result);
return system.getResult(result); return system.getResult(result);
} }
} }
......
...@@ -28,7 +28,9 @@ module.exports = (db, DataTypes) => { ...@@ -28,7 +28,9 @@ module.exports = (db, DataTypes) => {
region:DataTypes.STRING,//地区 region:DataTypes.STRING,//地区
business_id:DataTypes.STRING,//云服产品id business_id:DataTypes.STRING,//云服产品id
push_status:DataTypes.INTEGER, push_status:DataTypes.INTEGER,
notes: DataTypes.STRING sub_status:DataTypes.INTEGER,
notes: DataTypes.STRING,
sub_notes: DataTypes.STRING
}, { }, {
paranoid: true,//假的删除 paranoid: true,//假的删除
underscored: true, underscored: true,
......
...@@ -20,42 +20,89 @@ class NeedinfoService extends ServiceBase { ...@@ -20,42 +20,89 @@ class NeedinfoService extends ServiceBase {
return res; return res;
} }
var createRes = await this.dao.create(res); var createRes = await this.dao.create(res);
this.pushMediaNeed2Queue(createRes.id); // this.pushMediaNeed2Queue(createRes.id);
return system.getResultSuccess(); return system.getResultSuccess();
} }
// //校验封装参数
// async checkAndPackageSubmitParams(ab){
// if(!ab.submit_type){
// return system.getResultFail(-101,"提交方式不能为空!")
// }else if(ab.submit_type!="1" && ab.submit_type!="2"){
// return system.getResultFail(-102,"提交方式参数错误!")
// }
// if(!ab.channel_code){
// return system.getResultFail(-103,"渠道编码不能为空!")
// }
// if(!ab.page_code){
// return system.getResultFail(-104,"页面编码不能为空!")
// }
// if(!ab.page_name){
// return system.getResultFail(-105,"页面名称不能为空!")
// }
// if(!ab.original_need){
// return system.getResultFail(-106,"需求信息不能为空!")
// }
// if(!ab.contact_mobile){
// return system.getResultFail(-107,"联系电话不能为空!")
// }
// var reg =/^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(14[0-9]{1})|)+\d{8})$/;
// if(ab.contact_mobile.length!=11){
// return system.getResultFail(-108,"联系电话格式错误!")
// }
// var channel = await this.launchchannelDao.model.findOne({
// attributes:["code","name","only_code"],
// where:{code:ab.channel_code},raw:true
// });
// if(!channel || !channel.code){
// return system.getResultFail(-300,"渠道信息不存在")
// }
// ab["channel_name"] = channel.name;
// ab["channel_only_code"] = channel.only_code || "";
// return ab;
// }
//校验封装参数 //校验封装参数
async checkAndPackageSubmitParams(ab){ async checkAndPackageSubmitParams(ab){
ab.sub_status=1;
if(!ab.submit_type){ if(!ab.submit_type){
return system.getResultFail(-101,"提交方式不能为空!") ab.sub_status=2;
ab.sub_notes = "提交方式不能为空!";
}else if(ab.submit_type!="1" && ab.submit_type!="2"){ }else if(ab.submit_type!="1" && ab.submit_type!="2"){
return system.getResultFail(-102,"提交方式参数错误!") ab.sub_status=2;
ab.sub_notes = "提交方式参数错误!submit_type="+ab.submit_type;
} }
if(!ab.channel_code){ if(!ab.channel_code){
return system.getResultFail(-103,"渠道编码不能为空!") ab.sub_status=2;
ab.sub_notes = "渠道编码不能为空!";
} }
if(!ab.page_code){ if(!ab.page_code){
return system.getResultFail(-104,"页面编码不能为空!") ab.sub_status=2;
ab.sub_notes = "页面编码不能为空!";
} }
if(!ab.page_name){ if(!ab.page_name){
return system.getResultFail(-105,"页面名称不能为空!") ab.sub_status=2;
ab.sub_notes = "页面名称不能为空!";
} }
if(!ab.original_need){ if(!ab.original_need){
return system.getResultFail(-106,"需求信息不能为空!") ab.sub_status=2;
ab.sub_notes = "需求信息不能为空!";
} }
if(!ab.contact_mobile){ if(!ab.contact_mobile){
return system.getResultFail(-107,"联系电话不能为空!") ab.sub_status=2;
ab.sub_notes = "联系电话不能为空!";
} }
var reg =/^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(14[0-9]{1})|)+\d{8})$/; var reg =/^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(14[0-9]{1})|)+\d{8})$/;
if(ab.contact_mobile.length!=11){ if(ab.contact_mobile.length!=11){
return system.getResultFail(-108,"联系电话格式错误!") ab.sub_status=2;
ab.sub_notes = "联系电话格式错误!contact_mobile="+ab.contact_mobile;
} }
var channel = await this.launchchannelDao.model.findOne({ var channel = await this.launchchannelDao.model.findOne({
attributes:["code","name","only_code"], attributes:["code","name","only_code"],
where:{code:ab.channel_code},raw:true where:{code:ab.channel_code},raw:true
}); });
if(!channel || !channel.code){ if(!channel || !channel.code){
return system.getResultFail(-300,"渠道信息不存在") ab.sub_status=2;
ab.sub_notes = "渠道信息不存在";
} }
ab["channel_name"] = channel.name; ab["channel_name"] = channel.name;
ab["channel_only_code"] = channel.only_code || ""; ab["channel_only_code"] = channel.only_code || "";
......
...@@ -475,7 +475,7 @@ class TemplatelinkService extends ServiceBase { ...@@ -475,7 +475,7 @@ class TemplatelinkService extends ServiceBase {
linkinfo linkinfo
}; };
//将数据保存 //将数据保存
this.templateLinkInfoCache[shaStr] = JSON.stringify(rtnObj); // this.templateLinkInfoCache[shaStr] = JSON.stringify(rtnObj);
// 将数据保存到redis中 // 将数据保存到redis中
await this.redisClient.set(shaStr, JSON.stringify(rtnObj)); await this.redisClient.set(shaStr, JSON.stringify(rtnObj));
// await this.redisClient.setWithEx(shaStr, JSON.stringify(rtnObj), 60); // 保存的同时设置过期时间 // await this.redisClient.setWithEx(shaStr, JSON.stringify(rtnObj), 60); // 保存的同时设置过期时间
......
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