瀏覽代碼

bug919修改

lihai 7 年之前
父節點
當前提交
bc34c22921

+ 16 - 5
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/CustomerController.cs

@@ -194,6 +194,16 @@ namespace CallCenterApi.Interface.Controllers.customer
194 194
                     string mobile = RequestString.GetFormString("mobile");
195 195
                     //获取当前表格选择的客户
196 196
                     int cid = Utils.StrToInt(RequestString.GetFormString("cid"), 0);
197
+                    #region 2018-05-03 lihai 添加验证判断
198
+                    if (string.IsNullOrEmpty(name))
199
+                        return Error("姓名不能为空!");
200
+                    if (string.IsNullOrEmpty(province))
201
+                        return Error("省份不能为空!");
202
+                    if (!Validate.IsHasCHZN(province))
203
+                        return Error("请输入有效的省份!");
204
+                    if (!Validate.IsValidPhoneAndMobile(mobile))
205
+                        return Error("请输入有效的电话号码");
206
+                    #endregion
197 207
 
198 208
                     Model.T_Cus_CustomerBase model = new Model.T_Cus_CustomerBase();
199 209
                     BLL.T_Cus_CustomerBase bll = new BLL.T_Cus_CustomerBase();
@@ -212,11 +222,11 @@ namespace CallCenterApi.Interface.Controllers.customer
212 222
                         int n = bll.Add(model);
213 223
                         if (n > 0)
214 224
                         {
215
-                            res = Success("新增成功!", model);
225
+                            return Success("新增成功!", model);
216 226
                         }
217 227
                         else
218 228
                         {
219
-                            res = Error("新增失败!");
229
+                            return Error("新增失败!");
220 230
                         }
221 231
                     }
222 232
                     else
@@ -230,11 +240,11 @@ namespace CallCenterApi.Interface.Controllers.customer
230 240
                             model.F_Telephone = mobile;
231 241
                             if (bll.Update(model))
232 242
                             {
233
-                                res = Success("修改成功!", model);
243
+                                return Success("修改成功!", model);
234 244
                             }
235 245
                             else
236 246
                             {
237
-                                res = Error("修改失败!");
247
+                                return Error("修改失败!");
238 248
                             }
239 249
                         }
240 250
                     }
@@ -253,9 +263,10 @@ namespace CallCenterApi.Interface.Controllers.customer
253 263
                     }
254 264
                     CacheHelper.Insert("LDDep", lddep);
255 265
                 }
266
+                return Error("参数错误");
256 267
 
257 268
             }
258
-            return res;
269
+            return Error("未知错误,请重新登录");
259 270
         }
260 271
 
261 272
         /// <summary>