Commit ec8b67df by 庄冰

校验封装参数

parent 286c267a
......@@ -59,6 +59,17 @@ class TemplatelinkService extends ServiceBase {
ab.user_name=xctx.username;
ab.company_id=xctx.companyid;
ab.is_enabled=0;
//查重
var distinctObj = {
template_id:ab.template_id,channel_code:ab.channel_code,else_channel_param:else_channel_param,
business_type_code:business_type_code,lauch_type_code:lauch_type_code,marketing_subject_code:marketing_subject_code
};
var distinctres = await this.dao.model.findOne({
where:distinctObj,raw:true
});
if(distinctres && distinctres.id){
return system.getResultFail(-113,"操作失败,存在重复的链接");
}
}else{//修改
var linkinfo = await this.dao.model.findOne({
where:{code:ab.code},raw:true
......@@ -70,11 +81,23 @@ class TemplatelinkService extends ServiceBase {
return system.getResultFail(-301,"该链接正在投放中,不能执行此操作");
}
ab.id = linkinfo.id;
//查重
var distinctObj = {
template_id:ab.template_id,channel_code:ab.channel_code,else_channel_param:else_channel_param,
business_type_code:business_type_code,lauch_type_code:lauch_type_code,marketing_subject_code:marketing_subject_code,
id:{[this.db.Op.ne]:linkinfo.id}
};
var distinctres = await this.dao.model.findOne({
where:distinctObj,raw:true
});
if(distinctres && distinctres.id){
return system.getResultFail(-113,"操作失败,存在重复的链接");
}
}
ab.link_url_pc = this.templateLinkUrl+"?id="+ab.template_id+"&source="+ab.channel_code+"&device=pc&event="+ab.else_channel_param+
"&business="+ab.business_type_code+"&type="+ab.lauch_type_name+"for="+ab.marketing_subject_code;
"&business="+ab.business_type_code+"&type="+ab.lauch_type_code+"for="+ab.marketing_subject_code;
ab.link_url_mobile = this.templateLinkUrl+"?id="+ab.template_id+"&source="+ab.channel_code+"&device=mobile&event="+ab.else_channel_param+
"&business="+ab.business_type_code+"&type="+ab.lauch_type_name+"for="+ab.marketing_subject_code;
"&business="+ab.business_type_code+"&type="+ab.lauch_type_code+"for="+ab.marketing_subject_code;
return ab;
}
......
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