public string SendMsg(string channelId, string msg,  string recUserId, string recUserDisplayName)
 {
     ChatMessage chat = new ChatMessage() { ChannelId = channelId, ChatMsgType = 0, MessageContent = msg, ReceiveStatus = 0, SendDate = DateTime.Now, SendUser = DataCache.Instance.LoginUser.UserName, RecUser = recUserId, SendUserDisplayName = DataCache.Instance.LoginUser.UserDisplayName, RecUserDisplayName = recUserDisplayName };
     UnityInstance.Instance.GetObject<ISuperService>().Insert<ChatMessage>(chat);
     return JsonConvert.SerializeObject(new { result = "操作成功!" });
 }
        public bool SendChatMessage([FromBody]string objJson)
        {
            try
            {

                var obj = JsonConvert.DeserializeObject<dynamic>(objJson);

                string channelId = obj.channelId, recUserDisplayName = obj.recUserDisplayName, message = obj.message;
                QueryModel queryModel = new QueryModel();
                queryModel.AddAndQuery(new QueryInfo("id", "=", channelId));
                queryModel.AddAndQuery(new List<QueryInfo>() { new QueryInfo("ChatLeftUser", "=", DataCache.Instance.LoginUser.UserName), new QueryInfo("ChatLeftUser", "=", DataCache.Instance.LoginUser.UserName) });

                string json = UnityInstance.Instance.GetObject<ISuperService>().FindOne<ChatChannel>(queryModel);
                ChatChannel chat = JsonConvert.DeserializeObject<ChatChannel>(json);
                string recUserName = string.Empty;
                if (chat.ChatLeftUser != DataCache.Instance.LoginUser.UserName)
                    recUserName = chat.ChatLeftUser;
                if (chat.ChatRightUser != DataCache.Instance.LoginUser.UserName)
                    recUserName = chat.ChatRightUser;

                ChatMessage chatmessage = new ChatMessage()
                {
                    ChannelId = channelId,
                    ChatMsgType = 0,
                    MessageContent = message,
                    ReceiveStatus = 0,
                    RecUser = recUserName,
                    RecUserDisplayName = recUserDisplayName,
                    SendDate = DateTime.Now,
                    SendUser = DataCache.Instance.LoginUser.UserName,
                    SendUserDisplayName = DataCache.Instance.LoginUser.UserDisplayName
                };
                UnityInstance.Instance.GetObject<ISuperService>().Insert<ChatMessage>(chatmessage);
                return true;
            }
            catch (Exception ex)
            {
                return false;
            }
        }