From e818c6a6523a71d73f37598b8555911271759963 Mon Sep 17 00:00:00 2001 From: RIceWqy <1840169763@qq.com> Date: Sun, 24 Dec 2023 21:16:19 +0800 Subject: [PATCH] init --- module/comment/Comment.go | 31 +++++++++++++++++++++++++++++++ module/comment/init.go | 12 ++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 module/comment/Comment.go create mode 100644 module/comment/init.go diff --git a/module/comment/Comment.go b/module/comment/Comment.go new file mode 100644 index 0000000..14d21b9 --- /dev/null +++ b/module/comment/Comment.go @@ -0,0 +1,31 @@ +package comment + +import "time" + +func (Comment) TableName() string { + return "comment" +} + +// Comment 用户评论结构体 +type Comment struct { + ID int `json:"id"` // 评论ID + GoodsID int `json:"goods_id"` // 商品ID + OrderID int `json:"order_id"` // 订单ID + OrderItemID int `json:"order_item_id"` // 订单项ID + UserID int `json:"user_id"` // 用户ID + Level int `json:"level"` // 评级 + Content string `json:"content"` // 评论内容 + Images []string `json:"images"` // 评论图片列表 + Status string `json:"status"` // 评论状态 + AdminID int `json:"admin_id"` // 管理员ID + ReplyContent string `json:"reply_content"` // 回复内容 + ReplyTime time.Time `json:"replytime"` // 回复时间 + CreateTime int64 `json:"createtime"` // 创建时间 + UpdateTime int64 `json:"updatetime"` // 更新时间 + DeleteTime int64 `json:"deletetime"` // 删除时间 + User struct { + ID int `json:"id"` // 用户ID + Nickname string `json:"nickname"` // 用户昵称 + Avatar string `json:"avatar"` // 用户头像 + } `json:"user" xorm:"-"` // 用户信息 +} diff --git a/module/comment/init.go b/module/comment/init.go new file mode 100644 index 0000000..5a4a21e --- /dev/null +++ b/module/comment/init.go @@ -0,0 +1,12 @@ +package comment + +import ( + "github.com/towgo/towgo/dao/ormDriver/xormDriver" + "github.com/towgo/towgo/towgo" +) + +func init() { + xormDriver.Sync2(new(Comment)) + towgo.NewCRUDJsonrpcAPI("/comment", Comment{}, []Comment{}).RegAPI() + +}