package com.flossom.miniProgram.controller;


import com.flossom.common.core.domain.R;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.domain.AjaxResult;
import com.flossom.miniProgram.service.IWxNoRemindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/noRemind")
public class WxNoRemindController extends BaseController {

    @Autowired
    private IWxNoRemindService wxNoRemindService;

    /**
     * 查询用户是否关闭了 ·提醒关注微信公众号·
     *
     * @return
     * @throws Exception
     */
    @GetMapping("/getOfficialAccount")
    public R officialAccount() {
        return R.ok(wxNoRemindService.officialAccount() > 0 ? true : false);
    }

    /**
     * 关闭 ·提醒关注微信公众号·
     *
     * @return
     * @throws Exception
     */
    @GetMapping("/closeOfficialAccount")
    public AjaxResult closeOfficialAccount() {
        wxNoRemindService.closeOfficialAccount();
        return AjaxResult.success();
    }

    /**
     * 是否关注微信公众号
     *
     * @return
     */
    @GetMapping("/isAttentionOfficialAccount")
    public R isAttentionOfficialAccount() throws Exception {
        return R.ok(wxNoRemindService.isAttentionOfficialAccount());
    }

}
