Просмотр исходного кода

固定号码加前缀问题调整,本地号码区号去0加9,外地号码区号去0加90

zhengbingbing лет назад: 7
Родитель
Сommit
2c37c80731

+ 31 - 11
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/CallOutOptController.cs

@@ -17,6 +17,7 @@ namespace CallCenterApi.Interface.Controllers
17 17
             if (Request.IsAuthenticated)
18 18
             {
19 19
                 string phone1 = RequestString.ToDBC(RequestString.RemoveNotNumber(WebHelper.NoHtml(phone)));
20
+                string tophone = phone1;
20 21
                 string zipcode = ""; string bfix = ""; string wfix = ""; string fix = "";
21 22
                 string userseatgroupid = CurrentUser.UserData.F_SeartGroupID.ToString();
22 23
                 if (userseatgroupid != "" && userseatgroupid != "0")
@@ -30,18 +31,31 @@ namespace CallCenterApi.Interface.Controllers
30 31
                     }
31 32
                 }
32 33
                 int zip = GetZipCodeByPhone(phone1, zipcode);
34
+                #region 
33 35
                 if (zip == 1)
34
-                {
36
+                {//手机本地号码
35 37
                     fix = bfix;
36 38
                 }
37 39
                 else if (zip == 2)
38
-                {
40
+                {//手机外地号码
39 41
                     fix = wfix;
40 42
                 }
41
-
43
+                else
44
+                {
45
+                    tophone = phone1.TrimStart('0');
46
+                    if (zip == 3)
47
+                    {//本地固话去0加9 比如:988888517,937188888517
48
+                        fix = bfix;
49
+                    }
50
+                    else if (zip == 4)
51
+                    {//外地固话前加9 比如:9037188888517
52
+                        fix = wfix;
53
+                    }
54
+                }
55
+                #endregion
42 56
                 var obj = new
43 57
                 {
44
-                    phone = fix + phone1,
58
+                    phone = fix + tophone,
45 59
                     fix = fix
46 60
                 };
47 61
 
@@ -53,8 +67,10 @@ namespace CallCenterApi.Interface.Controllers
53 67
         /// <summary>
54 68
         /// 根据号码和区号判断号码是否为归属地号码
55 69
         /// 返回0为分机号或特殊号码
56
-        /// 返回1为本地号码
57
-        /// 返回2为外地号码
70
+        /// 返回1为手机本地号码
71
+        /// 返回2为手机外地号码
72
+        /// 返回3为固定电话本地号码
73
+        /// 返回4为固定电话外地号码
58 74
         /// </summary>
59 75
         /// <param name="phone"></param>
60 76
         /// <param name="zipcode"></param>
@@ -70,7 +86,7 @@ namespace CallCenterApi.Interface.Controllers
70 86
                 if (phone.Trim().Length == 11 && phone[0] == '1')
71 87
                 {//号码为11位,首位是1,为手机号
72 88
                     BLL.T_Sys_MobileData mobile_Bll = new BLL.T_Sys_MobileData();
73
-                    Model.T_Sys_MobileData mobileModel = mobile_Bll.GetModelList(" F_MobileNum='" + phone.Substring(0, 7) + "' ").FirstOrDefault();
89
+                    Model.T_Sys_MobileData mobileModel = mobile_Bll.GetModelList("F_MobileNum='" + phone.Substring(0, 7) + "'").FirstOrDefault();
74 90
                     if (mobileModel != null)
75 91
                     {
76 92
                         if (mobileModel.F_ZipCode.Equals(zipcode))
@@ -93,20 +109,24 @@ namespace CallCenterApi.Interface.Controllers
93 109
                         bool resbd4 = phone.Substring(0, 4).Equals(zipcode);
94 110
                         if (resbd3 || resbd4)
95 111
                         {
96
-                            res = 1;
112
+                            res = 3;
113
+                        }
114
+                        else
115
+                        {
116
+                            res = 4;
97 117
                         }
98 118
                     }
99 119
                     else if (phone.Trim().Length < 11)
100 120
                     {//号码小于11位,为本地
101
-                        res = 1;
121
+                        res = 3;
102 122
                     }
103 123
                     else if (phone.Trim().Length > 11 && phone.Substring(0, 4).Equals(zipcode))
104 124
                     {//号码大于11位,截取前四位区号判断是否本地
105
-                        res = 1;
125
+                        res = 3;
106 126
                     }
107 127
                     else
108 128
                     {
109
-                        res = 2;
129
+                        res = 4;
110 130
                     }
111 131
                 }
112 132
             }