Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["need.go"],
importpath = "go-common/app/admin/main/apm/model/need",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = ["//library/time:go_default_library"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,111 @@
package need
import "go-common/library/time"
// type and states
const (
TypeCancel = 0
TypeLike = 1
TypeDislike = 2
VerifyAccept = 2
VerifyReject = 3
VerifyObserved = 4
NeedApply = 5
NeedVerify = 6
NeedReview = 7
)
//VerifyType is
var (
VerifyType = map[int]string{
VerifyAccept: "采纳",
VerifyReject: "驳回",
VerifyObserved: "待观察",
NeedApply: "申请",
NeedVerify: "确认",
NeedReview: "审核",
}
)
//TableName needs
func (*NInfo) TableName() string {
return "needs"
}
//NInfo struct
type NInfo struct {
ID int64 `gorm:"column:id" json:"id"`
Title string `gorm:"column:title" json:"title"`
Content string `gorm:"column:content" json:"content"`
Reporter string `gorm:"column:reporter" json:"reporter"`
Status int8 `gorm:"column:status" json:"status"`
LikeCounts int `gorm:"column:like_counts" json:"like_counts"`
DislikeCounts int `gorm:"column:dislike_counts" json:"dislike_counts"`
CTime time.Time `gorm:"column:ctime" json:"ctime"`
MTime time.Time `gorm:"column:mtime" json:"mtime"`
LikeState int8 `gorm:"-" json:"like_state"`
}
//NAddReq add request struct
type NAddReq struct {
Title string `form:"title" validate:"required"`
Content string `form:"content" validate:"required"`
}
// EmpResp is empty resp.
type EmpResp struct {
}
//NEditReq edit request struct
type NEditReq struct {
ID int64 `form:"id" validate:"required"`
Title string `form:"title"`
Content string `form:"content"`
}
//NListReq is list request struct
type NListReq struct {
Ps int `form:"ps" default:"20"`
Pn int `form:"pn" default:"1"`
Status int `form:"status"`
Reporter string `form:"reporter"`
}
//NListResp is list resp struct
type NListResp struct {
Data []*NInfo `json:"data"`
Total int64 `json:"total"`
}
//NVerifyReq is verify req struct
type NVerifyReq struct {
ID int64 `form:"id" validate:"required"`
Status int `form:"status" validate:"required"`
}
//TableName user_likes
func (*UserLikes) TableName() string {
return "user_likes"
}
//UserLikes struct
type UserLikes struct {
ID int64 `gorm:"column:id" json:"id"`
ReqID int64 `gorm:"column:req_id" json:"req_id"`
User string `gorm:"column:user" json:"user"`
LikeType int8 `gorm:"column:like_type" json:"like_type"`
CTime time.Time `gorm:"column:ctime" json:"ctime"`
MTime time.Time `gorm:"column:mtime" json:"mtime"`
}
//Likereq is userlike req struct
type Likereq struct {
ReqID int64 `form:"req_id" validate:"required"`
LikeType int8 `form:"like_type"`
}
//VoteListResp is vote resp struct
type VoteListResp struct {
Data []*UserLikes `json:"data"`
Total int64 `json:"total"`
}