Nessuna descrizione

CallleaveController.cs 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. using CallCenter.Utility;
  2. using CallCenterApi.Common;
  3. using CallCenterApi.Interface.Controllers.Base;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Web;
  9. using System.Web.Mvc;
  10. namespace CallCenterApi.Interface.Controllers.tel
  11. {
  12. public class CallleaveController : BaseController
  13. {
  14. //获取留言列表
  15. public ActionResult GetList(string strtelnum)
  16. {
  17. ActionResult res = NoToken("未知错误,请重新登录");
  18. if (Request.IsAuthenticated)
  19. {
  20. string sql = "";
  21. DataTable dt = new DataTable();
  22. string strsettime = HttpUtility.UrlDecode(RequestString.GetQueryString("settime"));
  23. string strremovetime = HttpUtility.UrlDecode(RequestString.GetQueryString("removetime"));
  24. string status = HttpUtility.UrlDecode(RequestString.GetQueryString("status"));
  25. string strpageindex = RequestString.GetQueryString("page");
  26. int pageindex = 1;
  27. string strpagesize = RequestString.GetQueryString("pagesize");
  28. int pagesize = 10;
  29. if (strtelnum != null && strtelnum.Trim() != "")
  30. {
  31. sql += " and F_Phone= '" + strtelnum.Trim() + "' ";
  32. }
  33. if (strsettime.Trim() != "" && strsettime != "undefined")
  34. {
  35. sql += " and CONVERT(varchar(10),F_LeaveTime, 23) = '" + strsettime.Trim() + "' ";
  36. }
  37. if (strremovetime.Trim() != "" && strremovetime != "undefined")
  38. {
  39. sql += " and CONVERT(varchar(10),F_DealTime, 23) = '" + strremovetime.Trim() + "' ";
  40. }
  41. if (status.Trim() != "-1" && status != "undefined")
  42. {
  43. sql += " and F_Status = " + Convert.ToInt32(status);
  44. }
  45. else
  46. {
  47. sql += " and F_Status = " +0;
  48. }
  49. if (strpageindex.Trim() != "")
  50. {
  51. pageindex = Convert.ToInt32(strpageindex);
  52. }
  53. if (strpagesize.Trim() != "")
  54. {
  55. pagesize = Convert.ToInt32(strpagesize);
  56. }
  57. int recordCount = 0;
  58. dt = BLL.PagerBLL.GetListPager(
  59. "T_Call_LeaveRecord",
  60. "F_Id",
  61. "*",
  62. sql,
  63. "ORDER BY F_Id desc",
  64. pagesize,
  65. pageindex,
  66. true,
  67. out recordCount);
  68. var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
  69. foreach (DataRow dr in dt.Rows)
  70. {
  71. string path = dr["F_RecFileUrl"] != null ? dr["F_RecFileUrl"].ToString() : "";
  72. if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
  73. {
  74. dr["F_RecFileUrl"] = config.F_ParamValue + path;
  75. }
  76. var phone = dr["F_Phone"].ToString();
  77. var prono = phone.Trim().Length >= 7 ? dr["F_Phone"].ToString().Substring(0, 7) : dr["F_Phone"].ToString();
  78. var MobileData = new BLL.T_Sys_MobileData().GetModelList("F_MobileNum='"+ prono+"'").FirstOrDefault ();
  79. if (MobileData != null)
  80. dr["F_Remark"] = MobileData.F_CityDes;
  81. }
  82. var obj = new
  83. {
  84. state = "success",
  85. message = "成功",
  86. rows = dt,
  87. total = recordCount
  88. };
  89. res = Content(obj.ToJson());
  90. }
  91. return res;
  92. }
  93. //删除留言记录
  94. public ActionResult DelLeaveRecord(string[] ids)
  95. {
  96. ActionResult res = NoToken("未知错误,请重新登录");
  97. if (Request.IsAuthenticated)
  98. {
  99. if (ids != null && ids.Length > 0)
  100. {
  101. string idd = " ";
  102. foreach (string str in ids)
  103. {
  104. idd += str + ",";
  105. }
  106. if (new BLL.T_Call_LeaveRecord().DeleteList(idd.TrimEnd(',')))
  107. {
  108. res = Success("删除成功");
  109. }
  110. else
  111. res = Error("删除失败");
  112. }
  113. else
  114. {
  115. res = Error("请选择要删除的记录");
  116. }
  117. }
  118. return res;
  119. }
  120. //更新留言处理状态
  121. public ActionResult OptLeaveRecord(string[] ids)
  122. {
  123. ActionResult res = NoToken("未知错误,请重新登录");
  124. if (Request.IsAuthenticated)
  125. {
  126. int userId = CurrentUser.UserData.F_UserId;
  127. if (userId != 0)
  128. {
  129. Model.T_Sys_UserAccount ua = new BLL.T_Sys_UserAccount().GetModel(userId);
  130. if (ua != null)
  131. {
  132. if (ids.Length>0)
  133. {
  134. foreach (string arrid in ids)
  135. {
  136. Model.T_Call_LeaveRecord model = new BLL.T_Call_LeaveRecord().GetModel(Convert.ToInt32(arrid));
  137. if (model != null)
  138. {
  139. model.F_Status = 1;
  140. model.F_DealTime = DateTime.Now;
  141. model.F_DealContent = "1";
  142. model.F_UserName = ua.F_UserName;
  143. model.F_UserCode = ua.F_UserCode;
  144. model.F_UserId = ua.F_UserId;
  145. new BLL.T_Call_LeaveRecord().Update(model);
  146. }
  147. }
  148. res = Success("处理成功");
  149. }
  150. else
  151. {
  152. res = Error("请选择要处理的留言");
  153. }
  154. }
  155. }
  156. }
  157. return res;
  158. }
  159. }
  160. }