Browse Source

修改联系人不能为空的bug

mainqaq 3 years ago
parent
commit
7fbd151ff0
1 changed files with 10 additions and 2 deletions
  1. 10 2
      controllers/supply_order_api_contorller.go

+ 10 - 2
controllers/supply_order_api_contorller.go View File

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