fusenapi/server/home-user-auth/internal/logic/userstatusconfiglogic.go
2023-06-21 14:26:29 +08:00

99 lines
3.3 KiB
Go

package logic
import (
"context"
"fusenapi/server/home-user-auth/internal/svc"
"fusenapi/server/home-user-auth/internal/types"
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"github.com/zeromicro/go-zero/core/logx"
)
type UserStatusConfigLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewUserStatusConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserStatusConfigLogic {
return &UserStatusConfigLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *UserStatusConfigLogic) UserStatusConfig(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
data := &types.DataStatusConfig{
SearchList: []types.KeyName{
{Key: -1, Name: "All"},
{Key: -1, Name: "All"},
{Key: 1, Name: "Order Has Been Placed"},
{Key: 2, Name: "In Production"},
{Key: 3, Name: "Shipped"},
{Key: 4, Name: "Inventory"},
{Key: 8, Name: "Ready for Shipment"},
{Key: 5, Name: "Completed"},
// {"key": 6, "name": "Refund Under Review"},
{Key: 7, Name: "Transaction Closed"},
},
OrderStatus: []types.KeyNameButton{
{Key: 1, Name: "Order Has Been Placed", Button: []string{"download_invoice", "cancel", "again", "toPay"}},
{Key: 2, Name: "In Production", Button: []string{"download_invoice", "again", "toPay"}},
{Key: 3, Name: "Shipped", Button: []string{"download_invoice", "again", "view_logistics"}},
{Key: 5, Name: "Completed", Button: []string{"download_invoice", "again", "view_logistics", "delete"}},
{Key: 7, Name: "Transaction Closed", Button: []string{"again", "delete"}},
},
InventoryStatus: []types.KeyNameButton{
{Key: 1, Name: "Order Has Been Placed", Button: []string{"download_invoice", "cancel", "again", "toPay"}},
{Key: 2, Name: "In Production", Button: []string{"download_invoice", "again", "toPay"}},
{Key: 4, Name: "Inventory", Button: []string{"download_invoice", "again", "go_cloud", "toPay"}},
{Key: 8, Name: "Ready for Shipment", Button: []string{"download_invoice", "again", "go_cloud", "delete"}},
{Key: 7, Name: "Transaction Closed", Button: []string{"again", "delete"}},
},
Time: []types.KeyName{
{Key: 0, Name: "All"},
{Key: 1, Name: "within a month"},
{Key: 2, Name: "within a quarter"},
{Key: 3, Name: "Within half a year"},
{Key: 4, Name: "Within a year"},
},
RefundReason: []types.KeyName{
{Key: 1, Name: "I don't want it anymore"},
{Key: 2, Name: "no reason"},
{Key: 3, Name: "other"},
},
OrderLogisticsStatus: []types.KeyName{
{Key: 1, Name: "Order"},
{Key: 2, Name: "Completed"},
{Key: 3, Name: "Shipped"},
{Key: 4, Name: "UPS Pick Up"},
{Key: 5, Name: "Arrival"},
},
InventoryLogisticsStatus: []types.KeyName{
{Key: 1, Name: "Order"},
{Key: 2, Name: "Arrival Inventory"},
{Key: 3, Name: "Ready For Shipment"},
},
LogisticsStatus: []types.KeyNameButton{
{Key: -1, Name: "All", Button: []string{}},
{Key: 1, Name: "Draw", Button: []string{}},
{Key: 2, Name: "Shipping", Button: []string{}},
{Key: 3, Name: "UPS pick up", Button: []string{"check_detail"}},
{Key: 4, Name: "Arrival", Button: []string{}},
},
}
return resp.SetStatus(basic.CodeOK, data)
}