You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\common\controller\Api;
|
|
use app\admin\model\content\Article as articleModel;
|
|
|
|
class Article extends Api
|
|
{
|
|
protected $noNeedLogin = ['*'];
|
|
protected $noNeedRight = ['*'];
|
|
protected $model;
|
|
|
|
public function _initialize() {
|
|
parent::_initialize();
|
|
|
|
$this->model = new articleModel();
|
|
}
|
|
public function list() {
|
|
$type = $this->request->param('type');
|
|
if (empty($type)) {
|
|
$this->error('参数异常');
|
|
}
|
|
$list = $this->model
|
|
->where('type', $type)
|
|
->where('status', 1)
|
|
->paginate();
|
|
|
|
foreach ($list as &$row) {
|
|
$row['image'] = formatImage($row['image']);
|
|
}
|
|
$this->success('营销配置', $list);
|
|
}
|
|
|
|
public function detail() {
|
|
$id = $this->request->param('id');
|
|
if (empty($id)) {
|
|
$this->error('参数异常');
|
|
}
|
|
$detail = $this->model
|
|
->where('status', 1)
|
|
->where('id', $id)
|
|
->find();
|
|
$detail['image'] = formatImage($detail['image']);
|
|
$this->success('success', $detail);
|
|
}
|
|
} |