-
Notifications
You must be signed in to change notification settings - Fork 0
/
fields_transport.go
109 lines (101 loc) · 2.87 KB
/
fields_transport.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package TMSTransportMod
import (
"database/sql/driver"
"encoding/json"
"errors"
CoreSQLAddress "github.com/fotomxq/weeekj_core/v5/core/sql/address"
CoreSQLConfig "github.com/fotomxq/weeekj_core/v5/core/sql/config"
"github.com/lib/pq"
"time"
)
// FieldsTransport 配送
type FieldsTransport struct {
//ID
ID int64 `db:"id" json:"id"`
//创建时间
CreateAt time.Time `db:"create_at" json:"createAt"`
//更新时间
UpdateAt time.Time `db:"update_at" json:"updateAt"`
//删除时间
DeleteAt time.Time `db:"delete_at" json:"deleteAt"`
//完成时间
FinishAt time.Time `db:"finish_at" json:"finishAt"`
//组织ID
OrgID int64 `db:"org_id" json:"orgID"`
//当前配送人员
// 组织成员ID
BindID int64 `db:"bind_id" json:"bindID"`
//客户档案ID
InfoID int64 `db:"info_id" json:"infoID"`
//客户用户ID
UserID int64 `db:"user_id" json:"userID"`
//编号
// 商户下唯一
SN int64 `db:"sn" json:"sn"`
//今日编号
SNDay int64 `db:"sn_day" json:"snDay"`
//配送状态
// 0 等待分配人员; 1 取货中; 2 送货中; 3 完成配送
Status int `db:"status" json:"status"`
//取货地址
FromAddress CoreSQLAddress.FieldsAddress `db:"from_address" json:"fromAddress"`
//收货地址
ToAddress CoreSQLAddress.FieldsAddress `db:"to_address" json:"toAddress"`
//订单ID
OrderID int64 `db:"order_id" json:"orderID"`
//货物ID
Goods FieldsTransportGoods `db:"goods" json:"goods"`
//快递总重量
Weight int `db:"weight" json:"weight"`
//长宽
Length int `db:"length" json:"length"`
Width int `db:"width" json:"width"`
//货币
Currency int `db:"currency" json:"currency"`
//配送费用
Price int64 `db:"price" json:"price"`
//完成缴费时间
PayFinishAt time.Time `db:"pay_finish_at" json:"payFinishAt"`
//缴费交易ID
PayID int64 `db:"pay_id" json:"payID"`
//历史支付请求
PayIDs pq.Int64Array `db:"pay_ids" json:"payIDs" check:"ids" empty:"true"`
//扩展参数
Params CoreSQLConfig.FieldsConfigsType `db:"params" json:"params"`
}
// FieldsTransportGood 货物
type FieldsTransportGood struct {
//来源系统
System string `json:"system"`
//来源ID
ID int64 `json:"id"`
//标识码
Mark string `json:"mark"`
//名称
Name string `json:"name"`
//数量
Count int `json:"count"`
}
// Value sql底层处理器
func (t FieldsTransportGood) Value() (driver.Value, error) {
return json.Marshal(t)
}
func (t *FieldsTransportGood) Scan(value interface{}) error {
b, ok := value.([]byte)
if !ok {
return errors.New("type assertion to []byte failed")
}
return json.Unmarshal(b, &t)
}
type FieldsTransportGoods []FieldsTransportGood
// Value sql底层处理器
func (t FieldsTransportGoods) Value() (driver.Value, error) {
return json.Marshal(t)
}
func (t *FieldsTransportGoods) Scan(value interface{}) error {
b, ok := value.([]byte)
if !ok {
return errors.New("type assertion to []byte failed")
}
return json.Unmarshal(b, &t)
}