51 lines
1.1 KiB
PHP
51 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\api\BaseController;
|
|
use app\api\middleware\Auth;
|
|
use think\facade\Db;
|
|
|
|
|
|
/**
|
|
* 教育培训
|
|
*/
|
|
class HouseDecoration extends BaseController
|
|
{
|
|
/**
|
|
* 控制器中间件 [不需要鉴权]
|
|
* @var array
|
|
*/
|
|
protected $middleware = [
|
|
Auth::class => ['except' => ['Case','Store'] ]
|
|
];
|
|
|
|
protected function getData($cid){
|
|
$where = ['category_id'=>$cid];
|
|
$list = Db::table('fa_article')
|
|
// ->withAttr('enroll',
|
|
// function($value, $data){
|
|
// return Db::table(self::ARTICLE_PUBLIC_BENEFIT)->field('promoter,enrolled_num')->where('article_id', $data['id'])->find();
|
|
// }
|
|
// )
|
|
->where($where)
|
|
->page(1)
|
|
->limit(10)
|
|
->order('id desc')
|
|
->select();
|
|
|
|
return $list;
|
|
}
|
|
|
|
public function Case(){
|
|
$data = $this->getData(371);
|
|
$this->apiSuccess('ok', ['list' => $data]);
|
|
}
|
|
|
|
public function Store(){
|
|
$data = $this->getData(372);
|
|
$this->apiSuccess('ok', ['list' => $data]);
|
|
}
|
|
|
|
}
|