Преглед на файлове

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

mainqaq преди 3 години
родител
ревизия
98f4909e56
променени са 1 файла, в които са добавени 24 реда и са изтрити 18 реда
  1. 24 18
      controllers/supply_order_api_contorller.go

+ 24 - 18
controllers/supply_order_api_contorller.go Целия файл

@@ -184,12 +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
+	//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
+	//}
193 193
 	supplierName := dataBody["suppliername"].(string)
194 194
 	if supplierName == "" {
195 195
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商名称不能为空")
@@ -240,6 +240,12 @@ func (this *SupplyOrderApiController) UpdateSupply() {
240 240
 	orgId := this.GetAdminUserInfo().CurrentOrgId
241 241
 	//contacts := this.Get("contacts")//联系人
242 242
 	//dataBody := make(map[string]interface{}, 0)
243
+	err = json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
244
+	if err != nil {
245
+		utils.ErrorLog(err.Error())
246
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
247
+		return
248
+	}
243 249
 	//保存联系人
244 250
 	if dataBody["contacts"] != nil && reflect.TypeOf(dataBody["contacts"]).String() == "[]interface {}" {
245 251
 		thisStockIn, _ := dataBody["contacts"].([]interface{})
@@ -377,12 +383,12 @@ func (this *SupplyOrderApiController) GetSupplyCode() {
377 383
 func (this *SupplyOrderApiController) SaveSupply() {
378 384
 	//supplierName := this.GetString("suppliername") //供应商名称
379 385
 	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
-	}
386
+	//err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
387
+	//if err != nil {
388
+	//	utils.ErrorLog(err.Error())
389
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
390
+	//	return
391
+	//}
386 392
 	supplierName := dataBody["suppliername"].(string)
387 393
 	if supplierName == "" {
388 394
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商名称不能为空")
@@ -416,12 +422,12 @@ func (this *SupplyOrderApiController) SaveSupply() {
416 422
 	bankAccount := dataBody["bankaccount"].(string)
417 423
 	orgId := this.GetAdminUserInfo().CurrentOrgId
418 424
 	//contacts := this.Get("contacts")//联系人
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
-	//}
425
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
426
+	if err != nil {
427
+		utils.ErrorLog(err.Error())
428
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
429
+		return
430
+	}
425 431
 	//保存联系人
426 432
 	if dataBody["contacts"] != nil && reflect.TypeOf(dataBody["contacts"]).String() == "[]interface {}" {
427 433
 		thisStockIn, _ := dataBody["contacts"].([]interface{})