TaxiServiceCategory.php 1019 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\ApiController;
  4. use app\api\service\JWTAuth as IAuth;
  5. use think\App;
  6. class TaxiServiceCategory extends ApiController
  7. {
  8. protected $model;
  9. public function __construct(App $app = null, IAuth $auth)
  10. {
  11. parent::__construct($app, $auth);
  12. $this->model = new \app\common\model\TaxiServiceCategory();
  13. }
  14. public function index()
  15. {
  16. $params = input();
  17. $params['page'] = input('page/d', 1);
  18. $params['limit'] = input('limit/d', 10);
  19. $list = $this->model->field('id,name,image,url,type')
  20. ->where('status', 1)
  21. ->page($params['page'], $params['limit'])
  22. ->select();
  23. if ($list) {
  24. foreach ($list as $item) {
  25. $image = json_decode($item['image'], true);
  26. $item->image = implode(',', $image);
  27. }
  28. }
  29. return $this->ApiJson(0,'成功', $list);
  30. }
  31. }