package com.platform.utils;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author abnerhou
 * @date 2020/5/11 20:04
 * @desciption
 */

@Service
@Slf4j
public class SyncWxSubscribeServiceImpl implements  AsyncService{

    @Value("${wx.appId}")
    private String agencyWxAppId;


    @Value("${wx.secret}")
    private String agencyWxAppSecret;

    @Value("${wx_miniprogram_state}")
    private String wxMiniState;

    @Value("${wx_subscribe.template.id}")
    private String wxTemplateId;

    @Override
    public Map<String, Object> executeAsync(Map<String , Object> content , String page , String userOpenId) {
        log.info("================开始执行微信消息订阅================");

        Map<String, Object> result = WxOpUtils.subscribeMessageSend(agencyWxAppId , agencyWxAppSecret , userOpenId, wxMiniState,
                 wxTemplateId ,page, content);

        log.info("================微信消息订阅完成================");
       return result;
    }
}
