|
@@ -121,22 +121,22 @@ func SearchPricing(ctx context.Context, pageSize, pageNum int32, conditions *com
|
|
|
func ModifyPricing(ctx context.Context, req *http_model.ModifyPricingRequest) (int, error) {
|
|
|
db := GetReadDB(ctx)
|
|
|
strategyId := req.StrategyId
|
|
|
- db = db.Model(gorm_model.InfoPricingStrategy{}).Where("strategyId = ?", strategyId)
|
|
|
+ db = db.Model(gorm_model.InfoPricingStrategy{})
|
|
|
project_type, fee_form, platform, fans_low, fans_up, service_charge, service_rate := req.ProjectType, req.FeeForm, req.Platform, req.FansLow, req.FansHigh, req.ServiceCharge, req.ServiceRate*10
|
|
|
var IsExclusive, IsExclusive2, IsExclusive3, IsExclusive1 int64
|
|
|
- err := db.Where("strategyId <> ? && fee_form = ? && platform = ? && fans_low <= ? && fans_up >= ?", strategyId, fee_form, platform, fans_low, fans_up).Count(&IsExclusive).Error
|
|
|
+ err := db.Debug().Where("strategyId <> ? && fee_form = ? && platform = ? && fans_low <= ? && fans_up >= ?", strategyId, fee_form, platform, fans_low, fans_up).Count(&IsExclusive).Error
|
|
|
if IsExclusive != 0 {
|
|
|
return 1, nil
|
|
|
}
|
|
|
- err = db.Where("strategyId <> ? && fee_form = ? && platform = ? && fans_low < ? && fans_up > ?", strategyId, fee_form, platform, fans_low, fans_low).Count(&IsExclusive1).Error
|
|
|
+ err = db.Debug().Where("strategyId <> ? && fee_form = ? && platform = ? && fans_low < ? && fans_up > ?", strategyId, fee_form, platform, fans_low, fans_low).Count(&IsExclusive1).Error
|
|
|
if IsExclusive1 != 0 {
|
|
|
return 1, nil
|
|
|
}
|
|
|
- err = db.Where("strategyId <> ? && fee_form = ? && platform = ? && fans_low < ? && fans_up > ?", strategyId, fee_form, platform, fans_up, fans_up).Count(&IsExclusive2).Error
|
|
|
+ err = db.Debug().Where("strategyId <> ? && fee_form = ? && platform = ? && fans_low < ? && fans_up > ?", strategyId, fee_form, platform, fans_up, fans_up).Count(&IsExclusive2).Error
|
|
|
if IsExclusive2 != 0 {
|
|
|
return 1, nil
|
|
|
}
|
|
|
- err = db.Where("strategyId <> ? && fee_form = ? && platform = ? && fans_low >= ? && fans_up <= ?", strategyId, fee_form, platform, fans_low, fans_up).Count(&IsExclusive3).Error
|
|
|
+ err = db.Debug().Where("strategyId <> ? && fee_form = ? && platform = ? && fans_low >= ? && fans_up <= ?", strategyId, fee_form, platform, fans_low, fans_up).Count(&IsExclusive3).Error
|
|
|
if IsExclusive3 != 0 {
|
|
|
return 1, nil
|
|
|
}
|
|
@@ -145,7 +145,7 @@ func ModifyPricing(ctx context.Context, req *http_model.ModifyPricingRequest) (i
|
|
|
logrus.WithContext(ctx).Errorf("[ModifyPricing] error query mysql find, err:%+v", err)
|
|
|
return 2, err
|
|
|
}
|
|
|
- fmt.Printf("service_rate:%+v", service_rate)
|
|
|
+ //fmt.Printf("service_rate:%+v", service_rate)
|
|
|
db1 := GetReadDB(ctx).Model(gorm_model.InfoPricingStrategy{}).Where("strategyId = ?", strategyId)
|
|
|
err1 := db1.Updates(map[string]interface{}{
|
|
|
"project_type": project_type, "service_rate": service_rate, "fee_form": fee_form,
|