|
...
|
...
|
@@ -9,6 +9,9 @@ use App\Models\News\News as NewsModel; |
|
|
|
use App\Models\News\NewsCategory as NewsCategoryModel;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name:新闻管理
|
|
|
|
*/
|
|
|
|
class NewsController extends BaseController
|
|
|
|
{
|
|
|
|
/**
|
|
...
|
...
|
@@ -18,6 +21,7 @@ class NewsController extends BaseController |
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function lists(NewsModel $news){
|
|
|
|
$this->map['project_id'] = $this->user['project_id'];
|
|
|
|
$lists = $news->lists($this->map,$this->page,$this->row,$this->order);
|
|
|
|
$this->response('success',Code::SUCCESS,$lists);
|
|
|
|
}
|
|
...
|
...
|
@@ -29,6 +33,8 @@ class NewsController extends BaseController |
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function get_category_list(NewsCategoryModel $newsCategoryModel){
|
|
|
|
$this->map['status'] = 0;
|
|
|
|
$this->map['project_id'] = $this->user['project_id'];
|
|
|
|
$cate_list = $newsCategoryModel->list($this->map,'sort');
|
|
|
|
if($cate_list === false){
|
|
|
|
$this->response('error',Code::USER_ERROR);
|
|
...
|
...
|
@@ -41,7 +47,7 @@ class NewsController extends BaseController |
|
|
|
$list[] = $v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->response('当前用户菜单列表',Code::SUCCESS,$list);
|
|
|
|
$this->response('success',Code::SUCCESS,$list);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @name :获取详情
|
|
...
|
...
|
@@ -71,7 +77,7 @@ class NewsController extends BaseController |
|
|
|
public function add(NewsRequest $newsRequest,NewsModel $news){
|
|
|
|
$newsRequest->validated();
|
|
|
|
$this->param['create_id'] = $this->uid;
|
|
|
|
$this->param['Operator_id'] = $this->uid;
|
|
|
|
$this->param['operator_id'] = $this->uid;
|
|
|
|
$this->param['project_id'] = $this->user['project_id'];
|
|
|
|
//TODO::路由映射
|
|
|
|
$rs = $news->add($this->param);
|
|
...
|
...
|
@@ -94,7 +100,7 @@ class NewsController extends BaseController |
|
|
|
],[
|
|
|
|
'id.required' => 'ID不能为空',
|
|
|
|
]);
|
|
|
|
$this->param['Operator_id'] = $this->uid;
|
|
|
|
$this->param['operator_id'] = $this->uid;
|
|
|
|
$rs = $news->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
if($rs === false){
|
|
|
|
$this->response('error',Code::USER_ERROR);
|
|
...
|
...
|
@@ -115,7 +121,7 @@ class NewsController extends BaseController |
|
|
|
],[
|
|
|
|
'id.required' => 'ID不能为空',
|
|
|
|
]);
|
|
|
|
$this->param['Operator_id'] = $this->uid;
|
|
|
|
$this->param['operator_id'] = $this->uid;
|
|
|
|
$rs = $news->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
if($rs === false){
|
|
|
|
$this->response('error',Code::USER_ERROR);
|
|
...
|
...
|
@@ -135,8 +141,8 @@ class NewsController extends BaseController |
|
|
|
],[
|
|
|
|
'id.required' => 'ID不能为空',
|
|
|
|
]);
|
|
|
|
$this->param['id'] = ['in',$this->param['id']];
|
|
|
|
$rs = $news->edit(['status'=>2],$this->param);
|
|
|
|
$this->param['id'] = ['in',$this->param['id']];d;
|
|
|
|
$rs = $news->edit(['status'=>2,'operator_id'=>$this->uid],$this->param);
|
|
|
|
if($rs === false){
|
|
|
|
$this->response('error',Code::USER_ERROR);
|
|
|
|
}
|
...
|
...
|
|