Commit 2141605f by 庄冰

productSve

parent ed885bf9
...@@ -39,17 +39,18 @@ class OpProductAPI extends APIBase { ...@@ -39,17 +39,18 @@ class OpProductAPI extends APIBase {
async opActionProcess(action_process, action_type, action_body, pobj, req) { async opActionProcess(action_process, action_type, action_body, pobj, req) {
// action_body.app = req.app; // action_body.app = req.app;
// action_body.user = req.user; // action_body.user = req.user;
action_body.app = { id: 7};
var opResult = null; var opResult = null;
switch (action_type) { switch (action_type) {
case "findByTypeCode"://通过产品类别编码获取产品列表 case "findByTypeCode"://通过产品类别编码获取产品列表
action_body["app"]=pobj.app;
opResult = await this.productSve.findByTypeCode(action_body); opResult = await this.productSve.findByTypeCode(action_body);
break; break;
case "findByTypeOneCode"://通过产品大类编码获取产品列表 case "findByTypeOneCode"://通过产品大类编码获取产品列表
action_body["app"]=pobj.app;
opResult = await this.productSve.findByTypeOneCode(action_body); opResult = await this.productSve.findByTypeOneCode(action_body);
break; break;
case "getProductDetailByCode"://通过产品大类编码获取产品列表 case "getProductDetailByCode"://获取产品详情
opResult = await this.productSve.getProductDetailByCode(action_body.itemCode,action_body.app.id); opResult = await this.productSve.getProductDetailByCode(action_body.itemCode,pobj.uapp_id);
break; break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
......
...@@ -39,14 +39,14 @@ class ProductService extends ServiceBase { ...@@ -39,14 +39,14 @@ class ProductService extends ServiceBase {
* @param {*} pcode 产品码 * @param {*} pcode 产品码
* @param {*} appid 渠道id * @param {*} appid 渠道id
*/ */
async getProductDetailByCode(pcode,appid){ async getProductDetailByCode(pcode,uappid){
if(!pcode){ if(!pcode){
return system.getResult(null, "产品编码有误"); return system.getResult(null, "产品编码有误");
} }
if(!appid){ if(!uappid){
return system.getResult(null, "渠道编码有误"); return system.getResult(null, "渠道编码有误");
} }
var sql = "select * from v_product where uapp_id="+appid+" and item_code='"+pcode+"'"; var sql = "select * from v_product where uapp_id="+uappid+" and item_code='"+pcode+"'";
var tmpResult = await this.customQuery(sql); var tmpResult = await this.customQuery(sql);
if(tmpResult && tmpResult.length>0){ if(tmpResult && tmpResult.length>0){
for(var i=0;i<tmpResult.length;i++){ for(var i=0;i<tmpResult.length;i++){
...@@ -73,14 +73,14 @@ class ProductService extends ServiceBase { ...@@ -73,14 +73,14 @@ class ProductService extends ServiceBase {
*/ */
async findByTypeCode(obj){ async findByTypeCode(obj){
var app=obj.app; var app=obj.app;
if(!app || !app.id){ if(!app || !app.uapp_id){
return system.getResult(null, "渠道参数有误"); return system.getResult(null, "渠道参数有误");
} }
var typeCode = obj.typeCode; var typeCode = obj.typeCode;
if(!typeCode){ if(!typeCode){
return system.getResult(null, "产品类别编码有误"); return system.getResult(null, "产品类别编码有误");
} }
var sql = "select * from v_product where uapp_id="+app.id+" and type_code='"+typeCode+"'"; var sql = "select * from v_product where uapp_id="+app.uapp_id+" and type_code='"+typeCode+"'";
var tmpResult = await this.customQuery(sql); var tmpResult = await this.customQuery(sql);
return system.getResultSuccess(tmpResult); return system.getResultSuccess(tmpResult);
} }
...@@ -97,7 +97,7 @@ class ProductService extends ServiceBase { ...@@ -97,7 +97,7 @@ class ProductService extends ServiceBase {
if(!typeOneCode){ if(!typeOneCode){
return system.getResult(null, "产品类别编码有误"); return system.getResult(null, "产品类别编码有误");
} }
var sql = "select * from v_product where uapp_id="+app.id+" and p_type_code='"+typeOneCode+"'"; var sql = "select * from v_product where uapp_id="+app.uapp_id+" and p_type_code='"+typeOneCode+"'";
var tmpResult = await this.customQuery(sql); var tmpResult = await this.customQuery(sql);
return system.getResultSuccess(tmpResult); return system.getResultSuccess(tmpResult);
} }
......
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