fix
This commit is contained in:
parent
53a3490837
commit
9d7022ec11
@ -2,16 +2,16 @@ package gorm
|
|||||||
|
|
||||||
type FsProductPrice struct {
|
type FsProductPrice struct {
|
||||||
Id int64 `gorm:"primary_key" json:"id"`
|
Id int64 `gorm:"primary_key" json:"id"`
|
||||||
Sn string `gorm:"default:''" json:"sn"` // 唯一编码
|
Sn *string `gorm:"default:''" json:"sn"` // 唯一编码
|
||||||
Title string `gorm:"default:''" json:"title"` // 标题描述
|
Title *string `gorm:"default:''" json:"title"` // 标题描述
|
||||||
ProductId int64 `gorm:"default:0" json:"product_id"` // 产品ID
|
ProductId *int64 `gorm:"default:0" json:"product_id"` // 产品ID
|
||||||
MaterialId int64 `gorm:"default:0" json:"material_id"` // 材质ID
|
MaterialId *int64 `gorm:"default:0" json:"material_id"` // 材质ID
|
||||||
SizeId int64 `gorm:"default:0" json:"size_id"` // 尺寸ID
|
SizeId *int64 `gorm:"default:0" json:"size_id"` // 尺寸ID
|
||||||
EachBoxNum int64 `gorm:"default:0" json:"each_box_num"` // 每一箱的个数
|
EachBoxNum *int64 `gorm:"default:0" json:"each_box_num"` // 每一箱的个数
|
||||||
EachBoxWeight float64 `gorm:"default:0" json:"each_box_weight"` // 每一箱的重量 单位KG
|
EachBoxWeight *float64 `gorm:"default:0" json:"each_box_weight"` // 每一箱的重量 单位KG
|
||||||
MinBuyNum int64 `gorm:"default:0" json:"min_buy_num"` // 最少购买量
|
MinBuyNum *int64 `gorm:"default:0" json:"min_buy_num"` // 最少购买量
|
||||||
StepNum string `gorm:"default:''" json:"step_num"` // 数量阶梯 eg:10,20,30
|
StepNum *string `gorm:"default:''" json:"step_num"` // 数量阶梯 eg:10,20,30
|
||||||
StepPrice string `gorm:"default:''" json:"step_price"` // 价格阶梯 eg:100,50,25
|
StepPrice *string `gorm:"default:''" json:"step_price"` // 价格阶梯 eg:100,50,25
|
||||||
Status int64 `gorm:"default:1" json:"status"` // 是否可用
|
Status *int64 `gorm:"default:1" json:"status"` // 是否可用
|
||||||
IsDefault int64 `gorm:"default:0" json:"is_default"` // 是否默认
|
IsDefault *int64 `gorm:"default:0" json:"is_default"` // 是否默认
|
||||||
}
|
}
|
||||||
|
@ -1,69 +1,14 @@
|
|||||||
package model
|
package gorm
|
||||||
|
|
||||||
import (
|
type FsProductSize struct {
|
||||||
"context"
|
Id int64 `gorm:"primary_key" json:"id"`
|
||||||
"fmt"
|
ProductId *int64 `gorm:"default:0" json:"product_id"` // 产品ID
|
||||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
Title *string `gorm:"default:''" json:"title"` // 标题 10*10*20
|
||||||
"strings"
|
Cover *string `gorm:"default:''" json:"cover"` // 封面图
|
||||||
)
|
CoverImg *string `gorm:"default:''" json:"cover_img"` // 背景图
|
||||||
|
Capacity *string `gorm:"default:''" json:"capacity"` // 自己填的尺寸名称
|
||||||
var _ FsProductSizeModel = (*customFsProductSizeModel)(nil)
|
Status *int64 `gorm:"default:1" json:"status"` // 状态位 1显示 0删除
|
||||||
|
Sort *int64 `gorm:"default:50" json:"sort"` // 排序
|
||||||
type (
|
Remark *string `gorm:"default:''" json:"remark"` // 备注信息
|
||||||
// FsProductSizeModel is an interface to be customized, add more methods here,
|
PartsCanDeleted *int64 `gorm:"default:1" json:"parts_can_deleted"` // 配件是否可移除 1是0否
|
||||||
// and implement the added methods in customFsProductSizeModel.
|
|
||||||
FsProductSizeModel interface {
|
|
||||||
fsProductSizeModel
|
|
||||||
CountByStatus(ctx context.Context, status int) (total int, err error)
|
|
||||||
GetAllByProductIds(ctx context.Context, productIds []string, sort string) (resp []FsProductSize, err error)
|
|
||||||
GetAllByIds(ctx context.Context, ids []string, sort string) (resp []FsProductSize, err error)
|
|
||||||
}
|
|
||||||
|
|
||||||
customFsProductSizeModel struct {
|
|
||||||
*defaultFsProductSizeModel
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// NewFsProductSizeModel returns a model for the database table.
|
|
||||||
func NewFsProductSizeModel(conn sqlx.SqlConn) FsProductSizeModel {
|
|
||||||
return &customFsProductSizeModel{
|
|
||||||
defaultFsProductSizeModel: newFsProductSizeModel(conn),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *defaultFsProductSizeModel) CountByStatus(ctx context.Context, status int) (total int, err error) {
|
|
||||||
query := fmt.Sprintf("select %s from %s where `status` = ? limit 1", "count(*) as num", m.table)
|
|
||||||
err = m.conn.QueryRowCtx(ctx, &total, query, status)
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
func (m *defaultFsProductSizeModel) GetAllByProductIds(ctx context.Context, productIds []string, sort string) (resp []FsProductSize, err error) {
|
|
||||||
query := fmt.Sprintf("select %s from %s where `product_id` in(?) and `status` = ? ", fsProductSizeRows, m.table)
|
|
||||||
switch sort {
|
|
||||||
case "sort-asc":
|
|
||||||
query = fmt.Sprintf("%s order by `sort` ASC", query)
|
|
||||||
case "sort-desc":
|
|
||||||
query = fmt.Sprintf("%s order by `sort` DESC", query)
|
|
||||||
}
|
|
||||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(productIds, ","), 1)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *defaultFsProductSizeModel) GetAllByIds(ctx context.Context, ids []string, sort string) (resp []FsProductSize, err error) {
|
|
||||||
query := fmt.Sprintf("select %s from %s where `id` in (?) and `status` = ? ", fsProductSizeRows, m.table)
|
|
||||||
switch sort {
|
|
||||||
case "sort-asc":
|
|
||||||
query = fmt.Sprintf("%s order by `sort` ASC", query)
|
|
||||||
case "sort-desc":
|
|
||||||
query = fmt.Sprintf("%s order by `sort` DESC", query)
|
|
||||||
}
|
|
||||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(ids, ","), 1)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -1,40 +1,8 @@
|
|||||||
package model
|
package gorm
|
||||||
|
|
||||||
import (
|
type FsProductTemplateTags struct {
|
||||||
"context"
|
Id int64 `gorm:"primary_key" json:"id"` // ID
|
||||||
"fmt"
|
Title *string `gorm:"default:''" json:"title"` // 标题
|
||||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
Status *int64 `gorm:"default:1" json:"status"` // 状态 1:可用 0不可用
|
||||||
)
|
CreateAt *int64 `gorm:"default:0" json:"create_at"` // 创建时间
|
||||||
|
|
||||||
var _ FsProductTemplateTagsModel = (*customFsProductTemplateTagsModel)(nil)
|
|
||||||
|
|
||||||
type (
|
|
||||||
// FsProductTemplateTagsModel is an interface to be customized, add more methods here,
|
|
||||||
// and implement the added methods in customFsProductTemplateTagsModel.
|
|
||||||
FsProductTemplateTagsModel interface {
|
|
||||||
fsProductTemplateTagsModel
|
|
||||||
ListByIds(ctx context.Context, ids []string) (resp []FsProductTemplateTags, err error)
|
|
||||||
}
|
|
||||||
|
|
||||||
customFsProductTemplateTagsModel struct {
|
|
||||||
*defaultFsProductTemplateTagsModel
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// NewFsProductTemplateTagsModel returns a model for the database table.
|
|
||||||
func NewFsProductTemplateTagsModel(conn sqlx.SqlConn) FsProductTemplateTagsModel {
|
|
||||||
return &customFsProductTemplateTagsModel{
|
|
||||||
defaultFsProductTemplateTagsModel: newFsProductTemplateTagsModel(conn),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *defaultFsProductTemplateTagsModel) ListByIds(ctx context.Context, ids []string) (resp []FsProductTemplateTags, err error) {
|
|
||||||
if len(ids) == 0 {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
query := fmt.Sprintf("select %s from %s where `id` in (?) ", fsProductTemplateTagsRows, m.table)
|
|
||||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, ids)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -1,72 +1,20 @@
|
|||||||
package model
|
package gorm
|
||||||
|
|
||||||
import (
|
type FsProductTemplateV2 struct {
|
||||||
"context"
|
Id int64 `gorm:"primary_key" json:"id"`
|
||||||
"fmt"
|
ProductId *int64 `gorm:"default:0" json:"product_id"` // 产品ID
|
||||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
ModelId *int64 `gorm:"default:0" json:"model_id"` // 模型ID
|
||||||
"strings"
|
Title *string `gorm:"default:''" json:"title"` // 模板(sku),预留字段
|
||||||
)
|
Name *string `gorm:"default:''" json:"name"` // 名称
|
||||||
|
CoverImg *string `gorm:"default:''" json:"cover_img"` // 模板背景图
|
||||||
var _ FsProductTemplateV2Model = (*customFsProductTemplateV2Model)(nil)
|
TemplateInfo *string `gorm:"default:''" json:"template_info"` // 模板详情
|
||||||
|
MaterialImg *string `gorm:"default:''" json:"material_img"` // 合成好的贴图
|
||||||
type (
|
Sort *int64 `gorm:"default:0" json:"sort"` // 排序
|
||||||
// FsProductTemplateV2Model is an interface to be customized, add more methods here,
|
LogoWidth *int64 `gorm:"default:0" json:"logo_width"` // logo图最大宽度
|
||||||
// and implement the added methods in customFsProductTemplateV2Model.
|
LogoHeight *int64 `gorm:"default:0" json:"logo_height"` // logo图最大高度
|
||||||
FsProductTemplateV2Model interface {
|
IsPublic *int64 `gorm:"default:0" json:"is_public"` // 是否可公用(1:可以,0:不可以)
|
||||||
fsProductTemplateV2Model
|
Status *int64 `gorm:"default:1" json:"status"` // 状态1正常 2异常
|
||||||
FindAllByCondition(ctx context.Context, productIds []string) (resp []FsProductTemplateV2, err error)
|
Ctime *int64 `gorm:"default:0" json:"ctime"` // 添加时间
|
||||||
FindAllByModelIdsProduct(ctx context.Context, modelIds []string, productId int64, sort int) (resp []FsProductTemplateV2, err error)
|
Tag *string `gorm:"default:''" json:"tag"` // 标签(用户自填)
|
||||||
FindAllByModelIds(ctx context.Context, modelIds []string, sort int) (resp []FsProductTemplateV2, err error)
|
IsDel *int64 `gorm:"default:0" json:"is_del"` // 是否删除 1删除
|
||||||
}
|
|
||||||
|
|
||||||
customFsProductTemplateV2Model struct {
|
|
||||||
*defaultFsProductTemplateV2Model
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// NewFsProductTemplateV2Model returns a model for the database table.
|
|
||||||
func NewFsProductTemplateV2Model(conn sqlx.SqlConn) FsProductTemplateV2Model {
|
|
||||||
return &customFsProductTemplateV2Model{
|
|
||||||
defaultFsProductTemplateV2Model: newFsProductTemplateV2Model(conn),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *defaultFsProductTemplateV2Model) FindAllByCondition(ctx context.Context, productIds []string) (resp []FsProductTemplateV2, err error) {
|
|
||||||
query := fmt.Sprintf("select %s from %s where `id` in (?) and `is_del` = ? and `status` = ?", fsProductTemplateV2Rows, m.table)
|
|
||||||
if err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(productIds, ","), 0, 1); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
func (m *defaultFsProductTemplateV2Model) FindAllByModelIdsProduct(ctx context.Context, modelIds []string, productId int64, sort int) (resp []FsProductTemplateV2, err error) {
|
|
||||||
if len(modelIds) == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
query := fmt.Sprintf("select %s from %s where `model_id` in (?) and `product_id` = ? and `is_del` = ? and `status` = ?", fsProductTemplateV2Rows, m.table)
|
|
||||||
switch sort {
|
|
||||||
case 1:
|
|
||||||
query = fmt.Sprintf("%s order by `sort` ASC", query)
|
|
||||||
case 2:
|
|
||||||
query = fmt.Sprintf("%s order by `sort` DESC", query)
|
|
||||||
}
|
|
||||||
if err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(modelIds, ","), productId, 0, 1); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *defaultFsProductTemplateV2Model) FindAllByModelIds(ctx context.Context, modelIds []string, sort int) (resp []FsProductTemplateV2, err error) {
|
|
||||||
if len(modelIds) == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
query := fmt.Sprintf("select %s from %s where `model_id` in (?) and `is_del` = ? and `status` = ?", fsProductTemplateV2Rows, m.table)
|
|
||||||
switch sort {
|
|
||||||
case 1:
|
|
||||||
query = fmt.Sprintf("%s order by `sort` ASC", query)
|
|
||||||
case 2:
|
|
||||||
query = fmt.Sprintf("%s order by `sort` DESC", query)
|
|
||||||
}
|
|
||||||
if err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(modelIds, ","), 0, 1); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,16 @@
|
|||||||
package model
|
package gorm
|
||||||
|
|
||||||
import (
|
type FsQrcodeSet struct {
|
||||||
"context"
|
Id int64 `gorm:"primary_key" json:"id"` // id
|
||||||
"fmt"
|
Name *string `gorm:"default:''" json:"name"` // 二维码组件名称
|
||||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
Size *int64 `gorm:"default:0" json:"size"` // 二维码内容尺寸
|
||||||
)
|
IndexX *int64 `gorm:"default:0" json:"index_x"` // x偏移量
|
||||||
|
IndexY *int64 `gorm:"default:0" json:"index_y"` // y偏移量
|
||||||
var _ FsQrcodeSetModel = (*customFsQrcodeSetModel)(nil)
|
SvgWebsite *string `gorm:"default:''" json:"svg_website"` // website d数据
|
||||||
|
SvgInstagram *string `gorm:"default:''" json:"svg_instagram"` // svg instagram d数据
|
||||||
type (
|
SvgFacebook *string `gorm:"default:''" json:"svg_facebook"` // svg facebook d数据
|
||||||
// FsQrcodeSetModel is an interface to be customized, add more methods here,
|
Status *int64 `gorm:"default:1" json:"status"` // 状态 1正常 1删除
|
||||||
// and implement the added methods in customFsQrcodeSetModel.
|
AdminId *int64 `gorm:"default:0" json:"admin_id"` // 操作人
|
||||||
FsQrcodeSetModel interface {
|
Ctime *int64 `gorm:"default:0" json:"ctime"` // 添加时间
|
||||||
fsQrcodeSetModel
|
Utime *int64 `gorm:"default:0" json:"utime"` // 更新时间
|
||||||
GetAll(ctx context.Context) (resp []FsQrcodeSet, err error)
|
|
||||||
}
|
|
||||||
|
|
||||||
customFsQrcodeSetModel struct {
|
|
||||||
*defaultFsQrcodeSetModel
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// NewFsQrcodeSetModel returns a model for the database table.
|
|
||||||
func NewFsQrcodeSetModel(conn sqlx.SqlConn) FsQrcodeSetModel {
|
|
||||||
return &customFsQrcodeSetModel{
|
|
||||||
defaultFsQrcodeSetModel: newFsQrcodeSetModel(conn),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *defaultFsQrcodeSetModel) GetAll(ctx context.Context) (resp []FsQrcodeSet, err error) {
|
|
||||||
query := fmt.Sprintf("select %s from %s where `status` = ?", fsQrcodeSetRows, m.table)
|
|
||||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, 1)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,9 @@
|
|||||||
package model
|
package gorm
|
||||||
|
|
||||||
import (
|
type FsStandardLogo struct {
|
||||||
"context"
|
Id int64 `gorm:"primary_key" json:"id"` // ID
|
||||||
"fmt"
|
Name *string `gorm:"default:''" json:"name"` // logo名称
|
||||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
Image *string `gorm:"default:''" json:"image"` // 图片地址
|
||||||
)
|
Ctime *int64 `gorm:"default:0" json:"ctime"` // 添加时间
|
||||||
|
Status *int64 `gorm:"default:1" json:"status"` // 状态 1正常 0删除
|
||||||
var _ FsStandardLogoModel = (*customFsStandardLogoModel)(nil)
|
|
||||||
|
|
||||||
type (
|
|
||||||
// FsStandardLogoModel is an interface to be customized, add more methods here,
|
|
||||||
// and implement the added methods in customFsStandardLogoModel.
|
|
||||||
FsStandardLogoModel interface {
|
|
||||||
fsStandardLogoModel
|
|
||||||
GetAll(ctx context.Context) (resp []FsStandardLogo, err error)
|
|
||||||
}
|
|
||||||
|
|
||||||
customFsStandardLogoModel struct {
|
|
||||||
*defaultFsStandardLogoModel
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// NewFsStandardLogoModel returns a model for the database table.
|
|
||||||
func NewFsStandardLogoModel(conn sqlx.SqlConn) FsStandardLogoModel {
|
|
||||||
return &customFsStandardLogoModel{
|
|
||||||
defaultFsStandardLogoModel: newFsStandardLogoModel(conn),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *defaultFsStandardLogoModel) GetAll(ctx context.Context) (resp []FsStandardLogo, err error) {
|
|
||||||
query := fmt.Sprintf("select %s from %s where `status` = ? ", fsStandardLogoRows, m.table)
|
|
||||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, 1)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -1,48 +1,15 @@
|
|||||||
package model
|
package gorm
|
||||||
|
|
||||||
import (
|
type FsTags struct {
|
||||||
"context"
|
Id int64 `gorm:"primary_key" json:"id"` // ID
|
||||||
"fmt"
|
Title *string `gorm:"default:''" json:"title"` // 标题
|
||||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
Level *int64 `gorm:"default:0" json:"level"` // 层级、分类 1 => 二维码分类
|
||||||
"strings"
|
ClickNum *int64 `gorm:"default:0" json:"click_num"` // 点击次数
|
||||||
)
|
Sort *int64 `gorm:"default:0" json:"sort"` // 排序(从大到小)
|
||||||
|
CreateAt *int64 `gorm:"default:0" json:"create_at"` // 创建时间
|
||||||
var _ FsTagsModel = (*customFsTagsModel)(nil)
|
Icon *string `gorm:"default:''" json:"icon"` // 标签图标
|
||||||
|
Status *int64 `gorm:"default:1" json:"status"` // 状态 1:可用
|
||||||
type (
|
Description *string `gorm:"default:''" json:"description"` // 介绍 Seo
|
||||||
// FsTagsModel is an interface to be customized, add more methods here,
|
RecommendProduct *string `gorm:"default:''" json:"recommend_product"` // 推荐产品id例如: 1,3,4,5
|
||||||
// and implement the added methods in customFsTagsModel.
|
RecommendProductSort *string `gorm:"default:''" json:"recommend_product_sort"` // 推荐排序例如:1324
|
||||||
FsTagsModel interface {
|
|
||||||
fsTagsModel
|
|
||||||
GetAllByLevel(ctx context.Context, level int) (resp []FsTags, err error)
|
|
||||||
GetAllByIds(ctx context.Context, ids []string) (resp []FsTags, err error)
|
|
||||||
}
|
|
||||||
|
|
||||||
customFsTagsModel struct {
|
|
||||||
*defaultFsTagsModel
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// NewFsTagsModel returns a model for the database table.
|
|
||||||
func NewFsTagsModel(conn sqlx.SqlConn) FsTagsModel {
|
|
||||||
return &customFsTagsModel{
|
|
||||||
defaultFsTagsModel: newFsTagsModel(conn),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *defaultFsTagsModel) GetAllByLevel(ctx context.Context, level int) (resp []FsTags, err error) {
|
|
||||||
query := fmt.Sprintf("select %s from %s where `level` = ? and `status` = ?", fsTagsRows, m.table)
|
|
||||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, level, 1)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
func (m *defaultFsTagsModel) GetAllByIds(ctx context.Context, ids []string) (resp []FsTags, err error) {
|
|
||||||
query := fmt.Sprintf("select %s from %s where `id` in (?) and `status` = ?", fsTagsRows, m.table)
|
|
||||||
err = m.conn.QueryRowsCtx(ctx, &resp, query, strings.Join(ids, ","), 1)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
@ -1,36 +1,30 @@
|
|||||||
package model
|
package gorm
|
||||||
|
|
||||||
import (
|
type FsUser struct {
|
||||||
"context"
|
Id int64 `gorm:"primary_key" json:"id"` // ID
|
||||||
"fmt"
|
FaceId int64 `gorm:"default:0" json:"face_id"` // facebook的userid
|
||||||
|
Sub int64 `gorm:"default:0" json:"sub"` // google的sub
|
||||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
FirstName string `gorm:"default:''" json:"first_name"` // FirstName
|
||||||
)
|
LastName string `gorm:"default:''" json:"last_name"` // LastName
|
||||||
|
Username string `gorm:"default:''" json:"username"` // 用户名
|
||||||
var _ FsUserModel = (*customFsUserModel)(nil)
|
Company string `gorm:"default:''" json:"company"` // 公司名称
|
||||||
|
Mobile string `gorm:"default:''" json:"mobile" ` // 手机号码
|
||||||
type (
|
AuthKey string `gorm:"default:''" json:"auth_key"`
|
||||||
// FsUserModel is an interface to be customized, add more methods here,
|
PasswordHash string `gorm:"default:''" json:"password_hash"`
|
||||||
// and implement the added methods in customFsUserModel.
|
VerificationToken string `gorm:"default:''" json:"verification_token"`
|
||||||
FsUserModel interface {
|
PasswordResetToken string `gorm:"default:''" json:"password_reset_token"`
|
||||||
fsUserModel
|
Email string `gorm:"default:''" json:"email"` // 邮箱
|
||||||
UpdateVerificationToken(ctx context.Context, userid int64, token string) error
|
Type int64 `gorm:"default:1" json:"type"` // 1普通餐厅 2连锁餐厅
|
||||||
}
|
Status int64 `gorm:"default:1" json:"status"` // 1正常 0不正常
|
||||||
|
IsDel int64 `gorm:"default:0" json:"is_del"` // 是否删除 1删除
|
||||||
customFsUserModel struct {
|
CreatedAt int64 `gorm:"default:0" json:"created_at"` // 添加时间
|
||||||
*defaultFsUserModel
|
UpdatedAt int64 `gorm:"default:0" json:"updated_at"` // 更新时间
|
||||||
}
|
IsOrderStatusEmail int64 `gorm:"default:0" json:"is_order_status_email"` // 订单状态改变时是否接收邮件
|
||||||
)
|
IsEmailAdvertisement int64 `gorm:"default:0" json:"is_email_advertisement"` // 是否接收邮件广告
|
||||||
|
IsOrderStatusPhone int64 `gorm:"default:0" json:"is_order_status_phone"` // 订单状态改变是是否接收电话
|
||||||
// NewFsUserModel returns a model for the database table.
|
IsPhoneAdvertisement int64 `gorm:"default:0" json:"is_phone_advertisement"` // 是否接收短信广告
|
||||||
func NewFsUserModel(conn sqlx.SqlConn) FsUserModel {
|
IsOpenRender int64 `gorm:"default:0" json:"is_open_render"` // 是否打开个性化渲染(1:开启,0:关闭)
|
||||||
return &customFsUserModel{
|
IsThousandFace int64 `gorm:"default:0" json:"is_thousand_face"` // 是否已经存在千人千面(1:存在,0:不存在)
|
||||||
defaultFsUserModel: newFsUserModel(conn),
|
IsLowRendering int64 `gorm:"default:0" json:"is_low_rendering"` // 是否开启低渲染模型渲染
|
||||||
}
|
IsRemoveBg int64 `gorm:"default:1" json:"is_remove_bg"` // 用户上传logo是否去除背景
|
||||||
}
|
|
||||||
|
|
||||||
func (m *defaultFsUserModel) UpdateVerificationToken(ctx context.Context, userid int64, verificationToken string) error {
|
|
||||||
query := fmt.Sprintf("update %s set `verification_token` = ? where `id` = ?", m.table)
|
|
||||||
_, err := m.conn.ExecCtx(ctx, query, verificationToken, userid)
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user