* feat: add alist v3 driver (close #1833) * chore: use generics Co-authored-by: Noah Hsu <i@nn.ci>
This commit is contained in:
@ -28,7 +28,7 @@ func ErrorResp(c *gin.Context, err error, code int, l ...bool) {
|
||||
log.Errorf("%v", err)
|
||||
}
|
||||
}
|
||||
c.JSON(200, Resp{
|
||||
c.JSON(200, Resp[interface{}]{
|
||||
Code: code,
|
||||
Message: hidePrivacy(err.Error()),
|
||||
Data: nil,
|
||||
@ -40,7 +40,7 @@ func ErrorStrResp(c *gin.Context, str string, code int, l ...bool) {
|
||||
if len(l) != 0 && l[0] {
|
||||
log.Error(str)
|
||||
}
|
||||
c.JSON(200, Resp{
|
||||
c.JSON(200, Resp[interface{}]{
|
||||
Code: code,
|
||||
Message: hidePrivacy(str),
|
||||
Data: nil,
|
||||
@ -50,14 +50,14 @@ func ErrorStrResp(c *gin.Context, str string, code int, l ...bool) {
|
||||
|
||||
func SuccessResp(c *gin.Context, data ...interface{}) {
|
||||
if len(data) == 0 {
|
||||
c.JSON(200, Resp{
|
||||
c.JSON(200, Resp[interface{}]{
|
||||
Code: 200,
|
||||
Message: "success",
|
||||
Data: nil,
|
||||
})
|
||||
return
|
||||
}
|
||||
c.JSON(200, Resp{
|
||||
c.JSON(200, Resp[interface{}]{
|
||||
Code: 200,
|
||||
Message: "success",
|
||||
Data: data[0],
|
||||
|
Reference in New Issue
Block a user