Browse Source

后端代码

zhaozhiqiang 5 years ago
parent
commit
62a830d027

+ 2 - 1
代码/MadRunFabric.TestUserTypeApi/TestUserTypeApi.IRepositories/ImsgonlineRepository.cs

2
 using System.Collections.Generic;
2
 using System.Collections.Generic;
3
 using System.Text;
3
 using System.Text;
4
 using MadRunFabric.Common;
4
 using MadRunFabric.Common;
5
-using MadRunFabric.Model.OnlineServiceApi;
5
+using MadRunFabric.Model.TestUserTypeApi;
6
 
6
 
7
 namespace TestUserTypeApi.IRepositories
7
 namespace TestUserTypeApi.IRepositories
8
 {
8
 {
9
    public  interface ImsgonlineRepository : IRepository<T_Msg_Chat, string>
9
    public  interface ImsgonlineRepository : IRepository<T_Msg_Chat, string>
10
     {
10
     {
11
+        IEnumerable<object> GetList(int pageindex, int pagesize, int isread, out int recordCount);
11
     }
12
     }
12
 }
13
 }

+ 11 - 2
代码/MadRunFabric.TestUserTypeApi/TestUserTypeApi.Model/Dto/T_Msg_Chat.cs

22
         /// <summary>
22
         /// <summary>
23
         /// 消息来源
23
         /// 消息来源
24
         /// </summary>
24
         /// </summary>
25
-        public int fromuserid { get; set; }
25
+        public string  fromuserid { get; set; }
26
 
26
 
27
         /// <summary>
27
         /// <summary>
28
         /// 消息发送给谁
28
         /// 消息发送给谁
29
         /// </summary>
29
         /// </summary>
30
-        public int touserid { get; set; }
30
+        public string  touserid { get; set; }
31
 
31
 
32
         /// <summary>
32
         /// <summary>
33
         /// 是否删除
33
         /// 是否删除
34
         /// </summary>
34
         /// </summary>
35
         public int isdelete { get; set; }
35
         public int isdelete { get; set; }
36
+        /// <summary>
37
+        /// 区分微信接口和网站接口
38
+        /// </summary>
39
+
40
+        public int isonetype { get; set; }
41
+        /// <summary>
42
+        /// 是否查看过 0未查看 1查看过
43
+        /// </summary>
44
+        public int isread { get; set; }
36
     }
45
     }
37
 }
46
 }

+ 1 - 0
代码/MadRunFabric.TestUserTypeApi/TestUserTypeApi.Model/Dto/T_Msg_Chat_Map.cs

33
         /// 是否删除
33
         /// 是否删除
34
         /// </summary>
34
         /// </summary>
35
         public int isdelete { get; set; }
35
         public int isdelete { get; set; }
36
+
36
     }
37
     }
37
 }
38
 }

+ 6 - 0
代码/MadRunFabric.TestUserTypeApi/TestUserTypeApi.Model/Dto/TestPagerDto.cs

23
         /// 题目选项
23
         /// 题目选项
24
         /// </summary>
24
         /// </summary>
25
         public string testoptions { get; set; }
25
         public string testoptions { get; set; }
26
+
27
+        /// <summary>
28
+        /// 题目类型
29
+        /// </summary>
30
+        public string tesquestionType { get; set; }
31
+
26
         /// <summary>
32
         /// <summary>
27
         /// 参考答案
33
         /// 参考答案
28
         /// </summary>
34
         /// </summary>

+ 36 - 5
代码/MadRunFabric.TestUserTypeApi/TestUserTypeApi.Repositories/msgonlineRepository.cs

3
 using System.Text;
3
 using System.Text;
4
 using MadRunFabric.Common;
4
 using MadRunFabric.Common;
5
 using MadRunFabric.Common.Options;
5
 using MadRunFabric.Common.Options;
6
-using MadRunFabric.Model.OnlineServiceApi;
6
+using MadRunFabric.Model.TestUserTypeApi;
7
 using Microsoft.Extensions.Logging;
7
 using Microsoft.Extensions.Logging;
8
 using Microsoft.Extensions.Options;
8
 using Microsoft.Extensions.Options;
9
 using MongoDB.Driver;
9
 using MongoDB.Driver;
10
-
10
+using TestUserTypeApi.IRepositories;
11
+using System.Linq;
11
 
12
 
12
 namespace TestUserTypeApi.Repositories
13
 namespace TestUserTypeApi.Repositories
13
 {
14
 {
14
-   public  class msgonlineRepository : BaseRepository<T_Msg_Chat, string>, IRepositories.ImsgonlineRepository
15
+   public  class msgonlineRepository : BaseRepository<T_Msg_Chat, string>, ImsgonlineRepository
15
     {
16
     {
16
         protected readonly ILogger<BaseRepository<T_Msg_Chat, string>> _logger;
17
         protected readonly ILogger<BaseRepository<T_Msg_Chat, string>> _logger;
17
-        protected readonly IMongoCollection<T_Msg_Chat> _collection_MassageInfo;
18
+        protected readonly IMongoCollection<T_Msg_Chat> _collection_T_Msg_Chat;
19
+        protected readonly IMongoCollection<T_Msg_Chat_Map> _collection_T_Msg_Chat_Map;
18
         public msgonlineRepository(IOptions<MongodbOptions> settings, ILogger<BaseRepository<T_Msg_Chat, string>> logger) : base(settings, logger)
20
         public msgonlineRepository(IOptions<MongodbOptions> settings, ILogger<BaseRepository<T_Msg_Chat, string>> logger) : base(settings, logger)
19
         {
21
         {
20
-            _collection_MassageInfo = _context.GetCollection<T_Msg_Chat>();
22
+            _collection_T_Msg_Chat_Map = _context.GetCollection<T_Msg_Chat_Map>();
23
+            _collection_T_Msg_Chat = _context.GetCollection<T_Msg_Chat>();
21
             _logger = logger;
24
             _logger = logger;
22
         }
25
         }
26
+       
27
+        public IEnumerable<object> GetList(int pageindex, int pagesize, int isread, out int recordCount)
28
+        {
29
+            var query =
30
+                 from chat in _collection.AsQueryable()
31
+                 join chatmap in _collection_T_Msg_Chat_Map.AsQueryable() on chat.id equals chatmap.chatid into chatDefa
32
+                 where chat.isdelete == 0
33
+                 select new TestUserTypeApi.Model.Dto.T_Msg_Chat
34
+                 {
35
+                     id = chat.id,
36
+                     Msgcontent = chat.Msgcontent,
37
+                     fromuserid = chat.fromuserid,//消息来源
38
+                     touserid   = chat.touserid,//发送给谁
39
+                     isonetype  = chat.isonetype,//1是微信接口进入的
40
+                     isdelete   = chat.isdelete,
41
+                     createtime  = chat.createtime,
42
+                     isread      = chatDefa != null && chatDefa.Count() > 0 ? chatDefa.First().isread : 0
43
+                 };
44
+            #region 查询条件
45
+            if (!string.IsNullOrEmpty(isread.ToString()))
46
+                query = query.Where(it => it.isread == isread);
47
+            query = query.Where(it => it.isread == 0);
48
+            #endregion
49
+            //var list = query.OrderByDescending(it => it.createtime);
50
+            recordCount = query.Count();
51
+            var list = query.Skip((pageindex - 1) * pagesize).Take(pagesize);
52
+            return list;
53
+        }
23
     }
54
     }
24
 }
55
 }

+ 1 - 1
代码/MadRunFabric.TestUserTypeApi/TestUserTypeApi.Repositories/msgonlinemapRepository.cs

3
 using System.Text;
3
 using System.Text;
4
 using MadRunFabric.Common;
4
 using MadRunFabric.Common;
5
 using MadRunFabric.Common.Options;
5
 using MadRunFabric.Common.Options;
6
-using MadRunFabric.Model.OnlineServiceApi;
6
+using MadRunFabric.Model.TestUserTypeApi;
7
 using Microsoft.Extensions.Logging;
7
 using Microsoft.Extensions.Logging;
8
 using Microsoft.Extensions.Options;
8
 using Microsoft.Extensions.Options;
9
 using MongoDB.Driver;
9
 using MongoDB.Driver;

+ 150 - 59
代码/MadRunFabric.TestUserTypeApi/TestUserTypeApi/Controllers/TestUserTypeController.cs

21
 using System.Collections;
21
 using System.Collections;
22
 using System.Net.Http;
22
 using System.Net.Http;
23
 using System.Reflection;
23
 using System.Reflection;
24
-using MadRunFabric.Model.OnlineServiceApi;
24
+using com.pkuhit.iihip.sdk;
25
+using com.pkuhit.iihip.sdk.message;
25
 
26
 
26
 // For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
27
 // For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
27
 
28
 
101
             //    list = await _tsertuserRepository.Get(s => s.testtype == testtypeid);
102
             //    list = await _tsertuserRepository.Get(s => s.testtype == testtypeid);
102
             //}
103
             //}
103
             //排序字段
104
             //排序字段
104
-            var sort = Builders<TestPager>.Sort.Descending("createdatatime");
105
+            var sort = Builders<TestPager>.Sort.Ascending("testcode");
105
             //根据条件查询集合
106
             //根据条件查询集合
106
             var listApp = new List<FilterDefinition<TestPager>>();
107
             var listApp = new List<FilterDefinition<TestPager>>();
107
             listApp.Add(Builders<TestPager>.Filter.Eq("isdelete", 0));
108
             listApp.Add(Builders<TestPager>.Filter.Eq("isdelete", 0));
138
                 model.testcode = item.testcode;
139
                 model.testcode = item.testcode;
139
                 model.testoptions = optioncenter;
140
                 model.testoptions = optioncenter;
140
                 model.testtype = item.testtype;
141
                 model.testtype = item.testtype;
141
-                model.testtypename = ttps.Typename;
142
+                if (ttps != null)
143
+                {
144
+                    model.testtypename = ttps.Typename;
145
+                }
146
+                else
147
+                {
148
+                    model.testtypename = "";
149
+                }
142
                 //model.tesquestid = model.tesquestid;//选项编号
150
                 //model.tesquestid = model.tesquestid;//选项编号
143
                 model.isdelete = item.isdelete;
151
                 model.isdelete = item.isdelete;
144
                 listmodel.Add(model);
152
                 listmodel.Add(model);
159
         {
167
         {
160
 
168
 
161
             //排序字段
169
             //排序字段
162
-            var sort = Builders<TestPager>.Sort.Descending("createdatatime");
170
+            var sort = Builders<TestPager>.Sort.Ascending("testcode");
163
             //根据条件查询集合
171
             //根据条件查询集合
164
             var listApp = new List<FilterDefinition<TestPager>>();
172
             var listApp = new List<FilterDefinition<TestPager>>();
165
             listApp.Add(Builders<TestPager>.Filter.Eq("isdelete", 0));
173
             listApp.Add(Builders<TestPager>.Filter.Eq("isdelete", 0));
185
                 model.testcode = item.testcode;
193
                 model.testcode = item.testcode;
186
                 model.optionlists = tqn;//选项集合信息
194
                 model.optionlists = tqn;//选项集合信息
187
                 model.testtype = item.testtype;
195
                 model.testtype = item.testtype;
188
-                model.testtypename = ttps.Typename;
196
+                if (ttps != null)
197
+                {
198
+                    model.testtypename = ttps.Typename;
199
+                }
200
+                
189
                 //model.tesquestid = model.tesquestid;//选项编号
201
                 //model.tesquestid = model.tesquestid;//选项编号
190
                 model.isdelete = item.isdelete;
202
                 model.isdelete = item.isdelete;
191
                 listmodel.Add(model);
203
                 listmodel.Add(model);
462
                 model.id = item.id;
474
                 model.id = item.id;
463
                 model.telcode = item.telcode;//电话号
475
                 model.telcode = item.telcode;//电话号
464
                 model.testid = item.testid;//试卷表id
476
                 model.testid = item.testid;//试卷表id
465
-                model.testname = tpser.testtitle;//试题名称
477
+                if (tpser != null)
478
+                {
479
+                    model.testname = tpser.testtitle;//试题名称
480
+                }
481
+                
466
                 model.testoptions = item.testoptions;//选项
482
                 model.testoptions = item.testoptions;//选项
467
                 model.grade = item.grade;//得分
483
                 model.grade = item.grade;//得分
468
                 model.testtype = item.testtype;//试卷类型
484
                 model.testtype = item.testtype;//试卷类型
582
                 model.testcount = item.testcount;//答题数量
598
                 model.testcount = item.testcount;//答题数量
583
                 model.allgrade = item.allgrade;//总分数
599
                 model.allgrade = item.allgrade;//总分数
584
                 model.testtype = item.testtype;//试卷类型
600
                 model.testtype = item.testtype;//试卷类型
585
-                model.testtypename = ttps.Typename;//试卷类型名称
601
+                if (ttps != null)
602
+                {
603
+                    model.testtypename = ttps.Typename;//试卷类型名称
604
+                }
605
+               
586
                                                    // model.testid = item.testid;//问题id
606
                                                    // model.testid = item.testid;//问题id
587
 
607
 
588
                 listmodel.Add(model);
608
                 listmodel.Add(model);
713
         {
733
         {
714
             var model = await _ItestquestionRepository.Get(p => p.testid == testid);
734
             var model = await _ItestquestionRepository.Get(p => p.testid == testid);
715
             return Success("成功", model);
735
             return Success("成功", model);
716
-        } 
736
+        }
737
+
738
+        /// <summary>
739
+        /// 根据id获取详情信息
740
+        /// </summary>
741
+        /// <returns></returns>
742
+        [HttpGet("gettestquestinfobyid")]
743
+        public async Task<IActionResult> Gettestquestinfobyid(string id)
744
+        {
745
+            var model = await _ItestquestionRepository.Get(p => p.id == id);
746
+            return Success("成功", model);
747
+        }
717
         #endregion
748
         #endregion
718
         #region 短信模块
749
         #region 短信模块
719
         /// <summary>
750
         /// <summary>
906
             var str = tps.sendcenter;// "您好 !感谢您对我们医院的新人月支持请对我们的服质量给予评价1 满意;2不满意;3 表扬,回复数字即可。谢谢!顺祝生活愉快【郑州市第一人民医院】";//您好 !感谢您对我们医院的新人月支持请对我们的服质量给予评价1 满意;2不满意;3 表扬,回复数字即可。谢谢!顺祝生活愉快  
937
             var str = tps.sendcenter;// "您好 !感谢您对我们医院的新人月支持请对我们的服质量给予评价1 满意;2不满意;3 表扬,回复数字即可。谢谢!顺祝生活愉快【郑州市第一人民医院】";//您好 !感谢您对我们医院的新人月支持请对我们的服质量给予评价1 满意;2不满意;3 表扬,回复数字即可。谢谢!顺祝生活愉快  
907
             //发送给哪个手机号
938
             //发送给哪个手机号
908
             var Mobile = tps.telcode;
939
             var Mobile = tps.telcode;
909
-            //定时发送还是立即发送
910
-            var SendTime = tps.SendTime;
911
-            string result1 = HttpUtility.UrlEncode(str, Encoding.GetEncoding("GB2312"));
912
-            var ifsend = false;
913
-            var aaa = " ";
914
-            string url = "https://sdk2.028lk.com/sdk2/BatchSend2.aspx?CorpID=DYRMYY011170&Pwd=xxk@80188&Mobile=" + Mobile + "&Content=" + result1 + "&Cell=&SendTime=";
915
-
916
-            //?CorpID=DYRMYY011170&Pwd=xxk@80188&Mobile=13935966971&Content="+ result1 + "&Cell=&SendTime=
917
-
918
-            //Encoding encoding = Encoding.GetEncoding("GB2312");
919
-            //Encoding encoding = Encoding.GetEncoding("UTF-8");
920
-            Encoding encoding = Encoding.GetEncoding("GBK");
921
-            IDictionary<string, string> parameters = new Dictionary<string, string>();
922
-            parameters.Add("CorpID", "DYRMYY011170");
923
-            parameters.Add("Pwd", "xxk@80188");
924
-            parameters.Add("Mobile", Mobile);
925
-            parameters.Add("Content", result1);
926
-            parameters.Add("Cell", "");
927
-            parameters.Add("SendTime", SendTime.ToString());
928
-            HttpWebResponse response = PostHttps(url, parameters, encoding);
929
-            //打印返回值
930
-            Stream stream = response.GetResponseStream();   //获取响应的字符串流
931
-            StreamReader sr = new StreamReader(stream); //创建一个stream读取流
932
-
933
-            //返回的信息
934
-            string html = sr.ReadToEnd();
935
-
940
+            ////定时发送还是立即发送
941
+            //var SendTime = tps.SendTime;
942
+            //string result1 = HttpUtility.UrlEncode(str, Encoding.GetEncoding("GB2312"));
943
+            //var ifsend = false;
944
+            //var aaa = " ";
945
+            //string url = "https://sdk2.028lk.com/sdk2/BatchSend2.aspx?CorpID=DYRMYY011170&Pwd=xxk@80188&Mobile=" + Mobile + "&Content=" + result1 + "&Cell=&SendTime=";
946
+
947
+            ////?CorpID=DYRMYY011170&Pwd=xxk@80188&Mobile=13935966971&Content="+ result1 + "&Cell=&SendTime=
948
+
949
+            ////Encoding encoding = Encoding.GetEncoding("GB2312");
950
+            ////Encoding encoding = Encoding.GetEncoding("UTF-8");
951
+            //Encoding encoding = Encoding.GetEncoding("GBK");
952
+            //IDictionary<string, string> parameters = new Dictionary<string, string>();
953
+            //parameters.Add("CorpID", "DYRMYY011170");
954
+            //parameters.Add("Pwd", "xxk@80188");
955
+            //parameters.Add("Mobile", Mobile);
956
+            //parameters.Add("Content", result1);
957
+            //parameters.Add("Cell", "");
958
+            //parameters.Add("SendTime", SendTime.ToString());
959
+            //HttpWebResponse response = PostHttps(url, parameters, encoding);
960
+            ////打印返回值
961
+            //Stream stream = response.GetResponseStream();   //获取响应的字符串流
962
+            //StreamReader sr = new StreamReader(stream); //创建一个stream读取流
963
+
964
+            ////返回的信息
965
+            //string html = sr.ReadToEnd();
966
+            string html ="2";
936
             if (Convert.ToInt32(html) > 0)
967
             if (Convert.ToInt32(html) > 0)
937
             {
968
             {
938
-                MassageInfo tp = new MassageInfo();
939
-                tp.telcode = tps.telcode;
940
-                tp.sendcenter = tps.sendcenter;
941
-                tp.senddate = DateTime.Now;
942
-                tp.isdelete = 0;
943
-                tp.replycenter = "";
944
-                var a = _IMassageInfoRepository.AddRetID(tp);
945
-                if (a.Result != null || a.Result != "")
946
-                {
947
-                    return Success("成功", a.Result);
948
-                }
949
-                else
969
+                string[] arrStr = tps.sendcenter.Split(',');
970
+                foreach (var item in arrStr)
950
                 {
971
                 {
951
-                    return Error("失败");
972
+                    MassageInfo tp = new MassageInfo();
973
+
974
+                    tp.telcode = tps.telcode;
975
+                    tp.sendcenter = tps.sendcenter;
976
+                    tp.senddate = DateTime.Now;
977
+                    tp.isdelete = 0;
978
+                    tp.replycenter = "";
979
+                    var a = _IMassageInfoRepository.AddRetID(tp);
952
                 }
980
                 }
981
+                return Success("成功");
982
+                //if (a.Result != null || a.Result != "")
983
+                //{
984
+                //    return Success("成功", a.Result);
985
+                //}
986
+                //else
987
+                //{
988
+                //    return Error("失败");
989
+                //}
953
             }
990
             }
954
             else if (Convert.ToInt32(html) == -2)
991
             else if (Convert.ToInt32(html) == -2)
955
             {
992
             {
1304
             return Success("成功", obj);
1341
             return Success("成功", obj);
1305
         }
1342
         }
1306
         /// <summary>
1343
         /// <summary>
1307
-        /// 添加聊天记录表信息
1344
+        ///网站接口进入 添加聊天记录表信息
1308
         /// </summary>
1345
         /// </summary>
1309
         /// <param name="tps"></param>
1346
         /// <param name="tps"></param>
1310
         /// <returns></returns>
1347
         /// <returns></returns>
1315
             tp.Msgcontent = tps.Msgcontent;//信息内容
1352
             tp.Msgcontent = tps.Msgcontent;//信息内容
1316
             tp.fromuserid = tps.fromuserid;//消息来源
1353
             tp.fromuserid = tps.fromuserid;//消息来源
1317
             tp.touserid = tps.touserid;//发送给谁
1354
             tp.touserid = tps.touserid;//发送给谁
1355
+            tp.isonetype = 0;//0是网站接口进入的
1318
             tp.isdelete = 0;
1356
             tp.isdelete = 0;
1319
             tp.createtime = DateTime.Now;
1357
             tp.createtime = DateTime.Now;
1320
             var a = _ImsgonlineRepository.AddRetID(tp);
1358
             var a = _ImsgonlineRepository.AddRetID(tp);
1344
             }
1382
             }
1345
 
1383
 
1346
         }
1384
         }
1385
+
1386
+        /// <summary>
1387
+        /// 微信接口进入 添加聊天记录表信息
1388
+        /// </summary>
1389
+        /// <param name="tps"></param>
1390
+        /// <returns></returns>
1391
+        [HttpGet("whataddonlineservice")]
1392
+        public async Task<IActionResult> whatAddOnlineservice(Model.Dto.T_Msg_Chat tps)
1393
+        {
1394
+            T_Msg_Chat tp = new T_Msg_Chat();
1395
+            tp.Msgcontent = tps.Msgcontent;//信息内容
1396
+            tp.fromuserid = tps.fromuserid;//消息来源
1397
+            tp.touserid = tps.touserid;//发送给谁
1398
+            tp.isonetype =1;//1是微信接口进入的
1399
+            tp.isdelete = 0;
1400
+            tp.createtime = DateTime.Now;
1401
+            var a = _ImsgonlineRepository.AddRetID(tp);
1402
+            if (a.Result != null || a.Result != "")
1403
+            {
1404
+                T_Msg_Chat_Map tmp = new T_Msg_Chat_Map();
1405
+                tmp.chatid = a.Result;//聊天记录的编号
1406
+                tmp.fromuserid = tps.fromuserid;
1407
+                tmp.touserid = tps.touserid;
1408
+                tmp.isdelete = 0;
1409
+                tmp.isread = 0;//是否查看过
1410
+                tmp.createtime = DateTime.Now;
1411
+                var b = _ImsgonlinemapRepository.AddRetID(tmp);
1412
+                if (b.Result != null || b.Result != "")
1413
+                {
1414
+                    return Success("成功", a.Result);
1415
+                }
1416
+                else
1417
+                {
1418
+                    return Error("添加关联记录失败");
1419
+                }
1420
+
1421
+            }
1422
+            else
1423
+            {
1424
+                return Error("添加聊天记录失败");
1425
+            }
1426
+
1427
+        }
1347
         /// <summary>
1428
         /// <summary>
1348
         /// 根据编号获取聊天记录信息详情
1429
         /// 根据编号获取聊天记录信息详情
1349
         /// </summary>
1430
         /// </summary>
1360
             return Success("成功", model);
1441
             return Success("成功", model);
1361
         }
1442
         }
1362
         /// <summary>
1443
         /// <summary>
1363
-        /// 获取未读消息列表
1444
+        /// 获取未读消息列表 已读消息列表  
1364
         /// </summary>
1445
         /// </summary>
1365
         /// <param name="PageIndex"></param>
1446
         /// <param name="PageIndex"></param>
1366
         /// <param name="PageSize"></param>
1447
         /// <param name="PageSize"></param>
1367
         /// <returns></returns>
1448
         /// <returns></returns>
1368
-        [HttpGet("getListonlineservice")]
1369
-        public async Task<IActionResult> GetListOnlineservicemap(int PageIndex, int PageSize)
1449
+        [HttpGet("getlistonlineservicemap")]
1450
+        public async Task<IActionResult> GetListOnlineservicemap(int PageIndex, int PageSize,int isread)
1370
         {
1451
         {
1371
-
1452
+            var a = _ImsgonlineRepository.GetList(PageIndex, PageSize,0,out int count);
1372
             //排序字段
1453
             //排序字段
1373
-            var sort = Builders<T_Msg_Chat_Map>.Sort.Descending("createdatatime");
1454
+            var sort = Builders<T_Msg_Chat_Map>.Sort.Ascending("createdatatime");
1374
             //根据条件查询集合
1455
             //根据条件查询集合
1375
             var listApp = new List<FilterDefinition<T_Msg_Chat_Map>>();
1456
             var listApp = new List<FilterDefinition<T_Msg_Chat_Map>>();
1376
             listApp.Add(Builders<T_Msg_Chat_Map>.Filter.Eq("isdelete", 0));
1457
             listApp.Add(Builders<T_Msg_Chat_Map>.Filter.Eq("isdelete", 0));
1377
-
1458
+            if (isread != null)
1459
+            {
1460
+                listApp.Add(Builders<T_Msg_Chat_Map>.Filter.Eq("isread", isread));//未读 已读 
1461
+            }
1462
+            else
1463
+            {
1464
+                listApp.Add(Builders<T_Msg_Chat_Map>.Filter.Eq("isread", 0));//未读
1465
+            }
1378
             var filter = Builders<T_Msg_Chat_Map>.Filter.And(listApp);
1466
             var filter = Builders<T_Msg_Chat_Map>.Filter.And(listApp);
1379
 
1467
 
1380
             var list = await _ImsgonlinemapRepository.GetByPage(filter, PageIndex, PageSize, sort);
1468
             var list = await _ImsgonlinemapRepository.GetByPage(filter, PageIndex, PageSize, sort);
1381
             var redCount = await _ImsgonlinemapRepository.CountAsync(filter);   //获取总数
1469
             var redCount = await _ImsgonlinemapRepository.CountAsync(filter);   //获取总数
1382
-            var listmodel = new List<T_Msg_Chat_Map>();
1470
+            var listmodel = new List<T_Msg_Chat>();
1383
 
1471
 
1384
 
1472
 
1385
             foreach (var item in list)
1473
             foreach (var item in list)
1386
             {
1474
             {
1387
-                var model = new T_Msg_Chat_Map();
1475
+                var mapmode = await _ImsgonlineRepository.GetSingle(p => p.id == item.chatid);
1476
+                var model = new T_Msg_Chat();
1388
                 model.id = item.id;
1477
                 model.id = item.id;
1389
-                model.chatid = item.chatid;//聊天记录编号
1390
-                model.isread = item.isread;//是否阅读
1478
+                model.Msgcontent = mapmode.Msgcontent;//聊天内容
1391
                 model.fromuserid = item.fromuserid;//消息来源
1479
                 model.fromuserid = item.fromuserid;//消息来源
1480
+
1392
                 model.touserid = item.touserid;//发送给谁
1481
                 model.touserid = item.touserid;//发送给谁
1482
+
1393
                 model.createtime = item.createtime;//创建时间
1483
                 model.createtime = item.createtime;//创建时间
1394
                 model.isdelete = item.isdelete;//是否禁用
1484
                 model.isdelete = item.isdelete;//是否禁用
1395
                 listmodel.Add(model);
1485
                 listmodel.Add(model);
1402
             return Success("成功", obj);
1492
             return Success("成功", obj);
1403
         }
1493
         }
1404
         #endregion
1494
         #endregion
1495
+
1405
     }
1496
     }
1406
 }
1497
 }