Commit f5426cdf by xsren@gongsibao.com

询价新接口

parent 429887e3
...@@ -44,6 +44,9 @@ class OpProductAPI extends APIBase { ...@@ -44,6 +44,9 @@ class OpProductAPI extends APIBase {
case "getProductTypeInfo"://阿里工商获取需求類型 case "getProductTypeInfo"://阿里工商获取需求類型
opResult = await this.producttypeSve.getProductTypeInfo(pobj.actionBody, pobj.appInfo); opResult = await this.producttypeSve.getProductTypeInfo(pobj.actionBody, pobj.appInfo);
break; break;
case "getProductPrice"://询价
opResult = await this.productSve.getProductPrice(pobj.actionBody);
break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
......
...@@ -93,6 +93,67 @@ class ProductService extends ServiceBase { ...@@ -93,6 +93,67 @@ class ProductService extends ServiceBase {
return system.getResultSuccess(actionBody); return system.getResultSuccess(actionBody);
} }
/**
* 工商H5 产品询价
* @param actionBody
* @returns {Promise<{msg: *, data, status: number}>}
*/
async getProductPrice(actionBody){
let channelItemCode = actionBody.channelItemCode;
const code1 = channelItemCode.split('/')[1]
const code2 = channelItemCode.split('/')[2]
var producesql = "SELECT 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.channel_item_code = '" +code2+"'";
//资质许可
if(code1 === 'zzxk'){
if(actionBody.province != ''){
producesql += " AND pc.price_desc LIKE '%"+actionBody.province+"%'";
}else{
return system.getResultFail(null,'actionBody.province can not be empty!')
}
if(actionBody.time!= ''){
const index = actionBody.time.indexOf('个');
const time = actionBody.time.substring(0,index)
producesql += " AND pc.additions_desc LIKE '%"+actionBody.time+"%'";
}else{
return system.getResultFail(null,'actionBody.time can not be empty!')
}
}
//版权管理
if(code1 === 'bqfu'){
if(actionBody.serviceType != ''){
producesql += " AND pc.price_desc LIKE '%"+actionBody.serviceType+"%'";
}else{
return system.getResultFail(null,'actionBody.serviceType can not be empty!')
}
if(actionBody.time!= ''){
const index = actionBody.time.indexOf('个');
const time = actionBody.time.substring(0,index)
producesql += " AND pc.additions_desc LIKE '%"+time+"%'";
}else{
return system.getResultFail(null,'actionBody.time can not be empty!')
}
}
//工商服务
if(code1 === 'gsfu'){
if(actionBody.city != '' && actionBody.serviceType != ''){
let str = actionBody.city + actionBody.serviceType;
producesql += " AND pc.price_desc LIKE '%"+str+"%'";
}else{
return system.getResultFail(null,'actionBody.serviceType can not be empty!')
}
if(actionBody.companyType != ''){
producesql += " AND pc.additions_desc LIKE '%"+actionBody.companyType+"%'";
}else{
return system.getResultFail(null,'actionBody.taxType and actionBody.companyType can not be empty!')
}
}
var produceinfo = await this.customQuery(producesql);
if (produceinfo) {
actionBody.payCode = produceinfo[0].payCode;
actionBody.channelItemCode = produceinfo[0].channelItemCode;
actionBody.price = produceinfo[0].price;
}
return system.getResultSuccess(actionBody);
}
} }
module.exports = ProductService; 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