Product.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use app\common\model\ProductEcmall;
  5. use app\common\model\ProductGeneral;
  6. use app\common\model\ProductPro;
  7. use app\admin\model\Goods;
  8. /**
  9. * 产品接口
  10. */
  11. class Product extends Api
  12. {
  13. protected $noNeedLogin = ['Ecmall','Pro','General'];
  14. /**
  15. * 多商户列表
  16. */
  17. public function Ecmall(){
  18. $res = ProductEcmall::all(function ($query){
  19. $query->field('id,name,content,image');
  20. });
  21. $this->success('请求成功',$res);
  22. }
  23. /**
  24. * 单商户列表
  25. */
  26. public function Pro(){
  27. $res = ProductPro::all(function ($query){
  28. $query->field('id,name,content,image');
  29. });
  30. array_push($res,Goods::get(['id'=>7]));
  31. $this->success('请求成功',$res);
  32. }
  33. /**
  34. * 普通商户列表
  35. */
  36. public function General(){
  37. $res = ProductGeneral::all(function ($query){
  38. $query->field('id,name,content,image');
  39. });
  40. $this->success('请求成功',$res);
  41. }
  42. }