import { default as BaseController } from "../../baseController";
|
import { Post } from "egg-shell-decorators";
|
import { BaseProductInfo } from "../../../entity/basicInfo/base/baseProductInfo";
|
export default class ProductInfoController extends BaseController {
|
//#region 获取物料信息
|
/**
|
*获取物料信息
|
*/
|
@Post()
|
public async productInfo() {
|
let { ctx } = this;
|
//let body = ctx.body; // 接收前端发来的数据
|
let userInfo = await ctx.helper.userInfo(); // 权限
|
let userProduct_Id = userInfo.userProduct_Id; // 获取权限id
|
try {
|
let dataInfo = await this.dbRead.find(BaseProductInfo, {
|
where: {
|
userProduct_Id: userProduct_Id
|
}
|
});
|
if (!dataInfo) {
|
this.info.result = false;
|
this.info.msg = "数据不存在";
|
ctx.body = this.info;
|
return;
|
}
|
this.info.result = true;
|
this.info.data = dataInfo;
|
} catch (error) {
|
this.info.result = false;
|
this.info.msg = "错误信息:" + error.message;
|
}
|
ctx.body = this.info;
|
}
|
//#endregion
|
}
|