Ver a proveniência

更新

master
huangjiajun há 1 ano
ascendente
cometimento
33e8c6cda9
3 ficheiros alterados com 59 adições e 0 eliminações
  1. +14
    -0
      db/db_second_newcomers_free.go
  2. +19
    -0
      db/model/second_newcomers_free_price_type.go
  3. +26
    -0
      svc/get_plan_cfg.go

+ 14
- 0
db/db_second_newcomers_free.go Ver ficheiro

@@ -0,0 +1,14 @@
package db

import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db/model"
"xorm.io/xorm"
)

func SecondGetAllPriceTypeList(Db *xorm.Engine) ([]model.SecondNewcomersFreePriceType, error) {
var priceType []model.SecondNewcomersFreePriceType
if err := Db.Find(&priceType); err != nil {
return nil, err
}
return priceType, nil
}

+ 19
- 0
db/model/second_newcomers_free_price_type.go Ver ficheiro

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

type SecondNewcomersFreePriceType 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)"`
}

+ 26
- 0
svc/get_plan_cfg.go Ver ficheiro

@@ -34,6 +34,32 @@ func GetAllPlan(eg *xorm.Engine, dbName string) (map[string]*model.PlanReward, m
for _, v := range pvds {
plan[v.Pvd] = v
}
list, _ := db.SecondGetAllPriceTypeList(eg)
for _, v := range list {
var oneRewardPlan map[string]string
err := json.Unmarshal([]byte(v.CommissionData), &oneRewardPlan)
if err == nil {
var tmp = &model.PlanReward{
Id: 0,
Pvd: "seFree_" + 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,
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
Guardar