lrf402788946 4 年之前
父节点
当前提交
155bf945a5
共有 3 个文件被更改,包括 7 次插入1 次删除
  1. 1 0
      app/controller/dock/.transaction.js
  2. 5 0
      app/controller/dock/transaction.js
  3. 1 1
      app/service/dock/transaction.js

+ 1 - 0
app/controller/dock/.transaction.js

@@ -62,6 +62,7 @@ module.exports = {
       query: ["skip", "limit"],
       sort: ["meta.createdAt"],
       desc: true,
+      count: true,
     },
   },
   step: {

+ 5 - 0
app/controller/dock/transaction.js

@@ -9,5 +9,10 @@ class TransactionController extends Controller {
     super(ctx);
     this.service = this.ctx.service.dock.transaction;
   }
+
+  async index() {
+    const { data, total } = await this.service.query(this.ctx.query);
+    this.ctx.ok({ data, total });
+  }
 }
 module.exports = CrudController(TransactionController, meta);

+ 1 - 1
app/service/dock/transaction.js

@@ -12,7 +12,7 @@ class TransactionService extends CrudService {
     this.model = this.ctx.model.Transaction;
   }
 
-  async query(query, { skip = 0, limit = 0 } = {}) {
+  async query({ skip = 0, limit = 0, ...query }) {
     query = this.ctx.service.util.util.dealQuery(query);
     const { user_id, supplier, demander, status, ...info } = query;
     if (status)query.status = status.split(',');