Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteCommentService(id uint, auth *model.AuthInfo) *model.ApiJson
- func StatusName(status int) string
- func TxDeleteItem(tx *gorm.DB, id uint) error
- type AddItemRequest
- type AllOrderRequest
- type Comment
- type CommentJson
- type ConsumeItemRequest
- type CreateCommentRequest
- type CreateItemRequest
- type CreateOrderRequest
- type CreateTagRequest
- type Item
- type ItemInfoJson
- type ItemJson
- type ItemLog
- type ItemLogJson
- type Order
- type OrderJson
- type RepairerOrderRequest
- type Status
- func NewStatus(status, repairer uint, operator uint) *Status
- func NewStatusAppraised(operator uint) *Status
- func NewStatusAssigned(repairer, operator uint) *Status
- func NewStatusCanceled(operator uint) *Status
- func NewStatusCompleted(operator uint) *Status
- func NewStatusHold(operator uint) *Status
- func NewStatusRejected(operator uint) *Status
- func NewStatusReported(operator uint) *Status
- func NewStatusWaiting(operator uint) *Status
- type StatusJson
- type Tag
- type TagJson
- type UpdateOrderRequest
- type UserOrderRequest
Constants ¶
View Source
const ( CommentAllow = iota + 1 CommentDisallow )
View Source
const ( StatusIllegal = iota StatusWaiting StatusAssigned StatusCompleted StatusReported StatusHold StatusCanceled StatusRejected StatusAppraised )
Variables ¶
View Source
var Module module.Module
Functions ¶
func StatusName ¶
Types ¶
type AddItemRequest ¶
type AllOrderRequest ¶
type AllOrderRequest struct { Title string `json:"title" url:"title" validate:"lte=191"` UserID uint `json:"user_id" url:"user_id"` Status uint `json:"status" url:"status"` // 状态 0:非法 1:待处理 2:已接单 3:已完成 4:上报中 5:挂单 6:已取消 7:已拒绝 8:已评价 Tags []uint `json:"tags" url:"tags"` // 若干 Tag 的 ID Disjunctive bool `json:"disjunctive" url:"disjunctive"` // false: 查询包含所有Tag的订单, true: 查询包含任一Tag的订单 model.PageParam }
type Comment ¶
type Comment struct { model.BaseModel OrderID uint `gorm:"not null; index:idx_comment_order_seqnum,priority:1; comment:订单ID"` UserID uint `gorm:"not null; comment:用户ID"` UserName string `gorm:"not null; comment:用户名"` SequenceNum uint `gorm:"not null; index:idx_comment_order_seqnum,priority:2; default:0; comment:发言序号"` Content string `gorm:"not null; comment:内容"` }
func GetCommentByID ¶
GetCommentByID returns the comment with the given ID.
type CommentJson ¶
type ConsumeItemRequest ¶
type CreateCommentRequest ¶
type CreateCommentRequest struct {
Content string `json:"content" validate:"required,lte=65535"`
}
type CreateItemRequest ¶
type CreateOrderRequest ¶
type CreateOrderRequest struct { Title string `json:"title" validate:"required,lte=191"` Content string `json:"content" validate:"omitempty,lte=65535"` Address string `json:"address" validate:"required,lte=65535"` ContactName string `json:"contact_name" validate:"required,lte=191"` ContactPhone string `json:"contact_phone" validate:"required,lte=191"` Tags []uint `json:"tags"` // 若干 Tag 的 ID }
type CreateTagRequest ¶
type Item ¶
type Item struct { model.BaseModel Name string `gorm:"not null; size:191; unique; comment:物品名称"` Description string `gorm:"not null; comment:物品描述"` Price float64 `gorm:"not null; default:0; comment:物品总价值"` Income float64 `gorm:"not null; default:0; comment:维修收入"` Count int `gorm:"not null; default:0; comment:物品数量"` ItemLogs []*ItemLog `gorm:"foreignkey:ItemID"` }
func TxCreateItem ¶
type ItemInfoJson ¶
type ItemInfoJson struct { ID uint `json:"id"` Name string `json:"name"` Description string `json:"discription"` Price float64 `json:"price"` Income float64 `json:"income"` Count int `json:"count"` ItemLogs []*ItemLogJson `json:"item_log"` CreatedAt int64 `json:"created_at"` // unix timestamp in seconds (UTC) UpdatedAt int64 `json:"updated_at"` // unix timestamp in seconds (UTC) CreatedBy uint `json:"created_by"` // 创建用户ID UpdatedBy uint `json:"updated_by"` // 更新用户ID }
type ItemLog ¶
type ItemLog struct { model.BaseModel ItemID uint `gorm:"not null; comment:物品ID"` Item *Item `gorm:"foreignkey:ItemID;"` OrderID *uint `gorm:"comment:订单ID"` Order *Order `gorm:"foreignkey:OrderID;"` ChangeNum int `gorm:"not null; default:0; comment:增加/消耗数量 正:增加 负:减少"` ChangePrice float64 `gorm:"not null; default:0; comment:开销 正:进货 负:订单收费"` }
type ItemLogJson ¶
type ItemLogJson struct { ID uint `json:"id"` ItemID uint `json:"item_id"` OrderID uint `json:"order_id"` ChangeNum int `json:"change_num"` // 增加/消耗数量 正:增加 负:减少 ChangePrice float64 `json:"change_price"` // 开销 正:进货 负:订单收费 CreatedAt int64 `json:"created_at"` // unix timestamp in seconds (UTC) CreatedBy uint `json:"created_by"` // unix timestamp in seconds (UTC) }
type Order ¶
type Order struct { model.BaseModel UserID uint `gorm:"not null; index:idx_order_user_status,priority:1; comment:用户ID"` User *user.User `gorm:"foreignkey:UserID"` Title string `gorm:"not null; index; size:191; comment:标题"` Content string `gorm:"not null; comment:内容"` Address string `gorm:"not null; comment:地址"` ContactName string `gorm:"not null; size:191; comment:联系人"` ContactPhone string `gorm:"not null; size:191; comment:联系电话"` Status uint `` /* 192-byte string literal not displayed */ StatusList []*Status `gorm:"foreignkey:OrderID"` AllowComment uint `gorm:"not null; size:2; default:1; comment:是否允许评论 1:允许 2:不允许"` Comments []*Comment `gorm:"foreignkey:OrderID"` ItemLogs []*ItemLog `gorm:"foreignkey:OrderID"` Tags []*Tag `gorm:"many2many:order_tags;"` Appraisal uint `gorm:"not null; size:5; default:0; comment:评价 0:未评价 1-5:已评价"` }
func GetOrderByID ¶
GetOrderByID returns the order with the given ID and Tags and Comments.
func GetOrderWithLastStatus ¶
GetOrderWithLastStatus returns the order with the given ID and the last status.
func GetSimpleOrderByID ¶
GetSimpleOrderByID returns the order with the given ID.
func TxUpdateOrder ¶
type OrderJson ¶
type OrderJson struct { ID uint `json:"id"` UserID uint `json:"user_id"` User *user.UserJson `json:"user,omitempty"` Title string `json:"title"` Content string `json:"content"` Address string `json:"address"` ContactName string `json:"contact_name"` ContactPhone string `json:"contact_phone"` Status uint `json:"status"` Repairer *user.UserJson `json:"repairer,omitempty"` AllowComment bool `json:"allow_comment"` CreatedAt int64 `json:"created_at"` // unix timestamp in seconds (UTC) UpdatedAt int64 `json:"updated_at"` // unix timestamp in seconds (UTC) Appraisal uint `json:"appraisal"` Tags []*TagJson `json:"tags,omitempty"` Comments []*CommentJson `json:"comments,omitempty"` }
type RepairerOrderRequest ¶
type Status ¶
type Status struct { model.BaseModel OrderID uint `gorm:"not null; comment:订单ID"` Order *Order `gorm:"foreignkey:OrderID;"` Status uint `` /* 152-byte string literal not displayed */ Current bool `gorm:"not null; index:idx_status_repairer_current,priority:2; size:1; default:0; comment:是否最新状态"` RepairerID *uint `gorm:"index:idx_status_repairer_current,priority:1; comment:维修员ID"` Repairer *user.User `gorm:"foreignkey:RepairerID;"` SequenceNum uint `gorm:"not null; default:0; comment:状态序号"` }
immutable
type StatusJson ¶
type StatusJson struct { SequenceNum uint `json:"sequence_num"` // 状态序号 Status uint `json:"status"` // 状态 0:非法 1:待处理 2:已接单 3:已完成 4:上报中 5:挂单 6:已取消 7:已拒绝 8:已评价 RepairerID uint `json:"repairer_id"` Repairer *user.UserJson `json:"repairer"` CreatedAt int64 `json:"created_at"` // unix timestamp in seconds (UTC) UpdatedAt int64 `json:"updated_at"` // unix timestamp in seconds (UTC) CreatedBy uint `json:"created_by"` UpdatedBy uint `json:"updated_by"` }
type Tag ¶
type Tag struct { model.BaseModel Sort string `gorm:"not null; size:191; index:idx_tag_sort_name,priority:1; comment:分类"` Name string `gorm:"not null; size:191; index:idx_tag_sort_name,priority:2; comment:标签名称"` Level uint `gorm:"not null; size:5; default:0; comment:标签等级"` Congener uint `gorm:"not null; default:0; comment:同类型数量"` Orders []*Order `gorm:"many2many:order_tags;"` }
type UpdateOrderRequest ¶
type UpdateOrderRequest struct { Title string `json:"title" validate:"omitempty,lte=191"` Content string `json:"content" validate:"omitempty,lte=65535"` Address string `json:"address" validate:"omitempty,lte=65535"` ContactName string `json:"contact_name" validate:"omitempty,lte=191"` ContactPhone string `json:"contact_phone" validate:"omitempty,lte=191"` AddTags []uint `json:"add_tags"` // 若干需要添加的 Tag 的 ID DelTags []uint `json:"del_tags"` // 若干需要删除的 Tag 的 ID }
Source Files ¶
- api.go
- config.go
- controller_comment.go
- controller_item.go
- controller_order.go
- controller_tag.go
- dao_comment.go
- dao_item.go
- dao_itemlog.go
- dao_order.go
- dao_status.go
- dao_tag.go
- index.go
- model_comment.go
- model_item.go
- model_itemlog.go
- model_order.go
- model_status.go
- model_tag.go
- service_comment.go
- service_item.go
- service_order.go
- service_tag.go
Click to show internal directories.
Click to hide internal directories.