Procházet zdrojové kódy

增加用户权限字段

asd123a20 před 3 roky
rodič
revize
6a2bb031ad

+ 2 - 0
service-vip/app/model/power.js

@@ -7,6 +7,8 @@ const SchemaDefine = {
   openid: { type: String, required: true },
   // 文章IDlist
   list: { type: Array, required: true },
+  // 绑定类型
+  type: { type: String, required: true },
 };
 const schema = new Schema(SchemaDefine);
 module.exports = app => {

+ 4 - 4
service-vip/app/service/power.js

@@ -7,12 +7,12 @@ class PowerService extends Service {
     super(ctx);
     this.model = this.ctx.model.Power;
   }
-  async create({ vipTab, openid, list }) {
+  async create({ vipTab, openid, list, type }) {
     assert(list, 'ID列表不存在');
     assert(openid, 'openid不存在');
     assert(vipTab, '会员标识不存在');
     try {
-      const res = await this.model.create({ vipTab, openid, list });
+      const res = await this.model.create({ vipTab, openid, list, type });
       return { errcode: 0, errmsg: 'ok', data: res };
     } catch (error) {
       throw error;
@@ -36,9 +36,9 @@ class PowerService extends Service {
       throw error;
     }
   }
-  async query({ skip, limit, vipTab, openid, list }) {
+  async query({ skip, limit, vipTab, openid, list, type }) {
     const filter = {};
-    const arr = { vipTab, openid, list };
+    const arr = { vipTab, openid, list, type };
     for (const e in arr) {
       let datas;
       if (e === 'list') {