Merge branch 'jng'
This commit is contained in:
commit
55a5ba3152
@ -68,6 +68,7 @@ func CreateOrderRecord(req *bundle.OrderCreateRecord) (res *bundle.CommonRespons
|
||||
ExpirationTime: req.ExpirationTime,
|
||||
Language: req.Language,
|
||||
BundleOrderValueAdd: addRecords,
|
||||
PlatformIds: req.PlatformIds,
|
||||
}
|
||||
res, err = dao.CreateOrderRecord(orderRecord)
|
||||
return
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@ -42,6 +44,7 @@ type BundleOrderRecords struct {
|
||||
Language string `gorm:"column:language;comment:语言" json:"language"`
|
||||
BundleOrderValueAdd []BundleOrderValueAdd `gorm:"foreignKey:OrderUUID;references:UUID" json:"bundleOrderValueAdd"`
|
||||
ReSignature int `json:"reSignature" gorm:"column:re_signature;default:2;type:int;comment:是否重新签 1:是 2:否"`
|
||||
PlatformIds PlatformIDs `gorm:"column:platform_ids;type:json;NOT NULL;comment:发布平台ID集合 TIKTOK= 1, YOUTUBE = 2, INS = 3 , DM = 4, BL = 5;" json:"platformIDs"`
|
||||
}
|
||||
type BundleOrderValueAdd struct {
|
||||
gorm.Model
|
||||
@ -73,6 +76,30 @@ type BundleOrderValueAdd struct {
|
||||
QuotaValue int32 `json:"quotaValue" gorm:"column:quota_value;type:int;comment:额度值"`
|
||||
IsExpired bool `json:"isExpired" gorm:"column:is_expired;default:false;comment:是否过期作废 false:不作废 true:作废"`
|
||||
}
|
||||
type PlatformIDs []uint32
|
||||
|
||||
// 实现 Scanner 接口
|
||||
func (p *PlatformIDs) Scan(value interface{}) error {
|
||||
if value == nil {
|
||||
*p = []uint32{}
|
||||
return nil
|
||||
}
|
||||
|
||||
bytes, ok := value.([]byte)
|
||||
if !ok {
|
||||
return errors.New("type assertion to []byte failed")
|
||||
}
|
||||
|
||||
return json.Unmarshal(bytes, p)
|
||||
}
|
||||
|
||||
// 实现 Valuer 接口
|
||||
func (p PlatformIDs) Value() (driver.Value, error) {
|
||||
if len(p) == 0 {
|
||||
return "[]", nil
|
||||
}
|
||||
return json.Marshal(p)
|
||||
}
|
||||
|
||||
// 财务确认状态
|
||||
const (
|
||||
|
||||
@ -217,6 +217,7 @@ message OrderCreateRecord{
|
||||
int32 payType = 19 [json_name = "payType"];
|
||||
repeated OrderCreateAddRecord addRecords = 20 [json_name = "addRecords"]; //增值服务
|
||||
string orderNo = 21 [json_name = "orderNo"];
|
||||
repeated uint32 platformIds = 22; // 发布平台ID集合 (json 格式字符串)
|
||||
}
|
||||
message OrderCreateAddRecord{
|
||||
int32 serviceType = 1 [json_name = "serviceType"];
|
||||
|
||||
11185
pb/bundle/bundle.pb.go
11185
pb/bundle/bundle.pb.go
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-triple v1.0.8
|
||||
// - protoc v3.21.1
|
||||
// - protoc-gen-go-triple v1.0.5
|
||||
// - protoc v6.32.0
|
||||
// source: pb/bundle.proto
|
||||
|
||||
package bundle
|
||||
|
||||
@ -63,7 +63,11 @@ func loadMysqlConn(conn string) *gorm.DB {
|
||||
&model.BundleActivate{},
|
||||
&model.BundleBalanceLayout{},
|
||||
)
|
||||
|
||||
if db.Migrator().HasColumn(&model.BundleOrderRecords{}, "platform_ids") == false {
|
||||
if err := db.Migrator().AddColumn(&model.BundleOrderRecords{}, "platform_ids"); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
// return nil
|
||||
panic(err)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user