'条', 'sms' => '条', 'stick' => '天', 'emergency' => '天', 'auto_refresh_jobs' => '次','jobfair_num'=>'次','jobs'=>'条'); public $cate_arr = ['download_resume' => '简历增值包','jobs'=>'职位增值包','jobfair_num'=>'招聘会场次增值包', 'sms' => '短信增值包', 'stick' => '职位置顶', 'emergency' => '职位紧急', 'tpl' => '企业模板', 'auto_refresh_jobs' => '职位智能刷新']; public function model() { return SetmealIncrement::class; } public function boot() { $this->pushCriteria(app(RequestCriteria::class)); } public function getCat($cat) { return $this->model->where(['cat'=>$cat])->first(); } public function getIncrement($id) { return $this->model->where(['id'=>$id])->first(); } public function getIncrementCache($cat = '', $id = 0) { //除掉缓存 $rst = $this->model->orderBy('sort', 'desc')->get(); $cache = null; if ($rst) { foreach ($rst as $k => $v) { $cache[$v->id] = $v; } } if ($cat <> '') { $return = array(); foreach ($cache as $key => $value) { if ($value->cat == $cat) { $return[] = $value; } } } else { $return = $cache; } if ($id > 0) { return $return[$id]; } else { return $return; } } public function getIncrementCategory() { return $this->model->select(['cat'])->groupBy('cat')->get(); } }