2023-06-28 11:32:41 +00:00
|
|
|
package logic
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fusenapi/utils/auth"
|
|
|
|
"fusenapi/utils/basic"
|
|
|
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"fusenapi/server/home-user-auth/internal/svc"
|
|
|
|
"fusenapi/server/home-user-auth/internal/types"
|
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
|
)
|
|
|
|
|
|
|
|
type UserContactServiceLogic struct {
|
|
|
|
logx.Logger
|
|
|
|
ctx context.Context
|
|
|
|
svcCtx *svc.ServiceContext
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewUserContactServiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserContactServiceLogic {
|
|
|
|
return &UserContactServiceLogic{
|
|
|
|
Logger: logx.WithContext(ctx),
|
|
|
|
ctx: ctx,
|
|
|
|
svcCtx: svcCtx,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (l *UserContactServiceLogic) UserContactService(req *types.RequestContactService, userinfo *auth.UserInfo) (resp *basic.Response) {
|
|
|
|
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
|
|
|
// userinfo 传入值时, 一定不为null
|
|
|
|
|
2023-09-14 10:43:10 +00:00
|
|
|
// if !userinfo.IsUser() {
|
|
|
|
// return resp.SetStatus(basic.CodeUnAuth)
|
|
|
|
// }
|
2023-06-28 11:32:41 +00:00
|
|
|
|
2023-09-14 10:43:10 +00:00
|
|
|
// cs := gmodel.FsContactService{
|
|
|
|
// UserId: &userinfo.UserId,
|
|
|
|
// }
|
|
|
|
// collect.LoadJsonTag(&cs, &req)
|
2023-06-28 11:32:41 +00:00
|
|
|
|
2023-09-14 10:43:10 +00:00
|
|
|
// switch req.Type {
|
|
|
|
// case "order":
|
|
|
|
// _, err := l.svcCtx.AllModels.FsOrder.FindOneAndCreateServiceContact(l.ctx, userinfo.UserId, req.RelationID, &cs)
|
|
|
|
// if err != nil {
|
|
|
|
// if err == gorm.ErrRecordNotFound {
|
|
|
|
// return resp.SetStatus(basic.CodeOrderNotFoundErr)
|
|
|
|
// }
|
|
|
|
// return resp.SetStatus(basic.CodeDbSqlErr)
|
|
|
|
// }
|
|
|
|
// case "cloud":
|
|
|
|
// _, err := l.svcCtx.AllModels.FsCloudPickUp.GetCloudPickUpByIDAndUserID(l.ctx, userinfo.UserId, req.RelationID, &cs)
|
|
|
|
// if err != nil {
|
|
|
|
// if err == gorm.ErrRecordNotFound {
|
|
|
|
// return resp.SetStatus(basic.CodeCloudOrderNotFoundErr)
|
|
|
|
// }
|
|
|
|
// return resp.SetStatus(basic.CodeDbSqlErr)
|
|
|
|
// }
|
|
|
|
// return
|
|
|
|
// default:
|
|
|
|
// return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "type is unknown")
|
|
|
|
// }
|
2023-06-28 11:32:41 +00:00
|
|
|
|
2023-09-14 10:43:10 +00:00
|
|
|
return resp.SetStatus(basic.CodeOK)
|
2023-06-28 11:32:41 +00:00
|
|
|
}
|