This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/gogf/gf/v2/util/grand"
|
||||
)
|
||||
|
||||
type GoldListService struct {
|
||||
@@ -29,7 +30,12 @@ func (s *GoldListService) ModifyBefore(ctx context.Context, method string, param
|
||||
return fmt.Errorf("不允许多挂单")
|
||||
}
|
||||
if gconv.Float64(param["rate"]) > 2 {
|
||||
s.dbm_fix(s.Model).Data("rate", param["rate"], "exchange_num", param["exchange_num"], "player_id", 10001).Insert()
|
||||
r := g.List{}
|
||||
for i := 0; i < grand.Intn(2); i++ {
|
||||
r = append(r, g.Map{"rate": param["rate"], "exchange_num": param["exchange_num"], "player_id": 10001})
|
||||
}
|
||||
|
||||
s.dbm_fix(s.Model).Data(r).Insert()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/player/model"
|
||||
"time"
|
||||
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type GoldService struct {
|
||||
@@ -24,7 +26,7 @@ func (s *GoldService) Cheak(allcount, pid, ptye uint32) bool {
|
||||
va = now.Day()
|
||||
|
||||
}
|
||||
ret, err := s.dbm_fix(s.Model).Where("year", now.Year()).Where("biz_id", pid).Wheref("consume ->> ?::integer = ?", ptye, va).Count()
|
||||
ret, err := s.dbm_fix(s.Model).WhereNotBetween("updateTime",gtime.Now().EndOfDay()).Where("year", now.Year()).Where("biz_id", pid).Wheref("consume ->> ?::integer = ?", ptye, va).Count()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user