Commit bd73a0e1 by 宋毅

tj

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