|
|
@@ -434,7 +434,11 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
434
|
434
|
}
|
|
435
|
435
|
return sb.ToString();
|
|
436
|
436
|
}
|
|
437
|
|
-
|
|
|
437
|
+ /// <summary>
|
|
|
438
|
+ /// 获取签名
|
|
|
439
|
+ /// </summary>
|
|
|
440
|
+ /// <param name="url"></param>
|
|
|
441
|
+ /// <returns></returns>
|
|
438
|
442
|
public ActionResult GetJsSdk(string url)
|
|
439
|
443
|
{
|
|
440
|
444
|
var timestamp = GetCurrentUinxTime();
|
|
|
@@ -535,111 +539,14 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
535
|
539
|
|
|
536
|
540
|
return ticket;
|
|
537
|
541
|
}
|
|
538
|
|
- public ActionResult Getsig()
|
|
539
|
|
- {
|
|
540
|
|
- WebClient web = new WebClient();
|
|
541
|
|
- web.Encoding = Encoding.UTF8;
|
|
542
|
|
- string msg = "";
|
|
543
|
|
- string url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + AppId + "&secret=" + AppSecret;
|
|
544
|
|
- string Dataaa = web.DownloadString(url);//这一句话就能请求到数据了
|
|
545
|
|
- string token = "";
|
|
546
|
|
- try
|
|
547
|
|
- {
|
|
548
|
|
- DataSet ds = new DataSet();
|
|
549
|
|
- StringReader stream = new StringReader(Dataaa);//读取字符串为数据量
|
|
550
|
|
- XmlTextReader reader = new XmlTextReader(stream);//对XML的数据流的只进只读访问
|
|
551
|
|
- ds.ReadXml(reader);//吧数据读入DataSet
|
|
552
|
|
- DataTable dt = ds.Tables["returnsms"];
|
|
553
|
|
- if (dt.Rows.Count > 0)
|
|
554
|
|
- {
|
|
555
|
|
- for (int i = 0; i < dt.Rows.Count; i++)
|
|
556
|
|
- {
|
|
557
|
|
- DataRow dr = ds.Tables[0].Rows[i];
|
|
558
|
|
- token = dr["access_token"].ToString();
|
|
559
|
|
- }
|
|
560
|
|
- }
|
|
561
|
|
- string urltoken = " https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + token + "&type=jsapi";
|
|
562
|
|
- string Dataaasig = web.DownloadString(urltoken);//这一句话就能请求到数据了
|
|
563
|
|
- DataSet dj = new DataSet();
|
|
564
|
|
- StringReader streams = new StringReader(Dataaasig);//读取字符串为数据量
|
|
565
|
|
- XmlTextReader readers = new XmlTextReader(streams);//对XML的数据流的只进只读访问
|
|
566
|
|
- dj.ReadXml(readers);//吧数据读入DataSet
|
|
567
|
|
- DataTable dc = dj.Tables["returnsms"];
|
|
568
|
|
- if (dc.Rows.Count > 0)
|
|
569
|
|
- {
|
|
570
|
|
- for (int i = 0; i < dc.Rows.Count; i++)
|
|
571
|
|
- {
|
|
572
|
|
- DataRow dr = dj.Tables[0].Rows[i];
|
|
573
|
|
- msg = dr["ticket"].ToString();
|
|
574
|
|
- }
|
|
575
|
|
- }
|
|
576
|
|
- }
|
|
577
|
|
- catch (Exception ex)
|
|
578
|
|
- {
|
|
579
|
|
- msg = ex.Message;
|
|
580
|
|
- }
|
|
581
|
|
- var obj = new
|
|
582
|
|
- {
|
|
583
|
|
- state = "success",
|
|
584
|
|
- message = "成功",
|
|
585
|
|
- appId = AppId,
|
|
586
|
|
- token,
|
|
587
|
|
- msg,
|
|
588
|
|
- };
|
|
589
|
|
- return Content(obj.ToJson()); ;
|
|
590
|
|
- }
|
|
591
|
|
- private string sig()
|
|
592
|
|
- {
|
|
593
|
|
- WebClient web = new WebClient();
|
|
594
|
|
- web.Encoding = Encoding.UTF8;
|
|
595
|
|
- string msg = "";
|
|
596
|
|
- string url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+ AppId + "&secret="+ AppSecret;
|
|
597
|
|
- string Dataaa = web.DownloadString(url);//这一句话就能请求到数据了
|
|
598
|
|
- string token="";
|
|
599
|
|
- try
|
|
600
|
|
- {
|
|
601
|
|
- DataSet ds = new DataSet();
|
|
602
|
|
- StringReader stream = new StringReader(Dataaa);//读取字符串为数据量
|
|
603
|
|
- XmlTextReader reader = new XmlTextReader(stream);//对XML的数据流的只进只读访问
|
|
604
|
|
- ds.ReadXml(reader);//吧数据读入DataSet
|
|
605
|
|
- DataTable dt = ds.Tables["returnsms"];
|
|
606
|
|
- if (dt.Rows.Count > 0)
|
|
607
|
|
- {
|
|
608
|
|
- for (int i = 0; i < dt.Rows.Count; i++)
|
|
609
|
|
- {
|
|
610
|
|
- DataRow dr = ds.Tables[0].Rows[i];
|
|
611
|
|
- token = dr["access_token"].ToString();
|
|
612
|
|
- }
|
|
613
|
|
- }
|
|
614
|
|
- string urltoken = " https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token="+ token + "&type=jsapi";
|
|
615
|
|
- string Dataaasig = web.DownloadString(urltoken);//这一句话就能请求到数据了
|
|
616
|
|
- DataSet dj = new DataSet();
|
|
617
|
|
- StringReader streams = new StringReader(Dataaasig);//读取字符串为数据量
|
|
618
|
|
- XmlTextReader readers = new XmlTextReader(streams);//对XML的数据流的只进只读访问
|
|
619
|
|
- dj.ReadXml(readers);//吧数据读入DataSet
|
|
620
|
|
- DataTable dc = dj.Tables["returnsms"];
|
|
621
|
|
- if (dc.Rows.Count > 0)
|
|
622
|
|
- {
|
|
623
|
|
- for (int i = 0; i < dc.Rows.Count; i++)
|
|
624
|
|
- {
|
|
625
|
|
- DataRow dr = dj.Tables[0].Rows[i];
|
|
626
|
|
- msg = dr["ticket"].ToString();
|
|
627
|
|
- }
|
|
628
|
|
- }
|
|
629
|
|
- }
|
|
630
|
|
- catch (Exception ex)
|
|
631
|
|
- {
|
|
632
|
|
- msg = ex.Message;
|
|
633
|
|
- }
|
|
634
|
|
- return msg;
|
|
635
|
|
- }
|
|
|
542
|
+
|
|
636
|
543
|
public class Accesstoken
|
|
637
|
544
|
{
|
|
638
|
545
|
public string access_token;
|
|
639
|
546
|
public int expires_in;
|
|
640
|
547
|
}
|
|
641
|
548
|
/// <summary>
|
|
642
|
|
- /// 获取签名
|
|
|
549
|
+ /// 获取jsapi_ticket
|
|
643
|
550
|
/// </summary>
|
|
644
|
551
|
/// <param name="jsapi_ticket">微信公众号调用微信JS临时票据</param>
|
|
645
|
552
|
/// <param name="nonceStr">随机串</param>
|
|
|
@@ -673,51 +580,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
673
|
580
|
return output;
|
|
674
|
581
|
}
|
|
675
|
582
|
|
|
676
|
|
- /// <summary>
|
|
677
|
|
- /// 签名加密,使用SHA加密所得
|
|
678
|
|
- /// </summary>
|
|
679
|
|
- /// <param name="content">签名加密参数</param>
|
|
680
|
|
- /// <param name="encode">编码UTF-8</param>
|
|
681
|
|
- /// <returns></returns>
|
|
682
|
|
- public static string Sha1(string content, Encoding encode)
|
|
683
|
|
- {
|
|
684
|
|
- try
|
|
685
|
|
- {
|
|
686
|
|
- SHA1 sha1 = new SHA1CryptoServiceProvider();
|
|
687
|
|
- byte[] bytesIn = encode.GetBytes(content);
|
|
688
|
|
- byte[] bytesOut = sha1.ComputeHash(bytesIn);
|
|
689
|
|
- sha1.Dispose();
|
|
690
|
|
- string result = BitConverter.ToString(bytesOut);
|
|
691
|
|
- result = result.Replace("-", "");
|
|
692
|
|
- return result;
|
|
693
|
|
- }
|
|
694
|
|
- catch (Exception ex)
|
|
695
|
|
- {
|
|
696
|
|
- throw new Exception("SHA1加密出错:" + ex.Message);
|
|
697
|
|
- }
|
|
698
|
|
- }
|
|
699
|
|
- /// <summary>
|
|
700
|
|
- /// SHA1加密
|
|
701
|
|
- /// </summary>
|
|
702
|
|
- /// <param name="content">待加密的字符串</param>
|
|
703
|
|
- /// <param name="encode">编码方式</param>
|
|
704
|
|
- /// <returns></returns>
|
|
705
|
|
- public static string Sha1Sign(String content, Encoding encode)
|
|
706
|
|
- {
|
|
707
|
|
- try
|
|
708
|
|
- {
|
|
709
|
|
- SHA1 sha1 = new SHA1CryptoServiceProvider();//创建SHA1对象
|
|
710
|
|
- byte[] bytes_in = encode.GetBytes(content);//将待加密字符串转为byte类型
|
|
711
|
|
- byte[] bytes_out = sha1.ComputeHash(bytes_in);//Hash运算
|
|
712
|
|
- sha1.Dispose();//释放当前实例使用的所有资源
|
|
713
|
|
- string result = BitConverter.ToString(bytes_out);//将运算结果转为string类型
|
|
714
|
|
- return result;
|
|
715
|
|
- }
|
|
716
|
|
- catch (Exception ex)
|
|
717
|
|
- {
|
|
718
|
|
- return ex.Message;
|
|
719
|
|
- }
|
|
720
|
|
- }
|
|
|
583
|
+
|
|
721
|
584
|
|
|
722
|
585
|
/// <summary>
|
|
723
|
586
|
/// 获取当前时间戳
|
|
|
@@ -912,7 +775,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
912
|
775
|
/// <summary>
|
|
913
|
776
|
///工单列表
|
|
914
|
777
|
/// </summary>
|
|
915
|
|
- public ActionResult GetList(string description,string OpenId, string code, string cusname, string keywords, string cusphone, string companyname, string province, string city,
|
|
|
778
|
+ public ActionResult GetList(string handler,string description,string OpenId, string code, string cusname, string keywords, string cusphone, string companyname, string province, string city,
|
|
916
|
779
|
string country, string township, string category, string salebase, string touser, int source = 0, int state = -1, int status = -1, int type = 0, int pageindex = 1, int pagesize = 10)
|
|
917
|
780
|
{
|
|
918
|
781
|
// int userId = CurrentUser.UserData.F_UserId;
|
|
|
@@ -969,6 +832,30 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
969
|
832
|
if (!string.IsNullOrWhiteSpace(province))//乡
|
|
970
|
833
|
sql += $" and F_IncidentTownship like '%" + township.Trim() + "%'";
|
|
971
|
834
|
|
|
|
835
|
+ if (!string .IsNullOrEmpty (handler))
|
|
|
836
|
+ {
|
|
|
837
|
+ Model.T_Sys_UserAccount user = userAccountBLL .GetworkModel(handler);
|
|
|
838
|
+ if (user != null)
|
|
|
839
|
+ {
|
|
|
840
|
+ if (GetParticipate(user.F_UserCode) != "")
|
|
|
841
|
+ {
|
|
|
842
|
+
|
|
|
843
|
+ sql += " and T_Wo_WorkOrder.F_ID in ( " + GetParticipate(user.F_UserCode) + ") ";
|
|
|
844
|
+ }
|
|
|
845
|
+ }
|
|
|
846
|
+ else
|
|
|
847
|
+ {
|
|
|
848
|
+ Model.T_Sys_UserAccount userer = userAccountBLL.GetName(handler);
|
|
|
849
|
+ if (userer != null)
|
|
|
850
|
+ {
|
|
|
851
|
+ if (GetParticipate(userer.F_UserCode) != "")
|
|
|
852
|
+ {
|
|
|
853
|
+
|
|
|
854
|
+ sql += " and T_Wo_WorkOrder.F_ID in ( " + GetParticipate(userer.F_UserCode) + ") ";
|
|
|
855
|
+ }
|
|
|
856
|
+ }
|
|
|
857
|
+ }
|
|
|
858
|
+ }
|
|
972
|
859
|
// sql += " and (F_CreateBy= '" + ua.F_UserCode + "' or T_Wo_WorkOrder.F_ID in ( " + GetCYWorkOrderID(ua.F_UserCode) + ")) ";
|
|
973
|
860
|
if (ua != null)
|
|
974
|
861
|
{
|
|
|
@@ -1926,11 +1813,11 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
1926
|
1813
|
{
|
|
1927
|
1814
|
if (string.IsNullOrEmpty(model.F_Annotation))
|
|
1928
|
1815
|
{
|
|
1929
|
|
- model.F_Annotation = cont+"-"+ ua.F_UserName + "("+ua .F_WorkNumber +")";
|
|
|
1816
|
+ model.F_Annotation = cont+"-"+ ua.F_UserName + "("+ua .F_WorkNumber +")"+DateTime .Now .ToString ("yyyy-MM-dd HH:mm:ss");
|
|
1930
|
1817
|
}
|
|
1931
|
1818
|
else
|
|
1932
|
1819
|
{
|
|
1933
|
|
- model.F_Annotation = model.F_Annotation + "。" + cont + "-" + ua.F_UserName + "(" + ua.F_WorkNumber + ")";
|
|
|
1820
|
+ model.F_Annotation = model.F_Annotation + "。" + cont + "-" + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ;
|
|
1934
|
1821
|
}
|
|
1935
|
1822
|
var res = woBLL.Update(model);
|
|
1936
|
1823
|
if (res)
|
|
|
@@ -3273,6 +3160,19 @@ namespace CallCenterApi.Interface.Controllers.weixin
|
|
3273
|
3160
|
;
|
|
3274
|
3161
|
return str;
|
|
3275
|
3162
|
}
|
|
|
3163
|
+ /// <summary>
|
|
|
3164
|
+ /// 获取我参与的工单编号
|
|
|
3165
|
+ /// </summary>
|
|
|
3166
|
+ /// <param name="user"></param>
|
|
|
3167
|
+ /// <returns></returns>
|
|
|
3168
|
+ public string GetParticipate(string user)
|
|
|
3169
|
+ {
|
|
|
3170
|
+ string str = string.Empty;
|
|
|
3171
|
+ str = "select F_WoID from T_Wo_WorkOrderItem_New where F_CreateUser in(" + user + ") ";
|
|
|
3172
|
+
|
|
|
3173
|
+ ;
|
|
|
3174
|
+ return str;
|
|
|
3175
|
+ }
|
|
3276
|
3176
|
private bool IsCustomerBaseNew(WorkOrderNewInput input)
|
|
3277
|
3177
|
{
|
|
3278
|
3178
|
bool n = false;
|