Unify error handling and HTTP statuses
Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package unit
|
||||
import (
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
"honoka-chan/internal/session"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -34,7 +35,7 @@ func unitAccessoryAll(ctx *gin.Context) (res any, err error) {
|
||||
WearingInfo: wearingInfo,
|
||||
EspecialCreateFlag: false,
|
||||
},
|
||||
Status: 200,
|
||||
Status: http.StatusOK,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
}
|
||||
|
||||
@@ -2,13 +2,14 @@ package unit
|
||||
|
||||
import (
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func unitAccessoryMaterialAll() (res any, err error) {
|
||||
res = unitapischema.AccessoryMaterialAllResp{
|
||||
Result: unitapischema.AccessoryMaterialAllData{},
|
||||
Status: 200,
|
||||
Status: http.StatusOK,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package unit
|
||||
import (
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
honokautils "honoka-chan/internal/utils"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -16,7 +17,7 @@ func unitAccessoryTab() (res any, err error) {
|
||||
Result: unitapischema.AccessoryTabData{
|
||||
TabList: tabList,
|
||||
},
|
||||
Status: 200,
|
||||
Status: http.StatusOK,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
unitmodel "honoka-chan/internal/model/unit"
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
"honoka-chan/internal/session"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -55,7 +56,7 @@ func unitAll(ctx *gin.Context) (res any, err error) {
|
||||
Active: unitsData,
|
||||
Waiting: []unitapischema.Waiting{},
|
||||
},
|
||||
Status: 200,
|
||||
Status: http.StatusOK,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package unit
|
||||
import (
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
"honoka-chan/internal/session"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -46,7 +47,7 @@ func unitDeckInfo(ctx *gin.Context) (res any, err error) {
|
||||
}
|
||||
res = unitapischema.DeckInfoResp{
|
||||
Result: unitDeckInfo,
|
||||
Status: 200,
|
||||
Status: http.StatusOK,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package unit
|
||||
import (
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
"honoka-chan/internal/session"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -67,7 +68,7 @@ func unitRemovableSkillInfo(ctx *gin.Context) (res any, err error) {
|
||||
OwningInfo: owingInfo,
|
||||
EquipmentInfo: equipInfo,
|
||||
}, // 宝石
|
||||
Status: 200,
|
||||
Status: http.StatusOK,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package unit
|
||||
|
||||
import (
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -10,7 +11,7 @@ func unitSupporterAll() (res any, err error) {
|
||||
Result: unitapischema.SupporterAllData{
|
||||
UnitSupportList: []unitapischema.SupporterList{},
|
||||
}, // 练习道具
|
||||
Status: 200,
|
||||
Status: http.StatusOK,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user