by Robin at 20231230; add status

This commit is contained in:
Leufolium 2023-12-30 17:32:41 +08:00
parent 2e638c4f04
commit ed3bc2294c
3 changed files with 60 additions and 56 deletions

View File

@ -5,62 +5,16 @@ import (
"service/dbstruct"
)
// op 创建
type OpCreateReq struct {
// api 创建
type ApiCreateReq struct {
base.BaseRequest
*dbstruct.Feedback
}
type OpCreateData struct {
type ApiCreateData struct {
}
type OpCreateResp struct {
type ApiCreateResp struct {
base.BaseResponse
Data *OpCreateData `json:"data"`
}
// op 删除
type OpDeleteReq struct {
base.BaseRequest
Id int64 `json:"id"`
}
type OpDeleteData struct {
}
type OpDeleteResp struct {
base.BaseResponse
Data *OpDeleteData `json:"data"`
}
// op 更新
type OpUpdateReq struct {
base.BaseRequest
*dbstruct.Feedback
}
type OpUpdateData struct {
}
type OpUpdateResp struct {
base.BaseResponse
Data *OpUpdateData `json:"data"`
}
// op 列表
type OpListReq struct {
base.BaseRequest
Offset int `json:"offset"`
Limit int `json:"limit"`
}
type OpListData struct {
List []*dbstruct.Feedback `json:"list"`
Offset int `json:"offset"`
More int `json:"more"`
}
type OpListResp struct {
base.BaseResponse
Data *OpListData `json:"data"`
Data *ApiCreateData `json:"data"`
}

View File

@ -5,16 +5,63 @@ import (
"service/dbstruct"
)
// api 创建
type ApiCreateReq struct {
// op 创建
type OpCreateReq struct {
base.BaseRequest
*dbstruct.Feedback
}
type ApiCreateData struct {
type OpCreateData struct {
}
type ApiCreateResp struct {
type OpCreateResp struct {
base.BaseResponse
Data *ApiCreateData `json:"data"`
Data *OpCreateData `json:"data"`
}
// op 删除
type OpDeleteReq struct {
base.BaseRequest
Id int64 `json:"id"`
}
type OpDeleteData struct {
}
type OpDeleteResp struct {
base.BaseResponse
Data *OpDeleteData `json:"data"`
}
// op 更新
type OpUpdateReq struct {
base.BaseRequest
*dbstruct.Feedback
}
type OpUpdateData struct {
}
type OpUpdateResp struct {
base.BaseResponse
Data *OpUpdateData `json:"data"`
}
// op 列表
type OpListReq struct {
base.BaseRequest
Status *int64 `json:"status"`
Offset int `json:"offset"`
Limit int `json:"limit"`
}
type OpListData struct {
List []*dbstruct.Feedback `json:"list"`
Offset int `json:"offset"`
More int `json:"more"`
}
type OpListResp struct {
base.BaseResponse
Data *OpListData `json:"data"`
}

View File

@ -1760,6 +1760,9 @@ func (m *Mongo) GetFeedbackList(ctx *gin.Context, req *feedbackproto.OpListReq)
query := qmgo.M{
"del_flag": 0,
}
if req.Status != nil {
query["status"] = util.DerefInt64(req.Status)
}
err := col.Find(ctx, query).Sort("-ct").Skip(int64(req.Offset)).Limit(int64(req.Limit)).All(&list)
if err == qmgo.ErrNoSuchDocuments {
err = nil