Commit 3c7afe5c by xsren@gongsibao.com

update

parent 9e270903
......@@ -47,6 +47,9 @@ class OpProductAPI extends APIBase {
case "getProductPrice"://询价
opResult = await this.productSve.getProductPrice(pobj.actionBody);
break;
case "getMinPrice"://最低价
opResult = await this.productSve.getMinPrice(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -35,6 +35,7 @@ class ProductService extends ServiceBase {
attributes: ["id", "pay_code", "price", "supply_price", "service_charge", "public_expense", "is_default", "is_show", "price_type", "price_type_name",
"sort", "price_desc", "min_qty", "max_qty", "service_code"
],
order: [ [ "price", 'ASC' ] ],
raw: true
});
if (!pList || pList.length == 0) {
......@@ -118,7 +119,7 @@ class ProductService extends ServiceBase {
if(actionBody.time!= ''){
const index = actionBody.time.indexOf('个');
const time = actionBody.time.substring(0,index);
producesql += ` AND pc.additions_desc LIKE = '${time}'`;
producesql += ` AND pc.additions_desc = '${time}'`;
}else{
return system.getResultFail(null,'actionBody.time can not be empty!')
}
......@@ -175,5 +176,22 @@ class ProductService extends ServiceBase {
}
return system.getResultSuccess(actionBody);
}
/**
* 获取最低价
* @returns {Promise<void>}
*/
async getMinPrice(pobj){
let data ={};
if(!pobj.actionBody.product_id){
return system.getResultFail(-1,'product_id is empty');
}
let sql = `select min(price) price from p_product_price where product_id = ${pobj.actionBody.product_id}`;
let result = await this.customQuery(sql);
if(result){
data = result[0];
}
return system.getResultSuccess(data);
}
}
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