Browse Source

update 一个圈圈

master
DengBiao 10 months ago
parent
commit
6208811932
3 changed files with 39 additions and 16 deletions
  1. +16
    -15
      db/model/one_circles_green_energy_basic_setting.go
  2. +1
    -1
      md/fin_user_flow.go
  3. +22
    -0
      rule/one_circles/one_circles_available_green_energy_settlement.go

+ 16
- 15
db/model/one_circles_green_energy_basic_setting.go View File

@@ -9,21 +9,21 @@ type OneCirclesGreenEnergyBasicSetting struct {
IsOpen int `json:"is_open" xorm:"not null default 1 comment('是否开启(1:开启 0:关闭)') TINYINT(1)"`
PersonGreenEnergyCoinId int `json:"person_green_energy_coin_id" xorm:"not null default 0 comment('个人绿色能量对应虚拟币id') INT(11)"`
TeamGreenEnergyCoinId int `json:"team_green_energy_coin_id" xorm:"not null default 0 comment('团队绿色能量对应虚拟币id') INT(11)"`
TotalIssuanceAmount string `json:"total_issuance_amount" xorm:"not null comment('总发行量') DECIMAL(28,10)"`
EcologicalApplication string `json:"ecological_application" xorm:"not null comment('生态应用') DECIMAL(28,10)"`
TotalTechnologyTeam string `json:"total_technology_team" xorm:"not null comment('技术团队') DECIMAL(28,10)"`
TotalOperateTeam string `json:"total_operate_team" xorm:"not null comment('运营团队') DECIMAL(28,10)"`
TotalActiveGiveaways string `json:"total_active_giveaways" xorm:"not null comment('活跃赠送') DECIMAL(28,10)"`
OriginalQuantityNums string `json:"original_quantity_nums" xorm:"not null comment('原始数量') DECIMAL(28,10)"`
InitialPrice string `json:"initial_price" xorm:"not null comment('初始价格') DECIMAL(28,10)"`
NowPrice string `json:"now_price" xorm:"not null comment('当前价格') DECIMAL(28,10)"`
OriginalFunds string `json:"original_funds" xorm:"not null comment('原始资金') DECIMAL(28,10)"`
MarketplaceMerchantNums string `json:"marketplace_merchant_nums" xorm:"not null comment('市商数量') DECIMAL(28,10)"`
MarketplaceMerchantFunds string `json:"marketplace_merchant_funds" xorm:"not null comment('市商资金') DECIMAL(28,10)"`
DevelopmentCommittee string `json:"development_committee" xorm:"not null comment('发展委员会') DECIMAL(28,10)"`
PublicWelfareAndCharity string `json:"public_welfare_and_charity" xorm:"not null comment('公益慈善') DECIMAL(28,10)"`
StarLevelDividends string `json:"star_level_dividends" xorm:"not null comment('星级分红') DECIMAL(28,10)"`
DestructionQuantityNums string `json:"destruction_quantity_nums" xorm:"not null comment('销毁数量') DECIMAL(28,10)"`
TotalIssuanceAmount string `json:"total_issuance_amount" xorm:"not null comment('总发行量') DECIMAL(28,8)"`
EcologicalApplication string `json:"ecological_application" xorm:"not null comment('生态应用') DECIMAL(28,8)"`
TotalTechnologyTeam string `json:"total_technology_team" xorm:"not null comment('技术团队') DECIMAL(28,8)"`
TotalOperateTeam string `json:"total_operate_team" xorm:"not null comment('运营团队') DECIMAL(28,8)"`
TotalActiveGiveaways string `json:"total_active_giveaways" xorm:"not null comment('活跃赠送') DECIMAL(28,8)"`
OriginalQuantityNums string `json:"original_quantity_nums" xorm:"not null comment('原始数量') DECIMAL(28,8)"`
InitialPrice string `json:"initial_price" xorm:"not null comment('初始价格') DECIMAL(28,8)"`
NowPrice string `json:"now_price" xorm:"not null comment('当前价格') DECIMAL(28,8)"`
OriginalFunds string `json:"original_funds" xorm:"not null comment('原始资金') DECIMAL(28,8)"`
MarketplaceMerchantNums string `json:"marketplace_merchant_nums" xorm:"not null comment('市商数量') DECIMAL(28,8)"`
MarketplaceMerchantFunds string `json:"marketplace_merchant_funds" xorm:"not null comment('市商资金') DECIMAL(28,8)"`
DevelopmentCommittee string `json:"development_committee" xorm:"not null comment('发展委员会') DECIMAL(28,8)"`
PublicWelfareAndCharity string `json:"public_welfare_and_charity" xorm:"not null comment('公益慈善') DECIMAL(28,8)"`
StarLevelDividends string `json:"star_level_dividends" xorm:"not null comment('星级分红') DECIMAL(28,8)"`
DestructionQuantityNums string `json:"destruction_quantity_nums" xorm:"not null comment('销毁数量') DECIMAL(28,8)"`
DestructionSetting string `json:"destruction_setting" xorm:"not null comment('销毁设置') TEXT"`
IsLimitDividend int `json:"is_limit_dividend" xorm:"not null default 1 comment('是否限制分红(会员本人不活跃,没有绿色能量分红)') TINYINT(1)"`
SettlementQuantity int `json:"settlement_quantity" xorm:"not null default 0 comment('结算数量(百分比)') INT(11)"`
@@ -34,4 +34,5 @@ type OneCirclesGreenEnergyBasicSetting struct {
VipEquitySetting string `json:"vip_equity_setting" xorm:"not null comment('会员权益') TEXT"`
CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
IsOpenWelfareOrders int `json:"is_open_welfare_orders" xorm:"not null default 0 comment('是否开启福利订单') TINYINT(1)"`
}

+ 1
- 1
md/fin_user_flow.go View File

@@ -29,7 +29,7 @@ const (
)

const DealUserAmountRequestIdPrefix = "%s:deal_user_amount:%d"
const UserAmountRedisKey = "%s:user_amount:%d"
const UserAmountRedisKey = "%s:rule_user_amount:%d"

type DealIntegralReleaseInterpositionUserAmountReq struct {
Kind string `json:"kind"`


+ 22
- 0
rule/one_circles/one_circles_available_green_energy_settlement.go View File

@@ -105,3 +105,25 @@ func NewCalcPriceReductionFormula(userExchangeNumsValue string, oneCirclesGreenE
afterPriceValue = afterPrice.String()
return
}

// JudgeUserIsCanBuyWelfareOrders 判断用户是否可以购买福利订单
func JudgeUserIsCanBuyWelfareOrders(engine *xorm.Engine, uid int) (err error, values, nowPriceValue, afterPriceValue string) {
//1、查找 `one_circles_green_energy_basic_setting` 基础设置
//oneCirclesGreenEnergyBasicSetting, err := db.OneCirclesGreenEnergyBasicSettingGetOneByParams(engine, map[string]interface{}{
// "key": "is_open",
// "value": 1,
//})
//if err != nil {
// return
//}
//userAmount, _ := decimal.NewFromString(userAmountValue) //用户资金
//nowPrice, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.NowPrice) //当前价格
//originalQuantityNums, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.OriginalQuantityNums) //原始数量
//originalQuantityFunds, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.OriginalFunds) //原始资金
//afterPrice := (userAmount.Add(originalQuantityFunds)).Div(originalQuantityNums).Truncate(8) //涨价后的价格
//
//values = userAmount.Div(afterPrice).Truncate(8).String() //用户得到绿色能量个数
//nowPriceValue = nowPrice.String()
//afterPriceValue = afterPrice.String()
return
}

Loading…
Cancel
Save