Commit 14782c26 by linboxuan

lin add productType

parent 29588d1c
......@@ -39,10 +39,10 @@ class OpProductAPI extends APIBase {
opResult = await this.productSve.getaliicProduce(pobj.actionBody);
break;
case "getaliicpProduce"://阿里icp获取产品信息
opResult = await this.productSve.getaliicpProduce(pobj.actionBody,pobj.appInfo);
opResult = await this.productSve.getaliicpProduce(pobj.actionBody, pobj.appInfo);
break;
case "getIcpProduce"://获取ICP产品信息
opResult = await this.productSve.getIcpProduce(pobj.actionBody,pobj.appInfo);
opResult = await this.productSve.getIcpProduce(pobj.actionBody, pobj.appInfo);
break;
case "getProductTypeInfo"://阿里工商获取需求類型
opResult = await this.producttypeSve.getProductTypeInfo(pobj.actionBody, pobj.appInfo);
......@@ -54,10 +54,10 @@ class OpProductAPI extends APIBase {
opResult = await this.productSve.getMinPrice(pobj);
break;
case "getProductRecommend":
opResult = await this.productSve.getProductRecommend(pobj.actionBody,pobj.appInfo);
opResult = await this.productSve.getProductRecommend(pobj.actionBody, pobj.appInfo);
break;
case "updateProductPrice":
opResult = await this.productSve.updateProductPrice(pobj.actionBody,pobj.appInfo);
opResult = await this.productSve.updateProductPrice(pobj.actionBody, pobj.appInfo);
break;
//2020-12-17 baidu reg start -----------------
case "getRegProducePrice"://获取reg产品price
......@@ -72,11 +72,20 @@ class OpProductAPI extends APIBase {
opResult = await this.productSve.getProductByWhere(pobj.actionBody);
break;
case "getymicpProduce"://易名icp获取产品信息
opResult = await this.productSve.getymicpProduce(pobj.actionBody,pobj.appInfo);
opResult = await this.productSve.getymicpProduce(pobj.actionBody, pobj.appInfo);
break;
case "getAllPathName":
opResult = await this.productSve.getAllPathName();
break;
case "getAllProductType":// 获取全部产品大类
opResult = await this.producttypeSve.getAllProductType(pobj.actionBody);
break;
case "submitProductType":// 创建产品大类
opResult = await this.producttypeSve.submitProductType(pobj.actionBody);
break;
case "editProductType":// 修改产品大类
opResult = await this.producttypeSve.editProductType(pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -7,16 +7,57 @@ class ProductTypeService extends ServiceBase {
super("dbproduct", ServiceBase.getDaoName(ProductTypeService));
}
async getProductTypeInfo(actionBody,appInfo){
if(!actionBody.type){
async getProductTypeInfo(actionBody, appInfo) {
if (!actionBody.type) {
return system.getResult(null, "channelCode item is data empty !");
}
if(!appInfo){
if (!appInfo) {
return system.getResult(null, "appInfo item is data empty !");
}
var producttypeinfo=await this.findOne({"channel_type_code":actionBody.type,"uapp_id":appInfo.uapp_id});
var producttypeinfo = await this.findOne({ "channel_type_code": actionBody.type, "uapp_id": appInfo.uapp_id });
return system.getResultSuccess(producttypeinfo);
}
/**
* 获取全部产品大类
* @returns {Promise<void>}
*/
async getAllProductType(actionBody) {
var tmpWhere = {
pageInfo: {}
};
if (actionBody) {
if (actionBody.pageSize) {
tmpWhere.limit = actionBody.pageSize;
}
if (actionBody.current) {
let current = actionBody.current;
tmpWhere.offset = (current - 1) * actionBody.pageSize;
}
}
let result = await this.dao.model.findAndCountAll(tmpWhere)
return system.getResultSuccess(result);
}
/**
* 创建产品大类
* @returns {Promise<void>}
*/
async submitProductType(actionBody) {
let result = await this.dao.model.create(actionBody)
return system.getResultSuccess(result);
}
/**
* 修改产品大类
* @returns {Promise<void>}
*/
async editProductType(actionBody) {
if (actionBody) {
let result = await this.dao.update(actionBody)
return system.getResultSuccess(result);
}
return;
}
}
module.exports = ProductTypeService;
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