u
This commit is contained in:
1 parent
44ab5416a3
commit
1935906676
17 files changed
+322
-266
No files matched your search
@@ -10,6 +10,7 @@ import (
|
||||
"allapp/utils/idgen"
|
||||
"allapp/utils/response"
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
money "allapp/biz/model/money"
|
||||
|
||||
@@ -123,8 +124,11 @@ func UpdateMoneyCategorySort(ctx context.Context, c *app.RequestContext) {
|
||||
func CreateMoneyCategory(ctx context.Context, c *app.RequestContext) {
|
||||
var err error
|
||||
var req money.CreateMoneyCategoryReq
|
||||
|
||||
err = c.BindAndValidate(&req)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
|
||||
c.String(consts.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
@@ -134,13 +138,12 @@ func CreateMoneyCategory(ctx context.Context, c *app.RequestContext) {
|
||||
ID := idgen.NextId()
|
||||
|
||||
params := repo.InsertMoneyUserCategoryParams{
|
||||
ID: ID,
|
||||
UserID: middleware.GetUserID(ctx),
|
||||
Name: req.Name,
|
||||
Icon: req.Icon,
|
||||
Type: req.Type,
|
||||
// 默认排序号为ID
|
||||
SortNumber: 0,
|
||||
ID: ID,
|
||||
UserID: middleware.GetUserID(ctx),
|
||||
Name: req.Name,
|
||||
Icon: req.Icon,
|
||||
Type: req.Type,
|
||||
SortNumber: req.SortNumber,
|
||||
}
|
||||
|
||||
// 插入
|
||||
|
||||
Reference in new issue
Block a user