|
@@ -13,7 +13,7 @@ class ProductService extends CrudService {
|
|
|
this.model = this.ctx.model.Product;
|
|
|
}
|
|
|
|
|
|
- async fetch({ id }) {
|
|
|
+ async newfetch({ id }) {
|
|
|
let product = await this.model.findById(id);
|
|
|
if (product.is_display) {
|
|
|
product = JSON.parse(JSON.stringify(product));
|
|
@@ -27,12 +27,16 @@ class ProductService extends CrudService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- async query({ skip, limit, ...info }) {
|
|
|
+ async newquery({ skip, limit, ...info }) {
|
|
|
+ console.log('222222222222222222222222222222222222222222222222');
|
|
|
+
|
|
|
const products = await this.model.find(info);
|
|
|
const _products = await this.model.find(info).skip(Number(skip)).limit(Number(limit));
|
|
|
const data = [];
|
|
|
for (const _product of _products) {
|
|
|
- const newproduct = await this.fetch({ id: _product._id });
|
|
|
+ console.log(_product);
|
|
|
+
|
|
|
+ const newproduct = await this.newfetch({ id: _product._id });
|
|
|
data.push(newproduct);
|
|
|
}
|
|
|
return { data, total: products.length };
|