陈少旭 5 months ago
parent
commit
6d6e8ae012

+ 1 - 0
controllers/admin_api_controllers/admin_api_router_register.go View File

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

+ 29 - 9
controllers/admin_api_controllers/custom_api_controller.go View File

149
 		"list": list,
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
 func (this *CustomAPIController) ModifyCustom() {
162
 func (this *CustomAPIController) ModifyCustom() {
162
 	id, _ := this.GetInt64("id")
163
 	id, _ := this.GetInt64("id")
163
 	module, _ := this.GetInt64("module")
164
 	module, _ := this.GetInt64("module")
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
 func (this *CustomAPIController) DeletePaymentCollection() {
480
 func (this *CustomAPIController) DeletePaymentCollection() {
461
 	id, _ := this.GetInt64("id")
481
 	id, _ := this.GetInt64("id")
462
 	cpc, _ := service.FindPaymentCollectionInfo(id)
482
 	cpc, _ := service.FindPaymentCollectionInfo(id)

+ 5 - 0
service/custom_service.go View File

16
 	err = ChargeWriteDB().Model(&models.KyyChargeCustom{}).Create(&admin).Error
16
 	err = ChargeWriteDB().Model(&models.KyyChargeCustom{}).Create(&admin).Error
17
 	return
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
 func GetAllCustoms() (cus []*models.KyyChargeCustom, err error) {
24
 func GetAllCustoms() (cus []*models.KyyChargeCustom, err error) {
20
 	err = ChargeReadDB().Model(&models.KyyChargeCustomTwo{}).Where("status = 1").Find(&cus).Error
25
 	err = ChargeReadDB().Model(&models.KyyChargeCustomTwo{}).Where("status = 1").Find(&cus).Error
21
 	return
26
 	return