reloaded 5 سال پیش
والد
کامیت
7b307d6f36
2فایلهای تغییر یافته به همراه16 افزوده شده و 2 حذف شده
  1. 13 1
      app/controller/.personchat.js
  2. 3 1
      app/model/personchat.js

+ 13 - 1
app/controller/.personchat.js

@@ -2,7 +2,9 @@ module.exports = {
   create: {
     requestBody: [
       "!sender_id",
+      "sender_name",
       "!receiver_id",
+      "receiver_name",
       "!content",
       "!personroom_id",
       "status",
@@ -16,7 +18,9 @@ module.exports = {
     params: ["!id"],
     requestBody: [
       "sender_id",
+      "sender_name",
       "receiver_id",
+      "receiver_name",
       "content",
       "personroom_id",
       "status",
@@ -30,7 +34,15 @@ module.exports = {
   },
   index: {
     parameters: {
-      query: ["sender_id", "receiver_id", "content", "personroom_id", "status"],
+      query: [
+        "sender_id",
+        "sender_name",
+        "receiver_id",
+        "receiver_name",
+        "content",
+        "personroom_id",
+        "status",
+      ],
     },
     service: "query",
     options: {

+ 3 - 1
app/model/personchat.js

@@ -4,10 +4,12 @@ const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
 
 const Personchat = {
   sender_id: { type: String, required: true, maxLength: 200 }, // 发送人id
+  sender_name: { type: String, required: false, maxLength: 200 }, // 发送人名字
   receiver_id: { type: String, required: true, maxLength: 200 }, // 接收人id
+  receiver_name: { type: String, required: false, maxLength: 200 }, // 接收人名字
   personroom_id: { type: String, required: true, maxLength: 200 }, // 聊天房间id
   content: { type: String, required: true, maxLength: 1000 }, // 发言内容
-  status: { type: String, required: false, maxLength: 100, default: '0' }, // 状态,0-未读,1-已读
+  status: { type: String, required: false, maxLength: 100, default: "0" }, // 状态,0-未读,1-已读
 };
 const schema = new Schema(Personchat, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });