/// <summary> /// 发送消息入库 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Insert(SDK.AntSdk.AntModels.AntSdkChatMsg.ChatBase model) { if (model.sourceContent != null) { model.sourceContent = model.sourceContent.Replace("'", "''"); } string insertStr = "insert into t_chat_message_groupburn(MTP,CHATINDEX,CONTENT,MESSAGEID,SENDTIME,SENDUSERID,SESSIONID,TARGETID,SENDORRECEIVE,SENDSUCESSORFAIL,uploadordownpath) values ('" + (int)model.MsgType + "','" + model.chatIndex + "','" + model.sourceContent + "','" + model.messageId + "','" + AntSdkDataConverter.ConvertDateTimeToIntLong(DateTime.Now) + "','" + model.sendUserId + "','" + model.sessionId + "','" + model.targetId + "','" + model.SENDORRECEIVE + "','" + model.sendsucessorfail + "','" + model.uploadOrDownPath + "')"; return(AntSdkSqliteHelper.ExecuteNonQuery(insertStr, AntSdkService.AntSdkConfigInfo.AntSdkCompanyCode, model.sendUserId)); }
/// <summary> /// 批量上传 /// </summary> /// <param name="list"></param> /// <returns></returns> public bool InsertBig(List <SDK.AntSdk.AntModels.AntSdkChatMsg.ChatBase> list) { StringBuilder sb = new StringBuilder(); sb.Append("insert into T_Chat_Message(MTP, CHATINDEX, CONTENT, MESSAGEID, SENDTIME, SENDUSERID, SESSIONID, TARGETID, SENDORRECEIVE, SENDSUCESSORFAIL, uploadOrDownPath, flag) values "); foreach (var model in list) { if (model.sourceContent != null) { model.sourceContent = model.sourceContent.Replace("'", "''"); } sb.Append("('" + (int)model.MsgType + "','" + model.chatIndex + "','" + model.sourceContent + "','" + model.messageId + "','" + AntSdkDataConverter.ConvertDateTimeToIntLong(DateTime.Now) + "','" + model.sendUserId + "','" + model.sessionId + "','" + model.targetId + "','" + model.SENDORRECEIVE + "','" + model.sendsucessorfail + "','" + model.uploadOrDownPath + "','" + model.flag + "'),"); } var str = sb.ToString().Substring(0, sb.ToString().Length - 1); bool b = AntSdkSqliteHelper.InsertBigData(str, AntSdkService.AntSdkConfigInfo.AntSdkCompanyCode, AntSdkService.AntSdkCurrentUserInfo.userId); return(b); }