Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop
This commit is contained in:
commit
65dc3bf6ab
6
constants/blm_service.go
Normal file
6
constants/blm_service.go
Normal file
|
@ -0,0 +1,6 @@
|
|||
package constants
|
||||
|
||||
const (
|
||||
BLMServiceUrlLogoCombine string = "/LogoCombine"
|
||||
BLMServiceUrlLogoRemovebg string = "/removebg"
|
||||
)
|
|
@ -4,17 +4,16 @@ type RABBIT_MQ string
|
|||
|
||||
// 消息队列队列名
|
||||
const (
|
||||
//组装渲染数据队列
|
||||
RABBIT_MQ_ASSEMBLE_RENDER_DATA RABBIT_MQ = "RABBIT_MQ_ASSEMBLE_RENDER_DATA"
|
||||
//渲染结果数据队列
|
||||
RABBIT_MQ_RENDER_RESULT_DATA RABBIT_MQ = "RABBIT_MQ_RENDER_RESULT_DATA"
|
||||
//原来发送到unity渲染的队列
|
||||
RABBIT_MQ_TO_UNITY RABBIT_MQ = "newTaskQueue"
|
||||
//组装渲染数据队列
|
||||
/*RABBIT_MQ_ASSEMBLE_RENDER_DATA RABBIT_MQ = "RABBIT_MQ_ASSEMBLE_RENDER_DATA"
|
||||
//渲染结果数据队列
|
||||
RABBIT_MQ_RENDER_RESULT_DATA RABBIT_MQ = "RABBIT_MQ_RENDER_RESULT_DATA"*/
|
||||
)
|
||||
|
||||
// 队列列表
|
||||
var MqQueueArr = []RABBIT_MQ{
|
||||
RABBIT_MQ_ASSEMBLE_RENDER_DATA,
|
||||
RABBIT_MQ_RENDER_RESULT_DATA,
|
||||
RABBIT_MQ_TO_UNITY,
|
||||
/*
|
||||
RABBIT_MQ_ASSEMBLE_RENDER_DATA,
|
||||
RABBIT_MQ_RENDER_RESULT_DATA,
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -8,8 +8,10 @@ const (
|
|||
WEBSOCKET_UNAUTH = "WEBSOCKET_UNAUTH"
|
||||
//ws连接成功
|
||||
WEBSOCKET_CONNECT_SUCCESS = "WEBSOCKET_CONNECT_SUCCESS"
|
||||
//渲染前数据组装
|
||||
WEBSOCKET_RENDER_IMAGE_ASSEMBLE = "WEBSOCKET_RENDER_IMAGE_ASSEMBLE"
|
||||
//请求恢复为上次连接的标识
|
||||
WEBSOCKET_REQUEST_REUSE_LAST_CONNECT = "WEBSOCKET_REQUEST_REUSE_LAST_CONNECT"
|
||||
//请求恢复为上次连接的标识错误
|
||||
WEBSOCKET_REQUEST_RESUME_LAST_CONNECT_ERR = "WEBSOCKET_REQUEST_RESUME_LAST_CONNECT_ERR"
|
||||
//图片渲染
|
||||
WEBSOCKET_RENDER_IMAGE = "WEBSOCKET_RENDER_IMAGE"
|
||||
//数据格式错误
|
||||
|
|
24
initalize/service.go
Normal file
24
initalize/service.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package initalize
|
||||
|
||||
import (
|
||||
"fusenapi/service/repositories"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws/session"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Repositories struct {
|
||||
ImageHandle repositories.ImageHandle
|
||||
}
|
||||
|
||||
type NewAllRepositorieData struct {
|
||||
GormDB *gorm.DB
|
||||
BLMServiceUrl *string
|
||||
AwsSession *session.Session
|
||||
}
|
||||
|
||||
func NewAllRepositories(newData *NewAllRepositorieData) *Repositories {
|
||||
return &Repositories{
|
||||
ImageHandle: repositories.NewImageHandle(newData.GormDB, newData.BLMServiceUrl, newData.AwsSession),
|
||||
}
|
||||
}
|
|
@ -9,10 +9,10 @@ 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"` //
|
||||
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"` //
|
||||
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 {
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
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"` //
|
||||
CreatedAt *int64 `gorm:"default:0;" json:"created_at"` // 创建时间
|
||||
UpdatedAt *int64 `gorm:"default:0;" json:"updated_at"` // 更新时间
|
||||
}
|
||||
type FsAuthRuleModel struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -6,14 +6,16 @@ import (
|
|||
|
||||
// fs_canteen_product 餐厅类别产品对应表
|
||||
type FsCanteenProduct struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" 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
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" 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
|
||||
ShowSizeTips *int64 `gorm:"default:0;" json:"show_size_tips"` // 是否显示提示
|
||||
ShowSizeList *int64 `gorm:"default:0;" json:"show_size_list"` // 是否显示规格列表
|
||||
}
|
||||
type FsCanteenProductModel struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
// fs_cart 购物车
|
||||
type FsCart struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // id
|
||||
UserId *int64 `gorm:"index;default:0;" json:"user_id"` //
|
||||
UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户ID
|
||||
ProductId *int64 `gorm:"index;default:0;" json:"product_id"` // 产品ID
|
||||
TemplateId *int64 `gorm:"index;default:0;" json:"template_id"` // 模板ID
|
||||
PriceId *int64 `gorm:"index;default:0;" json:"price_id"` // 价格ID
|
||||
|
@ -17,7 +17,7 @@ type FsCart struct {
|
|||
BuyNum *int64 `gorm:"default:0;" json:"buy_num"` // 购买数量
|
||||
Cover *string `gorm:"default:'';" json:"cover"` // 截图
|
||||
DesignId *int64 `gorm:"index;default:0;" json:"design_id"` // 设计ID
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` //
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||
Status *int64 `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:选中)
|
||||
|
|
|
@ -4,6 +4,7 @@ package gmodel
|
|||
|
||||
import (
|
||||
"context"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type FindOneCartByParamsReq struct {
|
||||
|
@ -94,3 +95,22 @@ func (c *FsCartModel) DeleteCartsByIds(ctx context.Context, ids []int64) ( err e
|
|||
}
|
||||
return c.db.Table(c.name).WithContext(ctx).Model(&FsCart{}).Where("`id` in (?)", ids).Update("status", 0).Error
|
||||
}
|
||||
|
||||
func (c *FsCartModel) RBDeleteCartsByIds(rowBuilder *gorm.DB,ids []int64) ( err error) {
|
||||
if len(ids) == 0 {
|
||||
return
|
||||
}
|
||||
return rowBuilder.Where("`id` in (?)", ids).Update("status", 0).Error
|
||||
}
|
||||
|
||||
func (c *FsCartModel) BuilderTrans(ctx context.Context,selectData []string) *gorm.DB {
|
||||
var rowBuilder = c.db.WithContext(ctx)
|
||||
|
||||
if selectData != nil {
|
||||
rowBuilder = rowBuilder.Select(selectData)
|
||||
} else {
|
||||
rowBuilder = rowBuilder.Select("*")
|
||||
}
|
||||
return rowBuilder
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
type FsCloudRenderLog struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
|
||||
UserId *int64 `gorm:"default:0;" json:"user_id"` // 用户id
|
||||
GuestId *int64 `gorm:"default:0;" json:"guest_id"` // 游客id
|
||||
PostData *string `gorm:"default:'';" json:"post_data"` //
|
||||
PostUrl *string `gorm:"default:'';" json:"post_url"` //
|
||||
Title *string `gorm:"index;default:'';" json:"title"` //
|
||||
|
|
|
@ -11,8 +11,8 @@ type FsContact struct {
|
|||
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"` //
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||
Status *int64 `gorm:"default:0;" json:"status"` // 状态位 是否已处理
|
||||
Mark *string `gorm:"default:'';" json:"mark"` // 后台订单备注
|
||||
}
|
||||
type FsContactModel struct {
|
||||
|
|
|
@ -12,10 +12,10 @@ type FsContactService struct {
|
|||
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"` //
|
||||
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"` //
|
||||
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"` // 处理时间
|
||||
|
|
|
@ -10,10 +10,10 @@ type FsEmailTemplate struct {
|
|||
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"` //
|
||||
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"` //
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||
}
|
||||
type FsEmailTemplateModel struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -13,7 +13,7 @@ type FsFaq struct {
|
|||
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"` //
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||
}
|
||||
type FsFaqModel struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -10,12 +10,12 @@ type FsGerent struct {
|
|||
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"` //
|
||||
PasswordResetToken *string `gorm:"unique_key;default:'';" json:"password_reset_token"` // 加密密码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"` //
|
||||
Icon *string `gorm:"default:'';" json:"icon"` // 标签图标
|
||||
DepartmentId *int64 `gorm:"default:0;" json:"department_id"` // 部门id
|
||||
}
|
||||
type FsGerentModel struct {
|
||||
|
|
29
model/gmodel/fs_logo_cartoon_gen.go
Normal file
29
model/gmodel/fs_logo_cartoon_gen.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
package gmodel
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
// fs_logo_cartoon logo底图表
|
||||
type FsLogoCartoon struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
|
||||
CategoryId *int64 `gorm:"default:0;" json:"category_id"` // 分类
|
||||
Name *string `gorm:"default:'';" json:"name"` //
|
||||
Url *string `gorm:"default:'';" json:"url"` //
|
||||
IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除
|
||||
CreateTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"create_time"` //
|
||||
UpdateTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"update_time"` //
|
||||
DeleteTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"delete_time"` //
|
||||
CreateUid *int64 `gorm:"default:0;" json:"create_uid"` // 创建人
|
||||
UpdateUid *int64 `gorm:"default:0;" json:"update_uid"` // 更新人
|
||||
DeleteUid *int64 `gorm:"default:0;" json:"delete_uid"` // 删除人
|
||||
}
|
||||
type FsLogoCartoonModel struct {
|
||||
db *gorm.DB
|
||||
name string
|
||||
}
|
||||
|
||||
func NewFsLogoCartoonModel(db *gorm.DB) *FsLogoCartoonModel {
|
||||
return &FsLogoCartoonModel{db: db, name: "fs_logo_cartoon"}
|
||||
}
|
2
model/gmodel/fs_logo_cartoon_logic.go
Normal file
2
model/gmodel/fs_logo_cartoon_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
|||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
25
model/gmodel/fs_merchant_category_gen.go
Normal file
25
model/gmodel/fs_merchant_category_gen.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package gmodel
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// fs_merchant_category 商户类型表
|
||||
type FsMerchantCategory struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // Id
|
||||
ZnName *string `gorm:"default:'';" json:"zn_name"` // 中文名
|
||||
EnName *string `gorm:"default:'';" json:"en_name"` // 英文名
|
||||
Icon *string `gorm:"default:'';" json:"icon"` // 图标
|
||||
RecommendProduct *string `gorm:"default:'';" json:"recommend_product"` // 推荐商品
|
||||
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序
|
||||
Status *int64 `gorm:"default:0;" json:"status"` // 状态
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||
}
|
||||
type FsMerchantCategoryModel struct {
|
||||
db *gorm.DB
|
||||
name string
|
||||
}
|
||||
|
||||
func NewFsMerchantCategoryModel(db *gorm.DB) *FsMerchantCategoryModel {
|
||||
return &FsMerchantCategoryModel{db: db, name: "fs_merchant_category"}
|
||||
}
|
54
model/gmodel/fs_merchant_category_logic.go
Normal file
54
model/gmodel/fs_merchant_category_logic.go
Normal file
|
@ -0,0 +1,54 @@
|
|||
package gmodel
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fusenapi/utils/handlers"
|
||||
"reflect"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
func (m *FsMerchantCategoryModel) FindOne(ctx context.Context, id int64) (resp *FsMerchantCategory, err error) {
|
||||
err = m.db.WithContext(ctx).Model(&FsMerchantCategory{}).Where("id = ? and status = ?", id, 1).Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
func (m *FsMerchantCategoryModel) FindRandOne(ctx context.Context) (resp *FsMerchantCategory, err error) {
|
||||
err = m.db.WithContext(ctx).Model(&FsMerchantCategory{}).Where("status = ?", 1).Order("RAND()").Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (m *FsMerchantCategoryModel) BuilderDB(ctx context.Context, selectData []string) *gorm.DB {
|
||||
if selectData != nil {
|
||||
return m.db.WithContext(ctx).Select(selectData)
|
||||
} else {
|
||||
return m.db.WithContext(ctx).Select("*")
|
||||
}
|
||||
}
|
||||
|
||||
func (m *FsMerchantCategoryModel) FindAll(gormDB *gorm.DB, filterMap map[string]string, orderBy string) ([]*FsMerchantCategory, error) {
|
||||
var resp []*FsMerchantCategory
|
||||
|
||||
// 过滤
|
||||
if filterMap != nil {
|
||||
gormDB = gormDB.Scopes(handlers.FilterData(filterMap))
|
||||
}
|
||||
|
||||
// 排序
|
||||
if orderBy != "" {
|
||||
var fieldsMap = make(map[string]struct{})
|
||||
s := reflect.TypeOf(&FsOrder{}).Elem() //通过反射获取type定义
|
||||
for i := 0; i < s.NumField(); i++ {
|
||||
fieldsMap[s.Field(i).Tag.Get("json")] = struct{}{}
|
||||
}
|
||||
gormDB = gormDB.Scopes(handlers.OrderCheck(orderBy, fieldsMap))
|
||||
}
|
||||
|
||||
result := gormDB.Find(&resp)
|
||||
if result.Error != nil {
|
||||
return nil, result.Error
|
||||
} else {
|
||||
return resp, nil
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ type FsOrderDetail struct {
|
|||
Id int64 `gorm:"primary_key;default:0;auto_increment;" 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"` //
|
||||
UserId *int64 `gorm:"default:0;" json:"user_id"` // 用户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
|
||||
|
|
|
@ -16,7 +16,7 @@ type FsOrderDetailTemplate struct {
|
|||
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"` //
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||
}
|
||||
type FsOrderDetailTemplateModel struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -26,6 +26,10 @@ func (dt *FsOrderDetailTemplateModel) FindOne(ctx context.Context, id int64) (re
|
|||
return resp, err
|
||||
}
|
||||
|
||||
func (dt *FsOrderDetailTemplateModel) RBCreate(ctx context.Context, data *FsOrderDetailTemplate) error {
|
||||
return dt.db.WithContext(ctx).Create(&data).Error
|
||||
}
|
||||
|
||||
func (m *FsOrderDetailTemplateModel) TableName() string {
|
||||
return m.name
|
||||
}
|
||||
|
|
|
@ -9,17 +9,17 @@ import (
|
|||
type FsOrder struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" 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"` //
|
||||
UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户ID
|
||||
SellerUserId *int64 `gorm:"default:0;" json:"seller_user_id"` // 销售员ID 0:自主下单
|
||||
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"` //
|
||||
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"` //
|
||||
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是补货
|
||||
|
@ -37,8 +37,8 @@ type FsOrder struct {
|
|||
IsRefunding *int64 `gorm:"default:0;" json:"is_refunding"` // 是否退款中(0:否,1:是)
|
||||
IsRefunded *int64 `gorm:"default:0;" json:"is_refunded"` // 是否退款完成(0:否,1:是)
|
||||
IsDeleted *int64 `gorm:"default:0;" json:"is_deleted"` // 是否删除(0:否,1:是)
|
||||
RefundReasonId *int64 `gorm:"default:0;" json:"refund_reason_id"` //
|
||||
RefundReason *string `gorm:"default:'';" json:"refund_reason"` //
|
||||
RefundReasonId *int64 `gorm:"default:0;" json:"refund_reason_id"` // 取消订单原因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"` // 发货单号
|
||||
|
|
|
@ -28,6 +28,10 @@ func (o *FsOrderModel) Update(ctx context.Context, data *FsOrder) error {
|
|||
return o.db.WithContext(ctx).Model(&FsOrder{}).Where("`id` = ?", data.Id).Updates(&data).Error
|
||||
}
|
||||
|
||||
func (o *FsOrderModel) RBUpdate(ctx context.Context, data *FsOrder) error {
|
||||
return o.db.WithContext(ctx).Where("`id` = ?", data.Id).Updates(&data).Error
|
||||
}
|
||||
|
||||
func (o *FsOrderModel) Create(ctx context.Context, data *FsOrder) error {
|
||||
return o.db.WithContext(ctx).Model(&FsOrder{}).Create(&data).Error
|
||||
}
|
||||
|
@ -120,6 +124,17 @@ func (m *FsOrderModel) RowSelectBuilder(selectData []string) *gorm.DB {
|
|||
return rowBuilder
|
||||
}
|
||||
|
||||
func (m *FsOrderModel) BuilderTrans(selectData []string) *gorm.DB {
|
||||
var rowBuilder = m.db
|
||||
|
||||
if selectData != nil {
|
||||
rowBuilder = rowBuilder.Select(selectData)
|
||||
} else {
|
||||
rowBuilder = rowBuilder.Select("*")
|
||||
}
|
||||
return rowBuilder
|
||||
}
|
||||
|
||||
func (m *FsOrderModel) FindCount(ctx context.Context, countBuilder *gorm.DB, filterMap map[string]string) (int64, error) {
|
||||
var count int64
|
||||
|
||||
|
|
|
@ -29,6 +29,14 @@ func (p *FsPayModel) GetListByOrderNumberStage(ctx context.Context, sn string, s
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
func (p *FsPayModel) RBGetListByOrderNumberStage(ctx context.Context, sn string, stage int64) (resp *FsPay, err error) {
|
||||
err = p.db.WithContext(ctx).Where("`order_number` = ? ", sn).Where("`pay_stage` = ? ", stage).Take(&resp).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (p *FsPayModel) CreateOrUpdate(ctx context.Context, req *FsPay) (resp *FsPay, err error) {
|
||||
rowBuilder := p.db.Table(p.name).WithContext(ctx)
|
||||
if req.Id > 0 {
|
||||
|
@ -39,6 +47,16 @@ func (p *FsPayModel) CreateOrUpdate(ctx context.Context, req *FsPay) (resp *FsPa
|
|||
return req, err
|
||||
}
|
||||
|
||||
func (p *FsPayModel) RBCreateOrUpdate(ctx context.Context, req *FsPay) (resp *FsPay, err error) {
|
||||
rowBuilder := p.db.WithContext(ctx)
|
||||
if req.Id > 0 {
|
||||
err = rowBuilder.Save(req).Error
|
||||
} else {
|
||||
err = rowBuilder.Create(req).Error
|
||||
}
|
||||
return req, err
|
||||
}
|
||||
|
||||
func (m *FsPayModel) RowSelectBuilder(selectData []string) *gorm.DB {
|
||||
var rowBuilder = m.db.Table(m.name)
|
||||
|
||||
|
@ -50,6 +68,17 @@ func (m *FsPayModel) RowSelectBuilder(selectData []string) *gorm.DB {
|
|||
return rowBuilder
|
||||
}
|
||||
|
||||
func (m *FsPayModel) BuilderTrans(selectData []string) *gorm.DB {
|
||||
var rowBuilder = m.db
|
||||
|
||||
if selectData != nil {
|
||||
rowBuilder = rowBuilder.Select(selectData)
|
||||
} else {
|
||||
rowBuilder = rowBuilder.Select("*")
|
||||
}
|
||||
return rowBuilder
|
||||
}
|
||||
|
||||
func (m *FsPayModel) FindCount(ctx context.Context, countBuilder *gorm.DB, filterMap map[string]string) (int64, error) {
|
||||
var count int64
|
||||
|
||||
|
|
|
@ -8,18 +8,19 @@ import (
|
|||
type FsProductDesignGather struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
Sn *string `gorm:"index;default:'';" json:"sn"` // 唯一标识
|
||||
UserId *int64 `gorm:"index;default:0;" json:"user_id"` //
|
||||
UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户ID
|
||||
ProductId *int64 `gorm:"index;default:0;" json:"product_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
|
||||
OptionalId *int64 `gorm:"index;default:0;" json:"optional_id"` // 选项ID
|
||||
Cover *string `gorm:"default:'';" json:"cover"` //
|
||||
Cover *string `gorm:"default:'';" json:"cover"` // 封面图
|
||||
Info *string `gorm:"default:'';" json:"info"` // 保留的设计信息
|
||||
Utime *int64 `gorm:"default:0;" json:"utime"` //
|
||||
Utime *int64 `gorm:"default:0;" json:"utime"` // 更新时间
|
||||
Status *int64 `gorm:"default:1;" json:"status"` // 状态位(1:显示,0:删除)
|
||||
ClientIp *string `gorm:"default:'';" json:"client_ip"` // 客户端ip
|
||||
ClientNo *string `gorm:"default:'';" json:"client_no"` // 客户端唯一标识
|
||||
InfoNew *string `gorm:"default:'';" json:"info_new"` // 设计信息-改版
|
||||
}
|
||||
type FsProductDesignGatherModel struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -23,6 +23,7 @@ type FsProductDesign struct {
|
|||
IsPay *int64 `gorm:"default:0;" json:"is_pay"` // 是否已有支付 0 未 1 有
|
||||
LogoColor *string `gorm:"default:'';" json:"logo_color"` // logo图片备选项
|
||||
PageGuid *string `gorm:"default:'';" json:"page_guid"` // 页面识别id
|
||||
InfoNew *string `gorm:"default:'';" json:"info_new"` // 设计信息-改版用
|
||||
}
|
||||
type FsProductDesignModel struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -2,6 +2,8 @@ package gmodel
|
|||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func (d *FsProductDesignModel) FindOneBySn(ctx context.Context, sn string, userId int64) (resp *FsProductDesign, err error) {
|
||||
|
@ -39,6 +41,21 @@ func (d *FsProductDesignModel) UpdateByIds(ctx context.Context, ids []int64, dat
|
|||
return d.db.Table(d.name).WithContext(ctx).Model(&FsProductDesign{}).Where("`id` in ?", ids).Updates(&data).Error
|
||||
}
|
||||
|
||||
func (d *FsProductDesignModel) RBUpdateByIds(rowBuilder *gorm.DB, ids []int64, data *FsProductDesign) error {
|
||||
return rowBuilder.Where("`id` in ?", ids).Updates(&data).Error
|
||||
}
|
||||
|
||||
func (m *FsProductDesignModel) BuilderTrans(ctx context.Context, selectData []string) *gorm.DB {
|
||||
var rowBuilder = m.db.WithContext(ctx)
|
||||
|
||||
if selectData != nil {
|
||||
rowBuilder = rowBuilder.Select(selectData)
|
||||
} else {
|
||||
rowBuilder = rowBuilder.Select("*")
|
||||
}
|
||||
return rowBuilder
|
||||
}
|
||||
|
||||
func (m *FsProductDesignModel) TableName() string {
|
||||
return m.name
|
||||
}
|
||||
|
|
|
@ -17,11 +17,11 @@ type FsProduct struct {
|
|||
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"` //
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||
View *int64 `gorm:"default:0;" json:"view"` // 浏览量
|
||||
SizeIds *string `gorm:"default:'';" json:"size_ids"` //
|
||||
SizeIds *string `gorm:"default:'';" json:"size_ids"` // 尺寸 1,2,3,4
|
||||
MaterialIds *string `gorm:"default:'';" json:"material_ids"` // 材质 1,2,3
|
||||
TagIds *string `gorm:"default:'';" json:"tag_ids"` //
|
||||
TagIds *string `gorm:"default:'';" json:"tag_ids"` // 标签 逗号间隔
|
||||
Status *int64 `gorm:"default:0;" json:"status"` // 状态位 弃用
|
||||
ProduceDays *int64 `gorm:"default:0;" json:"produce_days"` // 生产天数
|
||||
DeliveryDays *int64 `gorm:"default:0;" json:"delivery_days"` // 运送天数
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
type FsProductModel3d struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
ProductId *int64 `gorm:"index;default:0;" json:"product_id"` // 产品ID
|
||||
IsPopular *int64 `gorm:"default:0;" json:"is_popular"` // 是否热门 0否 1是
|
||||
Tag *int64 `gorm:"default:1;" json:"tag"` // 类别(1:模型,2:配件,3:场景)
|
||||
Title *string `gorm:"default:'';" json:"title"` // 标题
|
||||
Name *string `gorm:"default:'';" json:"name"` // 详情页展示名称
|
||||
|
@ -25,6 +24,7 @@ type FsProductModel3d struct {
|
|||
OptionTemplate *int64 `gorm:"default:0;" json:"option_template"` // 配件绑定的公共模板
|
||||
Price *int64 `gorm:"default:0;" json:"price"` // 仅配件用,配件的价格, 单位:美分
|
||||
Sku *string `gorm:"default:'';" json:"sku"` // sku
|
||||
IsHot *int64 `gorm:"default:0;" json:"is_hot"` // 是否热门
|
||||
}
|
||||
type FsProductModel3dModel struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -10,7 +10,7 @@ type FsProductModel3dLight struct {
|
|||
Name *string `gorm:"default:'';" json:"name"` // 灯光名称
|
||||
Info *string `gorm:"default:'';" json:"info"` // 灯光数据(json格式)
|
||||
Status *int64 `gorm:"default:1;" json:"status"` // 状态值(1:显示,0:删除)
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` //
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 创建时间
|
||||
}
|
||||
type FsProductModel3dLightModel struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -101,3 +101,14 @@ func (d *FsProductModel3dModel) FindOneJoinSize(ctx context.Context, productId i
|
|||
Order("s.sort ASC").Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (d *FsProductModel3dModel) GetOneBySizeIdTag(ctx context.Context, sizeId int64, tag int64, fields ...string) (resp *FsProductModel3d, err error) {
|
||||
db := d.db.WithContext(ctx).Model(&FsProductModel3d{}).
|
||||
Where("`size_id` = ? and `tag` = ? and `status` = ?", sizeId, tag, 1).
|
||||
Order("sort DESC")
|
||||
if len(fields) != 0 {
|
||||
db = db.Select(fields[0])
|
||||
}
|
||||
err = db.Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
package gmodel
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// fs_product_recommend 推荐商品表
|
||||
type FsProductRecommend struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
ProductId *int64 `gorm:"default:0;" json:"product_id"` // 产品ID
|
||||
Status *int64 `gorm:"default:1;" json:"status"` // 状态 1正常 0不正常
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||
}
|
||||
type FsProductRecommendModel struct {
|
||||
db *gorm.DB
|
||||
name string
|
||||
}
|
||||
|
||||
func NewFsProductRecommendModel(db *gorm.DB) *FsProductRecommendModel {
|
||||
return &FsProductRecommendModel{db: db, name: "fs_product_recommend"}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package gmodel
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type GetRecommendProductListReq struct {
|
||||
Ctx context.Context
|
||||
Page int
|
||||
Limit int
|
||||
}
|
||||
|
||||
func (r *FsProductRecommendModel) GetRecommendProductList(req GetRecommendProductListReq) (resp []FsProduct, total int64, err error) {
|
||||
db := r.db.WithContext(req.Ctx).
|
||||
Table("fs_product_recommend as r").
|
||||
Joins("inner join fs_product as p on r.product_id = p.id").
|
||||
Where("r.status = ? ", 1).
|
||||
Where("p.is_shelf = ? and p.is_del = ? and p.status = ?", 1, 0, 1)
|
||||
if err = db.Limit(1).Count(&total).Error; err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
db = db.Select("p.*")
|
||||
offset := (req.Page - 1) * req.Limit
|
||||
err = db.Offset(offset).Limit(req.Limit).Find(&resp).Error
|
||||
return resp, total, err
|
||||
}
|
||||
func (r *FsProductRecommendModel) CreateOrUpdate(ctx context.Context, productId int64, data *FsProductRecommend) error {
|
||||
var info FsProductRecommend
|
||||
err := r.db.WithContext(ctx).Model(&FsProductRecommend{}).Where("`product_id` = ?", productId).Take(&info).Error
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return err
|
||||
}
|
||||
if info.Id == 0 {
|
||||
return r.db.WithContext(ctx).Model(&FsProductRecommend{}).Create(data).Error
|
||||
}
|
||||
return r.db.WithContext(ctx).Model(&FsProductRecommend{}).Where("`product_id` = ?", productId).Updates(data).Error
|
||||
}
|
|
@ -8,19 +8,20 @@ import (
|
|||
type FsProductRenderDesign struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
Sn *string `gorm:"index;default:'';" json:"sn"` // 唯一标识
|
||||
UserId *int64 `gorm:"index;default:0;" json:"user_id"` //
|
||||
UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户ID
|
||||
ProductId *int64 `gorm:"index;default:0;" json:"product_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
|
||||
OptionalId *int64 `gorm:"index;default:0;" json:"optional_id"` // 选项ID
|
||||
Cover *string `gorm:"default:'';" json:"cover"` //
|
||||
Cover *string `gorm:"default:'';" json:"cover"` // 封面图
|
||||
Info *string `gorm:"default:'';" json:"info"` // 保留的设计信息
|
||||
Utime *int64 `gorm:"default:0;" json:"utime"` //
|
||||
Utime *int64 `gorm:"default:0;" json:"utime"` // 更新时间
|
||||
Status *int64 `gorm:"default:1;" json:"status"` // 状态位(1:显示,0:删除)
|
||||
ClientIp *string `gorm:"default:'';" json:"client_ip"` // 客户端ip
|
||||
ClientNo *string `gorm:"default:'';" json:"client_no"` // 客户端唯一标识
|
||||
LogoColor *string `gorm:"default:'';" json:"logo_color"` // logo图片备选颜色
|
||||
InfoNew *string `gorm:"default:'';" json:"info_new"` // 设计信息-改版用
|
||||
}
|
||||
type FsProductRenderDesignModel struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -8,15 +8,15 @@ import (
|
|||
type FsProductSize struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
ProductId *int64 `gorm:"index;default:0;" json:"product_id"` // 产品ID
|
||||
IsPopular *int64 `gorm:"default:0;" json:"is_popular"` // 是否受欢迎 0否1是
|
||||
Title *string `gorm:"default:'';" json:"title"` // 标题 10*10*20
|
||||
Cover *string `gorm:"default:'';" json:"cover"` //
|
||||
CoverImg *string `gorm:"default:'';" json:"cover_img"` //
|
||||
Cover *string `gorm:"default:'';" json:"cover"` // 封面图
|
||||
CoverImg *string `gorm:"default:'';" json:"cover_img"` // 背景图
|
||||
Capacity *string `gorm:"default:'';" json:"capacity"` // 自己填的尺寸名称
|
||||
Status *int64 `gorm:"default:0;" json:"status"` // 状态位 显示 删除
|
||||
Sort *int64 `gorm:"default:50;" json:"sort"` // 排序
|
||||
Remark *string `gorm:"default:'';" json:"remark"` //
|
||||
Remark *string `gorm:"default:'';" json:"remark"` // 备注信息
|
||||
PartsCanDeleted *int64 `gorm:"default:1;" json:"parts_can_deleted"` // 配件是否可移除 1是0否
|
||||
IsHot *int64 `gorm:"default:0;" json:"is_hot"` // 是否热门
|
||||
}
|
||||
type FsProductSizeModel struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -5,7 +5,7 @@ import "context"
|
|||
// TODO: 使用model的属性做你想做的
|
||||
type GetTagPropByProductIdsWithProductTagRsp struct {
|
||||
FsProductTagProp
|
||||
Title string `json:"title"`
|
||||
TemplateTag string `json:"template_tag"`
|
||||
}
|
||||
|
||||
func (p *FsProductTagPropModel) GetTagPropByProductIdsWithProductTag(ctx context.Context, productIds []int64) (resp []GetTagPropByProductIdsWithProductTagRsp, err error) {
|
||||
|
@ -14,7 +14,7 @@ func (p *FsProductTagPropModel) GetTagPropByProductIdsWithProductTag(ctx context
|
|||
}
|
||||
err = p.db.WithContext(ctx).Table(p.name+" as p ").
|
||||
Joins("left join fs_product_template_tags as t on p.template_tag_id = t.id").
|
||||
Select("p.*,t.title as title").
|
||||
Select("p.*,t.template_tag as template_tag").
|
||||
Where("p.product_id in (?) and p.status = ? and t.status = ?", productIds, 1, 1).
|
||||
Find(&resp).Error
|
||||
return resp, err
|
||||
|
|
35
model/gmodel/fs_product_template_element_0826_gen.go
Normal file
35
model/gmodel/fs_product_template_element_0826_gen.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package gmodel
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// fs_product_template_element_0826
|
||||
type FsProductTemplateElement0826 struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
Title *string `gorm:"default:'';" json:"title"` // 产品模板名称
|
||||
ProductTemplateId *int64 `gorm:"index;default:0;" json:"product_template_id"` // 产品模板id
|
||||
Main *string `gorm:"default:'';" json:"main"` //
|
||||
Second *string `gorm:"default:'';" json:"second"` //
|
||||
Base *string `gorm:"default:'';" json:"base"` //
|
||||
Paper *string `gorm:"default:'';" json:"paper"` //
|
||||
Spoon *string `gorm:"default:'';" json:"spoon"` //
|
||||
Fork *string `gorm:"default:'';" json:"fork"` //
|
||||
Toothpick *string `gorm:"default:'';" json:"toothpick"` //
|
||||
Chopsticks *string `gorm:"default:'';" json:"chopsticks"` //
|
||||
Shadow *string `gorm:"default:'';" json:"shadow"` //
|
||||
Cover *string `gorm:"default:'';" json:"cover"` //
|
||||
Cover1 *string `gorm:"default:'';" json:"cover1"` //
|
||||
Mode *string `gorm:"default:'';" json:"mode"` //
|
||||
Light *int64 `gorm:"default:0;" json:"light"` //
|
||||
Rotation *string `gorm:"default:'';" json:"rotation"` //
|
||||
Scale *string `gorm:"default:'';" json:"scale"` //
|
||||
}
|
||||
type FsProductTemplateElement0826Model struct {
|
||||
db *gorm.DB
|
||||
name string
|
||||
}
|
||||
|
||||
func NewFsProductTemplateElement0826Model(db *gorm.DB) *FsProductTemplateElement0826Model {
|
||||
return &FsProductTemplateElement0826Model{db: db, name: "fs_product_template_element_0826"}
|
||||
}
|
2
model/gmodel/fs_product_template_element_0826_logic.go
Normal file
2
model/gmodel/fs_product_template_element_0826_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
|||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
25
model/gmodel/fs_product_template_element_22_gen.go
Normal file
25
model/gmodel/fs_product_template_element_22_gen.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package gmodel
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// fs_product_template_element_22
|
||||
type FsProductTemplateElement22 struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
Title *string `gorm:"default:'';" json:"title"` // 产品模板名称
|
||||
ProductTemplateId *int64 `gorm:"index;default:0;" json:"product_template_id"` // 产品模板id
|
||||
Model *string `gorm:"default:'';" json:"model"` //
|
||||
Mode *string `gorm:"default:'';" json:"mode"` //
|
||||
Light *int64 `gorm:"default:0;" json:"light"` //
|
||||
Rotation *string `gorm:"default:'';" json:"rotation"` //
|
||||
Scale *string `gorm:"default:'';" json:"scale"` //
|
||||
}
|
||||
type FsProductTemplateElement22Model struct {
|
||||
db *gorm.DB
|
||||
name string
|
||||
}
|
||||
|
||||
func NewFsProductTemplateElement22Model(db *gorm.DB) *FsProductTemplateElement22Model {
|
||||
return &FsProductTemplateElement22Model{db: db, name: "fs_product_template_element_22"}
|
||||
}
|
2
model/gmodel/fs_product_template_element_22_logic.go
Normal file
2
model/gmodel/fs_product_template_element_22_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
|||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
37
model/gmodel/fs_product_template_element_backup1018_gen.go
Normal file
37
model/gmodel/fs_product_template_element_backup1018_gen.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
package gmodel
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// fs_product_template_element_backup1018
|
||||
type FsProductTemplateElementBackup1018 struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
Title *string `gorm:"default:'';" json:"title"` // 产品模板名称
|
||||
ProductTemplateId *int64 `gorm:"index;default:0;" json:"product_template_id"` // 产品模板id
|
||||
Main *string `gorm:"default:'';" json:"main"` //
|
||||
Second *string `gorm:"default:'';" json:"second"` //
|
||||
Base *string `gorm:"default:'';" json:"base"` //
|
||||
Paper *string `gorm:"default:'';" json:"paper"` //
|
||||
Spoon *string `gorm:"default:'';" json:"spoon"` //
|
||||
Fork *string `gorm:"default:'';" json:"fork"` //
|
||||
Toothpick *string `gorm:"default:'';" json:"toothpick"` //
|
||||
Chopsticks *string `gorm:"default:'';" json:"chopsticks"` //
|
||||
Shadow *string `gorm:"default:'';" json:"shadow"` //
|
||||
Cover *string `gorm:"default:'';" json:"cover"` //
|
||||
Cover1 *string `gorm:"default:'';" json:"cover1"` //
|
||||
Mode *string `gorm:"default:'';" json:"mode"` //
|
||||
Light *int64 `gorm:"default:0;" json:"light"` //
|
||||
Rotation *string `gorm:"default:'';" json:"rotation"` //
|
||||
Scale *string `gorm:"default:'';" json:"scale"` //
|
||||
ModelP *string `gorm:"default:'';" json:"model_p"` // 配件对应的云渲染贴图数据
|
||||
Refletion *int64 `gorm:"default:0;" json:"refletion"` // 反射探头
|
||||
}
|
||||
type FsProductTemplateElementBackup1018Model struct {
|
||||
db *gorm.DB
|
||||
name string
|
||||
}
|
||||
|
||||
func NewFsProductTemplateElementBackup1018Model(db *gorm.DB) *FsProductTemplateElementBackup1018Model {
|
||||
return &FsProductTemplateElementBackup1018Model{db: db, name: "fs_product_template_element_backup1018"}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
|
@ -8,22 +8,22 @@ import (
|
|||
type FsProductTemplateElement struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // id
|
||||
Title *string `gorm:"default:'';" json:"title"` // 产品模板名称
|
||||
ProductTemplateId *int64 `gorm:"index;default:0;" json:"product_template_id"` // 产品模板id
|
||||
Main *string `gorm:"default:'';" json:"main"` //
|
||||
Second *string `gorm:"default:'';" json:"second"` //
|
||||
Base *string `gorm:"default:'';" json:"base"` //
|
||||
Paper *string `gorm:"default:'';" json:"paper"` //
|
||||
Spoon *string `gorm:"default:'';" json:"spoon"` //
|
||||
Fork *string `gorm:"default:'';" json:"fork"` //
|
||||
Toothpick *string `gorm:"default:'';" json:"toothpick"` //
|
||||
Chopsticks *string `gorm:"default:'';" json:"chopsticks"` //
|
||||
Shadow *string `gorm:"default:'';" json:"shadow"` //
|
||||
Cover *string `gorm:"default:'';" json:"cover"` //
|
||||
Cover1 *string `gorm:"default:'';" json:"cover1"` //
|
||||
Mode *string `gorm:"default:'';" json:"mode"` //
|
||||
Light *int64 `gorm:"default:0;" json:"light"` //
|
||||
Rotation *string `gorm:"default:'';" json:"rotation"` //
|
||||
Scale *string `gorm:"default:'';" json:"scale"` //
|
||||
ProductTemplateId *int64 `gorm:"index;default:0;" json:"product_template_id"` // 产品模型id
|
||||
Main *string `gorm:"default:'';" json:"main"` // 废弃
|
||||
Second *string `gorm:"default:'';" json:"second"` // 废弃
|
||||
Base *string `gorm:"default:'';" json:"base"` // base
|
||||
Paper *string `gorm:"default:'';" json:"paper"` // 废弃
|
||||
Spoon *string `gorm:"default:'';" json:"spoon"` // 废弃
|
||||
Fork *string `gorm:"default:'';" json:"fork"` // 废弃
|
||||
Toothpick *string `gorm:"default:'';" json:"toothpick"` // 废弃
|
||||
Chopsticks *string `gorm:"default:'';" json:"chopsticks"` // 废弃
|
||||
Shadow *string `gorm:"default:'';" json:"shadow"` // shadow
|
||||
Cover *string `gorm:"default:'';" json:"cover"` // 废弃
|
||||
Cover1 *string `gorm:"default:'';" json:"cover1"` // 废弃
|
||||
Mode *string `gorm:"default:'';" json:"mode"` // 材质类型
|
||||
Light *int64 `gorm:"default:0;" json:"light"` // 灯光组
|
||||
Rotation *string `gorm:"default:'';" json:"rotation"` // 旋转
|
||||
Scale *string `gorm:"default:'';" json:"scale"` // 缩放
|
||||
ModelP *string `gorm:"default:'';" json:"model_p"` // 配件对应的云渲染贴图数据
|
||||
Refletion *string `gorm:"default:'';" json:"refletion"` // 反射探头组
|
||||
}
|
||||
|
|
35
model/gmodel/fs_product_template_element_kongde_gen.go
Normal file
35
model/gmodel/fs_product_template_element_kongde_gen.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package gmodel
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// fs_product_template_element_kongde
|
||||
type FsProductTemplateElementKongde struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
Title *string `gorm:"default:'';" json:"title"` // 产品模板名称
|
||||
ProductTemplateId *int64 `gorm:"index;default:0;" json:"product_template_id"` // 产品模板id
|
||||
Main *string `gorm:"default:'';" json:"main"` //
|
||||
Second *string `gorm:"default:'';" json:"second"` //
|
||||
Base *string `gorm:"default:'';" json:"base"` //
|
||||
Paper *string `gorm:"default:'';" json:"paper"` //
|
||||
Spoon *string `gorm:"default:'';" json:"spoon"` //
|
||||
Fork *string `gorm:"default:'';" json:"fork"` //
|
||||
Toothpick *string `gorm:"default:'';" json:"toothpick"` //
|
||||
Chopsticks *string `gorm:"default:'';" json:"chopsticks"` //
|
||||
Shadow *string `gorm:"default:'';" json:"shadow"` //
|
||||
Cover *string `gorm:"default:'';" json:"cover"` //
|
||||
Cover1 *string `gorm:"default:'';" json:"cover1"` //
|
||||
Mode *string `gorm:"default:'';" json:"mode"` //
|
||||
Light *int64 `gorm:"default:0;" json:"light"` //
|
||||
Rotation *string `gorm:"default:'';" json:"rotation"` //
|
||||
Scale *string `gorm:"default:'';" json:"scale"` //
|
||||
}
|
||||
type FsProductTemplateElementKongdeModel struct {
|
||||
db *gorm.DB
|
||||
name string
|
||||
}
|
||||
|
||||
func NewFsProductTemplateElementKongdeModel(db *gorm.DB) *FsProductTemplateElementKongdeModel {
|
||||
return &FsProductTemplateElementKongdeModel{db: db, name: "fs_product_template_element_kongde"}
|
||||
}
|
2
model/gmodel/fs_product_template_element_kongde_logic.go
Normal file
2
model/gmodel/fs_product_template_element_kongde_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
|||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
|
@ -7,7 +7,7 @@ import "context"
|
|||
func (e *FsProductTemplateElementModel) FindOneByModelId(ctx context.Context, modelId int64) (resp *FsProductTemplateElement, err error) {
|
||||
err = e.db.WithContext(ctx).Model(&FsProductTemplateElement{}).
|
||||
//以前的神仙员工把表model_id变成product_template_id
|
||||
Where("`product_template_id` = ?", modelId).
|
||||
Where("`model_id` = ?", modelId).
|
||||
Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
|
|
@ -6,11 +6,12 @@ import (
|
|||
|
||||
// fs_product_template_tags 模板标签表
|
||||
type FsProductTemplateTags struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
|
||||
Title *string `gorm:"default:'';" json:"title"` // 标题
|
||||
CoverImg *string `gorm:"default:'';" json:"cover_img"` // 封面图
|
||||
Status *int64 `gorm:"default:0;" json:"status"` // 状态 1:可用
|
||||
CreateAt *int64 `gorm:"default:0;" json:"create_at"` // 创建时间
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
|
||||
TemplateTag *string `gorm:"unique_key;default:'';" json:"template_tag"` // 标题
|
||||
Cover *string `gorm:"default:'';" json:"cover"` // 缩略图
|
||||
Status *int64 `gorm:"default:0;" json:"status"` // 状态 1:可用
|
||||
CreateAt *int64 `gorm:"default:0;" json:"create_at"` // 创建时间
|
||||
Groups *string `gorm:"default:'';" json:"groups"` // 分组信息
|
||||
}
|
||||
type FsProductTemplateTagsModel struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -32,3 +32,22 @@ func (pt *FsProductTemplateTagsModel) GetList(ctx context.Context, page, limit i
|
|||
err = db.Offset(offset).Limit(limit).Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
func (pt *FsProductTemplateTagsModel) GetListByTagNames(ctx context.Context, tagNames []string, limit int, orderBy string) (resp []FsProductTemplateTags, err error) {
|
||||
if len(tagNames) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
db := pt.db.WithContext(ctx).Model(&FsProductTemplateTags{}).Where("`template_tag` in (?) and `status` = ?", tagNames, 1)
|
||||
if orderBy != "" {
|
||||
db = db.Order(orderBy)
|
||||
}
|
||||
err = db.Limit(limit).Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
func (pt *FsProductTemplateTagsModel) FindOneByTagName(ctx context.Context, tagName string, fields ...string) (resp *FsProductTemplateTags, err error) {
|
||||
db := pt.db.WithContext(ctx).Model(&FsProductTemplateTags{}).Where("`template_tag` = ? and `status` = ?", tagName, 1)
|
||||
if len(fields) != 0 {
|
||||
db = db.Select(fields[0])
|
||||
}
|
||||
err = db.Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@ type FsProductTemplateV2 struct {
|
|||
IsPublic *int64 `gorm:"default:0;" json:"is_public"` // 是否可公用(1:可以,0:不可以)
|
||||
Status *int64 `gorm:"default:0;" json:"status"` // 状态1正常 2异常
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||
Tag *string `gorm:"default:'';" json:"tag"` // 标签(用户自填)
|
||||
TemplateTag *string `gorm:"default:'';" json:"template_tag"` // 标签(用户自填)
|
||||
IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除 1删除
|
||||
GroupOptions *string `gorm:"default:'';" json:"group_options"` // 颜色分组
|
||||
Version *int64 `gorm:"default:0;" json:"version"` //
|
||||
SwitchInfo *string `gorm:"default:'';" json:"switch_info"` // 开关信息
|
||||
Version *int64 `gorm:"default:0;" json:"version"` // 默认1
|
||||
}
|
||||
type FsProductTemplateV2Model struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -4,11 +4,14 @@ import (
|
|||
"context"
|
||||
)
|
||||
|
||||
func (t *FsProductTemplateV2Model) FindAllByProductIds(ctx context.Context, productIds []int64, fields ...string) (resp []FsProductTemplateV2, err error) {
|
||||
func (t *FsProductTemplateV2Model) FindAllByProductIds(ctx context.Context, productIds []int64, sort string, fields ...string) (resp []FsProductTemplateV2, err error) {
|
||||
if len(productIds) == 0 {
|
||||
return
|
||||
}
|
||||
db := t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`product_id` in (?) and `is_del` = ? and `status` = ?", productIds, 0, 1)
|
||||
if sort != "" {
|
||||
db = db.Order(sort)
|
||||
}
|
||||
if len(fields) != 0 {
|
||||
db = db.Select(fields[0])
|
||||
}
|
||||
|
@ -38,7 +41,7 @@ func (t *FsProductTemplateV2Model) FindAllByIdsWithoutStatus(ctx context.Context
|
|||
}
|
||||
func (t *FsProductTemplateV2Model) FindOne(ctx context.Context, id int64) (resp *FsProductTemplateV2, err error) {
|
||||
|
||||
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`id` = ? ", id).Find(&resp).Error
|
||||
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`id` = ? ", id).Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
func (t *FsProductTemplateV2Model) FindByParam(ctx context.Context, id int64, modelId int64, fields ...string) (resp *FsProductTemplateV2, err error) {
|
||||
|
@ -111,14 +114,14 @@ func (t *FsProductTemplateV2Model) GetProductTemplateListByParams(ctx context.Co
|
|||
}
|
||||
|
||||
// 获取第一个尺寸下的模板
|
||||
func (t *FsProductTemplateV2Model) FindOneByProductIdTagIdWithSizeTable(ctx context.Context, productId int64, tagId string) (resp *FsProductTemplateV2, err error) {
|
||||
func (t *FsProductTemplateV2Model) FindOneByProductIdTagIdWithSizeTable(ctx context.Context, productId int64, templateTag string) (resp *FsProductTemplateV2, err error) {
|
||||
err = t.db.WithContext(ctx).Table(t.name+" as t").
|
||||
Joins("left join fs_product_size as s on t.product_id = s.product_id").
|
||||
Joins("inner join fs_product_size as s on t.product_id = s.product_id").
|
||||
Select("t.*").
|
||||
Where("t.product_id = ? and t.tag = ? ", productId, tagId).
|
||||
Where("t.product_id = ? and t.template_tag = ? ", productId, templateTag).
|
||||
Where("t.status = ? and t.is_del = ?", 1, 0).
|
||||
Where("s.status = ?", 1).
|
||||
Order("s.sort ASC").
|
||||
Order("t.sort ASC,s.sort ASC").
|
||||
Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
@ -126,7 +129,7 @@ func (t *FsProductTemplateV2Model) FindAllByModelIdsTemplateTag(ctx context.Cont
|
|||
if len(modelIds) == 0 {
|
||||
return
|
||||
}
|
||||
db := t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`model_id` in (?) and `tag` = ? and `is_del` = ? and `status` = ?", modelIds, templateTag, 0, 1)
|
||||
db := t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`model_id` in (?) and `template_tag` = ? and `is_del` = ? and `status` = ?", modelIds, templateTag, 0, 1)
|
||||
if len(fields) != 0 {
|
||||
db = db.Select(fields[0])
|
||||
}
|
||||
|
@ -139,3 +142,14 @@ func (t *FsProductTemplateV2Model) FindAllByModelIdsTemplateTag(ctx context.Cont
|
|||
err = db.Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// 获取产品在指定模板标签下的所有模板
|
||||
func (t *FsProductTemplateV2Model) GetListByProductAndTemplateTag(ctx context.Context, templateTagId string, productId int64, fields ...string) (resp []FsProductTemplateV2, err error) {
|
||||
db := t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).
|
||||
Where("template_tag = ? and product_id = ? and status = ? and is_del = ?", templateTagId, productId, 1, 0)
|
||||
if len(fields) > 0 {
|
||||
db = db.Select(fields[0])
|
||||
}
|
||||
err = db.Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ type FsQrcodeLog struct {
|
|||
QrcodeId *int64 `gorm:"default:0;" json:"qrcode_id"` // 二维码ID
|
||||
TagId *int64 `gorm:"default:0;" json:"tag_id"` // 分组ID
|
||||
CreateAt *int64 `gorm:"default:0;" json:"create_at"` // 创建时间
|
||||
Platform *string `gorm:"default:'';" json:"platform"` //
|
||||
UserAgent *string `gorm:"default:'';" json:"user_agent"` //
|
||||
Platform *string `gorm:"default:'';" json:"platform"` // 系统信息
|
||||
UserAgent *string `gorm:"default:'';" json:"user_agent"` // 浏览器
|
||||
}
|
||||
type FsQrcodeLogModel struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -19,7 +19,6 @@ type FsQuotation struct {
|
|||
DesignId *int64 `gorm:"default:0;" json:"design_id"` // 设计人员
|
||||
QuotationId *int64 `gorm:"default:0;" json:"quotation_id"` // 报价人员
|
||||
IsMark *int64 `gorm:"default:0;" json:"is_mark"` // 星标
|
||||
Qid *int64 `gorm:"default:0;" json:"qid"` //
|
||||
}
|
||||
type FsQuotationModel struct {
|
||||
db *gorm.DB
|
||||
|
|
23
model/gmodel/fs_quotation_price_gen.go
Normal file
23
model/gmodel/fs_quotation_price_gen.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package gmodel
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// fs_quotation_price 报价单价格表
|
||||
type FsQuotationPrice struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // Id
|
||||
ProductId *int64 `gorm:"default:0;" json:"product_id"` // 产品id
|
||||
SizeId *int64 `gorm:"default:0;" json:"size_id"` // 尺寸id
|
||||
PriceInfo *string `gorm:"default:'';" json:"price_info"` // 价格数据
|
||||
Status *int64 `gorm:"default:1;" json:"status"` // 状态 1启用0废弃
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||
}
|
||||
type FsQuotationPriceModel struct {
|
||||
db *gorm.DB
|
||||
name string
|
||||
}
|
||||
|
||||
func NewFsQuotationPriceModel(db *gorm.DB) *FsQuotationPriceModel {
|
||||
return &FsQuotationPriceModel{db: db, name: "fs_quotation_price"}
|
||||
}
|
2
model/gmodel/fs_quotation_price_logic.go
Normal file
2
model/gmodel/fs_quotation_price_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
|||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
|
@ -6,20 +6,23 @@ import (
|
|||
|
||||
// fs_quotation_product 报价单产品表
|
||||
type FsQuotationProduct struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
|
||||
QuotationId *int64 `gorm:"index;default:0;" json:"quotation_id"` // 报价单id
|
||||
Name *string `gorm:"default:'';" json:"name"` // 产品名
|
||||
Size *string `gorm:"default:'';" json:"size"` // 产品规格
|
||||
Cycle *int64 `gorm:"default:0;" json:"cycle"` // 交付周期
|
||||
IsGift *int64 `gorm:"default:0;" json:"is_gift"` // 是否赠品
|
||||
Img *string `gorm:"default:'';" json:"img"` // 效果图
|
||||
Status *int64 `gorm:"default:0;" json:"status"` // 状态位 1启用0停用
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序
|
||||
Sid *string `gorm:"default:'';" json:"sid"` // 前端sid
|
||||
PriceInfo *string `gorm:"default:'';" json:"price_info"` // 价格信息
|
||||
Remark *string `gorm:"default:'';" json:"remark"` // 备注
|
||||
Num *int64 `gorm:"default:0;" json:"num"` // 产品数量
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
|
||||
QuotationId *int64 `gorm:"index;default:0;" json:"quotation_id"` // 报价单id
|
||||
Name *string `gorm:"default:'';" json:"name"` // 产品名
|
||||
Size *string `gorm:"default:'';" json:"size"` // 产品规格
|
||||
Cycle *int64 `gorm:"default:0;" json:"cycle"` // 交付周期
|
||||
IsGift *int64 `gorm:"default:0;" json:"is_gift"` // 是否赠品
|
||||
Img *string `gorm:"default:'';" json:"img"` // 效果图
|
||||
Status *int64 `gorm:"default:0;" json:"status"` // 状态位 1启用0停用
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序
|
||||
Sid *string `gorm:"default:'';" json:"sid"` // 前端sid
|
||||
PriceInfo *string `gorm:"default:'';" json:"price_info"` // 价格信息
|
||||
Remark *string `gorm:"default:'';" json:"remark"` // 备注
|
||||
Num *int64 `gorm:"default:0;" json:"num"` // 产品数量
|
||||
ShowSizeTips *int64 `gorm:"default:0;" json:"show_size_tips"` // 是否显示提示
|
||||
ShowSizeList *int64 `gorm:"default:0;" json:"show_size_list"` // 是否显示规格列表
|
||||
ProductId *int64 `gorm:"default:0;" json:"product_id"` // 产品id
|
||||
}
|
||||
type FsQuotationProductModel struct {
|
||||
db *gorm.DB
|
||||
|
|
22
model/gmodel/fs_quotation_size_layout_gen.go
Normal file
22
model/gmodel/fs_quotation_size_layout_gen.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package gmodel
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// fs_quotation_size_layout 产品尺寸排版表
|
||||
type FsQuotationSizeLayout struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
ProductId *int64 `gorm:"unique_key;default:0;" json:"product_id"` // 产品id
|
||||
SizeHtml *string `gorm:"default:'';" json:"size_html"` // 尺寸排版html
|
||||
Status *int64 `gorm:"default:1;" json:"status"` // 状态
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||
}
|
||||
type FsQuotationSizeLayoutModel struct {
|
||||
db *gorm.DB
|
||||
name string
|
||||
}
|
||||
|
||||
func NewFsQuotationSizeLayoutModel(db *gorm.DB) *FsQuotationSizeLayoutModel {
|
||||
return &FsQuotationSizeLayoutModel{db: db, name: "fs_quotation_size_layout"}
|
||||
}
|
2
model/gmodel/fs_quotation_size_layout_logic.go
Normal file
2
model/gmodel/fs_quotation_size_layout_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
|||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
|
@ -36,6 +36,16 @@ func (m *FsRefundReasonModel) CreateOrUpdate(ctx context.Context, req *FsRefundR
|
|||
return req, err
|
||||
}
|
||||
|
||||
func (m *FsRefundReasonModel) RBCreateOrUpdate(ctx context.Context, req *FsRefundReason) (resp *FsRefundReason, err error) {
|
||||
rowBuilder := m.db.WithContext(ctx)
|
||||
if req.Id > 0 {
|
||||
err = rowBuilder.Save(req).Error
|
||||
} else {
|
||||
err = rowBuilder.Create(req).Error
|
||||
}
|
||||
return req, err
|
||||
}
|
||||
|
||||
func (m *FsRefundReasonModel) FindOneByQuery(ctx context.Context, rowBuilder *gorm.DB, filterMap map[string]string) (*FsRefundReason, error) {
|
||||
var resp FsRefundReason
|
||||
|
||||
|
@ -62,6 +72,16 @@ func (m *FsRefundReasonModel) RowSelectBuilder(selectData []string) *gorm.DB {
|
|||
return rowBuilder
|
||||
}
|
||||
|
||||
func (m *FsRefundReasonModel) BuilderTrans(selectData []string) *gorm.DB {
|
||||
var rowBuilder = m.db
|
||||
if selectData != nil {
|
||||
rowBuilder = rowBuilder.Select(selectData)
|
||||
} else {
|
||||
rowBuilder = rowBuilder.Select("*")
|
||||
}
|
||||
return rowBuilder
|
||||
}
|
||||
|
||||
func (m *FsRefundReasonModel) TableName() string {
|
||||
return m.name
|
||||
}
|
||||
|
|
|
@ -13,11 +13,12 @@ type FsResource struct {
|
|||
ResourceType *string `gorm:"index;default:'';" json:"resource_type"` // 资源类型
|
||||
ResourceUrl *string `gorm:"default:'';" json:"resource_url"` // 资源 URL
|
||||
Version *string `gorm:"index;default:'0';" json:"version"` // 版本信息
|
||||
UploadedAt *time.Time `gorm:"index;default:'0000-00-00 00:00:00';" json:"uploaded_at"` // 上传时间
|
||||
UploadedAt *time.Time `gorm:"index;default:'0000-00-00 00:00:00';" json:"uploaded_at"` //
|
||||
Metadata *string `gorm:"default:'';" json:"metadata"` // 元数据,json格式,存储图像分率
|
||||
MetaKey1 *string `gorm:"index;default:'';" json:"meta_key1"` // 需要关键信息查询的自定义属性1,可以动态增加
|
||||
ApiType *int64 `gorm:"default:1;" json:"api_type"` // 调用类型:1=对外,2=对内
|
||||
BucketName *string `gorm:"default:'';" json:"bucket_name"` // 存储桶名: 1=持久 2=缓存
|
||||
Source *string `gorm:"default:'';" json:"source"` // 来源
|
||||
}
|
||||
type FsResourceModel struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -24,6 +24,16 @@ func (p *FsResourceModel) Update(ctx context.Context, req *FsResource) (resp *Fs
|
|||
return req, err
|
||||
}
|
||||
|
||||
func (p *FsResourceModel) BuilderCreate(ctx context.Context, rowBuilder *gorm.DB, req *FsResource) (resp *FsResource, err error) {
|
||||
err = rowBuilder.WithContext(ctx).Create(req).Error
|
||||
return req, err
|
||||
}
|
||||
|
||||
func (p *FsResourceModel) BuilderUpdate(ctx context.Context, rowBuilder *gorm.DB, req *FsResource) (resp *FsResource, err error) {
|
||||
err = rowBuilder.WithContext(ctx).Where("resource_id =?", req.ResourceId).Save(req).Error
|
||||
return req, err
|
||||
}
|
||||
|
||||
func (m *FsResourceModel) FindOneByQuery(ctx context.Context, rowBuilder *gorm.DB, filterMap map[string]string) (*FsResource, error) {
|
||||
var resp FsResource
|
||||
|
||||
|
@ -50,6 +60,17 @@ func (m *FsResourceModel) RowSelectBuilder(selectData []string) *gorm.DB {
|
|||
return rowBuilder
|
||||
}
|
||||
|
||||
func (m *FsResourceModel) BuilderTrans(selectData []string) *gorm.DB {
|
||||
var rowBuilder = m.db
|
||||
|
||||
if selectData != nil {
|
||||
rowBuilder = rowBuilder.Select(selectData)
|
||||
} else {
|
||||
rowBuilder = rowBuilder.Select("*")
|
||||
}
|
||||
return rowBuilder
|
||||
}
|
||||
|
||||
// 事务
|
||||
func (m *FsResourceModel) Trans(ctx context.Context, fn func(ctx context.Context, connGorm *gorm.DB) error) error {
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ type FsTags struct {
|
|||
Icon *string `gorm:"default:'';" json:"icon"` // 标签图标
|
||||
Status *int64 `gorm:"default:1;" json:"status"` // 状态 1:可用
|
||||
Description *string `gorm:"default:'';" json:"description"` // 介绍 Seo
|
||||
RecommendProduct *string `gorm:"default:'';" json:"recommend_product"` //
|
||||
RecommendProductSort *string `gorm:"default:'';" json:"recommend_product_sort"` //
|
||||
RecommendProduct *string `gorm:"default:'';" json:"recommend_product"` // 推荐产品id例如: 1,3,4,5
|
||||
RecommendProductSort *string `gorm:"default:'';" json:"recommend_product_sort"` // 推荐排序例如:1324
|
||||
Category *int64 `gorm:"default:1;" json:"category"` // 分类:1前台用的 2后台用的
|
||||
}
|
||||
type FsTagsModel struct {
|
||||
|
|
|
@ -13,10 +13,10 @@ type FsTrade struct {
|
|||
TradeSn *string `gorm:"unique_key;default:'';" json:"trade_sn"` // 三方交易号
|
||||
OrderId *int64 `gorm:"index;default:0;" json:"order_id"` // 订单ID
|
||||
Amount *int64 `gorm:"default:0;" json:"amount"` // 支付金额
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` //
|
||||
Utime *int64 `gorm:"default:0;" json:"utime"` //
|
||||
Desc *string `gorm:"default:'';" json:"desc"` //
|
||||
Status *int64 `gorm:"default:0;" json:"status"` //
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||
Utime *int64 `gorm:"default:0;" json:"utime"` // 更新时间
|
||||
Desc *string `gorm:"default:'';" json:"desc"` // 简要描述
|
||||
Status *int64 `gorm:"default:0;" json:"status"` // 状态位 是否支付成功
|
||||
}
|
||||
type FsTradeModel struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -7,13 +7,13 @@ import (
|
|||
// fs_user_design 废弃表
|
||||
type FsUserDesign struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
UserId *int64 `gorm:"index;default:0;" json:"user_id"` //
|
||||
UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户ID
|
||||
ProductId *int64 `gorm:"index;default:0;" json:"product_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
|
||||
Info *string `gorm:"default:'';" json:"info"` // 其他设计信息
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` //
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||
}
|
||||
type FsUserDesignModel struct {
|
||||
db *gorm.DB
|
||||
|
|
|
@ -9,11 +9,11 @@ type FsUser struct {
|
|||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
|
||||
FaceId *int64 `gorm:"default:0;" json:"face_id"` // facebook的userid
|
||||
GoogleId *int64 `gorm:"default:0;" json:"google_id"` // google的sub
|
||||
FirstName *string `gorm:"default:'';" json:"first_name"` //
|
||||
LastName *string `gorm:"default:'';" json:"last_name"` //
|
||||
FirstName *string `gorm:"default:'';" json:"first_name"` // FirstName
|
||||
LastName *string `gorm:"default:'';" json:"last_name"` // LastName
|
||||
Username *string `gorm:"unique_key;default:'';" json:"username"` //
|
||||
Company *string `gorm:"default:'';" json:"company"` //
|
||||
Mobile *string `gorm:"default:'';" json:"mobile"` //
|
||||
Company *string `gorm:"default:'';" json:"company"` // 公司名称
|
||||
Mobile *string `gorm:"default:'';" json:"mobile"` // 手机号码
|
||||
AuthKey *string `gorm:"default:'';" json:"auth_key"` //
|
||||
PasswordHash *string `gorm:"default:'';" json:"password_hash"` //
|
||||
VerificationToken *string `gorm:"default:'';" json:"verification_token"` //
|
||||
|
@ -30,7 +30,7 @@ type FsUser struct {
|
|||
IsPhoneAdvertisement *int64 `gorm:"default:0;" json:"is_phone_advertisement"` // 是否接收短信广告
|
||||
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"` // 是否开启低渲染模型渲染
|
||||
IsLowRendering *int64 `gorm:"default:0;" json:"is_low_rendering"` //
|
||||
IsRemoveBg *int64 `gorm:"default:1;" json:"is_remove_bg"` // 用户上传logo是否去除背景
|
||||
}
|
||||
type FsUserModel struct {
|
||||
|
|
25
model/gmodel/fs_user_info_gen.go
Normal file
25
model/gmodel/fs_user_info_gen.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package gmodel
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// fs_user_info 用户信息表
|
||||
type FsUserInfo struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
|
||||
Module *string `gorm:"default:'';" json:"module"` // 所属模块
|
||||
UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户 ID
|
||||
GuestId *int64 `gorm:"index;default:0;" json:"guest_id"` // 访客 ID
|
||||
Metadata *string `gorm:"default:'';" json:"metadata"` // 元数据,json格式
|
||||
MetaKey1 *string `gorm:"default:'';" json:"meta_key1"` // 需要关键信息查询的自定义属性1,可以动态增加
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` //
|
||||
Utime *int64 `gorm:"default:0;" json:"utime"` //
|
||||
}
|
||||
type FsUserInfoModel struct {
|
||||
db *gorm.DB
|
||||
name string
|
||||
}
|
||||
|
||||
func NewFsUserInfoModel(db *gorm.DB) *FsUserInfoModel {
|
||||
return &FsUserInfoModel{db: db, name: "fs_user_info"}
|
||||
}
|
44
model/gmodel/fs_user_info_logic.go
Normal file
44
model/gmodel/fs_user_info_logic.go
Normal file
|
@ -0,0 +1,44 @@
|
|||
package gmodel
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fusenapi/utils/handlers"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
func (m *FsUserInfoModel) BuilderDB(ctx context.Context, selectData []string) *gorm.DB {
|
||||
if selectData != nil {
|
||||
return m.db.WithContext(ctx).Select(selectData)
|
||||
} else {
|
||||
return m.db.WithContext(ctx).Select("*")
|
||||
}
|
||||
}
|
||||
|
||||
func (m *FsUserInfoModel) FindOne(gormDB *gorm.DB, filterMap map[string]string) (*FsUserInfo, error) {
|
||||
var resp FsUserInfo
|
||||
|
||||
if filterMap != nil {
|
||||
gormDB = gormDB.Scopes(handlers.FilterData(filterMap))
|
||||
}
|
||||
|
||||
result := gormDB.Limit(1).Find(&resp)
|
||||
if result.Error != nil {
|
||||
return nil, result.Error
|
||||
} else {
|
||||
return &resp, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p *FsUserInfoModel) CreateOrUpdate(gormDB *gorm.DB, req *FsUserInfo) (resp *FsUserInfo, err error) {
|
||||
if req.Id > 0 {
|
||||
err = gormDB.Save(req).Error
|
||||
} else {
|
||||
err = gormDB.Create(req).Error
|
||||
}
|
||||
return req, err
|
||||
}
|
|
@ -58,15 +58,9 @@ func (m *FsUserMaterialModel) RowSelectBuilder(selectData []string) *gorm.DB {
|
|||
|
||||
// 获取最新记录
|
||||
func (m *FsUserMaterialModel) FindLatestOne(ctx context.Context, userId int64, guestId int64) (resp FsUserMaterial, err error) {
|
||||
if userId == 0 && guestId == 0 {
|
||||
return FsUserMaterial{}, nil
|
||||
}
|
||||
db := m.db.WithContext(ctx).Model(&FsUserMaterial{}).Order("id DESC")
|
||||
if userId != 0 {
|
||||
db = db.Where("`user_id` = ?", userId)
|
||||
} else {
|
||||
db = db.Where("`guest_id` = ?", guestId)
|
||||
}
|
||||
db := m.db.WithContext(ctx).Model(&FsUserMaterial{}).
|
||||
Where("`user_id` = ? and `guest_id` = ?", userId, guestId).
|
||||
Order("id DESC")
|
||||
err = db.Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
@ -75,3 +69,8 @@ func (m *FsUserMaterialModel) FindOneById(ctx context.Context, id int64) (resp *
|
|||
err = m.db.WithContext(ctx).Model(&FsUserMaterial{}).Where("id = ?", id).Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
func (m *FsUserMaterialModel) GetListByUser(ctx context.Context, userId, guestId int64, limit int) (resp *FsUserMaterial, err error) {
|
||||
err = m.db.WithContext(ctx).Model(&FsUserMaterial{}).
|
||||
Where("`user_id` = ? and `guest_id` = ?", userId, guestId).Order("id DESC").Limit(limit).Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
|
|
@ -4,191 +4,207 @@ import "gorm.io/gorm"
|
|||
|
||||
// AllModelsGen 所有Model集合,修改单行,只要不改字段名,不会根据新的内容修改,需要修改的话手动删除
|
||||
type AllModelsGen struct {
|
||||
FsAddress *FsAddressModel // fs_address 用户地址表
|
||||
FsAuthAssignment *FsAuthAssignmentModel // fs_auth_assignment 用户角色和权限信息
|
||||
FsAuthItem *FsAuthItemModel // fs_auth_item 用户角色和权限信息
|
||||
FsAuthItemChild *FsAuthItemChildModel // fs_auth_item_child 角色和权限关系表
|
||||
FsAuthRule *FsAuthRuleModel // fs_auth_rule 规则表
|
||||
FsBackendUser *FsBackendUserModel // fs_backend_user 管理员表
|
||||
FsCanteenProduct *FsCanteenProductModel // fs_canteen_product 餐厅类别产品对应表
|
||||
FsCanteenType *FsCanteenTypeModel // fs_canteen_type 餐厅类型表
|
||||
FsCard *FsCardModel // fs_card 卡号表
|
||||
FsCardGroup *FsCardGroupModel // fs_card_group 卡号分组表
|
||||
FsCart *FsCartModel // fs_cart 购物车
|
||||
FsChangeCode *FsChangeCodeModel // fs_change_code 忘记密码code表
|
||||
FsCloud *FsCloudModel // fs_cloud 云仓表
|
||||
FsCloudDeliverEveryTmp *FsCloudDeliverEveryTmpModel // fs_cloud_deliver_every_tmp
|
||||
FsCloudDeliverTmp *FsCloudDeliverTmpModel // fs_cloud_deliver_tmp
|
||||
FsCloudPickUp *FsCloudPickUpModel // fs_cloud_pick_up 云仓提货单
|
||||
FsCloudPickUpDetail *FsCloudPickUpDetailModel // fs_cloud_pick_up_detail 云仓提货单-详情
|
||||
FsCloudReceive *FsCloudReceiveModel // fs_cloud_receive 云仓接收工厂总单
|
||||
FsCloudReceiveEvery *FsCloudReceiveEveryModel // fs_cloud_receive_every
|
||||
FsCloudRenderLog *FsCloudRenderLogModel // fs_cloud_render_log 云渲染日志表
|
||||
FsCloudUserApplyBack *FsCloudUserApplyBackModel // fs_cloud_user_apply_back 该表废弃
|
||||
FsContact *FsContactModel // fs_contact 该表暂未使用
|
||||
FsContactService *FsContactServiceModel // fs_contact_service
|
||||
FsCoupon *FsCouponModel // fs_coupon 代金券(暂未使用)
|
||||
FsDeliver *FsDeliverModel // fs_deliver 发货表 云仓 直发 通用(已废弃)
|
||||
FsDeliverEvery *FsDeliverEveryModel // fs_deliver_every 发货详细表(已废弃)
|
||||
FsDepartment *FsDepartmentModel // fs_department 部门表
|
||||
FsEmailLogs *FsEmailLogsModel // fs_email_logs 邮件日志表
|
||||
FsEmailTemplate *FsEmailTemplateModel // fs_email_template 邮件模板表(暂未使用)
|
||||
FsFactory *FsFactoryModel // fs_factory 该表废弃
|
||||
FsFactoryDeliver *FsFactoryDeliverModel // fs_factory_deliver 工厂发货主表(废弃)
|
||||
FsFactoryDeliverEvery *FsFactoryDeliverEveryModel // fs_factory_deliver_every 该表废弃
|
||||
FsFactoryProduct *FsFactoryProductModel // fs_factory_product 工厂生产表(废弃)
|
||||
FsFactoryShipTmp *FsFactoryShipTmpModel // fs_factory_ship_tmp
|
||||
FsFaq *FsFaqModel // fs_faq 常见问题
|
||||
FsFont *FsFontModel // fs_font 字体配置
|
||||
FsGerent *FsGerentModel // fs_gerent 管理员表
|
||||
FsGuest *FsGuestModel // fs_guest 游客表
|
||||
FsLog *FsLogModel // fs_log 日志表
|
||||
FsMapLibrary *FsMapLibraryModel // fs_map_library 贴图库
|
||||
FsMenu *FsMenuModel // fs_menu 后台菜单
|
||||
FsMigration *FsMigrationModel // fs_migration 版本库
|
||||
FsOrder *FsOrderModel // fs_order
|
||||
FsOrderAffiliate *FsOrderAffiliateModel // fs_order_affiliate 订单附属表-流程控制时间等
|
||||
FsOrderDetail *FsOrderDetailModel // fs_order_detail 订单详细表
|
||||
FsOrderDetailTemplate *FsOrderDetailTemplateModel // fs_order_detail_template 订单模板详细表
|
||||
FsOrderRemark *FsOrderRemarkModel // fs_order_remark 订单备注表
|
||||
FsPay *FsPayModel // fs_pay 支付记录
|
||||
FsPayEvent *FsPayEventModel // fs_pay_event 支付回调事件日志
|
||||
FsProduct *FsProductModel // fs_product 产品表
|
||||
FsProductCopy1 *FsProductCopy1Model // fs_product_copy1 产品表
|
||||
FsProductDesign *FsProductDesignModel // fs_product_design 产品设计表
|
||||
FsProductDesignGather *FsProductDesignGatherModel // fs_product_design_gather
|
||||
FsProductModel3d *FsProductModel3dModel // fs_product_model3d 产品模型表
|
||||
FsProductModel3dLight *FsProductModel3dLightModel // fs_product_model3d_light 模型-灯光组表
|
||||
FsProductOption *FsProductOptionModel // fs_product_option 产品选项表(已废弃)
|
||||
FsProductPrice *FsProductPriceModel // fs_product_price 阶梯价格表
|
||||
FsProductRecommend *FsProductRecommendModel // fs_product_recommend 推荐商品表
|
||||
FsProductRenderDesign *FsProductRenderDesignModel // fs_product_render_design
|
||||
FsProductScene *FsProductSceneModel // fs_product_scene 产品场景表
|
||||
FsProductSize *FsProductSizeModel // fs_product_size 产品尺寸表
|
||||
FsProductTagProp *FsProductTagPropModel // fs_product_tag_prop 产品标签相关属性表
|
||||
FsProductTemplate *FsProductTemplateModel // fs_product_template 产品模板表(已废弃)
|
||||
FsProductTemplateBasemap *FsProductTemplateBasemapModel // fs_product_template_basemap 模板底图表
|
||||
FsProductTemplateElement *FsProductTemplateElementModel // fs_product_template_element 云渲染配置表
|
||||
FsProductTemplateTags *FsProductTemplateTagsModel // fs_product_template_tags 模板标签表
|
||||
FsProductTemplateV2 *FsProductTemplateV2Model // fs_product_template_v2 产品-模型-模板表
|
||||
FsProductV2Tmp *FsProductV2TmpModel // fs_product_v2_tmp 产品表
|
||||
FsQrcode *FsQrcodeModel // fs_qrcode
|
||||
FsQrcodeLog *FsQrcodeLogModel // fs_qrcode_log 二维码扫描日志
|
||||
FsQrcodeSet *FsQrcodeSetModel // fs_qrcode_set 二维码边框配置表
|
||||
FsQrcodeUser *FsQrcodeUserModel // fs_qrcode_user 二维码-用户名表
|
||||
FsQuotation *FsQuotationModel // fs_quotation 报价单信息表
|
||||
FsQuotationProduct *FsQuotationProductModel // fs_quotation_product 报价单产品表
|
||||
FsQuotationRemarkTemplate *FsQuotationRemarkTemplateModel // fs_quotation_remark_template 报价单备注模板
|
||||
FsQuotationSaler *FsQuotationSalerModel // fs_quotation_saler 报价单业务员表
|
||||
FsRefundReason *FsRefundReasonModel // fs_refund_reason
|
||||
FsResource *FsResourceModel // fs_resource 资源表
|
||||
FsResources *FsResourcesModel // fs_resources 资源表
|
||||
FsStandardLogo *FsStandardLogoModel // fs_standard_logo 标准logo
|
||||
FsTags *FsTagsModel // fs_tags 产品分类表
|
||||
FsToolLogs *FsToolLogsModel // fs_tool_logs 3d设计工具日志表
|
||||
FsToolTemplate *FsToolTemplateModel // fs_tool_template 设计工具模板(废弃)
|
||||
FsToolUser *FsToolUserModel // fs_tool_user 3d设计工具用户表
|
||||
FsTrade *FsTradeModel // fs_trade
|
||||
FsUser *FsUserModel // fs_user 用户表
|
||||
FsUserDesign *FsUserDesignModel // fs_user_design 废弃表
|
||||
FsUserMaterial *FsUserMaterialModel // fs_user_material 用户素材表
|
||||
FsUserStock *FsUserStockModel // fs_user_stock 用户云仓库存
|
||||
FsWebSet *FsWebSetModel // fs_web_set 网站配置表
|
||||
FsAddress *FsAddressModel // fs_address 用户地址表
|
||||
FsAuthAssignment *FsAuthAssignmentModel // fs_auth_assignment 用户角色和权限信息
|
||||
FsAuthItem *FsAuthItemModel // fs_auth_item 用户角色和权限信息
|
||||
FsAuthItemChild *FsAuthItemChildModel // fs_auth_item_child 角色和权限关系表
|
||||
FsAuthRule *FsAuthRuleModel // fs_auth_rule 规则表
|
||||
FsBackendUser *FsBackendUserModel // fs_backend_user 管理员表
|
||||
FsCanteenProduct *FsCanteenProductModel // fs_canteen_product 餐厅类别产品对应表
|
||||
FsCanteenType *FsCanteenTypeModel // fs_canteen_type 餐厅类型表
|
||||
FsCard *FsCardModel // fs_card 卡号表
|
||||
FsCardGroup *FsCardGroupModel // fs_card_group 卡号分组表
|
||||
FsCart *FsCartModel // fs_cart 购物车
|
||||
FsChangeCode *FsChangeCodeModel // fs_change_code 忘记密码code表
|
||||
FsCloud *FsCloudModel // fs_cloud 云仓表
|
||||
FsCloudDeliverEveryTmp *FsCloudDeliverEveryTmpModel // fs_cloud_deliver_every_tmp
|
||||
FsCloudDeliverTmp *FsCloudDeliverTmpModel // fs_cloud_deliver_tmp
|
||||
FsCloudPickUp *FsCloudPickUpModel // fs_cloud_pick_up 云仓提货单
|
||||
FsCloudPickUpDetail *FsCloudPickUpDetailModel // fs_cloud_pick_up_detail 云仓提货单-详情
|
||||
FsCloudReceive *FsCloudReceiveModel // fs_cloud_receive 云仓接收工厂总单
|
||||
FsCloudReceiveEvery *FsCloudReceiveEveryModel // fs_cloud_receive_every
|
||||
FsCloudRenderLog *FsCloudRenderLogModel // fs_cloud_render_log 云渲染日志表
|
||||
FsCloudUserApplyBack *FsCloudUserApplyBackModel // fs_cloud_user_apply_back 该表废弃
|
||||
FsContact *FsContactModel // fs_contact 该表暂未使用
|
||||
FsContactService *FsContactServiceModel // fs_contact_service
|
||||
FsCoupon *FsCouponModel // fs_coupon 代金券(暂未使用)
|
||||
FsDeliver *FsDeliverModel // fs_deliver 发货表 云仓 直发 通用(已废弃)
|
||||
FsDeliverEvery *FsDeliverEveryModel // fs_deliver_every 发货详细表(已废弃)
|
||||
FsDepartment *FsDepartmentModel // fs_department 部门表
|
||||
FsEmailLogs *FsEmailLogsModel // fs_email_logs 邮件日志表
|
||||
FsEmailTemplate *FsEmailTemplateModel // fs_email_template 邮件模板表(暂未使用)
|
||||
FsFactory *FsFactoryModel // fs_factory 该表废弃
|
||||
FsFactoryDeliver *FsFactoryDeliverModel // fs_factory_deliver 工厂发货主表(废弃)
|
||||
FsFactoryDeliverEvery *FsFactoryDeliverEveryModel // fs_factory_deliver_every 该表废弃
|
||||
FsFactoryProduct *FsFactoryProductModel // fs_factory_product 工厂生产表(废弃)
|
||||
FsFactoryShipTmp *FsFactoryShipTmpModel // fs_factory_ship_tmp
|
||||
FsFaq *FsFaqModel // fs_faq 常见问题
|
||||
FsFont *FsFontModel // fs_font 字体配置
|
||||
FsGerent *FsGerentModel // fs_gerent 管理员表
|
||||
FsGuest *FsGuestModel // fs_guest 游客表
|
||||
FsLog *FsLogModel // fs_log 日志表
|
||||
FsLogoCartoon *FsLogoCartoonModel // fs_logo_cartoon logo底图表
|
||||
FsMapLibrary *FsMapLibraryModel // fs_map_library 贴图库
|
||||
FsMenu *FsMenuModel // fs_menu 后台菜单
|
||||
FsMerchantCategory *FsMerchantCategoryModel // fs_merchant_category 商户类型表
|
||||
FsMigration *FsMigrationModel // fs_migration 版本库
|
||||
FsOrder *FsOrderModel // fs_order
|
||||
FsOrderAffiliate *FsOrderAffiliateModel // fs_order_affiliate 订单附属表-流程控制时间等
|
||||
FsOrderDetail *FsOrderDetailModel // fs_order_detail 订单详细表
|
||||
FsOrderDetailTemplate *FsOrderDetailTemplateModel // fs_order_detail_template 订单模板详细表
|
||||
FsOrderRemark *FsOrderRemarkModel // fs_order_remark 订单备注表
|
||||
FsPay *FsPayModel // fs_pay 支付记录
|
||||
FsPayEvent *FsPayEventModel // fs_pay_event 支付回调事件日志
|
||||
FsProduct *FsProductModel // fs_product 产品表
|
||||
FsProductCopy1 *FsProductCopy1Model // fs_product_copy1 产品表
|
||||
FsProductDesign *FsProductDesignModel // fs_product_design 产品设计表
|
||||
FsProductDesignGather *FsProductDesignGatherModel // fs_product_design_gather
|
||||
FsProductModel3d *FsProductModel3dModel // fs_product_model3d 产品模型表
|
||||
FsProductModel3dLight *FsProductModel3dLightModel // fs_product_model3d_light 模型-灯光组表
|
||||
FsProductOption *FsProductOptionModel // fs_product_option 产品选项表(已废弃)
|
||||
FsProductPrice *FsProductPriceModel // fs_product_price 阶梯价格表
|
||||
FsProductRenderDesign *FsProductRenderDesignModel // fs_product_render_design
|
||||
FsProductScene *FsProductSceneModel // fs_product_scene 产品场景表
|
||||
FsProductSize *FsProductSizeModel // fs_product_size 产品尺寸表
|
||||
FsProductTagProp *FsProductTagPropModel // fs_product_tag_prop 产品标签相关属性表
|
||||
FsProductTemplate *FsProductTemplateModel // fs_product_template 产品模板表(已废弃)
|
||||
FsProductTemplateBasemap *FsProductTemplateBasemapModel // fs_product_template_basemap 模板底图表
|
||||
FsProductTemplateElement *FsProductTemplateElementModel // fs_product_template_element 云渲染配置表
|
||||
FsProductTemplateElement0826 *FsProductTemplateElement0826Model // fs_product_template_element_0826
|
||||
FsProductTemplateElement22 *FsProductTemplateElement22Model // fs_product_template_element_22
|
||||
FsProductTemplateElementBackup1018 *FsProductTemplateElementBackup1018Model // fs_product_template_element_backup1018
|
||||
FsProductTemplateElementKongde *FsProductTemplateElementKongdeModel // fs_product_template_element_kongde
|
||||
FsProductTemplateTags *FsProductTemplateTagsModel // fs_product_template_tags 模板标签表
|
||||
FsProductTemplateV2 *FsProductTemplateV2Model // fs_product_template_v2 产品-模型-模板表
|
||||
FsProductV2Tmp *FsProductV2TmpModel // fs_product_v2_tmp 产品表
|
||||
FsQrcode *FsQrcodeModel // fs_qrcode
|
||||
FsQrcodeLog *FsQrcodeLogModel // fs_qrcode_log 二维码扫描日志
|
||||
FsQrcodeSet *FsQrcodeSetModel // fs_qrcode_set 二维码边框配置表
|
||||
FsQrcodeUser *FsQrcodeUserModel // fs_qrcode_user 二维码-用户名表
|
||||
FsQuotation *FsQuotationModel // fs_quotation 报价单信息表
|
||||
FsQuotationPrice *FsQuotationPriceModel // fs_quotation_price 报价单价格表
|
||||
FsQuotationProduct *FsQuotationProductModel // fs_quotation_product 报价单产品表
|
||||
FsQuotationRemarkTemplate *FsQuotationRemarkTemplateModel // fs_quotation_remark_template 报价单备注模板
|
||||
FsQuotationSaler *FsQuotationSalerModel // fs_quotation_saler 报价单业务员表
|
||||
FsQuotationSizeLayout *FsQuotationSizeLayoutModel // fs_quotation_size_layout 产品尺寸排版表
|
||||
FsRefundReason *FsRefundReasonModel // fs_refund_reason
|
||||
FsResource *FsResourceModel // fs_resource 资源表
|
||||
FsResources *FsResourcesModel // fs_resources 资源表
|
||||
FsStandardLogo *FsStandardLogoModel // fs_standard_logo 标准logo
|
||||
FsTags *FsTagsModel // fs_tags 产品分类表
|
||||
FsToolLogs *FsToolLogsModel // fs_tool_logs 3d设计工具日志表
|
||||
FsToolTemplate *FsToolTemplateModel // fs_tool_template 设计工具模板(废弃)
|
||||
FsToolUser *FsToolUserModel // fs_tool_user 3d设计工具用户表
|
||||
FsTrade *FsTradeModel // fs_trade
|
||||
FsUser *FsUserModel // fs_user 用户表
|
||||
FsUserDesign *FsUserDesignModel // fs_user_design 废弃表
|
||||
FsUserInfo *FsUserInfoModel // fs_user_info 用户信息表
|
||||
FsUserMaterial *FsUserMaterialModel // fs_user_material 用户素材表
|
||||
FsUserStock *FsUserStockModel // fs_user_stock 用户云仓库存
|
||||
FsWebSet *FsWebSetModel // fs_web_set 网站配置表
|
||||
|
||||
}
|
||||
|
||||
func NewAllModels(gdb *gorm.DB) *AllModelsGen {
|
||||
models := &AllModelsGen{
|
||||
FsAddress: NewFsAddressModel(gdb),
|
||||
FsAuthAssignment: NewFsAuthAssignmentModel(gdb),
|
||||
FsAuthItem: NewFsAuthItemModel(gdb),
|
||||
FsAuthItemChild: NewFsAuthItemChildModel(gdb),
|
||||
FsAuthRule: NewFsAuthRuleModel(gdb),
|
||||
FsBackendUser: NewFsBackendUserModel(gdb),
|
||||
FsCanteenProduct: NewFsCanteenProductModel(gdb),
|
||||
FsCanteenType: NewFsCanteenTypeModel(gdb),
|
||||
FsCard: NewFsCardModel(gdb),
|
||||
FsCardGroup: NewFsCardGroupModel(gdb),
|
||||
FsCart: NewFsCartModel(gdb),
|
||||
FsChangeCode: NewFsChangeCodeModel(gdb),
|
||||
FsCloud: NewFsCloudModel(gdb),
|
||||
FsCloudDeliverEveryTmp: NewFsCloudDeliverEveryTmpModel(gdb),
|
||||
FsCloudDeliverTmp: NewFsCloudDeliverTmpModel(gdb),
|
||||
FsCloudPickUp: NewFsCloudPickUpModel(gdb),
|
||||
FsCloudPickUpDetail: NewFsCloudPickUpDetailModel(gdb),
|
||||
FsCloudReceive: NewFsCloudReceiveModel(gdb),
|
||||
FsCloudReceiveEvery: NewFsCloudReceiveEveryModel(gdb),
|
||||
FsCloudRenderLog: NewFsCloudRenderLogModel(gdb),
|
||||
FsCloudUserApplyBack: NewFsCloudUserApplyBackModel(gdb),
|
||||
FsContact: NewFsContactModel(gdb),
|
||||
FsContactService: NewFsContactServiceModel(gdb),
|
||||
FsCoupon: NewFsCouponModel(gdb),
|
||||
FsDeliver: NewFsDeliverModel(gdb),
|
||||
FsDeliverEvery: NewFsDeliverEveryModel(gdb),
|
||||
FsDepartment: NewFsDepartmentModel(gdb),
|
||||
FsEmailLogs: NewFsEmailLogsModel(gdb),
|
||||
FsEmailTemplate: NewFsEmailTemplateModel(gdb),
|
||||
FsFactory: NewFsFactoryModel(gdb),
|
||||
FsFactoryDeliver: NewFsFactoryDeliverModel(gdb),
|
||||
FsFactoryDeliverEvery: NewFsFactoryDeliverEveryModel(gdb),
|
||||
FsFactoryProduct: NewFsFactoryProductModel(gdb),
|
||||
FsFactoryShipTmp: NewFsFactoryShipTmpModel(gdb),
|
||||
FsFaq: NewFsFaqModel(gdb),
|
||||
FsFont: NewFsFontModel(gdb),
|
||||
FsGerent: NewFsGerentModel(gdb),
|
||||
FsGuest: NewFsGuestModel(gdb),
|
||||
FsLog: NewFsLogModel(gdb),
|
||||
FsMapLibrary: NewFsMapLibraryModel(gdb),
|
||||
FsMenu: NewFsMenuModel(gdb),
|
||||
FsMigration: NewFsMigrationModel(gdb),
|
||||
FsOrder: NewFsOrderModel(gdb),
|
||||
FsOrderAffiliate: NewFsOrderAffiliateModel(gdb),
|
||||
FsOrderDetail: NewFsOrderDetailModel(gdb),
|
||||
FsOrderDetailTemplate: NewFsOrderDetailTemplateModel(gdb),
|
||||
FsOrderRemark: NewFsOrderRemarkModel(gdb),
|
||||
FsPay: NewFsPayModel(gdb),
|
||||
FsPayEvent: NewFsPayEventModel(gdb),
|
||||
FsProduct: NewFsProductModel(gdb),
|
||||
FsProductCopy1: NewFsProductCopy1Model(gdb),
|
||||
FsProductDesign: NewFsProductDesignModel(gdb),
|
||||
FsProductDesignGather: NewFsProductDesignGatherModel(gdb),
|
||||
FsProductModel3d: NewFsProductModel3dModel(gdb),
|
||||
FsProductModel3dLight: NewFsProductModel3dLightModel(gdb),
|
||||
FsProductOption: NewFsProductOptionModel(gdb),
|
||||
FsProductPrice: NewFsProductPriceModel(gdb),
|
||||
FsProductRecommend: NewFsProductRecommendModel(gdb),
|
||||
FsProductRenderDesign: NewFsProductRenderDesignModel(gdb),
|
||||
FsProductScene: NewFsProductSceneModel(gdb),
|
||||
FsProductSize: NewFsProductSizeModel(gdb),
|
||||
FsProductTagProp: NewFsProductTagPropModel(gdb),
|
||||
FsProductTemplate: NewFsProductTemplateModel(gdb),
|
||||
FsProductTemplateBasemap: NewFsProductTemplateBasemapModel(gdb),
|
||||
FsProductTemplateElement: NewFsProductTemplateElementModel(gdb),
|
||||
FsProductTemplateTags: NewFsProductTemplateTagsModel(gdb),
|
||||
FsProductTemplateV2: NewFsProductTemplateV2Model(gdb),
|
||||
FsProductV2Tmp: NewFsProductV2TmpModel(gdb),
|
||||
FsQrcode: NewFsQrcodeModel(gdb),
|
||||
FsQrcodeLog: NewFsQrcodeLogModel(gdb),
|
||||
FsQrcodeSet: NewFsQrcodeSetModel(gdb),
|
||||
FsQrcodeUser: NewFsQrcodeUserModel(gdb),
|
||||
FsQuotation: NewFsQuotationModel(gdb),
|
||||
FsQuotationProduct: NewFsQuotationProductModel(gdb),
|
||||
FsQuotationRemarkTemplate: NewFsQuotationRemarkTemplateModel(gdb),
|
||||
FsQuotationSaler: NewFsQuotationSalerModel(gdb),
|
||||
FsRefundReason: NewFsRefundReasonModel(gdb),
|
||||
FsResource: NewFsResourceModel(gdb),
|
||||
FsResources: NewFsResourcesModel(gdb),
|
||||
FsStandardLogo: NewFsStandardLogoModel(gdb),
|
||||
FsTags: NewFsTagsModel(gdb),
|
||||
FsToolLogs: NewFsToolLogsModel(gdb),
|
||||
FsToolTemplate: NewFsToolTemplateModel(gdb),
|
||||
FsToolUser: NewFsToolUserModel(gdb),
|
||||
FsTrade: NewFsTradeModel(gdb),
|
||||
FsUser: NewFsUserModel(gdb),
|
||||
FsUserDesign: NewFsUserDesignModel(gdb),
|
||||
FsUserMaterial: NewFsUserMaterialModel(gdb),
|
||||
FsUserStock: NewFsUserStockModel(gdb),
|
||||
FsWebSet: NewFsWebSetModel(gdb),
|
||||
FsAddress: NewFsAddressModel(gdb),
|
||||
FsAuthAssignment: NewFsAuthAssignmentModel(gdb),
|
||||
FsAuthItem: NewFsAuthItemModel(gdb),
|
||||
FsAuthItemChild: NewFsAuthItemChildModel(gdb),
|
||||
FsAuthRule: NewFsAuthRuleModel(gdb),
|
||||
FsBackendUser: NewFsBackendUserModel(gdb),
|
||||
FsCanteenProduct: NewFsCanteenProductModel(gdb),
|
||||
FsCanteenType: NewFsCanteenTypeModel(gdb),
|
||||
FsCard: NewFsCardModel(gdb),
|
||||
FsCardGroup: NewFsCardGroupModel(gdb),
|
||||
FsCart: NewFsCartModel(gdb),
|
||||
FsChangeCode: NewFsChangeCodeModel(gdb),
|
||||
FsCloud: NewFsCloudModel(gdb),
|
||||
FsCloudDeliverEveryTmp: NewFsCloudDeliverEveryTmpModel(gdb),
|
||||
FsCloudDeliverTmp: NewFsCloudDeliverTmpModel(gdb),
|
||||
FsCloudPickUp: NewFsCloudPickUpModel(gdb),
|
||||
FsCloudPickUpDetail: NewFsCloudPickUpDetailModel(gdb),
|
||||
FsCloudReceive: NewFsCloudReceiveModel(gdb),
|
||||
FsCloudReceiveEvery: NewFsCloudReceiveEveryModel(gdb),
|
||||
FsCloudRenderLog: NewFsCloudRenderLogModel(gdb),
|
||||
FsCloudUserApplyBack: NewFsCloudUserApplyBackModel(gdb),
|
||||
FsContact: NewFsContactModel(gdb),
|
||||
FsContactService: NewFsContactServiceModel(gdb),
|
||||
FsCoupon: NewFsCouponModel(gdb),
|
||||
FsDeliver: NewFsDeliverModel(gdb),
|
||||
FsDeliverEvery: NewFsDeliverEveryModel(gdb),
|
||||
FsDepartment: NewFsDepartmentModel(gdb),
|
||||
FsEmailLogs: NewFsEmailLogsModel(gdb),
|
||||
FsEmailTemplate: NewFsEmailTemplateModel(gdb),
|
||||
FsFactory: NewFsFactoryModel(gdb),
|
||||
FsFactoryDeliver: NewFsFactoryDeliverModel(gdb),
|
||||
FsFactoryDeliverEvery: NewFsFactoryDeliverEveryModel(gdb),
|
||||
FsFactoryProduct: NewFsFactoryProductModel(gdb),
|
||||
FsFactoryShipTmp: NewFsFactoryShipTmpModel(gdb),
|
||||
FsFaq: NewFsFaqModel(gdb),
|
||||
FsFont: NewFsFontModel(gdb),
|
||||
FsGerent: NewFsGerentModel(gdb),
|
||||
FsGuest: NewFsGuestModel(gdb),
|
||||
FsLog: NewFsLogModel(gdb),
|
||||
FsLogoCartoon: NewFsLogoCartoonModel(gdb),
|
||||
FsMapLibrary: NewFsMapLibraryModel(gdb),
|
||||
FsMenu: NewFsMenuModel(gdb),
|
||||
FsMerchantCategory: NewFsMerchantCategoryModel(gdb),
|
||||
FsMigration: NewFsMigrationModel(gdb),
|
||||
FsOrder: NewFsOrderModel(gdb),
|
||||
FsOrderAffiliate: NewFsOrderAffiliateModel(gdb),
|
||||
FsOrderDetail: NewFsOrderDetailModel(gdb),
|
||||
FsOrderDetailTemplate: NewFsOrderDetailTemplateModel(gdb),
|
||||
FsOrderRemark: NewFsOrderRemarkModel(gdb),
|
||||
FsPay: NewFsPayModel(gdb),
|
||||
FsPayEvent: NewFsPayEventModel(gdb),
|
||||
FsProduct: NewFsProductModel(gdb),
|
||||
FsProductCopy1: NewFsProductCopy1Model(gdb),
|
||||
FsProductDesign: NewFsProductDesignModel(gdb),
|
||||
FsProductDesignGather: NewFsProductDesignGatherModel(gdb),
|
||||
FsProductModel3d: NewFsProductModel3dModel(gdb),
|
||||
FsProductModel3dLight: NewFsProductModel3dLightModel(gdb),
|
||||
FsProductOption: NewFsProductOptionModel(gdb),
|
||||
FsProductPrice: NewFsProductPriceModel(gdb),
|
||||
FsProductRenderDesign: NewFsProductRenderDesignModel(gdb),
|
||||
FsProductScene: NewFsProductSceneModel(gdb),
|
||||
FsProductSize: NewFsProductSizeModel(gdb),
|
||||
FsProductTagProp: NewFsProductTagPropModel(gdb),
|
||||
FsProductTemplate: NewFsProductTemplateModel(gdb),
|
||||
FsProductTemplateBasemap: NewFsProductTemplateBasemapModel(gdb),
|
||||
FsProductTemplateElement: NewFsProductTemplateElementModel(gdb),
|
||||
FsProductTemplateElement0826: NewFsProductTemplateElement0826Model(gdb),
|
||||
FsProductTemplateElement22: NewFsProductTemplateElement22Model(gdb),
|
||||
FsProductTemplateElementBackup1018: NewFsProductTemplateElementBackup1018Model(gdb),
|
||||
FsProductTemplateElementKongde: NewFsProductTemplateElementKongdeModel(gdb),
|
||||
FsProductTemplateTags: NewFsProductTemplateTagsModel(gdb),
|
||||
FsProductTemplateV2: NewFsProductTemplateV2Model(gdb),
|
||||
FsProductV2Tmp: NewFsProductV2TmpModel(gdb),
|
||||
FsQrcode: NewFsQrcodeModel(gdb),
|
||||
FsQrcodeLog: NewFsQrcodeLogModel(gdb),
|
||||
FsQrcodeSet: NewFsQrcodeSetModel(gdb),
|
||||
FsQrcodeUser: NewFsQrcodeUserModel(gdb),
|
||||
FsQuotation: NewFsQuotationModel(gdb),
|
||||
FsQuotationPrice: NewFsQuotationPriceModel(gdb),
|
||||
FsQuotationProduct: NewFsQuotationProductModel(gdb),
|
||||
FsQuotationRemarkTemplate: NewFsQuotationRemarkTemplateModel(gdb),
|
||||
FsQuotationSaler: NewFsQuotationSalerModel(gdb),
|
||||
FsQuotationSizeLayout: NewFsQuotationSizeLayoutModel(gdb),
|
||||
FsRefundReason: NewFsRefundReasonModel(gdb),
|
||||
FsResource: NewFsResourceModel(gdb),
|
||||
FsResources: NewFsResourcesModel(gdb),
|
||||
FsStandardLogo: NewFsStandardLogoModel(gdb),
|
||||
FsTags: NewFsTagsModel(gdb),
|
||||
FsToolLogs: NewFsToolLogsModel(gdb),
|
||||
FsToolTemplate: NewFsToolTemplateModel(gdb),
|
||||
FsToolUser: NewFsToolUserModel(gdb),
|
||||
FsTrade: NewFsTradeModel(gdb),
|
||||
FsUser: NewFsUserModel(gdb),
|
||||
FsUserDesign: NewFsUserDesignModel(gdb),
|
||||
FsUserInfo: NewFsUserInfoModel(gdb),
|
||||
FsUserMaterial: NewFsUserMaterialModel(gdb),
|
||||
FsUserStock: NewFsUserStockModel(gdb),
|
||||
FsWebSet: NewFsWebSetModel(gdb),
|
||||
}
|
||||
return models
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"fusenapi/utils/auth"
|
||||
|
||||
|
@ -23,7 +22,6 @@ func main() {
|
|||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
c.Timeout = int64(time.Second * 15)
|
||||
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {
|
||||
}))
|
||||
defer server.Stop()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
Name: assistant
|
||||
Host: 0.0.0.0
|
||||
Port: 9950
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"fusenapi/server/backend/internal/config"
|
||||
"fusenapi/server/backend/internal/handler"
|
||||
|
@ -22,7 +21,6 @@ func main() {
|
|||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
c.Timeout = int64(time.Second * 15)
|
||||
|
||||
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
Name: backend
|
||||
Host: 0.0.0.0
|
||||
Port: 9901
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
Auth:
|
||||
AccessSecret: fusen_backend_2023
|
||||
|
|
35
server/base/base.go
Normal file
35
server/base/base.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"fusenapi/utils/auth"
|
||||
|
||||
"fusenapi/server/base/internal/config"
|
||||
"fusenapi/server/base/internal/handler"
|
||||
"fusenapi/server/base/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "etc/base.yaml", "the config file")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
|
||||
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {
|
||||
}))
|
||||
defer server.Stop()
|
||||
|
||||
ctx := svc.NewServiceContext(c)
|
||||
handler.RegisterHandlers(server, ctx)
|
||||
|
||||
fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
|
||||
server.Start()
|
||||
}
|
9
server/base/base_test.go
Normal file
9
server/base/base_test.go
Normal file
|
@ -0,0 +1,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMain(t *testing.T) {
|
||||
main()
|
||||
}
|
10
server/base/etc/base.yaml
Normal file
10
server/base/etc/base.yaml
Normal file
|
@ -0,0 +1,10 @@
|
|||
Name: base
|
||||
Host: 0.0.0.0
|
||||
Port: 9920
|
||||
Timeout: 15000 #服务超时时间(毫秒)
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
RefreshAfter: 1592000
|
||||
SourceRabbitMq: amqp://rabbit001:rabbit001129@110.41.19.98:5672
|
14
server/base/internal/config/config.go
Normal file
14
server/base/internal/config/config.go
Normal file
|
@ -0,0 +1,14 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"fusenapi/server/base/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
rest.RestConf
|
||||
SourceMysql string
|
||||
Auth types.Auth
|
||||
SourceRabbitMq string
|
||||
}
|
35
server/base/internal/handler/merchantcategorylisthandler.go
Normal file
35
server/base/internal/handler/merchantcategorylisthandler.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"reflect"
|
||||
|
||||
"fusenapi/utils/basic"
|
||||
|
||||
"fusenapi/server/base/internal/logic"
|
||||
"fusenapi/server/base/internal/svc"
|
||||
"fusenapi/server/base/internal/types"
|
||||
)
|
||||
|
||||
func MerchantCategoryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var req types.MerchantCategoryListReq
|
||||
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 创建一个业务逻辑层实例
|
||||
l := logic.NewMerchantCategoryListLogic(r.Context(), svcCtx)
|
||||
|
||||
rl := reflect.ValueOf(l)
|
||||
basic.BeforeLogic(w, r, rl)
|
||||
|
||||
resp := l.MerchantCategoryList(&req, userinfo)
|
||||
|
||||
if !basic.AfterLogic(w, r, rl, resp) {
|
||||
basic.NormalAfterLogic(w, r, resp)
|
||||
}
|
||||
}
|
||||
}
|
22
server/base/internal/handler/routes.go
Normal file
22
server/base/internal/handler/routes.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Code generated by goctl. DO NOT EDIT.
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"fusenapi/server/base/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/api/base/merchant_category_list",
|
||||
Handler: MerchantCategoryListHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
53
server/base/internal/logic/merchantcategorylistlogic.go
Normal file
53
server/base/internal/logic/merchantcategorylistlogic.go
Normal file
|
@ -0,0 +1,53 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"fusenapi/model/gmodel"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
|
||||
"context"
|
||||
|
||||
"fusenapi/server/base/internal/svc"
|
||||
"fusenapi/server/base/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type MerchantCategoryListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewMerchantCategoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MerchantCategoryListLogic {
|
||||
return &MerchantCategoryListLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
// 处理进入前逻辑w,r
|
||||
// func (l *MerchantCategoryListLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
|
||||
// }
|
||||
|
||||
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
|
||||
// func (l *MerchantCategoryListLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
|
||||
// // httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
// }
|
||||
|
||||
func (l *MerchantCategoryListLogic) MerchantCategoryList(req *types.MerchantCategoryListReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
||||
// userinfo 传入值时, 一定不为null
|
||||
fsMerchantCategoryModel := gmodel.NewFsMerchantCategoryModel(l.svcCtx.MysqlConn)
|
||||
BuilderDB := fsMerchantCategoryModel.BuilderDB(l.ctx, nil).Model(&gmodel.FsMerchantCategory{})
|
||||
resourceInfo, err := fsMerchantCategoryModel.FindAll(BuilderDB, nil, "sort desc")
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatus(basic.CodeDbSqlErr, "MerchantCategoryList error system failed")
|
||||
}
|
||||
// 返回成功
|
||||
return resp.SetStatus(basic.CodeOK, map[string]interface{}{
|
||||
"list": resourceInfo,
|
||||
})
|
||||
}
|
62
server/base/internal/svc/servicecontext.go
Normal file
62
server/base/internal/svc/servicecontext.go
Normal file
|
@ -0,0 +1,62 @@
|
|||
package svc
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"fusenapi/server/base/internal/config"
|
||||
"net/http"
|
||||
|
||||
"fusenapi/initalize"
|
||||
"fusenapi/model/gmodel"
|
||||
|
||||
"github.com/golang-jwt/jwt"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
|
||||
MysqlConn *gorm.DB
|
||||
AllModels *gmodel.AllModelsGen
|
||||
RabbitMq *initalize.RabbitMqHandle
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
MysqlConn: initalize.InitMysql(c.SourceMysql),
|
||||
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
|
||||
RabbitMq: initalize.InitRabbitMq(c.SourceRabbitMq, nil),
|
||||
}
|
||||
}
|
||||
|
||||
func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, error) {
|
||||
AuthKey := r.Header.Get("Authorization")
|
||||
if AuthKey == "" {
|
||||
return nil, nil
|
||||
}
|
||||
AuthKey = AuthKey[7:]
|
||||
|
||||
if len(AuthKey) <= 50 {
|
||||
return nil, errors.New(fmt.Sprint("Error parsing token, len:", len(AuthKey)))
|
||||
}
|
||||
|
||||
token, err := jwt.Parse(AuthKey, func(token *jwt.Token) (interface{}, error) {
|
||||
// 检查签名方法是否为 HS256
|
||||
if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
|
||||
return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"])
|
||||
}
|
||||
// 返回用于验证签名的密钥
|
||||
return []byte(svcCtx.Config.Auth.AccessSecret), nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errors.New(fmt.Sprint("Error parsing token:", err))
|
||||
}
|
||||
|
||||
// 验证成功返回
|
||||
if claims, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {
|
||||
return claims, nil
|
||||
}
|
||||
|
||||
return nil, errors.New(fmt.Sprint("Invalid token", err))
|
||||
}
|
78
server/base/internal/types/types.go
Normal file
78
server/base/internal/types/types.go
Normal file
|
@ -0,0 +1,78 @@
|
|||
// Code generated by goctl. DO NOT EDIT.
|
||||
package types
|
||||
|
||||
import (
|
||||
"fusenapi/utils/basic"
|
||||
)
|
||||
|
||||
type MerchantCategoryListReq struct {
|
||||
}
|
||||
|
||||
type Request struct {
|
||||
}
|
||||
|
||||
type Response struct {
|
||||
Code int `json:"code"`
|
||||
Message string `json:"msg"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
type Auth struct {
|
||||
AccessSecret string `json:"accessSecret"`
|
||||
AccessExpire int64 `json:"accessExpire"`
|
||||
RefreshAfter int64 `json:"refreshAfter"`
|
||||
}
|
||||
|
||||
type File struct {
|
||||
Filename string `fsfile:"filename"`
|
||||
Header map[string][]string `fsfile:"header"`
|
||||
Size int64 `fsfile:"size"`
|
||||
Data []byte `fsfile:"data"`
|
||||
}
|
||||
|
||||
type Meta struct {
|
||||
TotalCount int64 `json:"totalCount"`
|
||||
PageCount int64 `json:"pageCount"`
|
||||
CurrentPage int `json:"currentPage"`
|
||||
PerPage int `json:"perPage"`
|
||||
}
|
||||
|
||||
// Set 设置Response的Code和Message值
|
||||
func (resp *Response) Set(Code int, Message string) *Response {
|
||||
return &Response{
|
||||
Code: Code,
|
||||
Message: Message,
|
||||
}
|
||||
}
|
||||
|
||||
// Set 设置整个Response
|
||||
func (resp *Response) SetWithData(Code int, Message string, Data interface{}) *Response {
|
||||
return &Response{
|
||||
Code: Code,
|
||||
Message: Message,
|
||||
Data: Data,
|
||||
}
|
||||
}
|
||||
|
||||
// SetStatus 设置默认StatusResponse(内部自定义) 默认msg, 可以带data, data只使用一个参数
|
||||
func (resp *Response) SetStatus(sr *basic.StatusResponse, data ...interface{}) *Response {
|
||||
newResp := &Response{
|
||||
Code: sr.Code,
|
||||
}
|
||||
if len(data) == 1 {
|
||||
newResp.Data = data[0]
|
||||
}
|
||||
return newResp
|
||||
}
|
||||
|
||||
// SetStatusWithMessage 设置默认StatusResponse(内部自定义) 非默认msg, 可以带data, data只使用一个参数
|
||||
func (resp *Response) SetStatusWithMessage(sr *basic.StatusResponse, msg string, data ...interface{}) *Response {
|
||||
newResp := &Response{
|
||||
Code: sr.Code,
|
||||
Message: msg,
|
||||
}
|
||||
if len(data) == 1 {
|
||||
newResp.Data = data[0]
|
||||
}
|
||||
return newResp
|
||||
}
|
|
@ -4,7 +4,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"fusenapi/server/canteen/internal/config"
|
||||
"fusenapi/server/canteen/internal/handler"
|
||||
|
@ -23,8 +22,6 @@ func main() {
|
|||
var c config.Config
|
||||
|
||||
conf.MustLoad(*configFile, &c)
|
||||
c.Timeout = int64(time.Second * 15)
|
||||
c.Timeout = int64(time.Second * 15)
|
||||
|
||||
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
Name: canteen
|
||||
Host: 0.0.0.0
|
||||
Port: 9902
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
svc2 "fusenapi/server/data-transfer/internal/svc"
|
||||
"fusenapi/utils/auth"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
|
@ -21,7 +20,6 @@ func main() {
|
|||
|
||||
var c config2.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
c.Timeout = int64(time.Second * 15)
|
||||
|
||||
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
Name: data-transfer
|
||||
Host: 0.0.0.0
|
||||
Port: 9903
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
Name: home-user-auth
|
||||
Host: 0.0.0.0
|
||||
Port: 9904
|
||||
Timeout: 15000 #服务超时时间
|
||||
MainAddress: "http://localhost:9900"
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"fusenapi/server/home-user-auth/internal/config"
|
||||
"fusenapi/server/home-user-auth/internal/handler"
|
||||
|
@ -23,7 +22,6 @@ func main() {
|
|||
var c config.Config
|
||||
|
||||
conf.MustLoad(*configFile, &c)
|
||||
c.Timeout = int64(time.Second * 15)
|
||||
|
||||
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {
|
||||
|
||||
|
|
|
@ -102,6 +102,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||
Path: "/api/user/one-more-order",
|
||||
Handler: UserAgainOrderHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/api/user/set_user_info",
|
||||
Handler: UserInfoSetHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
35
server/home-user-auth/internal/handler/userinfosethandler.go
Normal file
35
server/home-user-auth/internal/handler/userinfosethandler.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"reflect"
|
||||
|
||||
"fusenapi/utils/basic"
|
||||
|
||||
"fusenapi/server/home-user-auth/internal/logic"
|
||||
"fusenapi/server/home-user-auth/internal/svc"
|
||||
"fusenapi/server/home-user-auth/internal/types"
|
||||
)
|
||||
|
||||
func UserInfoSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var req types.UserInfoSetReq
|
||||
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 创建一个业务逻辑层实例
|
||||
l := logic.NewUserInfoSetLogic(r.Context(), svcCtx)
|
||||
|
||||
rl := reflect.ValueOf(l)
|
||||
basic.BeforeLogic(w, r, rl)
|
||||
|
||||
resp := l.UserInfoSet(&req, userinfo)
|
||||
|
||||
if !basic.AfterLogic(w, r, rl, resp) {
|
||||
basic.NormalAfterLogic(w, r, resp)
|
||||
}
|
||||
}
|
||||
}
|
95
server/home-user-auth/internal/logic/userinfosetlogic.go
Normal file
95
server/home-user-auth/internal/logic/userinfosetlogic.go
Normal file
|
@ -0,0 +1,95 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"fusenapi/model/gmodel"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
"fusenapi/utils/validate"
|
||||
"time"
|
||||
|
||||
"context"
|
||||
|
||||
"fusenapi/server/home-user-auth/internal/svc"
|
||||
"fusenapi/server/home-user-auth/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type UserInfoSetLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewUserInfoSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserInfoSetLogic {
|
||||
return &UserInfoSetLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
// 处理进入前逻辑w,r
|
||||
// func (l *UserInfoSetLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
|
||||
// }
|
||||
|
||||
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
|
||||
// func (l *UserInfoSetLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
|
||||
// // httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
// }
|
||||
|
||||
func (l *UserInfoSetLogic) UserInfoSet(req *types.UserInfoSetReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
||||
// userinfo 传入值时, 一定不为null
|
||||
if userinfo.IsOnlooker() {
|
||||
// 如果是,返回未授权的错误码
|
||||
return resp.SetStatus(basic.CodeUnAuth)
|
||||
}
|
||||
|
||||
var userId int64
|
||||
var guestId int64
|
||||
|
||||
// 检查用户是否是游客
|
||||
if userinfo.IsGuest() {
|
||||
// 如果是,使用游客ID和游客键名格式
|
||||
guestId = userinfo.GuestId
|
||||
} else {
|
||||
// 否则,使用用户ID和用户键名格式
|
||||
userId = userinfo.UserId
|
||||
}
|
||||
|
||||
_, err := validate.Validate(&req.Module, &req.Metadata)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatus(basic.CodeRequestParamsErr, "UserInfoSet error Validate failed")
|
||||
}
|
||||
|
||||
// 根据模块类型检查数据
|
||||
var userInfo = &gmodel.FsUserInfo{}
|
||||
fsUserInfoModel := gmodel.NewFsUserInfoModel(l.svcCtx.MysqlConn)
|
||||
BuilderDB := fsUserInfoModel.BuilderDB(l.ctx, nil).Model(&gmodel.FsUserInfo{})
|
||||
BuilderDB1 := BuilderDB.Where("module = ?", req.Module).Where("user_id=?", userId).Where("guest_id=?", guestId)
|
||||
userInfo, err = fsUserInfoModel.FindOne(BuilderDB1, nil)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatus(basic.CodeDbSqlErr, "UserInfoSet error system failed")
|
||||
}
|
||||
var nowTime = time.Now().Unix()
|
||||
if userInfo.Id != 0 {
|
||||
userInfo.Metadata = &req.Metadata
|
||||
userInfo.Utime = &nowTime
|
||||
} else {
|
||||
userInfo.GuestId = &guestId
|
||||
userInfo.UserId = &userId
|
||||
userInfo.Module = &req.Module
|
||||
userInfo.Metadata = &req.Metadata
|
||||
userInfo.Ctime = &nowTime
|
||||
}
|
||||
_, err = fsUserInfoModel.CreateOrUpdate(BuilderDB, userInfo)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatus(basic.CodeDbSqlErr, "UserInfoSet error system failed")
|
||||
}
|
||||
|
||||
return resp.SetStatus(basic.CodeOK)
|
||||
}
|
|
@ -80,14 +80,14 @@ func (l *UserOrderCancelLogic) UserOrderCancel(req *types.UserOrderCancelReq, us
|
|||
err = l.svcCtx.MysqlConn.Transaction(func(tx *gorm.DB) error {
|
||||
// 修改订单信息
|
||||
orderModelTS := gmodel.NewFsOrderModel(tx)
|
||||
err = orderModelTS.Update(ctx, orderInfo)
|
||||
err = orderModelTS.RBUpdate(ctx, orderInfo)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// 新增退款记录
|
||||
var isRefund int64 = 0
|
||||
refundReasonModelTS := gmodel.NewFsRefundReasonModel(tx)
|
||||
refundReasonModelTS.CreateOrUpdate(ctx, &gmodel.FsRefundReason{
|
||||
refundReasonModelTS.RBCreateOrUpdate(ctx, &gmodel.FsRefundReason{
|
||||
IsRefund: &isRefund,
|
||||
RefundReasonId: &req.RefundReasonId,
|
||||
RefundReason: &req.RefundReason,
|
||||
|
|
|
@ -5,6 +5,11 @@ import (
|
|||
"fusenapi/utils/basic"
|
||||
)
|
||||
|
||||
type UserInfoSetReq struct {
|
||||
Module string `form:"module,options=[merchant_category]"` // json格式字符串
|
||||
Metadata string `form:"metadata"` // json格式字符串
|
||||
}
|
||||
|
||||
type UserAgainOrderReq struct {
|
||||
Sn string `form:"sn"` // 订单编号
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Name: inventory
|
||||
Host: 0.0.0.0
|
||||
Port: 9905
|
||||
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"fusenapi/server/inventory/internal/config"
|
||||
"fusenapi/server/inventory/internal/handler"
|
||||
|
@ -22,7 +21,6 @@ func main() {
|
|||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
c.Timeout = int64(time.Second * 15)
|
||||
|
||||
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
Name: map-library
|
||||
Host: 0.0.0.0
|
||||
Port: 9906
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
|
|
|
@ -66,7 +66,7 @@ func (l *GetMapLibraryListLogic) GetMapLibraryList(req *types.Request, userinfo
|
|||
if tagIndex, ok := mapTag[*v.TagId]; ok {
|
||||
data.Tag = &types.MapLibraryListTag{
|
||||
Id: templateTagList[tagIndex].Id,
|
||||
Title: *templateTagList[tagIndex].Title,
|
||||
Title: *templateTagList[tagIndex].TemplateTag,
|
||||
}
|
||||
}
|
||||
//解析info
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"fusenapi/server/map-library/internal/config"
|
||||
"fusenapi/server/map-library/internal/handler"
|
||||
|
@ -22,7 +21,6 @@ func main() {
|
|||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
c.Timeout = int64(time.Second * 15)
|
||||
|
||||
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
Name: orders
|
||||
Host: 0.0.0.0
|
||||
Port: 9907
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"fusenapi/server/orders/internal/config"
|
||||
"fusenapi/server/orders/internal/handler"
|
||||
|
@ -22,7 +21,6 @@ func main() {
|
|||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
c.Timeout = int64(time.Second * 15)
|
||||
|
||||
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user