From 2b5b84236020f569945936da1aedb32699a6f260 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Sun, 4 Feb 2024 11:55:11 +0800 Subject: [PATCH] update --- .../one_circles_available_green_energy_settlement.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rule/one_circles/one_circles_available_green_energy_settlement.go b/rule/one_circles/one_circles_available_green_energy_settlement.go index ddcf1ca..9ca882f 100644 --- a/rule/one_circles/one_circles_available_green_energy_settlement.go +++ b/rule/one_circles/one_circles_available_green_energy_settlement.go @@ -112,13 +112,14 @@ func NewCalcPriceReductionFormula(userExchangeNumsValue string, oneCirclesGreenE func JudgeUserIsCanBuyWelfareOrders(engine *xorm.Engine, uid int) (err error) { now := time.Now() //1、查找 `one_circles_green_energy_basic_setting` 基础设置 - oneCirclesGreenEnergyBasicSetting, err := db.OneCirclesGreenEnergyBasicSettingGetOneByParams(engine, map[string]interface{}{ - "key": "is_open", - "value": 1, - }) + var oneCirclesGreenEnergyBasicSetting model.OneCirclesGreenEnergyBasicSetting + has, err := engine.Where("is_open = 1").Get(&oneCirclesGreenEnergyBasicSetting) if err != nil { return } + if !has { + return + } var welfareOrdersLimit *md2.WelfareOrdersLimit err = json.Unmarshal([]byte(oneCirclesGreenEnergyBasicSetting.WelfareOrdersLimit), &welfareOrdersLimit) if err != nil {