dengbiao hace 4 meses
padre
commit
833dc40101
Se han modificado 8 ficheros con 85 adiciones y 4 borrados
  1. +2
    -2
      go.mod
  2. +7
    -1
      go.sum
  3. +1
    -0
      md/mq.go
  4. +2
    -0
      rule/installment_payment/installment_payment.go
  5. +15
    -1
      rule/installment_payment/installment_payment_auto_repaid.go
  6. +2
    -0
      rule/installment_payment/md/installment_payment_list.go
  7. +18
    -0
      rule/installment_payment/md/mq.go
  8. +38
    -0
      utils/uuid.go

+ 2
- 2
go.mod Ver fichero

@@ -6,8 +6,8 @@ go 1.15
//replace code.fnuoos.com/go_rely_warehouse/zyos_model.git => E:/company/go_rely_warehouse/zyos_model/

require (
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.3
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240618104112-42ff22d419df
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.20240620100400-9ebf54e21441
github.com/gin-gonic/gin v1.9.1
github.com/go-redis/redis v6.15.9+incompatible
github.com/gomodule/redigo v1.8.9


+ 7
- 1
go.sum Ver fichero

@@ -2,8 +2,14 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.3 h1:SPp5AswPmkDO2ML6WwGlzhIuls+/1dUfU40iOeH0dh4=
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.3/go.mod h1:TTcCnFn/LhBGapnutpezlW+GXkLRNPMWkziOoCsXQqY=
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.3/go.mod h1:C8Cnjh+TKbSqhsbENGgVg17byUhsn6+SsSAEww0eBak=
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 h1:dqvWJqlJi0WXCwTxbWPLvSOsKPjP+iEDBVgLcAl9nOE=
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5/go.mod h1:TTcCnFn/LhBGapnutpezlW+GXkLRNPMWkziOoCsXQqY=
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240618104112-42ff22d419df h1:2rSTK/V4sEJWa1Rf+sc0nWixTbRThGsQs60cozAfU/w=
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240618104112-42ff22d419df/go.mod h1:ssMD5Wh5IRmd06P4DSIWtKWwlfAIjfLSkK0Xp9ZyE00=
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240619111913-4540786aa565 h1:KLbCiwdd/STDY8MTV2Gaqayrzi9Ai43pZe8LfF3UUa8=
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240619111913-4540786aa565/go.mod h1:ssMD5Wh5IRmd06P4DSIWtKWwlfAIjfLSkK0Xp9ZyE00=
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240620100400-9ebf54e21441 h1:hM0Yq0l3kc+qmdqq147yelawWBTOkR75D85H5O0iyik=
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240620100400-9ebf54e21441/go.mod h1:ssMD5Wh5IRmd06P4DSIWtKWwlfAIjfLSkK0Xp9ZyE00=
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s=


+ 1
- 0
md/mq.go Ver fichero

@@ -8,6 +8,7 @@ const (
OneCirclesRoutKeyForAutoExchangeGreenEnergyToPerson = "auto_exchange_green_energy_to_person_1" // 自动兑换个人绿色能量
OneCirclesRoutKeyForAutoExchangeGreenEnergyToTeam = "auto_exchange_green_energy_to_team" // 自动兑换团队绿色能量
OneCirclesRoutKeyForSettlementPublicGiveActivityCoin = "settlement_public_give_activity_coin" // 计算观看激励视屏得到活跃积分

)

type OneCirclesStructForSignIn struct {


+ 2
- 0
rule/installment_payment/installment_payment.go Ver fichero

@@ -42,6 +42,8 @@ func AddInstallmentPaymentList(engine *xorm.Engine, masterId string, args md.Add
GoodsId: args.GoodsId,
OrdId: args.OrdId,
TotalAmount: args.TotalAmount,
GoodsTitle: args.GoodsTitle,
GoodsImg: args.GoodsImg,
InstallmentNums: scheme.InstallmentNums,
AlreadyRepaidInstallmentNums: 0,
RepaymentAmountPerInstallment: repaymentAmountPerInstallment,


+ 15
- 1
rule/installment_payment/installment_payment_auto_repaid.go Ver fichero

@@ -68,7 +68,7 @@ func InstallmentPaymentAutoRepaid(engine *xorm.Engine, masterId string, ch *rabb
}

// DealInstallmentPaymentAutoRepaid 处理分期付自动还款
func DealInstallmentPaymentAutoRepaid(engine *xorm.Engine, args md.InstallmentPaymentStructForAutoRepaid, masterId string) (err error) {
func DealInstallmentPaymentAutoRepaid(engine *xorm.Engine, ch *rabbit.Channel, args md.InstallmentPaymentStructForAutoRepaid, masterId string) (err error) {
now := time.Now()
session := engine.NewSession()
defer func() {
@@ -109,6 +109,7 @@ func DealInstallmentPaymentAutoRepaid(engine *xorm.Engine, args md.InstallmentPa
}

//3、新增`installment_payment_repaid_flow`数据
oid := zhios_order_relate_utils.OrderUUID(installmentPaymentList.Uid)
installmentPaymentRepaidFlowDb := implement.NewInstallmentPaymentRepaidFlowDb(engine)
_, err = installmentPaymentRepaidFlowDb.InsertInstallmentPaymentRepaidFlowBySession(session, &models.InstallmentPaymentRepaidFlow{
RecordId: installmentPaymentList.Id,
@@ -117,6 +118,7 @@ func DealInstallmentPaymentAutoRepaid(engine *xorm.Engine, args md.InstallmentPa
WhichRepaymentPeriod: installmentPaymentList.AlreadyRepaidInstallmentNums,
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
OrdId: zhios_order_relate_utils.StrToInt64(oid),
})
if err != nil {
session.Rollback()
@@ -138,5 +140,17 @@ func DealInstallmentPaymentAutoRepaid(engine *xorm.Engine, args md.InstallmentPa
session.Rollback()
return err
}
rewardData := md.ZhiosTaskReward{
Uid: zhios_order_relate_utils.IntToStr(installmentPaymentList.Uid),
Mid: masterId,
Reward: zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(installmentPaymentList.Commission)),
Title: "分期付自动还款",
Oid: oid,
Provider: "installment_payment",
}
err1 := ch.PublishV2(md.RelateReward, zhios_order_relate_utils.SerializeStr(rewardData), md.RelateRewardData)
if err1 != nil {
ch.PublishV2(md.RelateReward, zhios_order_relate_utils.SerializeStr(rewardData), md.RelateRewardData)
}
return
}

+ 2
- 0
rule/installment_payment/md/installment_payment_list.go Ver fichero

@@ -7,6 +7,8 @@ type AddInstallmentPaymentListStruct struct {
OrdId int64 `json:"ord_id"`
TotalAmount string `json:"total_amount"` //总金额
SchemeId int `json:"scheme_id"` //分期方案Id
GoodsTitle string `json:"goods_title"`
GoodsImg string `json:"goods_img"`
}

type InstallmentPaymentManualRepaid struct {


+ 18
- 0
rule/installment_payment/md/mq.go Ver fichero

@@ -4,6 +4,8 @@ const InstallmentPaymentExchange = "installment.payment"

const (
InstallmentPaymentRoutKeyForAutoRepaid = "auto_repaid" // 自动还款
RelateReward = "zhios.relate_reward.exchange"
RelateRewardData = "relate_reward"
)

type InstallmentPaymentStructForAutoRepaid struct {
@@ -18,3 +20,19 @@ type InstallmentPaymentStructForAutoRepaid struct {
RepaymentAmountPerInstallment string `json:"repayment_amount_per_installment"`
IsRepaidOff int `json:"is_repaid_off"`
}

type ZhiosTaskReward struct {
CoinId string `json:"coin_id"` //
Money string `json:"money"`
Uid string `json:"uid"`
Mid string `json:"mid"`
Reward string `json:"reward"`
CoinIdType string `json:"coin_id_type"`
Mode string `json:"mode"`
Title string `json:"title"`
DeviceModel string `json:"device_model"`
Oid string `json:"oid"`
RewardType string `json:"reward_type"`
PlanType string `json:"plan_type"`
Provider string `json:"provider"`
}

+ 38
- 0
utils/uuid.go Ver fichero

@@ -0,0 +1,38 @@
package zhios_order_relate_utils

import (
"math/rand"
"time"
)

const (
KC_RAND_KIND_NUM = 0 // 纯数字
KC_RAND_KIND_LOWER = 1 // 小写字母
KC_RAND_KIND_UPPER = 2 // 大写字母
KC_RAND_KIND_ALL = 3 // 数字、大小写字母
)

// OrderUUID is only num for uuid
func OrderUUID(uid int) string {
ustr := IntToStr(uid)
tstr := Int64ToStr(time.Now().Unix())
ulen := len(ustr)
tlen := len(tstr)
rlen := 18 - ulen - tlen
krb := Krand(rlen, KC_RAND_KIND_NUM)
return ustr + tstr + string(krb)
}

func Krand(size int, kind int) []byte {
ikind, kinds, result := kind, [][]int{[]int{10, 48}, []int{26, 97}, []int{26, 65}}, make([]byte, size)
isAll := kind > 2 || kind < 0
rand.Seed(time.Now().UnixNano())
for i := 0; i < size; i++ {
if isAll { // random ikind
ikind = rand.Intn(3)
}
scope, base := kinds[ikind][0], kinds[ikind][1]
result[i] = uint8(base + rand.Intn(scope))
}
return result
}

Cargando…
Cancelar
Guardar