作者 yangfu

fix orm models

... ... @@ -2,7 +2,6 @@ package main
import (
"github.com/astaxie/beego"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/event"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
_ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
_ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg"
... ... @@ -21,7 +20,7 @@ func main() {
//ginsvr.Run()
//注册事件
event.InitEventCenter()
//event.InitEventCenter()
beego.Run()
}
... ...
... ... @@ -59,6 +59,10 @@ type OrderBase struct {
BonusStatus int8
//货物列表
OrderGood []*OrderGood
// 数据来源
DataFrom *OrderDataFrom
// 备注
Remark string
}
func (m *OrderBase) Identify() interface{} {
... ...
package domain
const (
OrderDataFromBestShop string = "bestshop"
)
//OrderDataFrom 订单数据来源
type OrderDataFrom struct {
Platform string `json:"platform"` //订单数据来源平台
DataId int64 `json:"dataId"` //订单数据id标识
}
... ...
... ... @@ -36,6 +36,10 @@ type OrderGood struct {
BonusStatus int
//备注信息
Remark string
// 数据来源
DataFrom *OrderDataFrom
// 备注原因
RemarkReason string
}
func (g *OrderGood) Status() GoodStatus {
... ...
... ... @@ -60,4 +60,8 @@ type OrderBase struct {
BonusStatus int8
//货物列表
OrderGood []*OrderGood `pg:"fk:order_id"`
// 数据来源
DataFrom *domain.OrderDataFrom
// 备注
Remark string
}
... ...
package models
import "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
//OrderGood 订单中的货品
type OrderGood struct {
tableName struct{} `pg:"order_good"`
... ... @@ -37,4 +39,8 @@ type OrderGood struct {
BonusStatus int
//备注信息
Remark string
// 数据来源
DataFrom *domain.OrderDataFrom
// 备注原因
RemarkReason string
}
... ...
... ... @@ -2,10 +2,8 @@ package middleware
import (
"github.com/astaxie/beego/context"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/userAuth"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol"
"strconv"
"strings"
)
... ... @@ -40,15 +38,15 @@ func CheckJWTToken(ctx *context.Context) {
ctx.Input.SetData("UserId", u.UserId)
// valid token
userPhone, _ := strconv.Atoi(u.Phone)
tokenAuth := userAuth.NewRedisUserAuth(userAuth.WithUserId(int64(userPhone)))
err := tokenAuth.Check(
userAuth.NewOptions(userAuth.WithAccessToken(token)),
)
if err != nil {
msg = protocol.NewMesage(4141)
return
}
//userPhone, _ := strconv.Atoi(u.Phone)
//tokenAuth := userAuth.NewRedisUserAuth(userAuth.WithUserId(int64(userPhone)))
//err := tokenAuth.Check(
// userAuth.NewOptions(userAuth.WithAccessToken(token)),
//)
//if err != nil {
// msg = protocol.NewMesage(4141)
// return
//}
}
return
}
... ...