package com.jfinal.club.my.help;

import com.jfinal.aop.Before;
import com.jfinal.aop.Inject;
import com.jfinal.club.common.controller.BaseController;
import com.jfinal.club.common.interceptor.FrontAuthInterceptor;
import com.jfinal.club.common.model.Helps;
import com.jfinal.club.my.newsfeed.UsersInfoIntreceptor;
import com.jfinal.plugin.activerecord.Page;

/**
 * @ClassName HelpController
 * @Description TODO
 * @Author caolong
 * @Date 2020/3/24 19:05
 */
@Before({FrontAuthInterceptor.class, UsersInfoIntreceptor.class})
public class HelpController extends BaseController {


    @Inject
    private HelpService helpService;


    /**
     * @return void
     * @Author Cc
     * @Description //TODO 帮助
     * @Date 2020/3/24
     * @Param []
     **/
    public void index() {
        Page<Helps> helpsPage = helpService.getHelpAll(getParaToInt("p", 1));
        setAttr("helpsPage", helpsPage);
        setAttr("comm_ques",true);
        render("help.html");
    }


    /**
     * @return
     * @Author Cc
     * @Description //TODO 帮助详情
     * @Date 2020/3/24
     * @Param
     **/
    public void helpDetail() {
        Integer id = getParaToInt("id", 1);
        Helps helpsById = helpService.getHelpsById(id);
        setAttr("helpsById", helpsById);
        render("help_detail.html");
    }

}
