陈少旭 5 months ago
parent
commit
ca332cedbb

+ 8 - 4
controllers/admin_api_controllers/custom_api_controller.go View File

842
 }
842
 }
843
 func (this *CustomAPIController) CheckFollowInfo() {
843
 func (this *CustomAPIController) CheckFollowInfo() {
844
 	id, _ := this.GetInt64("id")
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
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
847
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
848
 		return
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
 	if err != nil {
856
 	if err != nil {
853
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
857
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
854
 		return
858
 		return

+ 9 - 0
service/custom_service.go View File

122
 	return
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
 func FindChargeFollowInfo(id int64) (cf models.KyyChargeFollow, err error) {
130
 func FindChargeFollowInfo(id int64) (cf models.KyyChargeFollow, err error) {
126
 	err = ChargeReadDB().Model(&models.KyyChargeFollow{}).Where("id = ? AND status = 1", id).First(&cf).Error
131
 	err = ChargeReadDB().Model(&models.KyyChargeFollow{}).Where("id = ? AND status = 1", id).First(&cf).Error
127
 	return
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
 func SaveChargeDemand(cd *models.KyyChargeDemand) (err error) {
139
 func SaveChargeDemand(cd *models.KyyChargeDemand) (err error) {
131
 	err = ChargeWriteDB().Save(&cd).Error
140
 	err = ChargeWriteDB().Save(&cd).Error
132
 	return
141
 	return