package WorkPhone

import (
	"context"
	"github.com/suyuan32/simple-admin-common/msg/errormsg"
	"wechat-api/internal/service/wechat"
	"wechat-api/internal/svc"
	"wechat-api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type WxRefreshLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewWxRefreshLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WxRefreshLogic {
	return &WxRefreshLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx}
}

func (l *WxRefreshLogic) WxRefresh() (resp *types.BaseMsgResp, err error) {
	wechat.SyncAllWx(l.svcCtx)

	return &types.BaseMsgResp{Msg: errormsg.Success}, nil
}
