我的测试

置顶推荐精帖   0 188
才疏学浅
才疏学浅 12-01 22:48

 

img[/uploads/images/20181026/75f2bd7b3977d5a9a1a6ff6fccd47a7a.jpg] [pre] getMap(); // 排序 $order = $this->getOrder('id desc'); // 数据列表 $data_list = PostModel::where($map)->order($order)->select(); $plate = PlateModel::where('status', 1)->column('id,name'); // 使用ZBuilder快速创建数据表格 return ZBuilder::make('table') ->setSearch(['title' => '标题']) // 设置搜索框 ->addColumns([ // 批量添加数据列 ['id', 'ID'], ['user_id', '发帖人', 'text'], ['plate_id', '板块名称', 'select', $plate], ['title', '标题', 'text'], ['see_num', '浏览量', 'number'], ['reply_num', '回帖量', 'number'], ['is_top', '置顶', 'switch'], ['is_sticky', '加精', 'switch'], ['is_recom', '推荐', 'switch'], ['status', '状态', 'switch'], ['right_button', '操作', 'btn'] ]) ->addTopButtons('enable,disable,delete') // 批量添加顶部按钮 ->addRightButtons(['delete' => ['data-tips' => '删除后无法恢复。']]) // 批量添加右侧按钮 ->addOrder('id,user_id,plate_id,title,see_num,reply_num,is_top,is_sticky,is_recom,status') ->setRowList($data_list) // 设置表格数据 ->fetch(); // 渲染模板 } public function quickEdit($record = []) { $id = input('post.pk', ''); $field = input('post.name', ''); $value = input('post.value', ''); $advert = PostModel::where('id', $id)->value($field); if($field == 'status'){ $user_id = PostModel::where('id', $id)->value('user_id'); change_user_score('post', $user_id, 20); } $details = '字段(' . $field . '),原值(' . $advert . '),新值:(' . $value . ')'; return parent::quickEdit(['post_edit', 'bbs_post', $id, UID, $details]); } } [/pre]
回帖
  • - -   回帖抢沙发   - -