first commit

This commit is contained in:
Yangtao
2025-11-18 17:48:20 +08:00
commit 6e56cab848
196 changed files with 65809 additions and 0 deletions

View File

@ -0,0 +1,45 @@
package network
import (
"encoding/json"
)
const (
SuccessCode = "6000" // 成功
NeedLogin = "6018" // 登陆过期
ErrorCode = "6020" // 错误
)
type Response struct {
Code string
Result interface{}
Msg string
}
type EmptyResponse struct {
}
func Fail(msg string) Response {
response := Response{Code: ErrorCode, Msg: msg}
return response
}
func Invalid() string {
response := Response{Code: NeedLogin, Msg: "用户身份已过期"}
str, _ := json.Marshal(response)
return string(str)
}
func Success(data interface{}) Response {
response := Response{Code: SuccessCode, Result: data}
return response
}
func Page(data interface{}, count int64) Response {
response := Response{Code: SuccessCode, Result: map[string]interface{}{
"List": data,
"Count": count,
}}
return response
}