迅睿CMS框架是一款PHP8高性能·简单易用的CMS开源开发框架,基于MIT开源许可协议发布,免费且不限制商业使用,是免费开源的产品,以万端互联为设计理念,支持的微信公众号、小程序、APP客户端、移动端网站、PC网站等多终端式管理系统。
联系官方销售客服
1835022288
028-61286886
定时发布时待发布的文章怎么设置推荐
dayrui\Core\Views\share_list_time.html //加 <label><button type="button" onclick="dr_module_send('{dr_lang('推荐位')}','{dr_url($uriprefix.'/flag')}&page=0')" class="btn green btn-sm"> <i class="fa fa-flag"></i> {dr_lang('批量推荐到推荐位')}</button></label> dayrui\App\XXX\Controllers\Admin\Time.php //加 public function flag() { $this->_Admin_Time_Flag(); } dayrui\Fcms\Control\Admin\Module.php //加 // 后台推荐定时内容 protected function _Admin_Time_Flag() { $this->_init([ 'table' => SITE_ID.'_'.APP_DIR.'_time', ]); $page = \Phpcmf\Service::L('input')->get('page'); $ids = \Phpcmf\Service::L('input')->get('ids'); if (!$ids) { $this->_json(0, dr_lang('所选数据不存在')); } if (IS_AJAX_POST) { $in = []; foreach ($ids as $i) { $i && $in[] = intval($i); } if (!$in) { $this->_json(0, dr_lang('所选数据不存在')); } $flag = \Phpcmf\Service::L('input')->post('flag'); $clear = \Phpcmf\Service::L('input')->post('clear'); if (!$clear && !$flag) { $this->_json(0, dr_lang('你还没有选择推荐位')); } $data = \Phpcmf\Service::M()->table($this->init['table'])->where_in('id', $ids)->getAll(); if (!$data) { $this->_admin_msg(0, dr_lang('内容不存在')); } $flag_data = $clear? "" :$flag; // $flag_data = $clear? "" :implode(',',$flag); $c = 0; foreach ($data as $key => $val) { $tmp = json_decode($val['content'],true); $tmp['flag'] = $flag_data; $tmp['content'] = json_encode($tmp,true); \Phpcmf\Service::M()->table($this->init['table'])->update($val['id'], ['content' => $tmp['content'] ]); $c ++; } if ($clear) { $this->_json(1, dr_lang('推荐位清除成功')); } $this->_json(1, dr_lang('批量执行%s条', $c)); exit; } \Phpcmf\Service::V()->assign([ 'page' => $page, 'form' => dr_form_hidden(), 'select' => \Phpcmf\Service::L('Tree')->select_category( $this->module['category'], 0, 'id=\'dr_catid\' name=\'catid[]\' multiple="multiple" style="height:200px"', '', 1, 1 ), ]); \Phpcmf\Service::V()->display('share_send.html');exit; } dayrui\Fcms\Model\Content.php //改public function post_time($row) // 推荐位 if ($flag) { foreach ($flag as $i) { $this->insert_flag((int)$i, $rt['data'][1]['id'], $data['uid'], $data['catid']); } }