-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor frontend build process in makefile and add fly deployment co…
…mmand
- Loading branch information
Showing
9 changed files
with
98 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package utils | ||
package result | ||
|
||
import ( | ||
"bytes" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package result | ||
|
||
import ( | ||
"github.com/gofiber/fiber/v2" | ||
) | ||
|
||
// Res 响应结构体 | ||
type Res struct { | ||
Code uint `json:"code"` | ||
Msg string `json:"msg"` | ||
Data fiber.Map `json:"data"` | ||
} | ||
|
||
// 请求成功 | ||
func Success(msg ...string) *Res { | ||
if len(msg) > 0 { | ||
return &Res{2000, msg[0], fiber.Map{}} | ||
} | ||
return &Res{2000, "success", fiber.Map{}} | ||
} | ||
|
||
// 请求错误 | ||
func Error(msg ...string) *Res { | ||
if len(msg) > 0 { | ||
return &Res{4000, msg[0], fiber.Map{}} | ||
} | ||
return &Res{4000, "error", fiber.Map{}} | ||
} | ||
|
||
// 无权限 | ||
func NoPermission(msg ...string) *Res { | ||
if len(msg) > 0 { | ||
return &Res{4001, msg[0], fiber.Map{}} | ||
} | ||
return &Res{4001, "no permission", fiber.Map{}} | ||
} | ||
|
||
// 系统异常 | ||
func SystemError(msg ...string) *Res { | ||
if len(msg) > 0 { | ||
return &Res{5000, msg[0], fiber.Map{}} | ||
} | ||
return &Res{5000, "system error", fiber.Map{}} | ||
} | ||
|
||
// WithData 设置响应数据 | ||
func (r Res) WithData(data fiber.Map) *Res { | ||
return &Res{ | ||
Code: r.Code, | ||
Msg: r.Msg, | ||
Data: data, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters