人民医院API

CallleaveController.cs 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using RMYY_CallCenter_Api.Utility;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Web;
  7. using System.Web.Mvc;
  8. namespace RMYY_CallCenter_Api.Controllers.CallTel
  9. {
  10. public class CallleaveController : BaseController
  11. {
  12. //获取留言列表
  13. public ActionResult GetList(string settime, string removetime, string strtelnum, int status = -1, int page = 1, int pagesize = 10)
  14. {
  15. string sql = "";
  16. DataTable dt = new DataTable();
  17. if (strtelnum != null && strtelnum.Trim() != "")
  18. {
  19. sql += " and F_Phone= '" + strtelnum.Trim() + "' ";
  20. }
  21. if (settime.Trim() != "" && settime != "undefined")
  22. {
  23. sql += " and CONVERT(varchar(10),F_LeaveTime, 23) = '" + settime.Trim() + "' ";
  24. }
  25. if (removetime.Trim() != "" && removetime != "undefined")
  26. {
  27. sql += " and CONVERT(varchar(10),F_DealTime, 23) = '" + removetime.Trim() + "' ";
  28. }
  29. if (status > -1)
  30. {
  31. sql += " and F_Status = " + status;
  32. }
  33. int recordCount = 0;
  34. dt = Bll.PagerBll.GetListPager(
  35. "T_Call_LeaveRecord",
  36. "F_Id",
  37. "*",
  38. sql,
  39. "ORDER BY F_Id desc",
  40. pagesize,
  41. page,
  42. true,
  43. out recordCount);
  44. var config = new Bll.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
  45. foreach (DataRow dr in dt.Rows)
  46. {
  47. string path = dr["F_RecFileUrl"] != null ? dr["F_RecFileUrl"].ToString() : "";
  48. if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
  49. {
  50. dr["F_RecFileUrl"] = config.F_ParamValue + path;
  51. }
  52. }
  53. var obj = new
  54. {
  55. state = "success",
  56. message = "成功",
  57. rows = dt,
  58. total = recordCount
  59. };
  60. return Content(obj.ToJson());
  61. }
  62. //删除留言记录
  63. public ActionResult DelLeaveRecord(string[] ids)
  64. {
  65. if (ids != null && ids.Length > 0)
  66. {
  67. string idd = " ";
  68. foreach (string str in ids)
  69. {
  70. idd += str + ",";
  71. }
  72. if (new Bll.T_Call_LeaveRecord().DeleteList(idd.TrimEnd(',')))
  73. {
  74. return Success("删除成功");
  75. }
  76. else
  77. return Error("删除失败");
  78. }
  79. else
  80. {
  81. return Error("请选择要删除的记录");
  82. }
  83. }
  84. //更新留言处理状态
  85. public ActionResult OptLeaveRecord(string[] ids)
  86. {
  87. if (ids.Length > 0)
  88. {
  89. foreach (string arrid in ids)
  90. {
  91. Model.T_Call_LeaveRecord model = new Bll.T_Call_LeaveRecord().GetModel(Convert.ToInt32(arrid));
  92. if (model != null)
  93. {
  94. model.F_Status = 1;
  95. model.F_DealTime = DateTime.Now;
  96. model.F_DealContent = "1";
  97. model.F_UserName = User.F_UserName;
  98. model.F_UserCode = User.F_UserCode;
  99. model.F_UserId = User.F_UserId;
  100. new Bll.T_Call_LeaveRecord().Update(model);
  101. }
  102. }
  103. return Success("处理成功");
  104. }
  105. else
  106. {
  107. return Error("请选择要处理的留言");
  108. }
  109. }
  110. /// <summary>
  111. /// 获取留言信息
  112. /// </summary>
  113. /// <returns></returns>
  114. public ActionResult GetLeaveRecord(int id)
  115. {
  116. return Success("获取成功", new Bll.T_Call_LeaveRecord().GetModel(id));
  117. }
  118. }
  119. }