Browse Source

购物金

master
huangjiajun 4 months ago
parent
commit
09567e7853
3 changed files with 52 additions and 1 deletions
  1. +1
    -1
      go.mod
  2. +2
    -0
      go.sum
  3. +49
    -0
      rule/service_award_dividend/return.go

+ 1
- 1
go.mod View File

@@ -7,7 +7,7 @@ go 1.15


require ( require (
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240815013805-e7235e2d4d7e
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240816012431-432a50e554e4
github.com/gin-gonic/gin v1.9.1 github.com/gin-gonic/gin v1.9.1
github.com/go-redis/redis v6.15.9+incompatible github.com/go-redis/redis v6.15.9+incompatible
github.com/gomodule/redigo v1.8.9 github.com/gomodule/redigo v1.8.9


+ 2
- 0
go.sum View File

@@ -6,6 +6,8 @@ code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240812063422-6380c88
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240812063422-6380c884a38b/go.mod h1:nT2x13YFgrS3tS1fDyUR6q/GNIK+hPw7bdzZXz99SM0= code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240812063422-6380c884a38b/go.mod h1:nT2x13YFgrS3tS1fDyUR6q/GNIK+hPw7bdzZXz99SM0=
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240815013805-e7235e2d4d7e h1:XkIx6T9yJi3pnaZ1MNeVei/VqUZxrL9tZP7PjkqBt/Q= code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240815013805-e7235e2d4d7e h1:XkIx6T9yJi3pnaZ1MNeVei/VqUZxrL9tZP7PjkqBt/Q=
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240815013805-e7235e2d4d7e/go.mod h1:nT2x13YFgrS3tS1fDyUR6q/GNIK+hPw7bdzZXz99SM0= code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240815013805-e7235e2d4d7e/go.mod h1:nT2x13YFgrS3tS1fDyUR6q/GNIK+hPw7bdzZXz99SM0=
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240816012431-432a50e554e4 h1:DOPRTEFY8bKmAk+soM5t/hdnEaMI+UCNATX5y64sy7Q=
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240816012431-432a50e554e4/go.mod h1:nT2x13YFgrS3tS1fDyUR6q/GNIK+hPw7bdzZXz99SM0=
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s= gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s=


+ 49
- 0
rule/service_award_dividend/return.go View File

@@ -3,6 +3,7 @@ package service_award_dividend
import ( import (
zhios_order_relate_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils" zhios_order_relate_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils"
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/implement" "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/implement"
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"
"sort" "sort"
"strings" "strings"
"time" "time"
@@ -76,3 +77,51 @@ func GetDate(now time.Time, day, types string) int64 {
date = time.Date(year, month, zhios_order_relate_utils.StrToInt(day), 0, 0, 0, 0, now.Location()).Unix() date = time.Date(year, month, zhios_order_relate_utils.StrToInt(day), 0, 0, 0, 0, now.Location()).Unix()
return date return date
} }

func AddPeriod(eg *xorm.Engine, sess *xorm.Session, req map[string]string) int {
NewServiceAwardReturnBaseDb := implement.NewServiceAwardReturnBaseDb(eg)
base, _ := NewServiceAwardReturnBaseDb.GetServiceAwardReturnBase()
if base == nil {
return 2
}
if base.CoinId != zhios_order_relate_utils.StrToInt(req["coin_id"]) {
return 2
}
period := 0
switch req["pvd"] {
case "0":
period = base.CpsPeriod
break
case "1":
period = base.MallPeriod
break
case "2":
period = base.MemberUplvPeriod
break
case "3":
period = base.NewMemberPeriod
break
}
if period == 0 {
return 2
}
date := GetCycle(eg)
data := models.ServiceAwardReturnFlow{
Uid: zhios_order_relate_utils.StrToInt(req["uid"]),
Time: time.Now(),
UpdateTime: time.Now(),
Sum: req["amount"],
HasReturnMoney: "0",
Period: period,
EveryMoney: zhios_order_relate_utils.Float64ToStr(float64(int(zhios_order_relate_utils.StrToFloat64(req["amount"])/float64(period)*100)) / 100),
Pvd: zhios_order_relate_utils.StrToInt(req["pvd"]),
CoinId: base.CoinId,
Date: zhios_order_relate_utils.StrToInt(date["now"]),
Oid: zhios_order_relate_utils.StrToInt64(req["oid"]),
}
insert, err := sess.Insert(&data)
if insert == 0 || err != nil {
return 3
}
return 1
}

Loading…
Cancel
Save