nk-lihaink-cn/app/api/controller/HouseDecoration.php

51 lines
1.1 KiB
PHP
Raw Normal View History

2023-02-28 15:44:15 +08:00
<?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 = [
2023-03-01 03:39:04 +08:00
Auth::class => ['except' => ['Case','Store'] ]
2023-02-28 15:44:15 +08:00
];
protected function getData($cid){
$where = ['category_id'=>$cid];
2023-02-28 17:12:05 +08:00
$list = Db::table('fa_article')
2023-02-28 15:44:15 +08:00
// ->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;
}
2023-03-01 03:39:04 +08:00
public function Case(){
2023-02-28 15:44:15 +08:00
$data = $this->getData(499);
$this->apiSuccess('ok', ['list' => $data]);
}
2023-03-01 03:39:04 +08:00
public function Store(){
2023-02-28 15:44:15 +08:00
$data = $this->getData(501);
$this->apiSuccess('ok', ['list' => $data]);
}
}