Order 枚举

This commit is contained in:
eson
2023-06-20 16:46:56 +08:00
parent 8a4e122a0a
commit 2d3c394c73
7 changed files with 172 additions and 60 deletions

View File

@@ -2,31 +2,35 @@ package basic
// StatusResponse 公司自定义状态码
type StatusResponse struct {
Code int
Message string
Code int // 状态码
Message string // 状态码相关解析
}
var (
CodeOK = &StatusResponse{200, "success"} // 成功
CodeApiErr = &StatusResponse{500, "api error"} // api 错误
CodeSaveErr = &StatusResponse{501, "fail to save"} // 储存错误
CodeServiceErr = &StatusResponse{510, "server logic error"} // server logic 错误
CodeApiErr = &StatusResponse{500, "api error"} // API错误
CodeSaveErr = &StatusResponse{501, "fail to save"} // 保存失败
CodeServiceErr = &StatusResponse{510, "server logic error"} // 服务逻辑错误
CodeUnAuth = &StatusResponse{401, "unauthorized"} // 未授权
CodeEmailNotFoundErr = &StatusResponse{5050, "the email was not found"} // email 不存在
CodeUserIdNotFoundErr = &StatusResponse{5051, "the user was not found"} // userid 不存在
CodePasswordErr = &StatusResponse{5052, "invalid password"} // 密码错误
CodeEmailNotFoundErr = &StatusResponse{5050, "the email was not found"} // 未找到email
CodeUserIdNotFoundErr = &StatusResponse{5051, "the user was not found"} // 未找到用户
CodePasswordErr = &StatusResponse{5052, "invalid password"} // 无效密码
CodeSafeValueRangeErr = &StatusResponse{5040, "the value was not in values"} // 值不在范围内
CodeSafeValueRangeErr = &StatusResponse{5040, "the value was not in values"} // 值不在范围内
CodeGuestDupErr = &StatusResponse{5010, "the user is already a guest user and does not need to apply again"} // 用户已经是guest用户不需要重复申请 错误
CodeGuestGenErr = &StatusResponse{5011, "serialization failed for guest_id of the visitor"} // 游客guest_id序列化失败
CodeOrderNotFoundErr = &StatusResponse{5030, "the order not found"} //未找到订单
CodeOrderNotCancelledErr = &StatusResponse{5031, "The current order cannot be cancelled"} // 当前订单无法取消
CodeDbUpdateErr = &StatusResponse{5000, "update database error"} // update database logic 错误
CodeDupGuestErr = &StatusResponse{5001, "the user is already a guest user and does not need to apply again"} // 用户已经是guest用户不需要重复申请 错误
CodeRequestParamsErr = &StatusResponse{5002, "invalid request param"} // api参数校验 错误
CodeDbRecordNotFoundErr = &StatusResponse{5003, "db record not found"}
CodeDbCreateErr = &StatusResponse{5004, "create one in database error"}
CodeGuestDupErr = &StatusResponse{5010, "the user is already a guest user and does not need to apply again"} // 用户已经是访客用户,不需要重复申请
CodeGuestGenErr = &StatusResponse{5011, "serialization failed for guest_id of the visitor"} // 访客ID序列化失败
CodeDbUpdateErr = &StatusResponse{5000, "update database error"} // 数据库更新错误
CodeDupGuestErr = &StatusResponse{5001, "the user is already a guest user and does not need to apply again"} // 用户已经是访客用户,不需要重复申请
CodeRequestParamsErr = &StatusResponse{5002, "invalid request param"} // 请求参数无效
CodeDbRecordNotFoundErr = &StatusResponse{5003, "db record not found"} //未在数据库中找到记录
CodeDbCreateErr = &StatusResponse{5004, "create one in database error"} // 在数据库中创建错误
CodeDbSqlErr = &StatusResponse{5005, "database is error"} // 数据库错误
)
type Response struct {

View File

@@ -3,7 +3,7 @@ package order
import "fusenapi/constants"
// 获取订单生产状态
func GetOrderStatus(orderStatus int64, deliveryMethod int64) int64 {
func GetOrderStatus(orderStatus constants.Order, deliveryMethod constants.DeliveryMethod) constants.Order {
switch orderStatus {
//已支付
case constants.STATUS_NEW_PART_PAY, constants.STATUS_NEW_PAY_COMPLETED, constants.STATUS_NEW_SURE: