// +---------------------------------------------------------------------- namespace App\Services; use App\Models\BuddhistPagesModel; /** * 佛经章节管理-服务类 * @author wesmiler * @since 2020/11/11 * Class BuddhistPagesService * @package App\Services */ class BuddhistPagesService extends BaseService { protected static $instance = null; /** * 构造函数 * @author wesmiler * @since 2020/11/11 * BuddhistPagesService constructor. */ public function __construct() { $this->model = new BuddhistPagesModel(); } /** * 静态入口 * @return BuddhistPagesService|null */ public static function make(){ if(!self::$instance){ self::$instance = new BuddhistPagesService(); } return self::$instance; } /** * 获取列表 * @return array * @since 2020/11/11 * @author wesmiler */ public function getList() { $params = request()->all(); return parent::getList(); } /** * 添加或编辑 * @return array * @since 2020/11/11 * @author wesmiler */ public function edit() { $data = request()->all(); $data['update_time'] = time(); return parent::edit($data); // TODO: Change the autogenerated stub } /** * 获取章节数量 * @param $id * @return mixed */ public function getCount($id){ return $this->model::where(['bid'=> $id,'status'=> 1])->count('id'); } }