Commit 8a614d37 by 宋毅

Merge branch 'center-app' of gitlab.gongsibao.com:jiangyong/zhichan into center-app

parents 77e0ffbf 25360243
......@@ -68,6 +68,12 @@ class OpProductAPI extends APIBase {
case "getAllProducts":
opResult = await this.productSve.getAllProducts();
break;
case "getProductByWhere":
opResult = await this.productSve.getProductByWhere(pobj.actionBody);
break;
case "getymicpProduce"://易名icp获取产品信息
opResult = await this.productSve.getymicpProduce(pobj.actionBody,pobj.appInfo);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -110,7 +110,7 @@ class ProductService extends ServiceBase {
var producesql = "SELECT pc.service_code,pc.pay_code payCode,pt.channel_item_code channelItemCode,pc.price price FROM `p_product` pt JOIN p_product_price pc ON pt.id = pc.product_id WHERE pt.channel_item_code LIKE '%" + actionBody.typeCode
+ "%' AND pc.price_desc='"+actionBody.province+"' ";
if(uapp_id){
producesql = producesql+" and uapp_id="+uapp_id;
producesql = producesql+" and pc.uapp_id="+uapp_id;
}
var produceinfo = await this.customQuery(producesql);
if (produceinfo) {
......@@ -520,5 +520,73 @@ class ProductService extends ServiceBase {
})
return system.getResultSuccess(arr);
}
/**
* 根据条件过去产品
* @param actionBody
* @returns {Promise<void>}
*/
async getProductByWhere(actionBody){
let item = await this.dao.findOne(actionBody.whereParams);
return system.getResult(item);
}
//获取易名的icp产品信息
async getymicpProduce(actionBody,appInfo) {
console.log('actionBody---',actionBody)
var itemCode = {
item_code:actionBody.channelItemCode || actionBody.typeCode
}
var pathSql = "SELECT path_code,channel_item_code,service_business_code FROM p_product WHERE item_code = " + `'${itemCode.item_code}'` +" AND uapp_id = 52";
var pathCodeData = await this.customQuery(pathSql,itemCode);
if(actionBody.pathCode){
var pathCode = actionBody.pathCode;
}else{
if(pathCodeData && pathCodeData.length > 0){
var pathCode = pathCodeData[0].path_code;
}
}
console.log('pathCode---',pathCode)
if(actionBody.channelItemCode){
var channelItemCode = actionBody.channelItemCode;
}else{
if(pathCodeData && pathCodeData.length > 0){
var channelItemCode = pathCodeData[0].channel_item_code;
}
}
if(pathCodeData && pathCodeData.length > 0){
var serviceBusinessCode = pathCodeData[0].service_business_code;
}
const code1 = pathCode.split('/')[1];//一级产品码
const code2 = pathCode.split('/')[2];//二级产品码
let channel_item_code = code2;
var producesql = `SELECT pc.service_code,pc.pay_code payCode,pt.channel_item_code channelItemCode,pc.price price FROM p_product pt JOIN p_product_price pc ON pt.id = pc.product_id WHERE is_show = 1 AND pt.uapp_id = 52 AND pt.channel_item_code = '${channelItemCode}'`;
switch (code1) {
case 'zzfw':
if(actionBody.city){
let str = actionBody.city;
producesql += ` AND pc.price_desc = '${str}'`;
}else{
return system.getResultFail(null,'actionBody.serviceType can not be empty!')
}
break;
default:
producesql += ` AND pt.channel_item_code = '${code2}'`;
break;
}
var produceinfo = await this.customQuery(producesql);
if (produceinfo.length != 0) {
actionBody.payCode = produceinfo[0].payCode;
actionBody.channelItemCode = produceinfo[0].channelItemCode;
actionBody.price = produceinfo[0].price;
actionBody.serviceBusinessCode = serviceBusinessCode
actionBody.service_code = produceinfo[0].service_code
return system.getResultSuccess(actionBody);
} else {
return system.getResult(null, "getRegProduce fail , please check actionBody");
}
}
}
module.exports = ProductService;
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