Attribute.php 578 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\model\Attribute as AttributeModel;
  4. /**
  5. * 分类属性
  6. */
  7. class Attribute extends Base
  8. {
  9. protected $noNeedLogin = ['*'];
  10. //属性列表
  11. public function index()
  12. {
  13. $category_id = $this->request->param('category_id');
  14. if (empty($category_id)) {
  15. $this->error('分类不能为空');
  16. }
  17. $list = (new AttributeModel())->with(['AttributeValue'])->where('category_id', $category_id)->where('is_search', 1)->select();
  18. $this->success('获取成功', $list);
  19. }
  20. }