Commit 286c267a by 庄冰

模板接口

parent ab6a9800
......@@ -26,7 +26,8 @@ module.exports = (db, DataTypes) => {
lauch_type_code: DataTypes.STRING,
marketing_subject_code: DataTypes.STRING,
is_enabled: DataTypes.INTEGER,
link_url: DataTypes.STRING,
link_url_pc: DataTypes.STRING,
link_url_mobile: DataTypes.STRING,
notes: DataTypes.STRING,
user_id: DataTypes.STRING(100),
user_name: DataTypes.STRING(100), //user_name 用户名称
......
......@@ -4,37 +4,54 @@ const settings = require("../../../../config/settings");
class TemplatelinkService extends ServiceBase {
constructor() {
super("template", ServiceBase.getDaoName(TemplatelinkService));
this.templateLinkUrl = settings.templateLinkUrl();
}
async findAndCountAll(obj){
var res = await this.dao.findAndCountAll(obj);
return system.getResultSuccess(res);
}
/**
* 校验封装参数
* @param {*} ab
* @param {*} xctx
*/
async checkAndPackageParams(ab,xctx){
if(!ab.channel_id){
return system.getResultFail(-101,"渠道主体不能为空");
if(!ab.channel_code){
return system.getResultFail(-101,"渠道主体编码不能为空");
}
if(!ab.business_type_code){
return system.getResultFail(-102,"业务类型编码不能为空");
}
if(!ab.lauch_type_code){
return system.getResultFail(-103,"投放方式编码不能为空");
}
if(!ab.business_type_id){
return system.getResultFail(-102,"业务类型不能为空");
if(!ab.marketing_subject_code){
return system.getResultFail(-104,"营销主体编码不能为空");
}
if(!ab.lauch_type_id){
return system.getResultFail(-103,"投放方式不能为空");
if(!ab.channel_name){
return system.getResultFail(-105,"渠道主体名称不能为空");
}
if(!ab.marketing_subject_id){
return system.getResultFail(-104,"营销主体不能为空");
if(!ab.business_type_name){
return system.getResultFail(-106,"业务类型名称不能为空");
}
if(!ab.lauch_type_name){
return system.getResultFail(-107,"投放方式名称不能为空");
}
if(!ab.marketing_subject_name){
return system.getResultFail(-108,"营销主体名称不能为空");
}
if(!ab.delivery_word){
return system.getResultFail(-105,"投放词不能为空");
return system.getResultFail(-109,"投放词不能为空");
}
if(!ab.else_channel_param){
return system.getResultFail(-106,"其它渠道参数不能为空");
return system.getResultFail(-110,"其它渠道参数不能为空");
}
if(!ab.template_id){
return system.getResultFail(-107,"模板参数不能为空");
return system.getResultFail(-111,"模板参数不能为空");
}
if(!ab.name){
return system.getResultFail(-107,"任务名称不能为空");
return system.getResultFail(-112,"任务名称不能为空");
}
if(!ab.code){//新增
ab.code = await this.getBusUid("tl");
......@@ -54,6 +71,10 @@ class TemplatelinkService extends ServiceBase {
}
ab.id = linkinfo.id;
}
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;
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;
return ab;
}
......@@ -170,8 +191,5 @@ class TemplatelinkService extends ServiceBase {
await this.dao.delete({id:linkinfo.id});
return system.getResultSuccess();
}
}
module.exports = TemplatelinkService;
\ No newline at end of file
......@@ -31,6 +31,13 @@ var settings = {
return "http://logs-sytxpublic-msgq-service/api/queueAction/producer/springBoard";
}
},
templateLinkUrl:function () {
if (this.env == "dev") {
return "http://192.168.200.162:8081";
} else {
return "http://marketplat.gongsibao.com";
}
},
requrl: function () {
if (this.env == "dev") {
return "http://192.168.1.128:4018";
......
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