groupnameupdatelogic.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package logic
  2. import (
  3. quitl "app.yhyue.com/moapp/jybase/common"
  4. "app.yhyue.com/moapp/jybase/encrypt"
  5. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
  6. "context"
  7. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/svc"
  8. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/types"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type GroupNameUpdateLogic struct {
  12. logx.Logger
  13. ctx context.Context
  14. svcCtx *svc.ServiceContext
  15. }
  16. func NewGroupNameUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GroupNameUpdateLogic {
  17. return &GroupNameUpdateLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. }
  22. }
  23. func (l *GroupNameUpdateLogic) GroupNameUpdate(req *types.GroupNameUpdateReq) (resp *types.CommonRes, err error) {
  24. // todo: add your logic here and delete this line
  25. chatGroupId := quitl.Int64All(encrypt.SE.Decode4Hex(req.ChatGroupId))
  26. if len(req.GroupName)>15{
  27. return &types.CommonRes{
  28. Error_msg: "超过15个字,请调整后保存",
  29. Error_code: ,
  30. }, nil
  31. }
  32. result, err := l.svcCtx.Message.GroupNameUpdate(l.ctx, &messagecenter.GroupNameUpdateReq{
  33. PositionId: req.PositionId,
  34. AppId: req.Appid,
  35. GroupName: req.GroupName,
  36. ChatGroupId: chatGroupId,
  37. })
  38. if err != nil {
  39. return nil, err
  40. }
  41. return &types.CommonRes{
  42. Error_msg: result.ErrorMsg,
  43. Error_code: int(result.ErrorCode),
  44. Data: map[string]interface{}{
  45. "status": result.Status,
  46. },
  47. }, nil
  48. }