Commit ef89c955 by 任晓松

获取渠道和产品

parent af672e67
...@@ -65,6 +65,9 @@ class OpProductAPI extends APIBase { ...@@ -65,6 +65,9 @@ class OpProductAPI extends APIBase {
break; break;
//2020-12-17 baidu reg end ----------------- //2020-12-17 baidu reg end -----------------
case "getAllProducts":
opResult = await this.productSve.getAllProducts();
break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
......
...@@ -110,6 +110,14 @@ class AccessAuthAPI extends APIBase { ...@@ -110,6 +110,14 @@ class AccessAuthAPI extends APIBase {
return result; return result;
} }
/**
* 获取所有渠道
* @returns {Promise<void>}
*/
async getAllChannels(){
var result = await this.utilsappSve.getAllChannels();
return result;
}
} }
module.exports = AccessAuthAPI; module.exports = AccessAuthAPI;
\ No newline at end of file
...@@ -487,5 +487,42 @@ class ProductService extends ServiceBase { ...@@ -487,5 +487,42 @@ class ProductService extends ServiceBase {
} }
return system.getResultSuccess({successRet,failRet}) return system.getResultSuccess({successRet,failRet})
} }
/**
* 获取所有渠道的产品
* @returns {Promise<void>}
*/
async getAllProducts(){
let sql = `select DISTINCT(channel_item_name),item_code from p_product`;
let result = await this.customQuery(sql);
let arr = [];
result.forEach(item=>{
if (item.channel_item_name.indexOf('市') == item.channel_item_name.length-1) {
item.channel_item_name += '公司注册'
}
if (item.channel_item_name.indexOf('区') == item.channel_item_name.length-1) {
item.channel_item_name += '公司注册'
}
if (item.item_code == '10202010202001'){
item.item_code = 'zzsbzc';
}
if (item.item_code == '10202010202002'){
item.item_code = 'fzsbzc';
}
if (item.item_code == '10202010202003'){
item.item_code = 'dbsbzc';
}
if (item.item_code == '10202010204002'){
item.item_code = 'icpsq';
}
if (item.item_code == '10202010204001'){
item.item_code = 'edisq';
}
if(!arr.includes(item)){
arr.push(item)
}
})
return system.getResultSuccess(arr);
}
} }
module.exports = ProductService; module.exports = ProductService;
...@@ -60,5 +60,15 @@ class UtilsAppSve extends AppServiceBase { ...@@ -60,5 +60,15 @@ class UtilsAppSve extends AppServiceBase {
return system.getResult(null, "渠道码错误") return system.getResult(null, "渠道码错误")
} }
} }
/**
* 获取所有渠道
* @returns {Promise<{msg: *, data: (*|null), status: number}>}
*/
async getAllChannels(){
let sql = `SELECT DISTINCT(uapp_id),app_name FROM p_app`;
let result = await this.appDao.customQuery(sql);
return system.getResultSuccess(result);
}
} }
module.exports = UtilsAppSve; module.exports = UtilsAppSve;
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