-
Notifications
You must be signed in to change notification settings - Fork 0
/
fields_ad.go
67 lines (59 loc) · 1.74 KB
/
fields_ad.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package ServiceAD2
import (
"database/sql/driver"
"encoding/json"
"errors"
"time"
)
//FieldsAD 广告设置
type FieldsAD struct {
//ID
ID int64 `db:"id" json:"id"`
//创建时间
CreateAt time.Time `db:"create_at" json:"createAt"`
//更新时间
UpdateAt time.Time `db:"update_at" json:"updateAt"`
//组织ID
OrgID int64 `db:"org_id" json:"orgID"`
//分区标识码
// 同一个组织下唯一,具体行为交给mode识别和前端处理
Mark string `db:"mark" json:"mark"`
//结构
Data FieldsADChildList `json:"data"`
}
type FieldsADChildList []FieldsADChild
// Value sql底层处理器
func (t FieldsADChildList) Value() (driver.Value, error) {
return json.Marshal(t)
}
func (t *FieldsADChildList) Scan(value interface{}) error {
b, ok := value.([]byte)
if !ok {
return errors.New("type assertion to []byte failed")
}
return json.Unmarshal(b, &t)
}
type FieldsADChild struct {
//广告模式
// none 展示类广告
// blog_content 跳转文章; mall_core_product 跳转商品; mall_core_sort 跳转商品分类; user_ticket 跳转用户票据及优惠券; user_sub 用户会员; finance_user_deposit 用户充值
// weixin_wxx 微信小程序广告
Mode string `db:"mode" json:"mode" check:"mark"`
//绑定ID
BindID int64 `db:"bind_id" json:"bindID" check:"id" empty:"true"`
//用于一些第三方识别系统
BindMark string `db:"bind_mark" json:"bindMark"`
//封面
CoverFileID int64 `db:"cover_file_id" json:"coverFileID" check:"id"`
}
// Value sql底层处理器
func (t FieldsADChild) Value() (driver.Value, error) {
return json.Marshal(t)
}
func (t *FieldsADChild) Scan(value interface{}) error {
b, ok := value.([]byte)
if !ok {
return errors.New("type assertion to []byte failed")
}
return json.Unmarshal(b, &t)
}