Commit bc684391 by xsren@gongsibao.com

询价接口修改

parent f5426cdf
......@@ -99,53 +99,73 @@ class ProductService extends ServiceBase {
* @returns {Promise<{msg: *, data, status: number}>}
*/
async getProductPrice(actionBody){
let pathCode = actionBody.pathCode;
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!')
}
const code1 = pathCode.split('/')[1];//一级产品码
const code2 = pathCode.split('/')[2];//二级产品码
let channel_item_code = code2;
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 = '${channelItemCode}'`;
switch (code1) {
case 'sbfu':
channel_item_code = channelItemCode;
break;
case '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 '%${time}%'`;
}else{
return system.getResultFail(null,'actionBody.time can not be empty!')
}
break;
case '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!')
}
break;
case 'gsfu':
if(code2 != 'ysgszc'){
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!')
}
}else{
let str = actionBody.city;
producesql += ` AND pc.price_desc LIKE '%${str}%'`;
}
if(actionBody.companyType != ''){
producesql += ` AND pc.additions_desc LIKE '%${actionBody.companyType}%'`;
}else{
return system.getResultFail(null,'actionBody.companyType and actionBody.companyType can not be empty!')
}
break;
case 'csdb':
if(actionBody.city != ''){
let str = actionBody.city;
producesql += ` AND pc.price_desc LIKE '%${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) {
......
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