package ink.wgink.module.wechat.service.official.account;

import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.interfaces.consts.ISystemConstant;

import javax.servlet.AsyncContext;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: BaseOfficialAccountService
 * @Description: 公众号基类
 * @Author: wanggeng
 * @Date: 2021/5/2 11:11 上午
 * @Version: 1.0
 */
public class BaseOfficialAccountService extends DefaultBaseService {

    protected void write(AsyncContext asyncContext, HttpServletResponse response, String content) throws IOException {
        response.setCharacterEncoding(ISystemConstant.CHARSET_UTF8);
        PrintWriter writer = response.getWriter();
        writer.write(content);
        writer.flush();
        asyncContext.complete();
    }

}
