huangjiajun 2 semanas atrás
pai
commit
9f86c73636
3 arquivos alterados com 53 adições e 0 exclusões
  1. +7
    -0
      db/db_second_newcomers_free.go
  2. +19
    -0
      db/model/four_newcomers_free_price_type.go
  3. +27
    -0
      svc/get_plan_cfg.go

+ 7
- 0
db/db_second_newcomers_free.go Ver arquivo

@@ -19,3 +19,10 @@ func MoreGetAllPriceTypeList(Db *xorm.Engine) ([]model.MoreNewcomersFreePriceTyp
}
return priceType, nil
}
func FourGetAllPriceTypeList(Db *xorm.Engine) ([]model.FourNewcomersFreePriceType, error) {
var priceType []model.FourNewcomersFreePriceType
if err := Db.Find(&priceType); err != nil {
return nil, err
}
return priceType, nil
}

+ 19
- 0
db/model/four_newcomers_free_price_type.go Ver arquivo

@@ -0,0 +1,19 @@
package model

type FourNewcomersFreePriceType struct {
Id int `json:"id" xorm:"not null pk autoincr INT(10)"`
PriceName string `json:"price_name" xorm:"not null comment('价格类型') VARCHAR(255)"`
NeedQuan int `json:"need_quan" xorm:"not null default 0 comment('需要的福利券') INT(11)"`
CreatedAt int `json:"created_at" xorm:"not null default 0 INT(11)"`
UpdatedAt int `json:"updated_at" xorm:"not null default 0 INT(11)"`
IsShow int `json:"is_show" xorm:"not null default 1 comment('是否开启') TINYINT(1)"`
IsDel int `json:"is_del" xorm:"not null default 0 INT(11)"`
Auth string `json:"auth" xorm:"not null comment('权限') TEXT"`
NeedUseQuan int `json:"need_use_quan" xorm:"default 1 comment('是否需要使用免单券 0否 1是') INT(1)"`
NeedLimitBuy int `json:"need_limit_buy" xorm:"default 0 comment('是否限购') INT(1)"`
LimitBuyCondition string `json:"limit_buy_condition" xorm:"default '' comment('限购条件') VARCHAR(255)"`
CommissionId string `json:"commission_id" xorm:"default '' VARCHAR(255)"`
LimitStr string `json:"limit_str" xorm:"default '' VARCHAR(255)"`
BuyStr string `json:"buy_str" xorm:"default '' VARCHAR(255)"`
CommissionData string `json:"commission_data" xorm:"default '' VARCHAR(500)"`
}

+ 27
- 0
svc/get_plan_cfg.go Ver arquivo

@@ -89,6 +89,33 @@ func GetAllPlan(eg *xorm.Engine, dbName string) (map[string]*model.PlanReward, m
plan[tmp.Pvd] = tmp
}
}
fourList, _ := db.FourGetAllPriceTypeList(eg)
for _, v := range fourList {
var oneRewardPlan map[string]string
err := json.Unmarshal([]byte(v.CommissionData), &oneRewardPlan)
if err == nil {
var tmp = &model.PlanReward{
Id: 0,
Pvd: "fourFree_" + zhios_order_relate_utils.IntToStr(v.Id),
PvdRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["pvd_rate"]) / 100,
SysRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["sys_rate"]) / 100,
RegionRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["region_rate"]) / 100,
GlobalRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["global_rate"]) / 100,
StoreSubsidyRate: zhios_order_relate_utils.StrToFloat64(oneRewardPlan["store_subsidy_rate"]),
RedPacketRate: zhios_order_relate_utils.StrToFloat64(oneRewardPlan["red_packet_rate"]),
SettleMode: zhios_order_relate_utils.StrToInt(oneRewardPlan["settle_mode"]),
PlanCommissionId: zhios_order_relate_utils.StrToInt(oneRewardPlan["plan_commission_id"]),
PlanSettleId: zhios_order_relate_utils.StrToInt(oneRewardPlan["plan_settle_id"]),
State: 1,
Source: 1,
IntegralOpen: zhios_order_relate_utils.StrToInt(oneRewardPlan["integral_open"]),
MerchantRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["merchant_rate"]) / 100,
PushHandRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["push_hand_rate"]) / 100,
OrderBeforeRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["order_before_rate"]) / 100,
}
plan[tmp.Pvd] = tmp
}
}
commission := make(map[int]*model.PlanCommission, 0)
commissions := db.DbsPlanCommissionByIds(eg)
for _, v := range commissions {


Carregando…
Cancelar
Salvar