Commit bd73a0e1 by 宋毅

tj

parent 77e86f3b
...@@ -4,13 +4,14 @@ class ProductInterfaceDao extends Dao { ...@@ -4,13 +4,14 @@ class ProductInterfaceDao extends Dao {
constructor() { constructor() {
super(Dao.getModelName(ProductInterfaceDao)); super(Dao.getModelName(ProductInterfaceDao));
} }
async getItemByProductId(productId) { async getListByProductPriceId(productPriceId) {
return this.model.findOne({ return await this.productpriceDao.model.findAll({
where: { where: {
product_id: productId product_price_id: productPriceId
}, },
attributes: [ attributes: [
"id", "id",
"op_type",
"interface_url", "interface_url",
"interface_type", "interface_type",
"interface_type_name", "interface_type_name",
......
...@@ -25,6 +25,7 @@ module.exports = (db, DataTypes) => { ...@@ -25,6 +25,7 @@ module.exports = (db, DataTypes) => {
price_type_name: DataTypes.STRING(10), //定价类型名称 price_type_name: DataTypes.STRING(10), //定价类型名称
sort: DataTypes.INTEGER, sort: DataTypes.INTEGER,
price_desc: DataTypes.STRING(255), //价格描述 price_desc: DataTypes.STRING(255), //价格描述
service_code: DataTypes.STRING(255),
min_qty: DataTypes.INTEGER, //最小数量 min_qty: DataTypes.INTEGER, //最小数量
max_qty: DataTypes.INTEGER, //最大数量 max_qty: DataTypes.INTEGER, //最大数量
......
...@@ -33,8 +33,8 @@ class ProductService extends ServiceBase { ...@@ -33,8 +33,8 @@ class ProductService extends ServiceBase {
} }
var pList = await this.productpriceDao.model.findAll({ var pList = await this.productpriceDao.model.findAll({
where: { product_id: item.id }, where: { product_id: item.id },
attributes: ["pay_code", "price", "supply_price", "service_charge", "public_expense", "is_default", "price_type", "price_type_name", attributes: ["id", "pay_code", "price", "supply_price", "service_charge", "public_expense", "is_default", "price_type", "price_type_name",
"sort", "price_desc", "min_qty", "max_qty" "sort", "price_desc", "min_qty", "max_qty", "service_code"
], ],
raw: true raw: true
}); });
...@@ -49,11 +49,11 @@ class ProductService extends ServiceBase { ...@@ -49,11 +49,11 @@ class ProductService extends ServiceBase {
* @param {*} actionBody productId产品id * @param {*} actionBody productId产品id
*/ */
async getProductInterface(actionBody) { async getProductInterface(actionBody) {
var item = await this.productinterfaceDao.getItemByProductId(actionBody.productId); var list = await this.productinterfaceDao.getListByProductPriceId(actionBody.productPriceId);
if (!item) { // if (!item) {
return system.getResult(null, "product to interface is data empty !"); // return system.getResult(null, "product to interface is data empty !");
} // }
return system.getResultSuccess(item); return system.getResultSuccess(list);
} }
} }
......
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