liyuanyuan лет назад: 4
Родитель
Сommit
d9abcfc90e

+ 54 - 12
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/SMSController.cs

@@ -8,9 +8,9 @@ using CallCenterApi.Interface.Controllers.Base;
8 8
 using System.Data;
9 9
 using CallCenter.Utility;
10 10
 using System.Configuration;
11
-using Top.Api;
12
-using Top.Api.Request;
13
-using Top.Api.Response;
11
+//using Top.Api;
12
+//using Top.Api.Request;
13
+//using Top.Api.Response;
14 14
 using CallCenterApi.Common;
15 15
 using System.Net;
16 16
 using System.Text;
@@ -61,20 +61,52 @@ namespace CallCenterApi.Interface.Controllers
61 61
         /// <param name="type"></param>
62 62
         /// <returns></returns>
63 63
 
64
-        public string SendSMS(string mobile,  string sendTime, string content)
64
+        public string SendSMS(string mobile,  string sendTime, string content,int sendWay, int MBID )
65 65
         {
66 66
             WebClient web = new WebClient();
67 67
             web.Encoding = Encoding.UTF8;
68 68
             content += "【郑州颐和医院】";
69
-            url += "send?accName="+ accName + "&accPwd="+ Md5 (password) + "&aimcodes=" + mobile.Trim() + "&content=" + content.Trim() + "&schTime=" + DateTime .Now .ToString ("yyyy-MM-dd HH:mm:ss") + "&dataType=json& msgId=" + sendTime.Trim() + "454163135423543";
69
+           // url += "send?accName="+ accName + "&accPwd="+ Md5 (password) + "&aimcodes=" + mobile.Trim() + "&content=" + content.Trim() + "&schTime=" + DateTime .Now .ToString ("yyyy-MM-dd HH:mm:ss") + "&dataType=json& msgId=" + sendTime.Trim() + "454163135423543";
70
+
71
+            string mbid = DateTime.Now.ToString("yyyyMMddHHmmss");
72
+            if (!string.IsNullOrEmpty(sendTime))
73
+            {
74
+                string  st = Convert.ToDateTime(sendTime).ToString ("yyyy-MM-dd HH:mm:ss");
75
+                url += "send?accName=" + accName + "&accPwd=" + Md5(password) + "&aimcodes=" + mobile.Trim() + "&content=" + content.Trim() + "&schTime=" + st + "&dataType=json& msgId=" + mbid;// "454163135423543";
76
+            }
77
+
78
+            else {
79
+
80
+                url += "send?accName=" + accName + "&accPwd=" + Md5(password) + "&aimcodes=" + mobile.Trim() + "&content=" + content.Trim() + "&schTime=" + "&dataType=json& msgId=" + mbid;// "454163135423543";
81
+            }
82
+
70 83
             string Dataaa = web.DownloadString(url);//这一句话就能请求到数据了
71 84
             JObject jo = (JObject)JsonConvert.DeserializeObject(Dataaa);
72 85
             string replyCode = jo["replyCode"].ToString();
73 86
             string replyMsg = jo["replyMsg"].ToString();
87
+
88
+            string[] tel = mobile.Split(',');
89
+
90
+            foreach (var item in tel)
91
+            {
92
+
93
+                if (sendWay == 0)//立即发送
94
+                {
95
+                    AddSMSList(sendWay, null, DateTime.Now, Convert.ToInt32(replyCode), item, content, MBID);
96
+                }
97
+                else //定时发送
98
+                {
99
+                    AddSMSList(sendWay, Convert.ToDateTime(sendTime), Convert.ToDateTime(sendTime), Convert.ToInt32(replyCode), item, content, MBID);
100
+
101
+                }
102
+
103
+            }
74 104
             if (replyCode == "1")
75 105
                 return "发送成功";
76 106
             else
77 107
                 return "发送失败";
108
+
109
+        
78 110
         }
79 111
       
80 112
         public class CreateOrderReturnResult
@@ -592,7 +624,7 @@ namespace CallCenterApi.Interface.Controllers
592 624
         /// 新增短信记录
593 625
         /// </summary>
594 626
         /// <returns></returns>
595
-        public bool AddSMSList(int SendWay, DateTime DSSendTime, DateTime SendTime, int IsSend,
627
+        public bool AddSMSList(int SendWay, DateTime? DSSendTime, DateTime SendTime, int IsSend,
596 628
           string Telephone, string Detail, int MBID)
597 629
         {
598 630
             int userId = CurrentUser.UserData.F_UserId;
@@ -667,13 +699,14 @@ namespace CallCenterApi.Interface.Controllers
667 699
                 DataRow drNew = dt.NewRow();
668 700
                 drNew["编号"] = i++;
669 701
                 drNew["接收号码"] = it.Telephone ;
670
-                drNew["发送内容"] = it.Detail ;
702
+                drNew["发送内容"] = it.Detail ;       
671 703
                 if (it .SendWay==0 )
672 704
                     drNew["发送方式"] = "立即发送";
673 705
                 else
674 706
                     drNew["发送方式"] = "定时发送";
675 707
                 drNew["发送时间"] = it.SendTime ;
676
-                if (it.IsSend==1)
708
+                if (it.SendTime < DateTime.Now && it.IsSend==1)
709
+                    //if (it.IsSend==1)
677 710
                     drNew["发送状态"] = "已发送";
678 711
                 else
679 712
                     drNew["发送状态"] = "未发送";
@@ -818,17 +851,26 @@ namespace CallCenterApi.Interface.Controllers
818 851
                     model.SendWay = "定时发送";
819 852
                 model.DSSendTime = it.DSSendTime.ToString ();
820 853
                 model.SendTime = it.SendTime.ToString();
821
-                if (it.IsSend == 0)
822
-                    model.IsSend = "未发送";
823
-                else
854
+                if (it.SendTime < DateTime.Now && it.IsSend==1)
855
+                  //  if (it.IsSend == 0)
824 856
                     model.IsSend = "已发送";
857
+                else
858
+                    model.IsSend = "未发送";
825 859
                 model.Telephone = it.Telephone;
826 860
                 model.Detail = it.Detail;
827 861
                 if (it.MBID>0)
828 862
                 {
829 863
                     var MID = new BLL.T_SMS_Template().GetModel(int.Parse(it.MBID.ToString()));
830 864
                     if (MID != null)
831
-                        model.MBDetail = MID.Name;
865
+                    {
866
+                        // model.MBDetail = MID.Name;
867
+                        var typeName = new BLL.T_Sys_DictionaryValue().GetModel(Convert.ToInt32(MID.Name));
868
+                        if (typeName != null)
869
+                            model.MBDetail = typeName.F_Name;
870
+                    }
871
+
872
+
873
+
832 874
                 }
833 875
                 model.MID = it.MID;
834 876
                 model.MName = it.MName;

+ 1 - 2
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/knowledge/KnowledgeController.cs

@@ -38,8 +38,7 @@ namespace CallCenterApi.Interface.Controllers.knowledge
38 38
                 }
39 39
                 if (keywords.Trim() != "")
40 40
                 {
41
-                    sql += " and (F_Content like '%" + keywords.Trim() + "%' or F_Title like '%"
42
-                        + keywords.Trim() + "%' or F_KeyWords like '%" + keywords.Trim() + "%')";
41
+                    sql += " and   F_Title like '%" + keywords.Trim() + "%'  ";
43 42
                 }
44 43
                 if (strpageindex.Trim() != "")
45 44
                 {