|
@@ -5,27 +5,38 @@ import (
|
|
|
"app.yhyue.com/moapp/jybase/encrypt"
|
|
|
"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/svc"
|
|
|
"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/types"
|
|
|
+ "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/util"
|
|
|
"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
|
|
|
"context"
|
|
|
"fmt"
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
+ "net/http"
|
|
|
)
|
|
|
|
|
|
type CreateChatSessionLogic struct {
|
|
|
logx.Logger
|
|
|
ctx context.Context
|
|
|
svcCtx *svc.ServiceContext
|
|
|
+ r *http.Request
|
|
|
}
|
|
|
|
|
|
-func NewCreateChatSessionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateChatSessionLogic {
|
|
|
+func NewCreateChatSessionLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *http.Request) *CreateChatSessionLogic {
|
|
|
return &CreateChatSessionLogic{
|
|
|
Logger: logx.WithContext(ctx),
|
|
|
ctx: ctx,
|
|
|
svcCtx: svcCtx,
|
|
|
+ r: r,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (l *CreateChatSessionLogic) CreateChatSession(req *types.ChatSessionReq) (*types.CommonRes, error) {
|
|
|
+ if req.NewUserId == 0 {
|
|
|
+ r, err := util.GetTouristInfo(l.r, l.svcCtx.Social, l.ctx)
|
|
|
+ if err != nil || r.BaseUserId == 0 {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req.NewUserId = r.BaseUserId
|
|
|
+ }
|
|
|
chatMession := &messagecenter.ChatSessionReq{}
|
|
|
if req.UserType == 1 {
|
|
|
//客服信息
|