package com.flossom.miniProgram.controller;

import com.flossom.common.core.domain.R;
import com.flossom.common.core.domain.entity.WxUserScriptLog;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.page.TableDataInfo;
import com.flossom.miniProgram.service.IWxUserScriptLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 发送话术记录Controller
 *
 * @author flossom
 * @date 2023-12-20
 */
@RestController
@RequestMapping("/userScriptLog")
public class WxUserScriptLogController extends BaseController {

    @Autowired
    private IWxUserScriptLogService wxUserScriptLogService;


    /**
     * 查询发送话术记录列表
     */
    @GetMapping("/list")
    public TableDataInfo list() {
        startPage();
        List<WxUserScriptLog> list = wxUserScriptLogService.selectWxUserScriptLogList();
        return getDataTable(list);
    }

    /**
     * 查询是否有没未读消息
     */
    @GetMapping("getNoReadMessageNum")
    public R getNoReadMessageNum() {
        return R.ok(wxUserScriptLogService.getNoReadMessageNum());
    }

    /**
     * 触发所有已读
     */
    @GetMapping("/hasBeenRead")
    public R hasBeenRead() {
        wxUserScriptLogService.hasBeenRead();
        return R.ok();
    }


}
