12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- package logic
- import (
- quitl "app.yhyue.com/moapp/jybase/common"
- "app.yhyue.com/moapp/jybase/encrypt"
- util "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/entity"
- "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
- "context"
- "log"
- "unicode/utf8"
- "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/svc"
- "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/types"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type GroupNameUpdateLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewGroupNameUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GroupNameUpdateLogic {
- return &GroupNameUpdateLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- func (l *GroupNameUpdateLogic) GroupNameUpdate(req *types.GroupNameUpdateReq) (resp *types.CommonRes, err error) {
- // todo: add your logic here and delete this line
- chatGroupId := quitl.Int64All(encrypt.SE.Decode4Hex(req.ChatGroupId))
- log.Println(len(req.GroupName))
- if utf8.RuneCountInString(req.GroupName) > 15 {
- return &types.CommonRes{
- Error_msg: "超过15个字,请调整后保存",
- Error_code: int(util.ERROR_CODE),
- }, nil
- }
- result, err := l.svcCtx.Message.GroupNameUpdate(l.ctx, &messagecenter.GroupNameUpdateReq{
- PositionId: req.PositionId,
- AppId: req.Appid,
- GroupName: req.GroupName,
- ChatGroupId: chatGroupId,
- })
- if err != nil {
- return nil, err
- }
- return &types.CommonRes{
- Error_msg: result.ErrorMsg,
- Error_code: int(result.ErrorCode),
- Data: map[string]interface{}{
- "status": result.Status,
- },
- }, nil
- }
|