| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- using CallCenter.Utility;
- using CallCenterApi.Common;
- using CallCenterApi.Interface.Controllers.Base;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- namespace CallCenterApi.Interface.Controllers.tel
- {
- public class CallleaveController : BaseController
- {
- //获取留言列表
- public ActionResult GetList(string strtelnum)
- {
- ActionResult res = NoToken("未知错误,请重新登录");
- if (Request.IsAuthenticated)
- {
- string sql = "";
- DataTable dt = new DataTable();
-
- string strsettime = HttpUtility.UrlDecode(RequestString.GetQueryString("settime"));
- string strremovetime = HttpUtility.UrlDecode(RequestString.GetQueryString("removetime"));
- string status = HttpUtility.UrlDecode(RequestString.GetQueryString("status"));
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- if (strtelnum != null && strtelnum.Trim() != "")
- {
- sql += " and F_Phone= '" + strtelnum.Trim() + "' ";
- }
- if (strsettime.Trim() != "" && strsettime != "undefined")
- {
- sql += " and CONVERT(varchar(10),F_LeaveTime, 23) = '" + strsettime.Trim() + "' ";
- }
- if (strremovetime.Trim() != "" && strremovetime != "undefined")
- {
- sql += " and CONVERT(varchar(10),F_DealTime, 23) = '" + strremovetime.Trim() + "' ";
- }
- if (status.Trim() != "-1" && status != "undefined")
- {
- sql += " and F_Status = " + Convert.ToInt32(status);
- }
- else
- {
- sql += " and F_Status = " +0;
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Call_LeaveRecord",
- "F_Id",
- "*",
- sql,
- "ORDER BY F_Id desc",
- pagesize,
- pageindex,
- true,
- out recordCount);
-
- var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
- foreach (DataRow dr in dt.Rows)
- {
- string path = dr["F_RecFileUrl"] != null ? dr["F_RecFileUrl"].ToString() : "";
- if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
- {
- dr["F_RecFileUrl"] = config.F_ParamValue + path;
- }
- var phone = dr["F_Phone"].ToString();
- var prono = phone.Trim().Length >= 7 ? dr["F_Phone"].ToString().Substring(0, 7) : dr["F_Phone"].ToString();
- var MobileData = new BLL.T_Sys_MobileData().GetModelList("F_MobileNum='"+ prono+"'").FirstOrDefault ();
- if (MobileData != null)
- dr["F_Remark"] = MobileData.F_CityDes;
-
- }
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- res = Content(obj.ToJson());
-
- }
- return res;
- }
- //删除留言记录
- public ActionResult DelLeaveRecord(string[] ids)
- {
- ActionResult res = NoToken("未知错误,请重新登录");
- if (Request.IsAuthenticated)
- {
-
- if (ids != null && ids.Length > 0)
- {
- string idd = " ";
- foreach (string str in ids)
- {
- idd += str + ",";
- }
- if (new BLL.T_Call_LeaveRecord().DeleteList(idd.TrimEnd(',')))
- {
- res = Success("删除成功");
- }
- else
- res = Error("删除失败");
- }
- else
- {
- res = Error("请选择要删除的记录");
- }
-
- }
- return res;
- }
- //更新留言处理状态
- public ActionResult OptLeaveRecord(string[] ids)
- {
- ActionResult res = NoToken("未知错误,请重新登录");
- if (Request.IsAuthenticated)
- {
-
- int userId = CurrentUser.UserData.F_UserId;
- if (userId != 0)
- {
- Model.T_Sys_UserAccount ua = new BLL.T_Sys_UserAccount().GetModel(userId);
- if (ua != null)
- {
- if (ids.Length>0)
- {
- foreach (string arrid in ids)
- {
- Model.T_Call_LeaveRecord model = new BLL.T_Call_LeaveRecord().GetModel(Convert.ToInt32(arrid));
- if (model != null)
- {
- model.F_Status = 1;
- model.F_DealTime = DateTime.Now;
- model.F_DealContent = "1";
- model.F_UserName = ua.F_UserName;
- model.F_UserCode = ua.F_UserCode;
- model.F_UserId = ua.F_UserId;
- new BLL.T_Call_LeaveRecord().Update(model);
- }
- }
- res = Success("处理成功");
- }
- else
- {
- res = Error("请选择要处理的留言");
- }
- }
- }
-
- }
- return res;
- }
- }
- }
|