Commit 4aff9a0e by 庄冰

alltype

parent 99457cf7
...@@ -41,7 +41,9 @@ class Mediaaggregation extends APIBase { ...@@ -41,7 +41,9 @@ class Mediaaggregation extends APIBase {
case "getSourceChannelInfo"://获取来源渠道信息 case "getSourceChannelInfo"://获取来源渠道信息
opResult = this.launchchannelSve.getSourceChannelInfo(pobj); opResult = this.launchchannelSve.getSourceChannelInfo(pobj);
break; break;
case "getAllProductType"://获取所有渠道信息
opResult = this.needinfoSve.getAllProductType(pobj);
break;
case "productList"://服务列表 case "productList"://服务列表
opResult = await this.mediaaggregationSve.productList(pobj); opResult = await this.mediaaggregationSve.productList(pobj);
break; break;
......
...@@ -10,5 +10,28 @@ class NeedinfoDao extends Dao{ ...@@ -10,5 +10,28 @@ class NeedinfoDao extends Dao{
// return w; // return w;
// } // }
async getAllProductType(cid){
var params = {
company_id: cid
};
var returnRes = {
total: 0,//总记录条数
rows: []
};
var sql = "select id,p_id,p_code,p_name,code,name,pic_url,jump_link_type,jump_link,sequence from mc_product_type where deleted_at is null and p_id = 0 and company_id = :company_id order by sequence desc ";
var list = await this.customQuery(sql, params);
for(var i=0;i<list.length;i++){
if(list[i] && list[i].id)
var sql2 = "select id,p_id,p_code,p_name,code,name,pic_url,sequence from mc_product_type where deleted_at is null and p_id = "+list[i].id+" and company_id = :company_id order by sequence desc ";
var childlist = await this.customQuery(sql2, params);
list[i].children = childlist;
}
returnRes.rows = list;
returnRes.total = list.length;
return returnRes;
}
} }
module.exports=NeedinfoDao; module.exports=NeedinfoDao;
\ No newline at end of file
...@@ -157,6 +157,19 @@ class NeedinfoService extends ServiceBase { ...@@ -157,6 +157,19 @@ class NeedinfoService extends ServiceBase {
} }
return null; return null;
} }
//产品分类
async getAllProductType(pobj) {
if (!pobj || !pobj.actionBody || !pobj.actionBody.company_id) {
return system.getResultFail(-100, "参数错误");
}
var res = await this.dao.getAllProductType(pobj.actionBody.company_id);
return system.getResultSuccess(res);
}
} }
module.exports = NeedinfoService; module.exports = NeedinfoService;
\ No newline at end of file // var a = new NeedinfoService();
// a.getAllProductType({actionBody:{company_id:10}}).then(d=>{
// console.log(JSON.stringify(d));
// })
\ No newline at end of file
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