陈少旭 3 月之前
父節點
當前提交
ca332cedbb
共有 2 個文件被更改,包括 17 次插入4 次删除
  1. 8 4
      controllers/admin_api_controllers/custom_api_controller.go
  2. 9 0
      service/custom_service.go

+ 8 - 4
controllers/admin_api_controllers/custom_api_controller.go 查看文件

@@ -842,13 +842,17 @@ func (this *CustomAPIController) DeleteFollowInfo() {
842 842
 }
843 843
 func (this *CustomAPIController) CheckFollowInfo() {
844 844
 	id, _ := this.GetInt64("id")
845
-	follow, _ := service.FindChargeFollowInfo(id)
846
-	if follow.ID == 0 {
845
+	follow, _ := service.FindChargeFollowInfoTwo(id)
846
+	if len(follow) == 0 {
847 847
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
848 848
 		return
849 849
 	}
850
-	follow.IsCheck = 1
851
-	err := service.SaveChargeFollow(&follow)
850
+	var ids []int64
851
+	for _, item := range follow {
852
+
853
+		ids = append(ids, item.ID)
854
+	}
855
+	err := service.CheckChargeFollowTwo(ids)
852 856
 	if err != nil {
853 857
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
854 858
 		return

+ 9 - 0
service/custom_service.go 查看文件

@@ -122,11 +122,20 @@ func SaveChargeFollow(chargeFollow *models.KyyChargeFollow) (err error) {
122 122
 	return
123 123
 }
124 124
 
125
+func CheckChargeFollowTwo(ids []int64) (err error) {
126
+	err = ChargeWriteDB().Model(&models.KyyChargeFollow{}).Where("id in (?)", ids).Updates(map[string]interface{}{"is_check": 1}).Error
127
+	return
128
+}
129
+
125 130
 func FindChargeFollowInfo(id int64) (cf models.KyyChargeFollow, err error) {
126 131
 	err = ChargeReadDB().Model(&models.KyyChargeFollow{}).Where("id = ? AND status = 1", id).First(&cf).Error
127 132
 	return
128 133
 }
129 134
 
135
+func FindChargeFollowInfoTwo(id int64) (cf []models.KyyChargeFollow, err error) {
136
+	err = ChargeReadDB().Model(&models.KyyChargeFollow{}).Where("custom_id = ? AND status = 1", id).First(&cf).Error
137
+	return
138
+}
130 139
 func SaveChargeDemand(cd *models.KyyChargeDemand) (err error) {
131 140
 	err = ChargeWriteDB().Save(&cd).Error
132 141
 	return