Przeglądaj źródła

修改来电时接口请求顺序

zhangshuangnan 7 lat temu
rodzic
commit
b1e898b9b1
1 zmienionych plików z 24 dodań i 50 usunięć
  1. 24 50
      CallCenterWeb.UI/js/newtx.js

+ 24 - 50
CallCenterWeb.UI/js/newtx.js

@@ -762,19 +762,22 @@ $(document).ready(function() {
762 762
 							Phone.QueryCallIDOnAgentEx(_UserNo);
763 763
 							for(i = 0; i < Phone.CallIDNum; i++) {
764 764
 								var _CallId = Phone.GetCallIDByIdx(i);
765
-								//                        alert(_CallId);
766 765
 							}
767 766
 							Phone.QueryCallInfoEx(_CallId);
768 767
 							var CallId = IVRSelKey;
769 768
 							  var NowCallerPhoneCode = Phone.CallInfoEx_Ani;
770
-//							添加话务日志
771
-							$.get(huayi.config.callcenter_url + 'CallInScreen/AddCallLogs',{
772
-										telno:$('#callNumber').val(),
773
-										Status:status,
774
-										becallcome:becallcome,
775
-										hjbh:$('#callId').val(),
769
+							  	//获取呼叫编号callId
770
+									$.get(huayi.config.callcenter_url + 'CallInScreen/GetCallIdByPhone',{
771
+										telphone:NowCallerPhoneCode,
776 772
 										"token": $.cookie("token")
777
-									},function(res){});
773
+									}, function (res) {
774
+									    res = JSON.parse(res);
775
+									    if (res.state == "success") {
776
+											$('#callId').val(res.data.CallId);
777
+											$('#BusinessType').val(res.data.BusinessType);
778
+											updateCallLogs(NowCallerPhoneCode,status,becallcome)
779
+										}
780
+									});
778 781
 						}catch (e) {
779 782
 
780 783
             }
@@ -792,34 +795,9 @@ $(document).ready(function() {
792 795
 							Phone.QueryCallInfoEx(_CallId);
793 796
 							var telphone = Phone.CallInfoEx_Ani;
794 797
 							if(becallcome) {
795
-									var userid = $('#userId').val();
796
-									var usercode = $('#userCode').val();
797
-									var username = $('#userName').val();
798
-									var extnumber = $('#extenNum').val();
799
-									username = encodeURI(username);
800
-									//获取呼叫编号callId
801
-									$.get(huayi.config.callcenter_url + 'CallInScreen/GetCallIdByPhone',{
802
-										telphone:telphone,
803
-										userid:userid,
804
-										usercode:usercode,
805
-										username:username,
806
-										extnumber:extnumber,
807
-										timeno:timeno,
808
-										"token": $.cookie("token")
809
-									}, function (res) {
810
-									    res = JSON.parse(res);
811
-									    if (res.state == "success") {
812
-									        document.getElementById("callId").value = res.data.CallId;
813
-											//$('#callId').val(res.data.CallId);
814
-											$('#BusinessType').val(res.data.BusinessType);
815
-											callId = res.data.CallId;
816
-											console.log(res.data.CallId);
817
-											updateZL(res.data.CallId);
818
-											Form_callCommingCaller(telphone, res.data.CallId, res.data.BusinessType);
819
-										}
820
-									});
821
-									console.log($('#callId').val());
822
-								    //Form_callCommingCaller(telphone, $('#callId').val(),$('#BusinessType').val());
798
+								console.log($('#callId').val());
799
+								updateZL($('#callId').val());
800
+							    Form_callCommingCaller(telphone, $('#callId').val(),$('#BusinessType').val());
823 801
 							}
824 802
 							becallout = false;
825 803
 							becallcome = true;
@@ -833,9 +811,6 @@ $(document).ready(function() {
833 811
 									}, function (res) {
834 812
 									    console.log("CallInScreen/UpdateZJ");
835 813
 									    console.log(res);
836
-//										if(res.state.toLowerCase() == "success") {
837
-//											$('#callId').val(res.data.CallId);
838
-//										}
839 814
 									});
840 815
 									//改变按钮图片
841 816
 							Form_setWinfromenble("True", "false", "false", "false", "True", "True", "True", "false", "false", "false");
@@ -853,7 +828,6 @@ $(document).ready(function() {
853 828
 							});
854 829
 							Form_setWinfromenble("false", "True", "True", "false", "false", "false", "false", "false", "false", "false");
855 830
 							setAgentStatus("空闲");
856
-							//2014-10-22
857 831
 							becallout = false;
858 832
 							becallcome = true;
859 833
 						}
@@ -868,20 +842,23 @@ $(document).ready(function() {
868 842
 				   
869 843
 				    $.get(huayi.config.callcenter_url + 'CallInScreen/UpdateZL', {
870 844
 				        callid: callids,
871
-				        //userid:userid,
872
-				        //usercode:usercode,
873
-				        //username:username,
874
-				        //extnumber:extnumber,
875
-				        //timeno:timeno,
876 845
 				        "token": $.cookie("token")
877 846
 				    }, function (res) {
878 847
 				        console.log("CallInScreen/UpdateZL");
879 848
 				        console.log(res);
880
-				        //										if(res.state.toLowerCase() == "success") {
881
-				        //										}
882 849
 				    });
883 850
 
884 851
 				}
852
+				//添加话务日志
853
+				function updateCallLogs(telNum,status,callcomes){
854
+					$.get(huayi.config.callcenter_url + 'CallInScreen/AddCallLogs',{
855
+						telno:telNum,
856
+						Status:status,
857
+						becallcome:callcomes,
858
+						hjbh:$('#callId').val(),
859
+						"token": $.cookie("token")
860
+					},function(res){});
861
+				}
885 862
 				//来电弹屏事件
886 863
 				function Form_callCommingCaller(callerNum, callid, calledType) {
887 864
 				    console.log('callid' + callid + 'calledType' + calledType);
@@ -889,14 +866,11 @@ $(document).ready(function() {
889 866
 					becallcome = true;
890 867
 					var p = '<a href="javascript:;" class="active J_menuTab" data-id="./callScreen/callScreen.html?Number=' + callerNum + '&CallID=' + callid + '&callType='+ calledType +'">来电弹屏' + callerNum + ' <i class="fa fa-times-circle"></i></a>';
891 868
 					$(".J_menuTab").removeClass("active");
892
-//					var nif = '<iframe class="J_iframe J_iframeNew" name="iframe'+ callid  +'"  width="100%" height="100%" src="./callScreen/callScreen.html?Number=' + callerNum + '&CallID=' + callid + '&ActionID=' + data.ActionID + '" frameborder="0" data-id="./callScreen/callScreen.html?tel=' + callerNum + '&CallID=' + callid + '" seamless></iframe>';
893 869
 					var nif = '<iframe class="J_iframe J_iframeNew" name="iframe'+ callid  +'"  width="100%" height="100%" src="./callScreen/callScreen.html?Number=' + callerNum + '&CallID=' + callid + '&callType='+ calledType +'" frameborder="0" data-id="./callScreen/callScreen.html?Number=' + callerNum + '&CallID=' + callid + '&callType='+ calledType +'" seamless></iframe>';
894 870
 					$(".J_mainContent").find("iframe.J_iframe").hide().parents(".J_mainContent").append(nif);
895 871
 					$(".J_menuTabs .page-tabs-content").append(p);
896 872
 					$("#ZYNumber").val(callerNum);//转移号码
897 873
 					$("#callNumber").val(callerNum);//来电号码
898
-//					f_addTab('callin_' + CBnumber + callerNum, callerNum + '来电', '../telmanage/callinnew.aspx?callid=' + CBnumber + "&phone=" + callerNum + "&timeno=" + timeno);
899
-
900 874
 				}
901 875
 				//录音成功
902 876
 				function Form_callComming(callerNum, parth) {