58 lines
1.9 KiB
PHP
58 lines
1.9 KiB
PHP
![]() |
<?php
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | 作者:修缘 联系QQ:278896498 QQ群:1054861244
|
|||
|
// | 声明:未经作者许可,禁止倒卖等商业运营,违者必究
|
|||
|
// | 另接php业务,网站制作、代理后台、gm后台、支付对接等
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | 创建时间: 2022/1/1 2:54
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
|
|||
|
|
|||
|
namespace app\admin\controller;
|
|||
|
|
|||
|
|
|||
|
use app\admin\model\Notice;
|
|||
|
use think\Db;
|
|||
|
use think\db\Connection;
|
|||
|
use think\facade\Config;
|
|||
|
use think\Request;
|
|||
|
|
|||
|
class NoticeController extends Controller
|
|||
|
{
|
|||
|
protected function initialize(): void
|
|||
|
{
|
|||
|
parent::initialize(); // TODO: Change the autogenerated stub
|
|||
|
}
|
|||
|
|
|||
|
public function index(Notice $model, Request $request)
|
|||
|
{
|
|||
|
|
|||
|
$param = $request->param();
|
|||
|
// $son_agency_invite = $this->son_agency_invite . ",{$this->user->invite}";
|
|||
|
$model = $model
|
|||
|
->field('text,type,serverid,time')
|
|||
|
->order('time');
|
|||
|
|
|||
|
// ->withJoin([
|
|||
|
//// 'account' => function ($query) use($son_agency_invite) {
|
|||
|
//// $query->whereIn('invite', $son_agency_invite);
|
|||
|
//// }
|
|||
|
// ])->scope('where', $param);
|
|||
|
$data = $model->paginate($this->admin['per_page'], false, ['query' => $request->get()]);
|
|||
|
// dump($data);
|
|||
|
$this->assign($request->get());
|
|||
|
$this->assign([
|
|||
|
'data' => $data->toArray()['data'],
|
|||
|
'page' => $data->render(),
|
|||
|
'total' => $data->total(),
|
|||
|
]);
|
|||
|
return $this->fetch();
|
|||
|
|
|||
|
}
|
|||
|
public function del($id, Notice $model)
|
|||
|
{
|
|||
|
$result = $model->where('text', $id)->delete();
|
|||
|
|
|||
|
return $result ? admin_success(lang('delete_success'), URL_RELOAD) : admin_error(lang('delete_error'));
|
|||
|
}
|
|||
|
}
|