fusenapi/server/home-user-auth/internal/logic/useraddresslistlogic.go

41 lines
1.0 KiB
Go
Raw Normal View History

2023-06-08 07:41:49 +00:00
package logic
import (
"context"
2023-06-15 08:08:43 +00:00
"fusenapi/model/gmodel"
2023-06-08 07:41:49 +00:00
"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 UserAddressListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewUserAddressListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserAddressListLogic {
return &UserAddressListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
2023-06-12 10:08:34 +00:00
func (l *UserAddressListLogic) UserAddressList(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
2023-06-08 07:41:49 +00:00
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
2023-06-15 08:08:43 +00:00
m := gmodel.NewFsAddressModel(l.svcCtx.MysqlConn)
2023-06-15 03:05:33 +00:00
userinfo.GetIdType()
2023-06-16 02:58:43 +00:00
2023-06-15 08:08:43 +00:00
data, err := m.GetUserAllAddress(l.ctx, 22)
2023-06-08 07:41:49 +00:00
if err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeServiceErr, err.Error())
}
return resp.SetStatus(basic.CodeOK, data)
}