Browse Source

供应商模块保存和更改接口改动

mainqaq 2 years ago
parent
commit
d315948ba3
1 changed files with 18 additions and 13 deletions
  1. 18 13
      controllers/supply_order_api_contorller.go

+ 18 - 13
controllers/supply_order_api_contorller.go View File

@@ -184,6 +184,12 @@ func (this *SupplyOrderApiController) GetSupplyList() {
184 184
 //保存供应商及联系人(用于更改)
185 185
 func (this *SupplyOrderApiController) UpdateSupply() {
186 186
 	dataBody := make(map[string]interface{}, 0)
187
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
188
+	if err != nil {
189
+		utils.ErrorLog(err.Error())
190
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
191
+		return
192
+	}
187 193
 	supplierName := dataBody["suppliername"].(string)
188 194
 	if supplierName == "" {
189 195
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商名称不能为空")
@@ -234,12 +240,6 @@ func (this *SupplyOrderApiController) UpdateSupply() {
234 240
 	orgId := this.GetAdminUserInfo().CurrentOrgId
235 241
 	//contacts := this.Get("contacts")//联系人
236 242
 	//dataBody := make(map[string]interface{}, 0)
237
-	err = json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
238
-	if err != nil {
239
-		utils.ErrorLog(err.Error())
240
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
241
-		return
242
-	}
243 243
 	//保存联系人
244 244
 	if dataBody["contacts"] != nil && reflect.TypeOf(dataBody["contacts"]).String() == "[]interface {}" {
245 245
 		thisStockIn, _ := dataBody["contacts"].([]interface{})
@@ -377,6 +377,12 @@ func (this *SupplyOrderApiController) GetSupplyCode() {
377 377
 func (this *SupplyOrderApiController) SaveSupply() {
378 378
 	//supplierName := this.GetString("suppliername") //供应商名称
379 379
 	dataBody := make(map[string]interface{}, 0)
380
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
381
+	if err != nil {
382
+		utils.ErrorLog(err.Error())
383
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
384
+		return
385
+	}
380 386
 	supplierName := dataBody["suppliername"].(string)
381 387
 	if supplierName == "" {
382 388
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商名称不能为空")
@@ -410,13 +416,12 @@ func (this *SupplyOrderApiController) SaveSupply() {
410 416
 	bankAccount := dataBody["bankaccount"].(string)
411 417
 	orgId := this.GetAdminUserInfo().CurrentOrgId
412 418
 	//contacts := this.Get("contacts")//联系人
413
-
414
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
415
-	if err != nil {
416
-		utils.ErrorLog(err.Error())
417
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
418
-		return
419
-	}
419
+	//err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
420
+	//if err != nil {
421
+	//	utils.ErrorLog(err.Error())
422
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
423
+	//	return
424
+	//}
420 425
 	//保存联系人
421 426
 	if dataBody["contacts"] != nil && reflect.TypeOf(dataBody["contacts"]).String() == "[]interface {}" {
422 427
 		thisStockIn, _ := dataBody["contacts"].([]interface{})