From 956508eac03d9c0df896d4b6a0f6953f671d269e Mon Sep 17 00:00:00 2001 From: vatebur <67186678+vatebur@users.noreply.github.com> Date: Mon, 14 Oct 2024 11:04:14 +0800 Subject: [PATCH] fix: two bugs in mcifsh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 修复商品数量大于250时,商品价格浮动区间数值异常 2. 修复出售限制未生效的问题。(时间未更新) --- plugin/mcfish/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin/mcfish/main.go b/plugin/mcfish/main.go index cde0b25b28..5ecd5ba8ef 100644 --- a/plugin/mcfish/main.go +++ b/plugin/mcfish/main.go @@ -593,8 +593,8 @@ func (sql *fishdb) refreshStroeInfo() (ok bool, err error) { thingInfo := store{} _ = sql.db.Find("store", &thingInfo, "where Name = '"+name+"'") if thingInfo.Number > 150 { - // 通货膨胀 - thing.Discount = (1000 - 5*(thingInfo.Number-150)) / 10 + // 商品贬值,价格区间 -50%到0% + thing.Discount = 50 + rand.Intn(50) } err = sql.db.Insert("stroeDiscount", &thing) if err != nil { @@ -826,6 +826,10 @@ func (sql *fishdb) selectCanSalesFishFor(uid int64, sales int) int { if time.Now().Day() != time.Unix(userInfo.Duration, 0).Day() { userInfo.Duration = time.Now().Unix() userInfo.SalesFish = 0 + err := sql.db.Insert("buff", &userInfo) + if err != nil { + return residue + } } maxSales := 100 - userInfo.SalesFish if maxSales < 0 {