完成序列化

This commit is contained in:
eson 2023-06-16 18:52:24 +08:00
parent 169c167d4a
commit 8679ba1ba3
164 changed files with 2253 additions and 663 deletions

39
generator/gen_test.go Normal file
View File

@ -0,0 +1,39 @@
package main
import (
"fmt"
"regexp"
"testing"
)
func TestA(t *testing.T) {
main3()
}
func main3() {
ddl := `CREATE TABLE fs_guest (
guest_id bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
auth_key varchar(512) NOT NULL DEFAULT '' COMMENT 'jwt token',
status tinyint(3) unsigned DEFAULT '1' COMMENT '1正常 0不正常',
is_del tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除 1删除',
created_at int(11) NOT NULL DEFAULT '0' COMMENT '添加时间',
updated_at int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
is_open_render tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否打开个性化渲染1开启0关闭',
is_thousand_face tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已经存在千人千面1存在0不存在',
is_low_rendering tinyint(1) unsigned zerofill NOT NULL DEFAULT '0' COMMENT '是否开启低渲染模型渲染',
is_remove_bg tinyint(1) NOT NULL DEFAULT '1' COMMENT '用户上传logo是否去除背景',
guid decimal(10,2) NOT NULL,
PRIMARY KEY (guest_id) USING BTREE,
UNIQUE KEY fs_guest_guid_IDX (guid) USING BTREE,
KEY fs_guest_is_del_IDX (is_del) USING BTREE,
KEY fs_guest_status_IDX (status) USING BTREE,
KEY fs_guest_created_at_IDX (created_at) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='游客表'`
// 正则表达式匹配
r, _ := regexp.Compile(`CREATE TABLE (\S+) \..*COMMENT='(.*)'`)
matches := r.FindStringSubmatch(ddl)
// 输出结果
fmt.Println("表名:", matches[1])
fmt.Println("注释:", matches[2])
}

View File

@ -0,0 +1,12 @@
package main
import (
"testing"
_ "github.com/go-sql-driver/mysql"
)
func TestXMain(t *testing.T) {
// Now you can use the generated GORM model to interact with the database
}

View File

@ -1,23 +1,24 @@
package main
import (
"database/sql"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
"regexp"
"strconv"
"strings"
"github.com/zeromicro/ddl-parser/parser"
"golang.org/x/text/cases"
"golang.org/x/text/language"
_ "github.com/go-sql-driver/mysql"
)
var ddlDir = "ddl"
var genDir = "model/gmodel_gen"
var testName = "fs_auth_item"
var testGenDir = "model/gmodel_gen"
func toPascalCase(s string) string {
words := strings.Split(s, "_")
@ -27,257 +28,371 @@ func toPascalCase(s string) string {
return strings.Join(words, "")
}
func main() {
var name string // 需要序列化的单独文件名
var gdir string // 需要修改的序列化路径 model
var ddir string // 需要修改的序列化路径 ddl
flag.StringVar(&name, "name", "", "输入需要序列化的ddl文件名, 不需要后缀.ddl")
flag.StringVar(&gdir, "mdir", "", "输入需要生成model的Go文件所在目录")
flag.StringVar(&ddir, "ddir", "", "输入需要生成ddl的Go文件所在目录")
flag.Parse()
func GetAllTableNames(uri string) []string {
db, err := sql.Open("mysql", uri)
if err != nil {
panic(err)
}
defer db.Close()
if gdir != "" {
genDir = gdir
rows, err := db.Query("SHOW TABLES")
if err != nil {
panic(err)
}
if ddir != "" {
ddlDir = ddir
}
if name != "" {
name = fmt.Sprintf("%s/%s.sql", ddlDir, name)
GenFromPath(name)
} else {
matches, err := filepath.Glob(fmt.Sprintf("%s/*.sql", ddlDir))
if err != nil {
var tableNames []string
for rows.Next() {
var tableName string
if err := rows.Scan(&tableName); err != nil {
panic(err)
}
for _, pth := range matches {
GenFromPath(pth)
}
tableNames = append(tableNames, tableName)
}
return tableNames
}
func GenFromPath(pth string) {
p, err := filepath.Abs(pth)
// "fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest"
func GetColsFromTable(tname string, db *sql.DB) (result []Column, tableName, tableComment string) {
var a, ddl string
err := db.QueryRow("SHOW CREATE TABLE "+tname).Scan(&a, &ddl)
// log.Println(ddl)
if err != nil {
panic(err)
}
ddlfilestr, err := ioutil.ReadFile(pth)
return ParserDDL(ddl)
}
func main() {
var mysqluri string
var name string // 需要序列化的单独文件名
var mdir string // 需要修改的序列化路径 model
flag.StringVar(&mysqluri, "uri", "fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest", "输入需要序列化的ddl文件名, 不需要后缀.ddl")
flag.StringVar(&name, "name", "", "输入需要序列化的ddl文件名, 不需要后缀.ddl")
flag.StringVar(&mdir, "mdir", "", "输入需要生成model的Go文件所在目录")
flag.Parse()
if mdir != "" {
testGenDir = mdir
}
db, err := sql.Open("mysql", mysqluri)
if err != nil {
panic(err)
}
// PRIMARY KEY (`guest_id`) USING BTREE
re := regexp.MustCompile("PRIMARY\\s+KEY\\s+\\(\\s*`([^`]+)`\\s*\\)|`([^`]+)` [^\n]+PRIMARY\\s+KEY\\s+")
defer db.Close()
matches := re.FindStringSubmatch(string(ddlfilestr))
PrimaryStr := ""
if len(matches) > 0 {
PrimaryStr = matches[1]
if name == "-" {
tablenames := GetAllTableNames(mysqluri)
for _, testName := range tablenames {
cols, tname, tcomment := GetColsFromTable(testName, db)
GenFromPath(testGenDir, cols, tname, tcomment)
}
} else {
if name != "" {
testName = name
}
// log.Println(testName)
cols, tname, tcomment := GetColsFromTable(testName, db)
GenFromPath(testGenDir, cols, tname, tcomment)
}
// tablenames := GetAllTableNames(mysqluri)
// log.Println(tablenames)
// name
}
func GenFromPath(mdir string, cols []Column, tableName string, tableComment string) {
var importstr = "import (\"gorm.io/gorm\"\n"
// 匹配到主键定义
parser.NewParser()
result, err := parser.NewParser().From(p)
fcontent := "package model\n"
structstr := "// %s %s\ntype %s struct {%s\n}\n"
pTableName := toPascalCase(tableName)
fieldstr := ""
for _, col := range cols {
fieldName := toPascalCase(col.Name)
typeName := typeForMysqlToGo[col.GetType()]
var defaultString string
if col.DefaultValue != nil {
defaultString = "default:" + *col.DefaultValue + ";"
} else {
switch typeName {
case "*string":
defaultString = "default:'';"
case "*time.Time":
defaultString = "default:'0000-00-00 00:00:00';"
case "*[]byte":
defaultString = "default:'';"
case "*int64", "*uint64":
defaultString = "default:'0';"
case "*float64":
defaultString = "default:'0.0';"
case "*bool":
defaultString = "default:'0';"
default:
fieldName = "// " + fieldName + " " + col.Type
}
}
if typeName == "*time.Time" {
importstr += "\"time\"\n"
}
if col.IndexType == "primary_key" {
typeName = typeName[1:]
}
tagstr := "`gorm:"
gormTag := ""
if col.IndexType != "" {
gormTag += col.IndexType + ";"
}
gormTag += defaultString
// if col.DefaultValue == "" {
// log.Panic(col, "需要默认值")
// }
tagstr += fmt.Sprintf("\"%s\"", gormTag)
tagstr += fmt.Sprintf(" json:\"%s\"`", col.Name)
fieldColStr := fmt.Sprintf("\n%s %s %s// %s", fieldName, typeName, tagstr, col.Comment)
fieldstr += fieldColStr
}
fcontent += importstr + ")\n"
fcontent += fmt.Sprintf(structstr, tableName, tableComment, pTableName, fieldstr)
modelstr := fmt.Sprintf(`type %sModel struct {db *gorm.DB}`, pTableName)
fcontent += modelstr
fcontent += "\n"
newfuncstr := fmt.Sprintf(`func New%sModel(db *gorm.DB) *%sModel {return &%sModel{db}}`, pTableName, pTableName, pTableName)
fcontent += newfuncstr
fcontent += "\n"
genGoFileName := fmt.Sprintf("%s/%s_gen.go", mdir, tableName)
f, err := os.OpenFile(genGoFileName, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)
if err != nil {
panic(err)
}
fcontent := "package model\n"
for _, table := range result {
structstr := "type %s struct {%s\n}\n"
tableName := toPascalCase(table.Name)
fieldstr := ""
for _, col := range table.Columns {
fieldName := toPascalCase(col.Name)
typeName := SQLTypeToGoTypeMap[col.DataType.Type()]
if typeName == "*time.Time" {
importstr += "\"time\"\n"
}
tagstr := "`gorm:"
if col.Name == PrimaryStr {
tagstr += "\"primary_key\""
typeName = typeName[1:]
} else {
tagstr += "\"-\""
}
tagstr += fmt.Sprintf(" json:\"%s\"`", col.Name)
fieldColStr := fmt.Sprintf("\n%s %s %s// %s", fieldName, typeName, tagstr, col.Constraint.Comment)
fieldstr += fieldColStr
}
fcontent += importstr + ")\n"
fcontent += fmt.Sprintf(structstr, tableName, fieldstr)
modelstr := fmt.Sprintf(`type %sModel struct {db *gorm.DB}`, tableName)
fcontent += modelstr
fcontent += "\n"
newfuncstr := fmt.Sprintf(`func New%sModel(db *gorm.DB) *%sModel {return &%sModel{db}}`, tableName, tableName, tableName)
fcontent += newfuncstr
fcontent += "\n"
genGoFileName := fmt.Sprintf("%s/%s_gen.go", genDir, table.Name)
f, err := os.OpenFile(genGoFileName, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)
if err != nil {
panic(err)
}
f.WriteString(fcontent)
err = f.Close()
if err != nil {
panic(err)
}
err = exec.Command("gofmt", "-w", genGoFileName).Run()
if err != nil {
panic(err)
}
fcontent = "package model\n// TODO: 使用model的属性做你想做的"
genGoLogicFileName := fmt.Sprintf("%s/%s_logic.go", genDir, table.Name)
// 使用 os.Stat 函数获取文件信息
_, err = os.Stat(genGoLogicFileName)
// 判断文件是否存在并输出结果
if os.IsNotExist(err) {
f2, err := os.OpenFile(genGoLogicFileName, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)
if err != nil {
panic(err)
}
f2.WriteString(fcontent)
err = f2.Close()
if err != nil {
panic(err)
}
fmt.Println(genGoLogicFileName, "create!")
} else {
fmt.Println(genGoLogicFileName, "exists")
}
f.WriteString(fcontent)
err = f.Close()
if err != nil {
panic(err)
}
err = exec.Command("gofmt", "-w", genGoFileName).Run()
if err != nil {
panic(err)
}
fcontent = "package model\n// TODO: 使用model的属性做你想做的"
genGoLogicFileName := fmt.Sprintf("%s/%s_logic.go", mdir, tableName)
// 使用 os.Stat 函数获取文件信息
_, err = os.Stat(genGoLogicFileName)
// 判断文件是否存在并输出结果
if os.IsNotExist(err) {
f2, err := os.OpenFile(genGoLogicFileName, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)
if err != nil {
panic(err)
}
f2.WriteString(fcontent)
err = f2.Close()
if err != nil {
panic(err)
}
fmt.Println(genGoLogicFileName, "create!")
} else {
fmt.Println(genGoLogicFileName, "exists")
}
}
const (
_ int = iota
LongVarBinary
LongVarChar
GeometryCollection
GeomCollection
LineString
MultiLineString
MultiPoint
MultiPolygon
Point
Polygon
Json
Geometry
Enum
Set
Bit
Time
Timestamp
DateTime
Binary
VarBinary
Blob
Year
Decimal
Dec
Fixed
Numeric
Float
Float4
Float8
Double
Real
TinyInt
SmallInt
MediumInt
Int
Integer
BigInt
MiddleInt
Int1
Int2
Int3
Int4
Int8
Date
TinyBlob
MediumBlob
LongBlob
Bool
Boolean
Serial
NVarChar
NChar
Char
Character
VarChar
TinyText
Text
MediumText
LongText
)
type Column struct {
Name string
Type string
DefaultValue *string
Length int
Decimal int
Unsigned bool
NotNull bool
AutoIncrement bool
Comment string
var SQLTypeToGoTypeMap = map[int]string{
LongVarBinary: "[]byte",
Binary: "[]byte",
VarBinary: "[]byte",
Blob: "[]byte",
TinyBlob: "[]byte",
MediumBlob: "[]byte",
LongBlob: "[]byte",
LongVarChar: "*string",
NVarChar: "*string",
NChar: "*string",
Char: "*string",
Character: "*string",
VarChar: "*string",
TinyText: "*string",
Text: "*string",
MediumText: "*string",
LongText: "*string",
Time: "*time.Time",
Timestamp: "*time.Time",
DateTime: "*time.Time",
Date: "*time.Time",
Year: "*int64",
TinyInt: "*int64",
SmallInt: "*int64",
MediumInt: "*int64",
Int: "*int64",
Integer: "*int64",
BigInt: "*int64",
MiddleInt: "*int64",
Int1: "*int64",
Int2: "*int64",
Int3: "*int64",
Int4: "*int64",
Int8: "*int64",
Serial: "*int64",
Decimal: "*float64",
Dec: "*float64",
Fixed: "*float64",
Numeric: "*float64",
Float: "*float64",
Float4: "*float64",
Float8: "*float64",
Double: "*float64",
Real: "*float64",
Bool: "*bool",
Boolean: "*bool",
IndexType string
}
func (col *Column) GetType() string {
content := col.Type
if col.Unsigned {
return content + " unsigned"
}
return content
}
var typeForMysqlToGo = map[string]string{
// 整数
"int": "*int64",
"integer": "*int64",
"tinyint": "*int64",
"smallint": "*int64",
"mediumint": "*int64",
"bigint": "*int64",
"year": "*int64",
"int unsigned": "*uint64",
"integer unsigned": "*uint64",
"tinyint unsigned": "*uint64",
"smallint unsigned": "*uint64",
"mediumint unsigned": "*uint64",
"bigint unsigned": "*uint64",
"bit": "*uint64",
// 布尔类型
"bool": "*bool",
// 字符串
"enum": "*string",
"set": "*string",
"varchar": "*string",
"char": "*string",
"tinytext": "*string",
"mediumtext": "*string",
"text": "*string",
"longtext": "*string",
// 二进制
"binary": "*[]byte",
"varbinary": "*[]byte",
"blob": "*[]byte",
"tinyblob": "*[]byte",
"mediumblob": "*[]byte",
"longblob": "*[]byte",
// 日期时间
"date": "*time.Time",
"datetime": "*time.Time",
"timestamp": "*time.Time",
"time": "*time.Time",
// 浮点数
"float": "*float64",
"double": "*float64",
"decimal": "*float64",
}
func ParserDDL(ddl string) (result []Column, tableName, tableComment string) {
reTable := regexp.MustCompile(`CREATE TABLE +([^ ]+) +\(`)
reTableComment := regexp.MustCompile(`.+COMMENT='(.+)'$`)
reField := regexp.MustCompile("`([^`]+)` +([^ \n\\(\\,]+)(?:\\(([^)]+)\\))?( +unsigned| +UNSIGNED)?( +not +null| +NOT +NULL)?( +default +\\'[^\\']*'| +DEFAULT +\\'[^\\']*')?( +auto_increment| +AUTO_INCREMENT)?( comment '[^']*'| COMMENT '[^']*')?(,)?")
reIndex := regexp.MustCompile(`(?i)(PRIMARY|UNIQUE)?\s*(INDEX|KEY)\s*(` + "`([^`]*)`" + `)?\s*\(([^)]+)\)`)
reValue := regexp.MustCompile(` '(.+)'$`)
reDefaultValue := regexp.MustCompile(` ('.+')$`)
var fieldmap map[string]string = make(map[string]string)
indexMatches := reIndex.FindAllStringSubmatch(ddl, -1)
for _, m := range indexMatches {
idxAttr := strings.Trim(m[5], "`")
PrefixName := strings.ToUpper(m[1])
if PrefixName == "PRIMARY" {
fieldmap[idxAttr] = "primary_key"
} else if PrefixName == "UNIQUE" {
fieldmap[idxAttr] = "unique_key"
} else if PrefixName == "" {
fieldmap[idxAttr] = "index"
} else {
log.Fatal(PrefixName)
}
}
tableMatches := reTable.FindStringSubmatch(ddl)
tableName = strings.Trim(tableMatches[1], "`")
tableCommentMatches := reTableComment.FindStringSubmatch(ddl)
if len(tableCommentMatches) > 0 {
tableComment = strings.Trim(tableCommentMatches[1], "`")
}
// log.Println(tableName, tableComment)
fieldMatches := reField.FindAllStringSubmatch(ddl, -1)
for _, m := range fieldMatches {
if m[0] == "" {
continue
}
col := Column{
Name: m[1],
Type: strings.ToLower(m[2]),
}
col.IndexType = fieldmap[col.Name]
if m[3] != "" {
maylen := strings.Split(m[3], ",")
if len(maylen) >= 1 {
clen, err := strconv.ParseInt(maylen[0], 10, 64)
if err != nil {
panic(err)
}
col.Length = int(clen)
}
if len(maylen) >= 2 {
clen, err := strconv.ParseInt(maylen[1], 10, 64)
if err != nil {
panic(err)
}
col.Decimal = int(clen)
}
}
if len(m[4]) > 0 {
col.Unsigned = true
}
if len(m[5]) > 0 {
col.NotNull = true
}
if len(m[6]) > 0 {
v := reDefaultValue.FindStringSubmatch(m[6])
if len(v) > 0 {
dv := string(v[1])
col.DefaultValue = &dv
}
}
if len(m[7]) > 0 {
col.AutoIncrement = true
}
if len(m[8]) > 0 {
v := reValue.FindStringSubmatch(m[8])
if len(v) > 0 {
col.Comment = v[1]
}
}
result = append(result, col)
// fmt.Println(col)
}
return result, tableName, tableComment
}

View File

@ -6,8 +6,8 @@ import (
func TestMain(t *testing.T) {
// args := []string{"-name", "fs_guest"}
ddlDir = "../" + ddlDir
genDir = "../" + genDir
testGenDir = "../" + testGenDir
// os.Args = []string{"cmd", "-name=fs_guest"}
main()

View File

@ -6,10 +6,10 @@ import (
type FsCanteenType struct {
Id int64 `gorm:"primary_key" json:"id"` // ID
Name *string `gorm:"-" json:"name"` // 餐厅名字
Sort *int64 `gorm:"-" json:"sort"` // 排序
Status *int64 `gorm:"-" json:"status"` // 状态位 1启用0停用
Ctime *int64 `gorm:"-" json:"ctime"` // 添加时间
Name *string `gorm:"" json:"name"` // 餐厅名字
Sort *int64 `gorm:"" json:"sort"` // 排序
Status *int64 `gorm:"" json:"status"` // 状态位 1启用0停用
Ctime *int64 `gorm:"" json:"ctime"` // 添加时间
}
type FsCanteenTypeModel struct{ db *gorm.DB }

View File

@ -5,11 +5,11 @@ import (
)
type FsFont struct {
Id int64 `gorm:"primary_key" json:"id"` // id
Title *string `gorm:"-" json:"title"` // 字体名字
LinuxFontname *string `gorm:"-" json:"linux_fontname"` // linux对应字体名
FilePath *string `gorm:"-" json:"file_path"` // 字体文件路径
Sort *int64 `gorm:"-" json:"sort"` // 排序
Id int64 `gorm:"primary_key" json:"id"` // id
Title *string `gorm:"" json:"title"` // 字体名字
LinuxFontname *string `gorm:"" json:"linux_fontname"` // linux对应字体名
FilePath *string `gorm:"" json:"file_path"` // 字体文件路径
Sort *int64 `gorm:"" json:"sort"` // 排序
}
type FsFontModel struct{ db *gorm.DB }

View File

@ -5,21 +5,21 @@ import (
)
type FsPay struct {
Id int64 `gorm:"primary_key" json:"id"` //
UserId *int64 `gorm:"-" json:"user_id"` // 用户id
OrderNumber *string `gorm:"-" json:"order_number"` // 订单编号
TradeNo *string `gorm:"-" json:"trade_no"` // 第三方支付编号
PayAmount *int64 `gorm:"-" json:"pay_amount"` // 支付金额 (分)
PayStatus *int64 `gorm:"-" json:"pay_status"` // 支付状态 0 不成功 1 成功
IsRefund *int64 `gorm:"-" json:"is_refund"` // 是否退款 0 未退款 1退款
PaymentMethod *int64 `gorm:"-" json:"payment_method"` // 支付方式 1 stripe 2 paypal
PayStage *int64 `gorm:"-" json:"pay_stage"` // 支付阶段 1首付 2尾款
OrderSource *int64 `gorm:"-" json:"order_source"` // 订单来源 1pc
PayTime *int64 `gorm:"-" json:"pay_time"` // 支付时间
CreatedAt *int64 `gorm:"-" json:"created_at"` // 创建时间
UpdatedAt *int64 `gorm:"-" json:"updated_at"` // 更新时间
CardNo *string `gorm:"-" json:"card_no"` // 卡后4位
Brand *string `gorm:"-" json:"brand"` // 银行品牌
Id int64 `gorm:"primary_key" json:"id"` //
UserId *int64 `gorm:"" json:"user_id"` // 用户id
OrderNumber *string `gorm:"" json:"order_number"` // 订单编号
TradeNo *string `gorm:"" json:"trade_no"` // 第三方支付编号
PayAmount *int64 `gorm:"" json:"pay_amount"` // 支付金额 (分)
PayStatus *int64 `gorm:"" json:"pay_status"` // 支付状态 0 不成功 1 成功
IsRefund *int64 `gorm:"" json:"is_refund"` // 是否退款 0 未退款 1退款
PaymentMethod *int64 `gorm:"" json:"payment_method"` // 支付方式 1 stripe 2 paypal
PayStage *int64 `gorm:"" json:"pay_stage"` // 支付阶段 1首付 2尾款
OrderSource *int64 `gorm:"" json:"order_source"` // 订单来源 1pc
PayTime *int64 `gorm:"" json:"pay_time"` // 支付时间
CreatedAt *int64 `gorm:"" json:"created_at"` // 创建时间
UpdatedAt *int64 `gorm:"" json:"updated_at"` // 更新时间
CardNo *string `gorm:"" json:"card_no"` // 卡后4位
Brand *string `gorm:"" json:"brand"` // 银行品牌
}
type FsPayModel struct{ db *gorm.DB }

View File

@ -5,32 +5,32 @@ import (
)
type FsUser struct {
Id int64 `gorm:"primary_key" json:"id"` // ID
FaceId *int64 `gorm:"-" json:"face_id"` // facebook的userid
Sub *int64 `gorm:"-" json:"sub"` // google的sub
FirstName *string `gorm:"-" json:"first_name"` // FirstName
LastName *string `gorm:"-" json:"last_name"` // LastName
Username *string `gorm:"-" json:"username"` // 用户名
Company *string `gorm:"-" json:"company"` // 公司名称
Mobile *string `gorm:"-" json:"mobile"` // 手机号码
AuthKey *string `gorm:"-" json:"auth_key"` //
PasswordHash *string `gorm:"-" json:"password_hash"` //
VerificationToken *string `gorm:"-" json:"verification_token"` //
PasswordResetToken *string `gorm:"-" json:"password_reset_token"` //
Email *string `gorm:"-" json:"email"` // 邮箱
Type *int64 `gorm:"-" json:"type"` // 1普通餐厅 2连锁餐厅
Status *int64 `gorm:"-" json:"status"` // 1正常 0不正常
IsDel *int64 `gorm:"-" json:"is_del"` // 是否删除 1删除
CreatedAt *int64 `gorm:"-" json:"created_at"` // 添加时间
UpdatedAt *int64 `gorm:"-" json:"updated_at"` // 更新时间
IsOrderStatusEmail *int64 `gorm:"-" json:"is_order_status_email"` // 订单状态改变时是否接收邮件
IsEmailAdvertisement *int64 `gorm:"-" json:"is_email_advertisement"` // 是否接收邮件广告
IsOrderStatusPhone *int64 `gorm:"-" json:"is_order_status_phone"` // 订单状态改变是是否接收电话
IsPhoneAdvertisement *int64 `gorm:"-" json:"is_phone_advertisement"` // 是否接收短信广告
IsOpenRender *int64 `gorm:"-" json:"is_open_render"` // 是否打开个性化渲染1开启0关闭
IsThousandFace *int64 `gorm:"-" json:"is_thousand_face"` // 是否已经存在千人千面1存在0不存在
IsLowRendering *int64 `gorm:"-" json:"is_low_rendering"` // 是否开启低渲染模型渲染
IsRemoveBg *int64 `gorm:"-" json:"is_remove_bg"` // 用户上传logo是否去除背景
Id int64 `gorm:"primary_key" json:"id"` // ID
FaceId *int64 `gorm:"" json:"face_id"` // facebook的userid
Sub *int64 `gorm:"" json:"sub"` // google的sub
FirstName *string `gorm:"" json:"first_name"` // FirstName
LastName *string `gorm:"" json:"last_name"` // LastName
Username *string `gorm:"" json:"username"` // 用户名
Company *string `gorm:"" json:"company"` // 公司名称
Mobile *string `gorm:"" json:"mobile"` // 手机号码
AuthKey *string `gorm:"" json:"auth_key"` //
PasswordHash *string `gorm:"" json:"password_hash"` //
VerificationToken *string `gorm:"" json:"verification_token"` //
PasswordResetToken *string `gorm:"" json:"password_reset_token"` //
Email *string `gorm:"" json:"email"` // 邮箱
Type *int64 `gorm:"" json:"type"` // 1普通餐厅 2连锁餐厅
Status *int64 `gorm:"" json:"status"` // 1正常 0不正常
IsDel *int64 `gorm:"" json:"is_del"` // 是否删除 1删除
CreatedAt *int64 `gorm:"" json:"created_at"` // 添加时间
UpdatedAt *int64 `gorm:"" json:"updated_at"` // 更新时间
IsOrderStatusEmail *int64 `gorm:"" json:"is_order_status_email"` // 订单状态改变时是否接收邮件
IsEmailAdvertisement *int64 `gorm:"" json:"is_email_advertisement"` // 是否接收邮件广告
IsOrderStatusPhone *int64 `gorm:"" json:"is_order_status_phone"` // 订单状态改变是是否接收电话
IsPhoneAdvertisement *int64 `gorm:"" json:"is_phone_advertisement"` // 是否接收短信广告
IsOpenRender *int64 `gorm:"" json:"is_open_render"` // 是否打开个性化渲染1开启0关闭
IsThousandFace *int64 `gorm:"" json:"is_thousand_face"` // 是否已经存在千人千面1存在0不存在
IsLowRendering *int64 `gorm:"" json:"is_low_rendering"` // 是否开启低渲染模型渲染
IsRemoveBg *int64 `gorm:"" json:"is_remove_bg"` // 用户上传logo是否去除背景
}
type FsUserModel struct{ db *gorm.DB }

View File

@ -8,27 +8,27 @@ import (
type UserBasicInfoForSave struct {
ID uint `gorm:"primary_key" json:"id"`
FirstName string `gorm:"-" json:"first_name"`
LastName string `gorm:"-" json:"last_name"`
Mobile string `gorm:"-" json:"mobile"`
Company string `gorm:"-" json:"company"`
IsOrderStatusEmail int64 `gorm:"-" json:"is_order_status_email"`
IsEmailAdvertisement int64 `gorm:"-" json:"is_email_advertisement"`
IsOrderStatusPhone int64 `gorm:"-" json:"is_order_status_phone"`
IsPhoneAdvertisement int64 `gorm:"-" json:"is_phone_advertisement"`
Type int64 `gorm:"-" json:"type"`
IsOpenRender int64 `gorm:"-" json:"is_open_render"`
IsLowRendering int64 `gorm:"-" json:"is_low_rendering"`
IsRemoveBg int64 `gorm:"-" json:"is_remove_bg"`
FirstName string `gorm:"" json:"first_name"`
LastName string `gorm:"" json:"last_name"`
Mobile string `gorm:"" json:"mobile"`
Company string `gorm:"" json:"company"`
IsOrderStatusEmail int64 `gorm:"" json:"is_order_status_email"`
IsEmailAdvertisement int64 `gorm:"" json:"is_email_advertisement"`
IsOrderStatusPhone int64 `gorm:"" json:"is_order_status_phone"`
IsPhoneAdvertisement int64 `gorm:"" json:"is_phone_advertisement"`
Type int64 `gorm:"" json:"type"`
IsOpenRender int64 `gorm:"" json:"is_open_render"`
IsLowRendering int64 `gorm:"" json:"is_low_rendering"`
IsRemoveBg int64 `gorm:"" json:"is_remove_bg"`
}
func (u *FsUserModel) FindUserByEmail(ctx context.Context, emailname string) (resp FsUser, err error) {
err = u.db.WithContext(ctx).Model(&FsUser{}).Where("`email` = ?", emailname).First(&resp).Error
err = u.db.WithContext(ctx).Model(&FsUser{PasswordHash: new(string)}).Where("`email` = ?", emailname).Take(&resp).Error
return resp, err
}
func (u *FsUserModel) FindUserById(ctx context.Context, Id int64) (resp FsUser, err error) {
err = u.db.WithContext(ctx).Model(&FsUser{}).Where("`id` = ? and is_del = ?", Id, 0).First(&resp).Error
err = u.db.WithContext(ctx).Model(&FsUser{}).Where("`id` = ? and is_del = ?", Id, 0).Take(&resp).Error
return resp, err
}

View File

@ -32,7 +32,7 @@ func NewFsAddressModel(db *gorm.DB) *FsAddressModel {
return &FsAddressModel{db}
}
func (a *FsAddressModel) GetOne(ctx context.Context, id int64, userId int64) (resp FsAddress, err error) {
err = a.db.WithContext(ctx).Model(&FsAddress{}).Where("`id` = ? and `user_id` = ? and `status` = ? ", id, userId, 1).First(&resp).Error
err = a.db.WithContext(ctx).Model(&FsAddress{}).Where("`id` = ? and `user_id` = ? and `status` = ? ", id, userId, 1).Take(&resp).Error
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
return FsAddress{}, err
}

View File

@ -24,7 +24,7 @@ type FsCart struct {
Status *int64 `gorm:"default:1" json:"status"` // 状态位
OptionalId *int64 `gorm:"default:0" json:"optional_id"` // 选项ID
IsCheck *int64 `gorm:"default:0" json:"is_check"` // 是否选中状态0未选中1选中
TsTime *time.Time `gorm:"-" json:"ts_time"`
TsTime *time.Time `gorm:"" json:"ts_time"`
IsEmail *int64 `gorm:"default:0" json:"is_email"` // 是否发送邮件
}
type FsCartModel struct {
@ -46,7 +46,7 @@ type FindOneCartByParamsReq struct {
}
func (c *FsCartModel) FindOne(ctx context.Context, id int64) (resp FsCart, err error) {
err = c.db.WithContext(ctx).Model(&FsCart{}).Where("`id` = ?", id).First(&resp).Error
err = c.db.WithContext(ctx).Model(&FsCart{}).Where("`id` = ?", id).Take(&resp).Error
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
return FsCart{}, err
}
@ -75,7 +75,7 @@ func (c *FsCartModel) FindOneCartByParams(ctx context.Context, req FindOneCartBy
if req.Status != nil {
db = db.Where("`status` = ?", req.Status)
}
if err = db.First(&resp).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
if err = db.Take(&resp).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
return FsCart{}, err
}
return resp, nil

View File

@ -11,44 +11,41 @@ import (
type FsGuest struct {
GuestId int64 `gorm:"primary_key" json:"guest_id"` // 游客ID
AuthKey *string `gorm:"-" json:"auth_key"` // jwt token
Status *int64 `gorm:"-" json:"status"` // 1正常 0不正常
IsDel *int64 `gorm:"-" json:"is_del"` // 是否删除 1删除
CreatedAt *int64 `gorm:"-" json:"created_at"` // 添加时间
UpdatedAt *int64 `gorm:"-" json:"updated_at"` // 更新时间
IsOpenRender *int64 `gorm:"-" json:"is_open_render"` // 是否打开个性化渲染1开启0关闭
IsThousandFace *int64 `gorm:"-" json:"is_thousand_face"` // 是否已经存在千人千面1存在0不存在
IsLowRendering *int64 `gorm:"-" json:"is_low_rendering"` // 是否开启低渲染模型渲染
IsRemoveBg *int64 `gorm:"-" json:"is_remove_bg"` // 用户上传logo是否去除背景
AuthKey *string `gorm:"" json:"auth_key"` // jwt token
Status *int64 `gorm:"" json:"status"` // 1正常 0不正常
IsDel *int64 `gorm:"" json:"is_del"` // 是否删除 1删除
CreatedAt *int64 `gorm:"" json:"created_at"` // 添加时间
UpdatedAt *int64 `gorm:"" json:"updated_at"` // 更新时间
IsOpenRender *int64 `gorm:"" json:"is_open_render"` // 是否打开个性化渲染1开启0关闭
IsThousandFace *int64 `gorm:"" json:"is_thousand_face"` // 是否已经存在千人千面1存在0不存在
IsLowRendering *int64 `gorm:"" json:"is_low_rendering"` // 是否开启低渲染模型渲染
IsRemoveBg *int64 `gorm:"" json:"is_remove_bg"` // 用户上传logo是否去除背景
}
type FsGuestModel struct{ db *gorm.DB }
func NewFsGuestModel(db *gorm.DB) *FsGuestModel { return &FsGuestModel{db} }
func (m *FsGuestModel) GenerateGuestID(ctx context.Context, AccessSecret *string) (authKey string, err error) {
var record = &FsGuest{}
err = m.db.Create(record).Error
if err != nil {
logx.Error(err)
}
err = m.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
now := time.Now().Unix()
var record = &FsGuest{}
exp := now + 31536000
var record = &FsGuest{CreatedAt: &now, UpdatedAt: &exp, AuthKey: &authKey}
tx.Create(record)
authKey, err = auth.GenerateJwtToken(AccessSecret, now, 31536000, 0, record.GuestId)
if err != nil {
logx.Error(err)
err = tx.Rollback().Error
if err != nil {
logx.Error(err)
}
return err
}
record.AuthKey = &authKey
record.CreatedAt = &now
tx.Updates(record)
err = tx.Updates(record).Error
if err != nil {
logx.Error(err)
return err
}
return nil
})

View File

@ -41,7 +41,7 @@ type FsOrder struct {
IsDeleted *int64 `gorm:"default:0" json:"is_deleted"` // 是否删除01
RefundReasonId *int64 `gorm:"default:0" json:"refund_reason_id"` // 取消订单原因ID
RefundReason *string `gorm:"default:''" json:"refund_reason"` // 取消订单原因
TsTime *time.Time `gorm:"-" json:"ts_time"`
TsTime *time.Time `gorm:"" json:"ts_time"`
IsSure *int64 `gorm:"default:0" json:"is_sure"` // 是否确认订单 1确认0未确认
DeliverSn *string `gorm:"default:''" json:"deliver_sn"` // 发货单号
EmailTime *int64 `gorm:"default:0" json:"email_time"` // 邮件发送时间
@ -55,7 +55,7 @@ func NewFsOrderModel(db *gorm.DB) *FsOrderModel {
}
func (o *FsOrderModel) FindOneBySn(ctx context.Context, userId int64, sn string) (resp FsOrder, err error) {
err = o.db.WithContext(ctx).Model(&FsOrder{}).Where(" `user_id` = ? and `sn` = ? ", userId, sn).First(&resp).Error
err = o.db.WithContext(ctx).Model(&FsOrder{}).Where(" `user_id` = ? and `sn` = ? ", userId, sn).Take(&resp).Error
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
return FsOrder{}, err
}

View File

@ -19,7 +19,7 @@ type FsProductDesign struct {
OptionalId *int64 `gorm:"default:0" json:"optional_id"` // 选项ID
Cover *string `gorm:"default:''" json:"cover"` // 封面图
Info *string `gorm:"default:''" json:"info"` // 保留的设计信息
Utime *time.Time `gorm:"-" json:"utime"` // 更新时间
Utime *time.Time `gorm:"" json:"utime"` // 更新时间
Status *int64 `gorm:"default:1" json:"status"` // 状态
IsDel *int64 `gorm:"default:0" json:"is_del"` // 是否删除 0未删除 1删除
IsPay *int64 `gorm:"default:0" json:"is_pay"` // 是否已有支付 0 未 1 有
@ -35,7 +35,7 @@ func NewFsProductDesignModel(db *gorm.DB) *FsProductDesignModel {
}
func (d *FsProductDesignModel) FindOneBySn(ctx context.Context, sn string) (resp FsProductDesign, err error) {
err = d.db.WithContext(ctx).Model(&FsProductDesign{}).Where("`sn` = ? and `status` = ?", sn, 1).First(&resp).Error
err = d.db.WithContext(ctx).Model(&FsProductDesign{}).Where("`sn` = ? and `status` = ?", sn, 1).Take(&resp).Error
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
return FsProductDesign{}, err
}

View File

@ -3,6 +3,7 @@ package gmodel
import (
"context"
"errors"
"gorm.io/gorm"
)
@ -77,7 +78,7 @@ func (p *FsProductPriceModel) FindOneProductPriceByParams(ctx context.Context, r
if req.Status != nil {
db = db.Where("`status` = ?", *req.Status)
}
if err = db.First(&resp).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
if err = db.Take(&resp).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
return FsProductPrice{}, err
}
return resp, nil

View File

@ -3,6 +3,7 @@ package gmodel
import (
"context"
"errors"
"gorm.io/gorm"
)
@ -35,7 +36,7 @@ func (q *FsQrcodeSetModel) GetAll(ctx context.Context) (resp []FsQrcodeSet, err
return
}
func (q *FsQrcodeSetModel) FindOne(ctx context.Context, id int64) (resp FsQrcodeSet, err error) {
err = q.db.WithContext(ctx).Model(&FsQrcodeSet{}).Where("`id` = ?", id).First(&resp).Error
err = q.db.WithContext(ctx).Model(&FsQrcodeSet{}).Where("`id` = ?", id).Take(&resp).Error
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
return FsQrcodeSet{}, err
}

View File

@ -3,6 +3,7 @@ package gmodel
import (
"context"
"errors"
"gorm.io/gorm"
)
@ -27,7 +28,7 @@ func NewFsTagsModel(db *gorm.DB) *FsTagsModel {
return &FsTagsModel{db}
}
func (t *FsTagsModel) FindOne(ctx context.Context, id int64) (resp FsTags, err error) {
err = t.db.WithContext(ctx).Model(&FsTags{}).Where("`id` = ? and `status` = ?", id, 1).First(&resp).Error
err = t.db.WithContext(ctx).Model(&FsTags{}).Where("`id` = ? and `status` = ?", id, 1).Take(&resp).Error
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
return FsTags{}, err
}

View File

@ -4,21 +4,22 @@ import (
"gorm.io/gorm"
)
// fs_address 用户地址表
type FsAddress struct {
Id int64 `gorm:"primary_key" json:"id"` //
UserId *int64 `gorm:"-" json:"user_id"` // 用户ID
Name *string `gorm:"-" json:"name"` // 地址名称
FirstName *string `gorm:"-" json:"first_name"` // FirstName
LastName *string `gorm:"-" json:"last_name"` // LastName
Mobile *string `gorm:"-" json:"mobile"` // 手机号码
Street *string `gorm:"-" json:"street"` // 街道
Suite *string `gorm:"-" json:"suite"` // 房号
City *string `gorm:"-" json:"city"` // 城市
State *string `gorm:"-" json:"state"` // 州名
Country *string `gorm:"-" json:"country"` // 国家
ZipCode *string `gorm:"-" json:"zip_code"` // 邮编
Status *int64 `gorm:"-" json:"status"` // 1正常 0异常
IsDefault *int64 `gorm:"-" json:"is_default"` // 1默认地址0非默认地址
Id int64 `gorm:"primary_key;default:'0';" json:"id"` //
UserId *uint64 `gorm:"index;default:'0';" json:"user_id"` // 用户ID
Name *string `gorm:"default:'';" json:"name"` // 地址名称
FirstName *string `gorm:"default:'';" json:"first_name"` // FirstName
LastName *string `gorm:"default:'';" json:"last_name"` // LastName
Mobile *string `gorm:"default:'';" json:"mobile"` // 手机号码
Street *string `gorm:"default:'';" json:"street"` // 街道
Suite *string `gorm:"default:'';" json:"suite"` // 房号
City *string `gorm:"default:'';" json:"city"` // 城市
State *string `gorm:"default:'';" json:"state"` // 州名
Country *string `gorm:"default:'';" json:"country"` // 国家
ZipCode *string `gorm:"default:'';" json:"zip_code"` // 邮编
Status *int64 `gorm:"default:'0';" json:"status"` // 1正常 0异常
IsDefault *int64 `gorm:"default:'0';" json:"is_default"` // 1默认地址0非默认地址
}
type FsAddressModel struct{ db *gorm.DB }

View File

@ -0,0 +1,16 @@
package model
import (
"gorm.io/gorm"
)
// fs_auth_assignment 用户角色和权限信息
type FsAuthAssignment struct {
ItemName *string `gorm:"index;default:'';" json:"item_name"` // 角色或权限名称
UserId *string `gorm:"index;default:'';" json:"user_id"` // 用户ID
CreatedAt *int64 `gorm:"default:'0';" json:"created_at"` // 创建时间
// FsAuthAssignmentIbfk1 foreign `gorm:"" json:"fs_auth_assignment_ibfk_1"`//
}
type FsAuthAssignmentModel struct{ db *gorm.DB }
func NewFsAuthAssignmentModel(db *gorm.DB) *FsAuthAssignmentModel { return &FsAuthAssignmentModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,16 @@
package model
import (
"gorm.io/gorm"
)
// fs_auth_item_child 角色和权限关系表
type FsAuthItemChild struct {
Parent *string `gorm:"index;default:'';" json:"parent"` // 父角色或权限名称
Child *string `gorm:"index;default:'';" json:"child"` // 子角色或权限名称
// FsAuthItemChildIbfk1 foreign `gorm:"" json:"fs_auth_item_child_ibfk_1"`//
// FsAuthItemChildIbfk2 foreign `gorm:"" json:"fs_auth_item_child_ibfk_2"`//
}
type FsAuthItemChildModel struct{ db *gorm.DB }
func NewFsAuthItemChildModel(db *gorm.DB) *FsAuthItemChildModel { return &FsAuthItemChildModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,20 @@
package model
import (
"gorm.io/gorm"
)
// fs_auth_item 用户角色和权限信息
type FsAuthItem struct {
Name string `gorm:"primary_key;default:'';" json:"name"` // 角色或权限名称
Type *int64 `gorm:"index;default:'0';" json:"type"` // 权限类型1 表示角色2 表示权限
Description *string `gorm:"default:'';" json:"description"` // 角色或权限描述
RuleName *string `gorm:"index;default:'';" json:"rule_name"` //
Data *[]byte `gorm:"default:'';" json:"data"` // 角色或权限的额外数据
CreatedAt *int64 `gorm:"default:'0';" json:"created_at"` //
UpdatedAt *int64 `gorm:"default:'0';" json:"updated_at"` //
// FsAuthItemIbfk1 foreign `gorm:"" json:"fs_auth_item_ibfk_1"`//
}
type FsAuthItemModel struct{ db *gorm.DB }
func NewFsAuthItemModel(db *gorm.DB) *FsAuthItemModel { return &FsAuthItemModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,16 @@
package model
import (
"gorm.io/gorm"
)
// fs_auth_rule 规则表
type FsAuthRule struct {
Name string `gorm:"primary_key;default:'';" json:"name"` // 规则名称
Data *[]byte `gorm:"default:'';" json:"data"` // 规则的额外数据
CreatedAt *int64 `gorm:"default:'0';" json:"created_at"` //
UpdatedAt *int64 `gorm:"default:'0';" json:"updated_at"` //
}
type FsAuthRuleModel struct{ db *gorm.DB }
func NewFsAuthRuleModel(db *gorm.DB) *FsAuthRuleModel { return &FsAuthRuleModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -4,15 +4,16 @@ import (
"gorm.io/gorm"
)
// fs_canteen_product 餐厅类别产品对应表
type FsCanteenProduct struct {
Id int64 `gorm:"primary_key" json:"id"` // ID
CanteenType *int64 `gorm:"-" json:"canteen_type"` // 餐厅类别id
ProductId *int64 `gorm:"-" json:"product_id"` // 产品id
SizeId *int64 `gorm:"-" json:"size_id"` // 尺寸id
Sort *int64 `gorm:"-" json:"sort"` // 排序
Status *int64 `gorm:"-" json:"status"` // 状态位 1启用0停用
Ctime *int64 `gorm:"-" json:"ctime"` // 添加时间
Sid *string `gorm:"-" json:"sid"` // 前端带入的id
Id int64 `gorm:"primary_key;default:'0';" json:"id"` // ID
CanteenType *int64 `gorm:"index;default:'0';" json:"canteen_type"` // 餐厅类别id
ProductId *int64 `gorm:"default:'0';" json:"product_id"` // 产品id
SizeId *int64 `gorm:"default:'0';" json:"size_id"` // 尺寸id
Sort *int64 `gorm:"default:'0';" json:"sort"` // 排序
Status *int64 `gorm:"default:'0';" json:"status"` // 状态位 1启用0停用
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 添加时间
Sid *string `gorm:"default:'';" json:"sid"` // 前端带入的id
}
type FsCanteenProductModel struct{ db *gorm.DB }

View File

@ -4,12 +4,13 @@ import (
"gorm.io/gorm"
)
// fs_canteen_type 餐厅类型表
type FsCanteenType struct {
Id int64 `gorm:"primary_key" json:"id"` // ID
Name *string `gorm:"-" json:"name"` // 餐厅名字
Sort *int64 `gorm:"-" json:"sort"` // 排序
Status *int64 `gorm:"-" json:"status"` // 状态位 1启用0停用
Ctime *int64 `gorm:"-" json:"ctime"` // 添加时间
Id int64 `gorm:"primary_key;default:'0';" json:"id"` // ID
Name *string `gorm:"default:'';" json:"name"` // 餐厅名字
Sort *int64 `gorm:"default:'0';" json:"sort"` // 排序
Status *int64 `gorm:"default:'0';" json:"status"` // 状态位 1启用0停用
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 添加时间
}
type FsCanteenTypeModel struct{ db *gorm.DB }

View File

@ -0,0 +1,17 @@
package model
import (
"gorm.io/gorm"
)
// fs_card 卡号表
type FsCard struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` // Id
CardNo *string `gorm:"default:'';" json:"card_no"` // 卡号
GroupId *int64 `gorm:"default:'0';" json:"group_id"` // 分组id
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 创建时间
CardNum *string `gorm:"default:'';" json:"card_num"` // 卡号 无空格
}
type FsCardModel struct{ db *gorm.DB }
func NewFsCardModel(db *gorm.DB) *FsCardModel { return &FsCardModel{db} }

View File

@ -0,0 +1,17 @@
package model
import (
"gorm.io/gorm"
)
// fs_card_group 卡号分组表
type FsCardGroup struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` // id
GroupName *string `gorm:"default:'';" json:"group_name"` // 分组名字
PreNo *string `gorm:"default:'';" json:"pre_no"` // 规则前几位数
Num *int64 `gorm:"default:'0';" json:"num"` // 生成数量
Ctime *int64 `gorm:"default:'0';" json:"ctime"` //
}
type FsCardGroupModel struct{ db *gorm.DB }
func NewFsCardGroupModel(db *gorm.DB) *FsCardGroupModel { return &FsCardGroupModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -1,28 +1,28 @@
package model
import (
"time"
"gorm.io/gorm"
"time"
)
// fs_cart 购物车
type FsCart struct {
Id int64 `gorm:"primary_key" json:"id"` // id
UserId *int64 `gorm:"-" json:"user_id"` // 用户ID
ProductId *int64 `gorm:"-" json:"product_id"` // 产品ID
TemplateId *int64 `gorm:"-" json:"template_id"` // 模板ID
PriceId *int64 `gorm:"-" json:"price_id"` // 价格ID
MaterialId *int64 `gorm:"-" json:"material_id"` // 材质ID
SizeId *int64 `gorm:"-" json:"size_id"` // 尺寸ID
BuyNum *int64 `gorm:"-" json:"buy_num"` // 购买数量
Cover *string `gorm:"-" json:"cover"` // 截图
DesignId *int64 `gorm:"-" json:"design_id"` // 设计ID
Ctime *int64 `gorm:"-" json:"ctime"` // 添加时间
Status *int64 `gorm:"-" json:"status"` // 状态位
OptionalId *int64 `gorm:"-" json:"optional_id"` // 选项ID
IsCheck *int64 `gorm:"-" json:"is_check"` // 是否选中状态0未选中1选中
TsTime *time.Time `gorm:"-" json:"ts_time"` //
IsEmail *int64 `gorm:"-" json:"is_email"` // 是否发送邮件
Id uint64 `gorm:"primary_key;default:'0';" json:"id"` // id
UserId *uint64 `gorm:"index;default:'0';" json:"user_id"` //
ProductId *uint64 `gorm:"index;default:'0';" json:"product_id"` // 产品ID
TemplateId *uint64 `gorm:"index;default:'0';" json:"template_id"` // 模板ID
PriceId *uint64 `gorm:"index;default:'0';" json:"price_id"` // 价格ID
MaterialId *uint64 `gorm:"index;default:'0';" json:"material_id"` // 材质ID
SizeId *uint64 `gorm:"index;default:'0';" json:"size_id"` // 尺寸ID
BuyNum *uint64 `gorm:"default:'0';" json:"buy_num"` // 购买数量
Cover *string `gorm:"default:'';" json:"cover"` // 截图
DesignId *uint64 `gorm:"index;default:'0';" json:"design_id"` // 设计ID
Ctime *uint64 `gorm:"default:'0';" json:"ctime"` //
Status *uint64 `gorm:"default:'0';" json:"status"` // 状态位
OptionalId *int64 `gorm:"index;default:'0';" json:"optional_id"` // 选项ID
IsCheck *int64 `gorm:"default:'0';" json:"is_check"` // 是否选中状态0未选中1选中
TsTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ts_time"` //
IsEmail *int64 `gorm:"default:'0';" json:"is_email"` // 是否发送邮件
}
type FsCartModel struct{ db *gorm.DB }

View File

@ -0,0 +1,17 @@
package model
import (
"gorm.io/gorm"
)
// fs_change_code 忘记密码code表
type FsChangeCode struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` // id
Email *string `gorm:"default:'';" json:"email"` //
Code *string `gorm:"default:'';" json:"code"` //
CreatedAt *int64 `gorm:"default:'0';" json:"created_at"` // 创建时间
IsUse *int64 `gorm:"default:'0';" json:"is_use"` // 是否使用 1已使用 0未使用
}
type FsChangeCodeModel struct{ db *gorm.DB }
func NewFsChangeCodeModel(db *gorm.DB) *FsChangeCodeModel { return &FsChangeCodeModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,20 @@
package model
import (
"gorm.io/gorm"
)
// fs_cloud_deliver_every_tmp
type FsCloudDeliverEveryTmp struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` //
AdminId *int64 `gorm:"default:'0';" json:"admin_id"` // 管理员
CloudId *int64 `gorm:"default:'0';" json:"cloud_id"` // 云仓ID 暂且只有一个默认为 1
OrderDetailTemplateSn *string `gorm:"default:'';" json:"order_detail_template_sn"` // 详情modelSn
Num *int64 `gorm:"default:'0';" json:"num"` // 发货数量
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 添加时间
}
type FsCloudDeliverEveryTmpModel struct{ db *gorm.DB }
func NewFsCloudDeliverEveryTmpModel(db *gorm.DB) *FsCloudDeliverEveryTmpModel {
return &FsCloudDeliverEveryTmpModel{db}
}

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,25 @@
package model
import (
"gorm.io/gorm"
)
// fs_cloud_deliver_tmp
type FsCloudDeliverTmp struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` // id
CloudId *int64 `gorm:"default:'0';" json:"cloud_id"` // 云仓id
UserId *int64 `gorm:"default:'0';" json:"user_id"` // 用户id
AdminId *int64 `gorm:"default:'0';" json:"admin_id"` // 操作员id
DeliveryType *int64 `gorm:"default:'1';" json:"delivery_type"` // 发货公司 之后配置默认1
Fee *int64 `gorm:"default:'0';" json:"fee"` // 价格
AddressId *int64 `gorm:"default:'0';" json:"address_id"` // 地址
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 创建时间
IsDeliver *int64 `gorm:"default:'0';" json:"is_deliver"` // 0未发货1已发货
IsEnd *int64 `gorm:"default:'0';" json:"is_end"` // 0未完成1已完成
DeliverId *int64 `gorm:"default:'0';" json:"deliver_id"` // 发货总表id
}
type FsCloudDeliverTmpModel struct{ db *gorm.DB }
func NewFsCloudDeliverTmpModel(db *gorm.DB) *FsCloudDeliverTmpModel {
return &FsCloudDeliverTmpModel{db}
}

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,15 @@
package model
import (
"gorm.io/gorm"
)
// fs_cloud 云仓表
type FsCloud struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` // id
Address *string `gorm:"default:'';" json:"address"` // 云仓地址
Title *string `gorm:"default:'';" json:"title"` // 云仓名称
}
type FsCloudModel struct{ db *gorm.DB }
func NewFsCloudModel(db *gorm.DB) *FsCloudModel { return &FsCloudModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,20 @@
package model
import (
"gorm.io/gorm"
)
// fs_cloud_pick_up_detail 云仓提货单-详情
type FsCloudPickUpDetail struct {
Id uint64 `gorm:"primary_key;default:'0';" json:"id"` // Id
PickId *int64 `gorm:"index;default:'0';" json:"pick_id"` // 提货单id
StockId *int64 `gorm:"default:'0';" json:"stock_id"` // 用户云仓记录id
Num *int64 `gorm:"default:'0';" json:"num"` // 提取数量
Boxes *int64 `gorm:"default:'0';" json:"boxes"` // 提取箱数
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 添加时间
}
type FsCloudPickUpDetailModel struct{ db *gorm.DB }
func NewFsCloudPickUpDetailModel(db *gorm.DB) *FsCloudPickUpDetailModel {
return &FsCloudPickUpDetailModel{db}
}

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,23 @@
package model
import (
"gorm.io/gorm"
)
// fs_cloud_pick_up 云仓提货单
type FsCloudPickUp struct {
Id uint64 `gorm:"primary_key;default:'0';" json:"id"` // Id
UserId *int64 `gorm:"index;default:'0';" json:"user_id"` // 用户id
TrackNum *string `gorm:"default:'';" json:"track_num"` // 运输号
AddressId *int64 `gorm:"default:'0';" json:"address_id"` // 地址id
AddressInfo *string `gorm:"default:'';" json:"address_info"` // 地址信息 json
Status *int64 `gorm:"default:'0';" json:"status"` // 运输状态 1 draw 2shipping 3ups 4arrival
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 添加时间
ShippingTime *int64 `gorm:"default:'0';" json:"shipping_time"` // 发货时间
UpsTime *int64 `gorm:"default:'0';" json:"ups_time"` // 提货时间
ArrivalTime *int64 `gorm:"default:'0';" json:"arrival_time"` // 到达时间
UpsSn *string `gorm:"default:'';" json:"ups_sn"` // 运输单号
}
type FsCloudPickUpModel struct{ db *gorm.DB }
func NewFsCloudPickUpModel(db *gorm.DB) *FsCloudPickUpModel { return &FsCloudPickUpModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,19 @@
package model
import (
"gorm.io/gorm"
)
// fs_cloud_receive_every
type FsCloudReceiveEvery struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` //
DeliveryId *int64 `gorm:"index;default:'0';" json:"delivery_id"` // 云仓收货单id
OrderDetailTemplateSn *string `gorm:"index;default:'';" json:"order_detail_template_sn"` // 详情modelSn
Num *int64 `gorm:"default:'0';" json:"num"` // 收到的数量
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 添加时间
}
type FsCloudReceiveEveryModel struct{ db *gorm.DB }
func NewFsCloudReceiveEveryModel(db *gorm.DB) *FsCloudReceiveEveryModel {
return &FsCloudReceiveEveryModel{db}
}

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,21 @@
package model
import (
"gorm.io/gorm"
)
// fs_cloud_receive 云仓接收工厂总单
type FsCloudReceive struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` //
CloudId *int64 `gorm:"index;default:'0';" json:"cloud_id"` // 入库云仓id
AdminId *int64 `gorm:"index;default:'0';" json:"admin_id"` // 操作员id
UserId *int64 `gorm:"index;default:'0';" json:"user_id"` // 用户id
OrderId *int64 `gorm:"index;default:'0';" json:"order_id"` // 入库云仓的订单
Fee *int64 `gorm:"default:'0';" json:"fee"` // 运费
Delivery *string `gorm:"default:'';" json:"delivery"` // 运单号
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 创建时间
Status *int64 `gorm:"default:'0';" json:"status"` // 0未收到 1收到
}
type FsCloudReceiveModel struct{ db *gorm.DB }
func NewFsCloudReceiveModel(db *gorm.DB) *FsCloudReceiveModel { return &FsCloudReceiveModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,21 @@
package model
import (
"gorm.io/gorm"
)
// fs_cloud_render_log 云渲染日志表
type FsCloudRenderLog struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` // ID
UserId *int64 `gorm:"default:'0';" json:"user_id"` // 用户id
PostData *string `gorm:"default:'';" json:"post_data"` //
PostUrl *string `gorm:"default:'';" json:"post_url"` //
Title *string `gorm:"index;default:'';" json:"title"` //
Time *int64 `gorm:"default:'0';" json:"time"` // 所用时间
Result *string `gorm:"default:'';" json:"result"` // 返回结果
Tag *string `gorm:"index;default:'';" json:"tag"` // 标识
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 添加时间
}
type FsCloudRenderLogModel struct{ db *gorm.DB }
func NewFsCloudRenderLogModel(db *gorm.DB) *FsCloudRenderLogModel { return &FsCloudRenderLogModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,22 @@
package model
import (
"gorm.io/gorm"
)
// fs_cloud_user_apply_back 该表废弃
type FsCloudUserApplyBack struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` //
UserHash *string `gorm:"default:'';" json:"user_hash"` //
OrderDetailTemplateId *int64 `gorm:"default:'0';" json:"order_detail_template_id"` // 详情modelID
Num *int64 `gorm:"default:'0';" json:"num"` // 发货数量
AddressTo *string `gorm:"default:'';" json:"address_to"` // 收获地址
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 添加时间
StorageFee *int64 `gorm:"default:'0';" json:"storage_fee"` // 存储费用
Status *int64 `gorm:"default:'0';" json:"status"` // 状态位 是否已发货 是否处理 是否删除 是否推送
}
type FsCloudUserApplyBackModel struct{ db *gorm.DB }
func NewFsCloudUserApplyBackModel(db *gorm.DB) *FsCloudUserApplyBackModel {
return &FsCloudUserApplyBackModel{db}
}

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,20 @@
package model
import (
"gorm.io/gorm"
)
// fs_contact 该表暂未使用
type FsContact struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` //
Name *string `gorm:"default:'';" json:"name"` // 名字
Email *string `gorm:"index;default:'';" json:"email"` // 邮箱
Subject *int64 `gorm:"default:'0';" json:"subject"` // 主题
Message *string `gorm:"default:'';" json:"message"` // 消息
Ctime *int64 `gorm:"default:'0';" json:"ctime"` //
Status *int64 `gorm:"default:'0';" json:"status"` //
Mark *string `gorm:"default:'';" json:"mark"` // 后台订单备注
}
type FsContactModel struct{ db *gorm.DB }
func NewFsContactModel(db *gorm.DB) *FsContactModel { return &FsContactModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,25 @@
package model
import (
"gorm.io/gorm"
)
// fs_contact_service
type FsContactService struct {
Id uint64 `gorm:"primary_key;default:'0';" json:"id"` //
Type *string `gorm:"default:'';" json:"type"` // 类型
RelationId *int64 `gorm:"index;default:'0';" json:"relation_id"` // 关联id
UserId *int64 `gorm:"index;default:'0';" json:"user_id"` // 用户id
Name *string `gorm:"default:'';" json:"name"` // 联系人姓名
Email *string `gorm:"index;default:'';" json:"email"` // 联系人邮箱
Phone *string `gorm:"default:'';" json:"phone"` //
Remark *string `gorm:"default:'';" json:"remark"` // 备注内容
IsHandle *int64 `gorm:"default:'0';" json:"is_handle"` // 是否被处理0未处理1已处理
Ctime *int64 `gorm:"default:'0';" json:"ctime"` //
HandleRemark *string `gorm:"default:'';" json:"handle_remark"` // 处理备注
HandleUid *int64 `gorm:"default:'0';" json:"handle_uid"` // 处理人
HandleTime *int64 `gorm:"default:'0';" json:"handle_time"` // 处理时间
}
type FsContactServiceModel struct{ db *gorm.DB }
func NewFsContactServiceModel(db *gorm.DB) *FsContactServiceModel { return &FsContactServiceModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,25 @@
package model
import (
"gorm.io/gorm"
)
// fs_coupon 代金券(暂未使用)
type FsCoupon struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` //
UserId *int64 `gorm:"default:'0';" json:"user_id"` //
Sn *string `gorm:"default:'';" json:"sn"` // 优惠券码
Type *int64 `gorm:"default:'0';" json:"type"` // 类型 1代金券 2折扣券 3满减券
Amount *int64 `gorm:"default:'0';" json:"amount"` // 代金券金额、折扣比例、满减金额
MinAmount *int64 `gorm:"default:'0';" json:"min_amount"` // 满足条件的最小金额 0:不限制
MaxAmount *int64 `gorm:"default:'0';" json:"max_amount"` // 最多优惠的金额 0不限制
Stime *int64 `gorm:"default:'0';" json:"stime"` // 开始时间 0立即生效
Etime *int64 `gorm:"default:'0';" json:"etime"` // 结束时间 0永久有效
Exclude *int64 `gorm:"default:'2';" json:"exclude"` // 是否可以与其他优惠券同时使用 1可以 2不可以
Ctime *int64 `gorm:"default:'0';" json:"ctime"` //
GetTime *int64 `gorm:"default:'0';" json:"get_time"` //
Status *int64 `gorm:"default:'0';" json:"status"` // 状态 是否可用 是否已绑定到订单
}
type FsCouponModel struct{ db *gorm.DB }
func NewFsCouponModel(db *gorm.DB) *FsCouponModel { return &FsCouponModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,16 @@
package model
import (
"gorm.io/gorm"
)
// fs_deliver_every 发货详细表(已废弃)
type FsDeliverEvery struct {
Id uint64 `gorm:"primary_key;default:'0';" json:"id"` //
DeliverId *int64 `gorm:"index;default:'0';" json:"deliver_id"` // 发货ID
OrderDetailTemplateSn *string `gorm:"index;default:'';" json:"order_detail_template_sn"` // 订单详情模板sn
Num *int64 `gorm:"default:'0';" json:"num"` //
}
type FsDeliverEveryModel struct{ db *gorm.DB }
func NewFsDeliverEveryModel(db *gorm.DB) *FsDeliverEveryModel { return &FsDeliverEveryModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,39 @@
package model
import (
"gorm.io/gorm"
"time"
)
// fs_deliver 发货表 云仓 直发 通用(已废弃)
type FsDeliver struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` //
Type *int64 `gorm:"default:'0';" json:"type"` // 1直接发货2云仓发货
UserId *int64 `gorm:"index;default:'0';" json:"user_id"` // 用户ID
AdminId *int64 `gorm:"index;default:'0';" json:"admin_id"` // 操作人id
Fee *int64 `gorm:"default:'0';" json:"fee"` // 运费价格
Tel *string `gorm:"default:'';" json:"tel"` // 电话
DeliveryType *int64 `gorm:"default:'0';" json:"delivery_type"` // 发货公司
AddressId *int64 `gorm:"index;default:'0';" json:"address_id"` // 地址id
AddressInfo *string `gorm:"default:'';" json:"address_info"` // 地址信息
Ctime *int64 `gorm:"default:'0';" json:"ctime"` //
OrderId *int64 `gorm:"default:'0';" json:"order_id"` // 云仓发货order_id为0
WarehouseDeliverSn *string `gorm:"index;default:'';" json:"warehouse_deliver_sn"` //
IsConfirm *int64 `gorm:"default:'0';" json:"is_confirm"` // 0未确认 1已确认
IsDeliver *int64 `gorm:"default:'0';" json:"is_deliver"` // 0未发货 1已发货
IsPort *int64 `gorm:"default:'0';" json:"is_port"` // 是否到达港口 0未到达 1:已到达
IsPickUp *int64 `gorm:"default:'0';" json:"is_pick_up"` // 美国运输是否已收货 0未提货 1已提货
IsEnd *int64 `gorm:"default:'0';" json:"is_end"` // 0未收货 1已签收
Status *int64 `gorm:"default:'0';" json:"status"` // 状态值:(0默认未确认1已确认2已发货3到港口4运输中5已签收)
ConfirmAt *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"confirm_at"` //
DeliverAt *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"deliver_at"` //
PortAt *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"port_at"` //
PickUpAt *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"pick_up_at"` //
EndAt *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"end_at"` //
FirstDeliverSn *string `gorm:"index;default:'';" json:"first_deliver_sn"` //
TwoDeliverSn *string `gorm:"index;default:'';" json:"two_deliver_sn"` //
TsTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ts_time"` //
}
type FsDeliverModel struct{ db *gorm.DB }
func NewFsDeliverModel(db *gorm.DB) *FsDeliverModel { return &FsDeliverModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,17 @@
package model
import (
"gorm.io/gorm"
)
// fs_department 部门表
type FsDepartment struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` // id
Name *string `gorm:"default:'';" json:"name"` // 部门名称
Status *int64 `gorm:"default:'0';" json:"status"` // 状态 1正常0停用
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 添加时间
ParentId *int64 `gorm:"default:'0';" json:"parent_id"` // 父级id
}
type FsDepartmentModel struct{ db *gorm.DB }
func NewFsDepartmentModel(db *gorm.DB) *FsDepartmentModel { return &FsDepartmentModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,19 @@
package model
import (
"gorm.io/gorm"
)
// fs_email_logs 邮件日志表
type FsEmailLogs struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` // ID
Type *int64 `gorm:"default:'0';" json:"type"` // 邮件分类
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 发送时间
Email *string `gorm:"default:'';" json:"email"` // 发送邮箱
EmailSubject *string `gorm:"default:'';" json:"email_subject"` // 发送标题
Result *string `gorm:"default:'';" json:"result"` // 发送结果
Status *int64 `gorm:"default:'0';" json:"status"` // 状态 1成功0失败
}
type FsEmailLogsModel struct{ db *gorm.DB }
func NewFsEmailLogsModel(db *gorm.DB) *FsEmailLogsModel { return &FsEmailLogsModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,20 @@
package model
import (
"gorm.io/gorm"
)
// fs_email_template 邮件模板表(暂未使用)
type FsEmailTemplate struct {
Id uint64 `gorm:"primary_key;default:'0';" json:"id"` //
Type *int64 `gorm:"default:'0';" json:"type"` // 模板类型
Name *string `gorm:"default:'';" json:"name"` // 模板名称
Title *string `gorm:"default:'';" json:"title"` // 模板标题
ReplaceFields *string `gorm:"default:'';" json:"replace_fields"` //
Content *string `gorm:"default:'';" json:"content"` // 模板内容
Status *int64 `gorm:"default:'0';" json:"status"` // 状态值0:禁用1:启用)
Ctime *int64 `gorm:"default:'0';" json:"ctime"` //
}
type FsEmailTemplateModel struct{ db *gorm.DB }
func NewFsEmailTemplateModel(db *gorm.DB) *FsEmailTemplateModel { return &FsEmailTemplateModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,19 @@
package model
import (
"gorm.io/gorm"
)
// fs_factory_deliver_every 该表废弃
type FsFactoryDeliverEvery struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` //
FactoryDeliverId *int64 `gorm:"index;default:'0';" json:"factory_deliver_id"` // 工厂发货表ID
OrderDetailTemplateSn *string `gorm:"index;default:'';" json:"order_detail_template_sn"` // 订单产品模板sn
Num *int64 `gorm:"default:'0';" json:"num"` // 发货数量
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 添加时间
}
type FsFactoryDeliverEveryModel struct{ db *gorm.DB }
func NewFsFactoryDeliverEveryModel(db *gorm.DB) *FsFactoryDeliverEveryModel {
return &FsFactoryDeliverEveryModel{db}
}

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,19 @@
package model
import (
"gorm.io/gorm"
)
// fs_factory_deliver 工厂发货主表(废弃)
type FsFactoryDeliver struct {
Id uint64 `gorm:"primary_key;default:'0';" json:"id"` //
Sn *string `gorm:"index;default:'';" json:"sn"` // 工厂发货编号sn
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 创建时间
DeliveryMethod *int64 `gorm:"default:'0';" json:"delivery_method"` // 发货方式( 1:直接发货到收获地址 2云仓
OrderId *int64 `gorm:"index;default:'0';" json:"order_id"` // 订单id
IsArriveCloud *int64 `gorm:"default:'0';" json:"is_arrive_cloud"` // 是否到达云仓 0未到达1已到达
IsArriveAgent *int64 `gorm:"default:'0';" json:"is_arrive_agent"` // 是否到达货代公司 0未到达1已到达
}
type FsFactoryDeliverModel struct{ db *gorm.DB }
func NewFsFactoryDeliverModel(db *gorm.DB) *FsFactoryDeliverModel { return &FsFactoryDeliverModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,18 @@
package model
import (
"gorm.io/gorm"
)
// fs_factory 该表废弃
type FsFactory struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` //
Name *string `gorm:"default:'';" json:"name"` // 名字
Addr *string `gorm:"default:'';" json:"addr"` // 地址
Contact *string `gorm:"default:'';" json:"contact"` // 联系人
Mobile *string `gorm:"default:'';" json:"mobile"` // 联系电话
Status *int64 `gorm:"default:'0';" json:"status"` // 状态位 是否禁用
}
type FsFactoryModel struct{ db *gorm.DB }
func NewFsFactoryModel(db *gorm.DB) *FsFactoryModel { return &FsFactoryModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,21 @@
package model
import (
"gorm.io/gorm"
)
// fs_factory_product 工厂生产表(废弃)
type FsFactoryProduct struct {
Id uint64 `gorm:"primary_key;default:'0';" json:"id"` //
FactoryId *int64 `gorm:"index;default:'0';" json:"factory_id"` // 工厂id
OrderId *int64 `gorm:"index;default:'0';" json:"order_id"` // 订单id
OrderDetailTemplateSn *string `gorm:"index;default:'';" json:"order_detail_template_sn"` // 产品模板sn
Num *int64 `gorm:"default:'0';" json:"num"` // 数量
IsProduct *int64 `gorm:"default:'0';" json:"is_product"` // 是否开始生产( 0未开始 1已开始
IsEnd *int64 `gorm:"default:'0';" json:"is_end"` // 是否完成0未完成1已完成
IsDeliver *int64 `gorm:"default:'0';" json:"is_deliver"` // 是否已发货0未发货1已发货
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 创建时间
}
type FsFactoryProductModel struct{ db *gorm.DB }
func NewFsFactoryProductModel(db *gorm.DB) *FsFactoryProductModel { return &FsFactoryProductModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,23 @@
package model
import (
"gorm.io/gorm"
)
// fs_factory_ship_tmp
type FsFactoryShipTmp struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` //
Sn *string `gorm:"default:'';" json:"sn"` // 运单号码
FactoryId *int64 `gorm:"default:'0';" json:"factory_id"` // 工厂ID
OrderDetailTemplateSn *string `gorm:"default:'';" json:"order_detail_template_sn"` // 详情modelSn
UserId *int64 `gorm:"default:'0';" json:"user_id"` //
AddressSent *string `gorm:"default:'';" json:"address_sent"` // 发货地址
AddressTo *string `gorm:"default:'';" json:"address_to"` // 收获地址 始终是货代公司
Num *int64 `gorm:"default:'0';" json:"num"` // 发货数量
Fee *int64 `gorm:"default:'0';" json:"fee"` // 运费
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 添加时间
Status *int64 `gorm:"default:'0';" json:"status"` // 状态位 是否到达 是否通知货代公司 是否是发到云仓
}
type FsFactoryShipTmpModel struct{ db *gorm.DB }
func NewFsFactoryShipTmpModel(db *gorm.DB) *FsFactoryShipTmpModel { return &FsFactoryShipTmpModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -4,15 +4,16 @@ import (
"gorm.io/gorm"
)
// fs_faq 常见问题
type FsFaq struct {
Id int64 `gorm:"primary_key" json:"id"` //
TagId *int64 `gorm:"-" json:"tag_id"` // 分类ID
TagName *string `gorm:"-" json:"tag_name"` // 分类名称
Title *string `gorm:"-" json:"title"` // 标题
Content *string `gorm:"-" json:"content"` // 内容
Status *int64 `gorm:"-" json:"status"` // 状态(0:禁用1:启用)
Sort *int64 `gorm:"-" json:"sort"` // 排序
Ctime *int64 `gorm:"-" json:"ctime"` // 添加时间
Id int64 `gorm:"primary_key;default:'0';" json:"id"` //
TagId *int64 `gorm:"default:'0';" json:"tag_id"` // 分类ID
TagName *string `gorm:"default:'';" json:"tag_name"` // 分类名称
Title *string `gorm:"default:'';" json:"title"` // 标题
Content *string `gorm:"default:'';" json:"content"` // 内容
Status *int64 `gorm:"default:'0';" json:"status"` // 状态(0:禁用1:启用)
Sort *int64 `gorm:"default:'1';" json:"sort"` // 排序
Ctime *int64 `gorm:"default:'0';" json:"ctime"` //
}
type FsFaqModel struct{ db *gorm.DB }

View File

@ -4,12 +4,13 @@ import (
"gorm.io/gorm"
)
// fs_font 字体配置
type FsFont struct {
Id int64 `gorm:"primary_key" json:"id"` // id
Title *string `gorm:"-" json:"title"` // 字体名字
LinuxFontname *string `gorm:"-" json:"linux_fontname"` // linux对应字体名
FilePath *string `gorm:"-" json:"file_path"` // 字体文件路径
Sort *int64 `gorm:"-" json:"sort"` // 排序
Id uint64 `gorm:"primary_key;default:'0';" json:"id"` // id
Title *string `gorm:"default:'';" json:"title"` // 字体名字
LinuxFontname *string `gorm:"default:'';" json:"linux_fontname"` // linux对应字体名
FilePath *string `gorm:"default:'';" json:"file_path"` // 字体文件路径
Sort *int64 `gorm:"default:'0';" json:"sort"` // 排序
}
type FsFontModel struct{ db *gorm.DB }

View File

@ -0,0 +1,23 @@
package model
import (
"gorm.io/gorm"
)
// fs_gerent 管理员表
type FsGerent struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` // ID
Username *string `gorm:"unique_key;default:'';" json:"username"` // 用户名
AuthKey *string `gorm:"default:'';" json:"auth_key"` // token
PasswordHash *string `gorm:"default:'';" json:"password_hash"` // 加密密码
PasswordResetToken *string `gorm:"unique_key;default:'';" json:"password_reset_token"` //
Email *string `gorm:"unique_key;default:'';" json:"email"` // 邮箱
Status *int64 `gorm:"default:'10';" json:"status"` // 状态
CreatedAt *int64 `gorm:"default:'0';" json:"created_at"` // 创建时间
UpdatedAt *int64 `gorm:"default:'0';" json:"updated_at"` // 更新时间
Icon *string `gorm:"default:'';" json:"icon"` //
DepartmentId *int64 `gorm:"default:'0';" json:"department_id"` // 部门id
}
type FsGerentModel struct{ db *gorm.DB }
func NewFsGerentModel(db *gorm.DB) *FsGerentModel { return &FsGerentModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -4,17 +4,18 @@ import (
"gorm.io/gorm"
)
// fs_guest 游客表
type FsGuest struct {
GuestId int64 `gorm:"primary_key" json:"guest_id"` // 游客ID
AuthKey *string `gorm:"-" json:"auth_key"` // jwt token
Status *int64 `gorm:"-" json:"status"` // 1正常 0不正常
IsDel *int64 `gorm:"-" json:"is_del"` // 是否删除 1删除
CreatedAt *int64 `gorm:"-" json:"created_at"` // 添加时间
UpdatedAt *int64 `gorm:"-" json:"updated_at"` // 更新时间
IsOpenRender *int64 `gorm:"-" json:"is_open_render"` // 是否打开个性化渲染1开启0关闭
IsThousandFace *int64 `gorm:"-" json:"is_thousand_face"` // 是否已经存在千人千面1存在0不存在
IsLowRendering *int64 `gorm:"-" json:"is_low_rendering"` // 是否开启低渲染模型渲染
IsRemoveBg *int64 `gorm:"-" json:"is_remove_bg"` // 用户上传logo是否去除背景
GuestId uint64 `gorm:"primary_key;default:'0';" json:"guest_id"` // ID
AuthKey *string `gorm:"default:'';" json:"auth_key"` // jwt token
Status *uint64 `gorm:"index;default:'1';" json:"status"` // 1正常 0不正常
IsDel *int64 `gorm:"index;default:'0';" json:"is_del"` // 是否删除 1删除
CreatedAt *int64 `gorm:"index;default:'0';" json:"created_at"` // 添加时间
UpdatedAt *int64 `gorm:"default:'0';" json:"updated_at"` // 更新时间
IsOpenRender *int64 `gorm:"default:'0';" json:"is_open_render"` // 是否打开个性化渲染1开启0关闭
IsThousandFace *int64 `gorm:"default:'0';" json:"is_thousand_face"` // 是否已经存在千人千面1存在0不存在
IsLowRendering *int64 `gorm:"default:'0';" json:"is_low_rendering"` // 是否开启低渲染模型渲染
IsRemoveBg *int64 `gorm:"default:'1';" json:"is_remove_bg"` // 用户上传logo是否去除背景
}
type FsGuestModel struct{ db *gorm.DB }

View File

@ -0,0 +1,20 @@
package model
import (
"gorm.io/gorm"
)
// fs_log 日志表
type FsLog struct {
Id uint64 `gorm:"primary_key;default:'0';" json:"id"` // ID
Action *string `gorm:"default:'';" json:"action"` // 执行的动作
Table *string `gorm:"default:'';" json:"table"` // 表明
DataChanged *string `gorm:"default:'';" json:"data_changed"` // 修改后的数据
DataOld *string `gorm:"default:'';" json:"data_old"` // 变动的数据
Ctime *uint64 `gorm:"default:'0';" json:"ctime"` // 添加时间
Uid *uint64 `gorm:"default:'0';" json:"uid"` // 操作人ID
Uname *string `gorm:"default:'';" json:"uname"` // 操作人名字
}
type FsLogModel struct{ db *gorm.DB }
func NewFsLogModel(db *gorm.DB) *FsLogModel { return &FsLogModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -4,14 +4,15 @@ import (
"gorm.io/gorm"
)
// fs_map_library 贴图库
type FsMapLibrary struct {
Id int64 `gorm:"primary_key" json:"id"` // Id
Title *string `gorm:"-" json:"title"` // 名称
Info *string `gorm:"-" json:"info"` // 贴图数据
Sort *int64 `gorm:"-" json:"sort"` // 排序
Status *int64 `gorm:"-" json:"status"` // 状态 1启用
Ctime *int64 `gorm:"-" json:"ctime"` // 创建时间
TagId *int64 `gorm:"-" json:"tag_id"` // 模板标签id
Id int64 `gorm:"primary_key;default:'0';" json:"id"` // Id
Title *string `gorm:"default:'';" json:"title"` // 名称
Info *string `gorm:"default:'';" json:"info"` // 贴图数据
Sort *int64 `gorm:"default:'0';" json:"sort"` // 排序
Status *int64 `gorm:"default:'0';" json:"status"` // 状态 1启用
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 创建时间
TagId *int64 `gorm:"default:'0';" json:"tag_id"` // 模板标签id
}
type FsMapLibraryModel struct{ db *gorm.DB }

View File

@ -0,0 +1,18 @@
package model
import (
"gorm.io/gorm"
)
// fs_menu 后台菜单
type FsMenu struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` // id
Name *string `gorm:"default:'';" json:"name"` // 菜单名
Parent *int64 `gorm:"index;default:'0';" json:"parent"` //
Route *string `gorm:"default:'';" json:"route"` //
Order *int64 `gorm:"default:'0';" json:"order"` //
Data *[]byte `gorm:"default:'';" json:"data"` // 其他信息(图标等)
}
type FsMenuModel struct{ db *gorm.DB }
func NewFsMenuModel(db *gorm.DB) *FsMenuModel { return &FsMenuModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,14 @@
package model
import (
"gorm.io/gorm"
)
// fs_migration 版本库
type FsMigration struct {
Version string `gorm:"primary_key;default:'';" json:"version"` // 版本信息
ApplyTime *int64 `gorm:"default:'0';" json:"apply_time"` //
}
type FsMigrationModel struct{ db *gorm.DB }
func NewFsMigrationModel(db *gorm.DB) *FsMigrationModel { return &FsMigrationModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,22 @@
package model
import (
"gorm.io/gorm"
)
// fs_order_affiliate 订单附属表-流程控制时间等
type FsOrderAffiliate struct {
Id uint64 `gorm:"primary_key;default:'0';" json:"id"` // id
OrderId *uint64 `gorm:"unique_key;default:'0';" json:"order_id"` // 订单id
SureTime *uint64 `gorm:"default:'0';" json:"sure_time"` // 确认时间
ProductTime *uint64 `gorm:"default:'0';" json:"product_time"` // 生产时间
ProductEndtime *uint64 `gorm:"default:'0';" json:"product_endtime"` // 生成完成时间
DeliverTime *uint64 `gorm:"default:'0';" json:"deliver_time"` // 发货时间
UpsDeliverTime *uint64 `gorm:"default:'0';" json:"ups_deliver_time"` // ups发货时间
UpsTime *uint64 `gorm:"default:'0';" json:"ups_time"` // UPS提货时间
ArrivalTime *uint64 `gorm:"default:'0';" json:"arrival_time"` // 到达云仓的时间
RecevieTime *uint64 `gorm:"default:'0';" json:"recevie_time"` // 云仓收货时间
}
type FsOrderAffiliateModel struct{ db *gorm.DB }
func NewFsOrderAffiliateModel(db *gorm.DB) *FsOrderAffiliateModel { return &FsOrderAffiliateModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -4,31 +4,32 @@ import (
"gorm.io/gorm"
)
// fs_order_detail 订单详细表
type FsOrderDetail struct {
Id int64 `gorm:"primary_key" json:"id"` //
Sn *string `gorm:"-" json:"sn"` // 唯一编码
OrderId *int64 `gorm:"-" json:"order_id"` // 订单ID
UserId *int64 `gorm:"-" json:"user_id"` // 用户ID
FactoryId *int64 `gorm:"-" json:"factory_id"` // 工厂ID
OrderDetailTemplateId *int64 `gorm:"-" json:"order_detail_template_id"` // 详情templateID
ProductId *int64 `gorm:"-" json:"product_id"` // 产品ID
BuyNum *int64 `gorm:"-" json:"buy_num"` // 购买数量
PushNum *int64 `gorm:"-" json:"push_num"` // 已发数量
Amount *int64 `gorm:"-" json:"amount"` // 单价
Cover *string `gorm:"-" json:"cover"` // 截图
Ctime *int64 `gorm:"-" json:"ctime"` // 添加时间
Status *int64 `gorm:"-" json:"status"` // 状态位 是否推送到厂家 是否生产完成 是否发货完成
OptionalId *int64 `gorm:"-" json:"optional_id"` // 选项ID
OptionalTitle *string `gorm:"-" json:"optional_title"` // 选项名称
OptionPrice *int64 `gorm:"-" json:"option_price"` // 配件价格
IsTofactory *int64 `gorm:"-" json:"is_tofactory"` // 是否推送到工厂
IsProduct *int64 `gorm:"-" json:"is_product"` // 是否生产中
IsProductCompletion *int64 `gorm:"-" json:"is_product_completion"` // 是否生产完成
IsCloud *int64 `gorm:"-" json:"is_cloud"` // 是否是云仓订单
IsTocloud *int64 `gorm:"-" json:"is_tocloud"` // 是否已发云仓(云仓单要发货到云仓,直接发到用户的不需要发到云仓)
IsDeliver *int64 `gorm:"-" json:"is_deliver"` // 是否已发货
IsEnd *int64 `gorm:"-" json:"is_end"` // 是否完成订单(签收)
CartId *int64 `gorm:"-" json:"cart_id"` // 购物车编号
Id int64 `gorm:"primary_key;default:'0';" json:"id"` //
Sn *string `gorm:"unique_key;default:'';" json:"sn"` // 唯一编码
OrderId *int64 `gorm:"index;default:'0';" json:"order_id"` // 订单ID
UserId *int64 `gorm:"default:'0';" json:"user_id"` //
FactoryId *int64 `gorm:"default:'0';" json:"factory_id"` // 工厂ID
OrderDetailTemplateId *int64 `gorm:"default:'0';" json:"order_detail_template_id"` // 详情templateID
ProductId *int64 `gorm:"default:'0';" json:"product_id"` // 产品ID
BuyNum *int64 `gorm:"default:'0';" json:"buy_num"` // 购买数量
PushNum *int64 `gorm:"default:'0';" json:"push_num"` // 已发数量
Amount *int64 `gorm:"default:'0';" json:"amount"` // 单价
Cover *string `gorm:"default:'';" json:"cover"` // 截图
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 添加时间
Status *int64 `gorm:"default:'0';" json:"status"` // 状态位 是否推送到厂家 是否生产完成 是否发货完成
OptionalId *int64 `gorm:"default:'0';" json:"optional_id"` // 选项ID
OptionalTitle *string `gorm:"default:'';" json:"optional_title"` // 选项名称
OptionPrice *int64 `gorm:"default:'0';" json:"option_price"` // 配件价格
IsTofactory *int64 `gorm:"default:'0';" json:"is_tofactory"` // 是否推送到工厂
IsProduct *int64 `gorm:"default:'0';" json:"is_product"` // 是否生产中
IsProductCompletion *int64 `gorm:"default:'0';" json:"is_product_completion"` // 是否生产完成
IsCloud *int64 `gorm:"default:'0';" json:"is_cloud"` // 是否是云仓订单
IsTocloud *int64 `gorm:"default:'0';" json:"is_tocloud"` // 是否已发云仓(云仓单要发货到云仓,直接发到用户的不需要发到云仓)
IsDeliver *int64 `gorm:"default:'0';" json:"is_deliver"` // 是否已发货
IsEnd *int64 `gorm:"default:'0';" json:"is_end"` // 是否完成订单(签收)
CartId *int64 `gorm:"index;default:'0';" json:"cart_id"` // 购物车编号
}
type FsOrderDetailModel struct{ db *gorm.DB }

View File

@ -4,18 +4,19 @@ import (
"gorm.io/gorm"
)
// fs_order_detail_template 订单模板详细表
type FsOrderDetailTemplate struct {
Id int64 `gorm:"primary_key" json:"id"` //
Sn *string `gorm:"-" json:"sn"` // 唯一编码
ProductId *int64 `gorm:"-" json:"product_id"` // 产品ID
ModelId *int64 `gorm:"-" json:"model_id"` // 模型ID
TemplateId *int64 `gorm:"-" json:"template_id"` // 模板ID
MaterialId *int64 `gorm:"-" json:"material_id"` // 材质id
SizeId *int64 `gorm:"-" json:"size_id"` // 尺寸id
EachBoxNum *int64 `gorm:"-" json:"each_box_num"` // 每一箱的个数
EachBoxWeight *float64 `gorm:"-" json:"each_box_weight"` // 每一箱的重量 单位KG
DesignId *int64 `gorm:"-" json:"design_id"` // 设计ID
Ctime *int64 `gorm:"-" json:"ctime"` // 添加时间
Id int64 `gorm:"primary_key;default:'0';" json:"id"` //
Sn *string `gorm:"unique_key;default:'';" json:"sn"` // 唯一编码
ProductId *int64 `gorm:"index;default:'0';" json:"product_id"` // 产品ID
ModelId *int64 `gorm:"default:'0';" json:"model_id"` // 模型ID
TemplateId *int64 `gorm:"index;default:'0';" json:"template_id"` // 模板ID
MaterialId *int64 `gorm:"index;default:'0';" json:"material_id"` // 材质id
SizeId *int64 `gorm:"index;default:'0';" json:"size_id"` // 尺寸id
EachBoxNum *int64 `gorm:"default:'0';" json:"each_box_num"` // 每一箱的个数
EachBoxWeight *float64 `gorm:"default:'0.00';" json:"each_box_weight"` // 每一箱的重量 单位KG
DesignId *int64 `gorm:"index;default:'0';" json:"design_id"` // 设计ID
Ctime *int64 `gorm:"default:'0';" json:"ctime"` //
}
type FsOrderDetailTemplateModel struct{ db *gorm.DB }

View File

@ -1,48 +1,48 @@
package model
import (
"time"
"gorm.io/gorm"
"time"
)
// fs_order
type FsOrder struct {
Id int64 `gorm:"primary_key" json:"id"` //
Sn *string `gorm:"-" json:"sn"` // 订单编号 FS211224OL2XDKNP
UserId *int64 `gorm:"-" json:"user_id"` // 用户ID
SellerUserId *int64 `gorm:"-" json:"seller_user_id"` // 销售员ID 0:自主下单
TotalAmount *int64 `gorm:"-" json:"total_amount"` // 总价
PayedAmount *int64 `gorm:"-" json:"payed_amount"` // 已支付金额
PayMethod *int64 `gorm:"-" json:"pay_method"` // 支付方式 1paypal 2strip
Ctime *int64 `gorm:"-" json:"ctime"` // 添加时间
Utime *int64 `gorm:"-" json:"utime"` // 更新时间
Ptime *int64 `gorm:"-" json:"ptime"` // 最后一次 支付时间(可能多次支付)
AddressId *int64 `gorm:"-" json:"address_id"` // 地址ID或者云仓ID
DeliveryMethod *int64 `gorm:"-" json:"delivery_method"` // 配送方式 1:直接发货到收获地址 2云仓
CustomerMark *string `gorm:"-" json:"customer_mark"` // 客户备注
Mark *string `gorm:"-" json:"mark"` // 后台订单备注
AddressInfo *string `gorm:"-" json:"address_info"` // 详细地址信息JSON
IsSup *int64 `gorm:"-" json:"is_sup"` // 0不是补货 1是补货
Status *int64 `gorm:"-" json:"status"` // 状态位0未支付1部分支付2支付完成3部分生产4部分生产完成5全部生产6全部生产完成7部分发货8发货完成9完成订单10取消订单11:退款中12退款完成13:订单已删除14:订单已关闭)
IsPartPay *int64 `gorm:"-" json:"is_part_pay"` // 是否部分支付01
IsPayCompleted *int64 `gorm:"-" json:"is_pay_completed"` // 是否支付完成01
IsPartProduct *int64 `gorm:"-" json:"is_part_product"` // 是否部分生产01
IsPartProductCompleted *int64 `gorm:"-" json:"is_part_product_completed"` // 是否部分生产完成01
IsAllProduct *int64 `gorm:"-" json:"is_all_product"` // 是否全部生产01
IsAllProductCompleted *int64 `gorm:"-" json:"is_all_product_completed"` // 是否全部生产完成01
IsPartDelivery *int64 `gorm:"-" json:"is_part_delivery"` // 是否部分发货01
IsDeliveryCompleted *int64 `gorm:"-" json:"is_delivery_completed"` // 是否发货完成01
IsComplated *int64 `gorm:"-" json:"is_complated"` // 是否完成订单01
IsCancel *int64 `gorm:"-" json:"is_cancel"` // 是否取消订单01
IsRefunding *int64 `gorm:"-" json:"is_refunding"` // 是否退款中01
IsRefunded *int64 `gorm:"-" json:"is_refunded"` // 是否退款完成01
IsDeleted *int64 `gorm:"-" json:"is_deleted"` // 是否删除01
RefundReasonId *int64 `gorm:"-" json:"refund_reason_id"` // 取消订单原因ID
RefundReason *string `gorm:"-" json:"refund_reason"` // 取消订单原因
TsTime *time.Time `gorm:"-" json:"ts_time"` //
IsSure *int64 `gorm:"-" json:"is_sure"` // 是否确认订单 1确认0未确认
DeliverSn *string `gorm:"-" json:"deliver_sn"` // 发货单号
EmailTime *int64 `gorm:"-" json:"email_time"` // 邮件发送时间
Id int64 `gorm:"primary_key;default:'0';" json:"id"` //
Sn *string `gorm:"unique_key;default:'';" json:"sn"` // 订单编号 FS211224OL2XDKNP
UserId *int64 `gorm:"index;default:'0';" json:"user_id"` //
SellerUserId *int64 `gorm:"default:'0';" json:"seller_user_id"` //
TotalAmount *int64 `gorm:"default:'0';" json:"total_amount"` // 总价
PayedAmount *int64 `gorm:"default:'0';" json:"payed_amount"` // 已支付金额
PayMethod *int64 `gorm:"default:'0';" json:"pay_method"` // 支付方式 1paypal 2strip
Ctime *int64 `gorm:"default:'0';" json:"ctime"` //
Utime *int64 `gorm:"default:'0';" json:"utime"` //
Ptime *int64 `gorm:"default:'0';" json:"ptime"` //
AddressId *int64 `gorm:"index;default:'0';" json:"address_id"` // 地址ID或者云仓ID
DeliveryMethod *int64 `gorm:"default:'0';" json:"delivery_method"` // 配送方式 1:直接发货到收获地址 2云仓
CustomerMark *string `gorm:"default:'';" json:"customer_mark"` //
Mark *string `gorm:"default:'';" json:"mark"` // 后台订单备注
AddressInfo *string `gorm:"default:'';" json:"address_info"` // 详细地址信息JSON
IsSup *int64 `gorm:"default:'0';" json:"is_sup"` // 0不是补货 1是补货
Status *int64 `gorm:"default:'0';" json:"status"` // 状态位0未支付1部分支付2支付完成3部分生产4部分生产完成5全部生产6全部生产完成7部分发货8发货完成9完成订单10取消订单11:退款中12退款完成13:订单已删除14:订单已关闭)
IsPartPay *int64 `gorm:"default:'0';" json:"is_part_pay"` // 是否部分支付01
IsPayCompleted *int64 `gorm:"default:'0';" json:"is_pay_completed"` // 是否支付完成01
IsPartProduct *int64 `gorm:"default:'0';" json:"is_part_product"` // 是否部分生产01
IsPartProductCompleted *int64 `gorm:"default:'0';" json:"is_part_product_completed"` // 是否部分生产完成01
IsAllProduct *int64 `gorm:"default:'0';" json:"is_all_product"` // 是否全部生产01
IsAllProductCompleted *int64 `gorm:"default:'0';" json:"is_all_product_completed"` // 是否全部生产完成01
IsPartDelivery *int64 `gorm:"default:'0';" json:"is_part_delivery"` // 是否部分发货01
IsDeliveryCompleted *int64 `gorm:"default:'0';" json:"is_delivery_completed"` // 是否发货完成01
IsComplated *int64 `gorm:"default:'0';" json:"is_complated"` // 是否完成订单01
IsCancel *int64 `gorm:"default:'0';" json:"is_cancel"` // 是否取消订单01
IsRefunding *int64 `gorm:"default:'0';" json:"is_refunding"` // 是否退款中01
IsRefunded *int64 `gorm:"default:'0';" json:"is_refunded"` // 是否退款完成01
IsDeleted *int64 `gorm:"default:'0';" json:"is_deleted"` // 是否删除01
RefundReasonId *int64 `gorm:"default:'0';" json:"refund_reason_id"` //
RefundReason *string `gorm:"default:'';" json:"refund_reason"` //
TsTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ts_time"` //
IsSure *int64 `gorm:"default:'0';" json:"is_sure"` // 是否确认订单 1确认0未确认
DeliverSn *string `gorm:"default:'';" json:"deliver_sn"` // 发货单号
EmailTime *int64 `gorm:"default:'0';" json:"email_time"` // 邮件发送时间
}
type FsOrderModel struct{ db *gorm.DB }

View File

@ -0,0 +1,17 @@
package model
import (
"gorm.io/gorm"
)
// fs_order_remark 订单备注表
type FsOrderRemark struct {
Id int64 `gorm:"primary_key;default:'0';" json:"id"` // id
OrderId *int64 `gorm:"index;default:'0';" json:"order_id"` // 订单id
Remark *string `gorm:"default:'';" json:"remark"` // 订单备注
AdminId *int64 `gorm:"default:'0';" json:"admin_id"` // 后台操作人员
Ctime *int64 `gorm:"default:'0';" json:"ctime"` // 添加时间
}
type FsOrderRemarkModel struct{ db *gorm.DB }
func NewFsOrderRemarkModel(db *gorm.DB) *FsOrderRemarkModel { return &FsOrderRemarkModel{db} }

View File

@ -0,0 +1,2 @@
package model
// TODO: 使用model的属性做你想做的

View File

@ -4,22 +4,23 @@ import (
"gorm.io/gorm"
)
// fs_pay 支付记录
type FsPay struct {
Id int64 `gorm:"primary_key" json:"id"` //
UserId *int64 `gorm:"-" json:"user_id"` // 用户id
OrderNumber *string `gorm:"-" json:"order_number"` // 订单编号
TradeNo *string `gorm:"-" json:"trade_no"` // 第三方支付编号
PayAmount *int64 `gorm:"-" json:"pay_amount"` // 支付金额 (分)
PayStatus *int64 `gorm:"-" json:"pay_status"` // 支付状态 0 不成功 1 成功
IsRefund *int64 `gorm:"-" json:"is_refund"` // 是否退款 0 未退款 1退款
PaymentMethod *int64 `gorm:"-" json:"payment_method"` // 支付方式 1 stripe 2 paypal
PayStage *int64 `gorm:"-" json:"pay_stage"` // 支付阶段 1首付 2尾款
OrderSource *int64 `gorm:"-" json:"order_source"` // 订单来源 1pc
PayTime *int64 `gorm:"-" json:"pay_time"` // 支付时间
CreatedAt *int64 `gorm:"-" json:"created_at"` // 创建时间
UpdatedAt *int64 `gorm:"-" json:"updated_at"` // 更新时间
CardNo *string `gorm:"-" json:"card_no"` // 卡后4位
Brand *string `gorm:"-" json:"brand"` // 银行品牌
Id int64 `gorm:"primary_key;default:'0';" json:"id"` //
UserId *int64 `gorm:"index;default:'0';" json:"user_id"` // 用户id
OrderNumber *string `gorm:"default:'';" json:"order_number"` // 订单编号
TradeNo *string `gorm:"index;default:'';" json:"trade_no"` // 第三方支付编号
PayAmount *int64 `gorm:"default:'0';" json:"pay_amount"` // 支付金额 (分)
PayStatus *int64 `gorm:"default:'0';" json:"pay_status"` // 支付状态 0 不成功 1 成功
IsRefund *int64 `gorm:"default:'0';" json:"is_refund"` // 是否退款 0 未退款 1退款
PaymentMethod *int64 `gorm:"default:'0';" json:"payment_method"` // 支付方式 1 stripe 2 paypal
PayStage *int64 `gorm:"default:'0';" json:"pay_stage"` // 支付阶段 1首付 2尾款
OrderSource *int64 `gorm:"default:'1';" json:"order_source"` // 订单来源 1pc
PayTime *int64 `gorm:"default:'0';" json:"pay_time"` // 支付时间
CreatedAt *int64 `gorm:"default:'0';" json:"created_at"` // 创建时间
UpdatedAt *int64 `gorm:"default:'0';" json:"updated_at"` // 更新时间
CardNo *string `gorm:"default:'';" json:"card_no"` // 卡后4位
Brand *string `gorm:"default:'';" json:"brand"` // 银行品牌
}
type FsPayModel struct{ db *gorm.DB }

View File

@ -0,0 +1,38 @@
package model
import (
"gorm.io/gorm"
)
// fs_product_copy1 产品表
type FsProductCopy1 struct {
Id uint64 `gorm:"primary_key;default:'0';" json:"id"` //
Sn *string `gorm:"unique_key;default:'';" json:"sn"` // 商品编号 P98f087j
Type *int64 `gorm:"default:'0';" json:"type"` // 分类ID
Title *string `gorm:"default:'';" json:"title"` // 名称
TitleCn *string `gorm:"default:'';" json:"title_cn"` // 中文名称
Cover *string `gorm:"default:'';" json:"cover"` // 封面图
Imgs *string `gorm:"default:'';" json:"imgs"` // 一个或多个介绍图或视频
Keywords *string `gorm:"default:'';" json:"keywords"` // 关键字
Intro *string `gorm:"default:'';" json:"intro"` // 简要描述
Sort *int64 `gorm:"default:'0';" json:"sort"` // 排序
SelledNum *int64 `gorm:"default:'0';" json:"selled_num"` // 已卖数量
Ctime *int64 `gorm:"default:'0';" json:"ctime"` //
View *int64 `gorm:"default:'0';" json:"view"` // 浏览量
SizeIds *string `gorm:"default:'';" json:"size_ids"` //
MaterialIds *string `gorm:"default:'';" json:"material_ids"` // 材质 1,2,3
TagIds *string `gorm:"default:'';" json:"tag_ids"` //
Status *int64 `gorm:"default:'0';" json:"status"` // 状态位 是否上架 是否推荐 是否热销 是否环保 是否可加入微波炉 是否刪除
ProduceDays *uint64 `gorm:"default:'0';" json:"produce_days"` // 生产天数
DeliveryDays *uint64 `gorm:"default:'0';" json:"delivery_days"` // 运送天数
CoverImg *string `gorm:"default:'';" json:"cover_img"` // 背景图
IsShelf *int64 `gorm:"default:'1';" json:"is_shelf"` // 是否上架
IsRecommend *int64 `gorm:"default:'1';" json:"is_recommend"` // 是否推荐
IsHot *int64 `gorm:"default:'1';" json:"is_hot"` // 是否热销
IsProtection *int64 `gorm:"default:'1';" json:"is_protection"` // 是否环保
IsMicrowave *int64 `gorm:"default:'1';" json:"is_microwave"` // 是否可微波炉
IsDel *int64 `gorm:"default:'0';" json:"is_del"` // 是否删除
}
type FsProductCopy1Model struct{ db *gorm.DB }
func NewFsProductCopy1Model(db *gorm.DB) *FsProductCopy1Model { return &FsProductCopy1Model{db} }

Some files were not shown because too many files have changed in this diff Show More