liuyu 4 年之前
父節點
當前提交
c6611d492f
共有 4 個文件被更改,包括 3 次插入24 次删除
  1. 2 2
      app/controller/.lookuser.js
  2. 0 4
      app/controller/lookuser.js
  3. 1 0
      app/model/lookuser.js
  4. 0 18
      app/service/lookuser.js

+ 2 - 2
app/controller/.lookuser.js

@@ -1,6 +1,6 @@
 module.exports = {
   create: {
-    requestBody: ["roomid", "roomname", "userid","username"],
+    requestBody: ["roomid", "roomname", "userid","username","phone"],
   },
   destroy: {
     params: ["!id"],
@@ -8,7 +8,7 @@ module.exports = {
   },
   update: {
     params: ["!id"],
-    requestBody: ["roomid", "roomname", "userid","username"],
+    requestBody: ["roomid", "roomname", "userid","username","phone"],
   },
   show: {
     parameters: {

+ 0 - 4
app/controller/lookuser.js

@@ -13,10 +13,6 @@ class LookuserController extends Controller {
     this.service = this.ctx.service.lookuser;
   }
 
-  async index() {
-    const data = await this.service.query(this.ctx.query);
-    this.ctx.ok({ ...data });
-  }
 }
 
 module.exports = CrudController(LookuserController, meta);

+ 1 - 0
app/model/lookuser.js

@@ -7,6 +7,7 @@ const LookuserSchema = {
   roomname: { type: String, required: false, maxLength: 200 }, // 房间号
   userid: { type: String, required: false, maxLength: 200 }, // 观看用户id
   username: { type: String, required: false, maxLength: 200 }, // 观看用户名称
+  phone: { type: String, required: false, maxLength: 200 }, // 手机号
 };
 
 const schema = new Schema(LookuserSchema, { toJSON: { virtuals: true } });

+ 0 - 18
app/service/lookuser.js

@@ -11,7 +11,6 @@ class LookuserService extends CrudService {
   constructor(ctx) {
     super(ctx, 'lookuser');
     this.model = this.ctx.model.Lookuser;
-    this.rmodel = this.ctx.model.Roomuser;
   }
 
   async create(data) {
@@ -22,23 +21,6 @@ class LookuserService extends CrudService {
     }
   }
 
-  async query({ skip, limit, ...info }) {
-    const total = await this.model.count(info);
-    const lookuser = await this.model
-      .find(info)
-      .skip(Number(skip))
-      .limit(Number(limit));
-    const data = [];
-    for (const _lookuser of lookuser) {
-      const lu = JSON.parse(JSON.stringify(_lookuser));
-      const ruser = await this.rmodel.findById(_lookuser.userid);
-      const _ruser = JSON.parse(JSON.stringify(ruser));
-      const newdata = { ...lu, ..._ruser };
-      data.push(newdata);
-    }
-    return { data, total };
-  }
-
 
 }