You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Product.php 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace app\controller\kefu;
  3. use think\facade\App;
  4. use app\services\kefu\ProductServices;
  5. /**
  6. * Class Product
  7. * @package app\kefuapi\controller
  8. */
  9. class Product extends AuthController
  10. {
  11. /**
  12. * Product constructor.
  13. * @param App $app
  14. * @param ProductServices $services
  15. */
  16. public function __construct(App $app, ProductServices $services)
  17. {
  18. parent::__construct($app);
  19. $this->services = $services;
  20. }
  21. /**
  22. * 获取用户购买记录
  23. * @param $uid
  24. * @return mixed
  25. * @throws \think\db\exception\DataNotFoundException
  26. * @throws \think\db\exception\DbException
  27. * @throws \think\db\exception\ModelNotFoundException
  28. */
  29. public function getCartProductList($uid, string $store_name = '')
  30. {
  31. return $this->success(get_thumb_water($this->services->getProductCartList((int)$uid, $store_name)));
  32. }
  33. /**
  34. * 用户浏览记录
  35. * @param $uid
  36. * @param string $store_name
  37. * @return mixed
  38. */
  39. public function getVisitProductList($uid, string $store_name = '')
  40. {
  41. return $this->success(get_thumb_water($this->services->getVisitProductList((int)$uid, $store_name)));
  42. }
  43. /**
  44. * 获取用户购买的热销商品
  45. * @param $uid
  46. * @param string $store_name
  47. * @return mixed
  48. * @throws \think\db\exception\DataNotFoundException
  49. * @throws \think\db\exception\DbException
  50. * @throws \think\db\exception\ModelNotFoundException
  51. */
  52. public function getProductHotSale($uid, string $store_name = '')
  53. {
  54. return $this->success(get_thumb_water($this->services->getProductHotSale((int)$uid, $store_name)));
  55. }
  56. /**
  57. * 商品详情
  58. * @param $id
  59. * @return mixed
  60. * @throws \think\db\exception\DataNotFoundException
  61. * @throws \think\db\exception\DbException
  62. * @throws \think\db\exception\ModelNotFoundException
  63. */
  64. public function getProductInfo($id)
  65. {
  66. return $this->success(get_thumb_water($this->services->getProductInfo((int)$id), 'big', ['image', 'slider_image']));
  67. }
  68. }