陈少旭 před 3 měsíci
rodič
revize
6d6e8ae012

+ 1 - 0
controllers/admin_api_controllers/admin_api_router_register.go Zobrazit soubor

@@ -18,6 +18,7 @@ func AdminAPIControllersRegisterRouters() {
18 18
 	beego.Router("/admin/api/custom/list", &CustomAPIController{}, "get:GetCustomList")
19 19
 	beego.Router("/admin/api/custom/get", &CustomAPIController{}, "get:GetCustom")
20 20
 	beego.Router("/admin/api/custom/check", &CustomAPIController{}, "post:CheckCustom")
21
+	beego.Router("/admin/api/custom/delete", &CustomAPIController{}, "post:CheckCustom")
21 22
 
22 23
 	//beego.Router("/admin/api/checkcustom/get", &CustomAPIController{}, "get:GetWaitCheckCustom")
23 24
 

+ 29 - 9
controllers/admin_api_controllers/custom_api_controller.go Zobrazit soubor

@@ -149,15 +149,16 @@ func (this *CustomAPIController) GetCustomList() {
149 149
 		"list": list,
150 150
 	})
151 151
 }
152
-func (this *CustomAPIController) DeleteCustom() {
153
-	id, _ := this.GetInt64("id")
154
-	err := service.DeleteAdmin(id)
155
-	if err == nil {
156
-		this.ServeSuccessJSON(map[string]interface{}{
157
-			"msg": "删除成功",
158
-		})
159
-	}
160
-}
152
+
153
+//	func (this *CustomAPIController) DeleteAdmin() {
154
+//		id, _ := this.GetInt64("id")
155
+//		err := service.DeleteAdmin(id)
156
+//		if err == nil {
157
+//			this.ServeSuccessJSON(map[string]interface{}{
158
+//				"msg": "删除成功",
159
+//			})
160
+//		}
161
+//	}
161 162
 func (this *CustomAPIController) ModifyCustom() {
162 163
 	id, _ := this.GetInt64("id")
163 164
 	module, _ := this.GetInt64("module")
@@ -457,6 +458,25 @@ func (this *CustomAPIController) EditPaymentCollection() {
457 458
 	})
458 459
 
459 460
 }
461
+
462
+func (this *CustomAPIController) DeleteCustom() {
463
+	id, _ := this.GetInt64("id")
464
+	ct, _ := service.FindCustomInfoByIDTwo(id)
465
+	if ct.ID == 0 {
466
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
467
+		return
468
+	}
469
+	ct.Status = 0
470
+	err := service.SaveCustomTwo(ct)
471
+	if err != nil {
472
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
473
+		return
474
+	}
475
+	this.ServeSuccessJSON(map[string]interface{}{
476
+		"msg": "删除成功",
477
+	})
478
+}
479
+
460 480
 func (this *CustomAPIController) DeletePaymentCollection() {
461 481
 	id, _ := this.GetInt64("id")
462 482
 	cpc, _ := service.FindPaymentCollectionInfo(id)

+ 5 - 0
service/custom_service.go Zobrazit soubor

@@ -16,6 +16,11 @@ func SaveCustom(admin *models.KyyChargeCustom) (err error) {
16 16
 	err = ChargeWriteDB().Model(&models.KyyChargeCustom{}).Create(&admin).Error
17 17
 	return
18 18
 }
19
+
20
+func SaveCustomTwo(admin models.KyyChargeCustomThree) (err error) {
21
+	err = ChargeWriteDB().Model(&models.KyyChargeCustomThree{}).Create(&admin).Error
22
+	return
23
+}
19 24
 func GetAllCustoms() (cus []*models.KyyChargeCustom, err error) {
20 25
 	err = ChargeReadDB().Model(&models.KyyChargeCustomTwo{}).Where("status = 1").Find(&cus).Error
21 26
 	return