Commit 29727f70 by v_vjyjiang

d

parent ad95aca8
......@@ -16,13 +16,20 @@ class ProductAPI extends APIBase {
* code:''
* ]
*/
async findRegionsByProductName(p, q, req) {
async findRegionsByProductName (p, q, req) {
let pname = p.productname;
let sp = p.sp;
let rs = await this.productpriceS.findRegionsByProductName(pname, sp)
return system.getResult(rs);
}
classDesc() {
async findCostBySkuCode (p, q, req) {
let skucode = p.skucode;
let rs = await this.productpriceS.findCostBySkuCode(skucode)
return system.getResult({ cost: rs });
}
classDesc () {
return {
groupName: "auth",
groupDesc: "认证相关的包",
......@@ -37,12 +44,12 @@ class ProductAPI extends APIBase {
`,
};
}
methodDescs() {
methodDescs () {
return [
];
}
exam() {
exam () {
return ``
}
}
......
......@@ -4,6 +4,24 @@ class ProductpriceService extends ServiceBase {
constructor() {
super("product", ServiceBase.getDaoName(ProductpriceService));
}
async findCostBySkuCode (skucode) {
let productpricetmp = await this.dao.model.findOne({
where: { skucode: skucode, isEnabled: true },
include: [
{ model: this.db.models.productcost, where: { expensetype: 'service' }, as: "costs", attributes: ['id', 'expensetype', 'costamount'] }
],
raw: true,
}
)
let costAmount = 0
//获取服务费成本
if (productpricetmp && productpricetmp['costs.costamount']) {
costAmount = Number(productpricetmp['costs.costamount'])
} else {
console.log("skucode not find product:", skucode)
}
return costAmount
}
/**
* @param {*} pname 产品名称
* @param {*} spname 服务商名称
......
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