浏览代码

修改联系人不能为空的bug

mainqaq 3 年前
父节点
当前提交
7fbd151ff0
共有 1 个文件被更改,包括 10 次插入2 次删除
  1. 10 2
      controllers/supply_order_api_contorller.go

+ 10 - 2
controllers/supply_order_api_contorller.go 查看文件

@@ -306,7 +306,7 @@ func (this *SupplyOrderApiController) UpdateSupply() {
306 306
 					items := item.(map[string]interface{})
307 307
 					items["is_first"] = 1
308 308
 					//如果电话和联系人都为空,不保存联系人
309
-					if items["phone"] == "" && items["name"] == "" {
309
+					if items["phone"] == "" && items["name"] == nil {
310 310
 						upsupply := models.SpSupplierName{
311 311
 							ID:           supplierid,
312 312
 							SupplierCode: supplierCode,
@@ -325,6 +325,10 @@ func (this *SupplyOrderApiController) UpdateSupply() {
325 325
 							this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
326 326
 							return
327 327
 						}
328
+						this.ServeSuccessJSON(map[string]interface{}{
329
+							"list": "保存成功",
330
+						})
331
+						return
328 332
 					}
329 333
 				}
330 334
 			}
@@ -608,7 +612,7 @@ func (this *SupplyOrderApiController) SaveSupply() {
608 612
 					items := item.(map[string]interface{})
609 613
 					items["is_first"] = 1
610 614
 					//如果电话和联系人都为空,不保存联系人
611
-					if items["phone"] == "" && items["name"] == "" {
615
+					if items["phone"] == "" && items["name"] == nil {
612 616
 						supply := models.SpSupplierName{
613 617
 							SupplierCode: supplierCode,
614 618
 							SupplierName: supplierName,
@@ -629,6 +633,10 @@ func (this *SupplyOrderApiController) SaveSupply() {
629 633
 							this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
630 634
 							return
631 635
 						}
636
+						this.ServeSuccessJSON(map[string]interface{}{
637
+							"list": "保存成功",
638
+						})
639
+						return
632 640
 					}
633 641
 				}
634 642
 			}