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.

130 lines
4.0 KiB

  1. <?php
  2. namespace App\Controller\v3;
  3. use App\Constants\v3\ErrorCode;
  4. use App\Controller\BaseController;
  5. use App\Exception\ErrorCodeException;
  6. use App\Service\CouponServiceInterface;
  7. use Hyperf\Di\Annotation\Inject;
  8. use App\Service\v3\Interfaces\OnlineOrderServiceInterface;
  9. use App\Service\v3\Interfaces\UserBindTelServiceInterface;
  10. use App\Service\v3\Interfaces\AppointmentTimeServiceInterface;
  11. class OnlineOrderController extends BaseController
  12. {
  13. /**
  14. * @Inject
  15. * @var UserBindTelServiceInterface
  16. */
  17. protected $userBindTelService;
  18. /**
  19. * @Inject
  20. * @var CouponServiceInterface
  21. */
  22. protected $couponService;
  23. /**
  24. * @Inject
  25. * @var AppointmentTimeServiceInterface
  26. */
  27. protected $appointmentTime;
  28. /*
  29. * 如果没有绑手机号去绑定页面
  30. * 收货地址接口
  31. * 返回预约送达时间
  32. * 商品数据接口
  33. * 红包独立接口
  34. * 配送费独立接口 可根据距离动态计算费用
  35. * 增值服务接口
  36. * */
  37. public function detail()
  38. {
  39. $params = $this->request->all();
  40. //判断用户有没有绑定手机
  41. // $telExists = $this->userBindTelService->check($params['user_id']);
  42. // if(!$telExists){
  43. // throw new ErrorCodeException(ErrorCode::NOT_BIND_TEL_ERROR);
  44. // }
  45. //获取用户收货地址
  46. $res['address'] = [
  47. 'address' => '南宁市良庆区五象海尔·青啤联合广场',
  48. 'area' => 'A栋八单元' ,
  49. 'lat' => '22.759950637817383',
  50. 'lng' => '108.3835678100586',
  51. 'sex' => '1',
  52. 'tel' => '15677717734',
  53. 'user_name' => '李小龙',
  54. 'user_id' => '214'
  55. ];
  56. //返回预约送达时间 数组
  57. $res['appointment_time'] = [
  58. '08:30 - 09:00',
  59. '09:00 - 09:30',
  60. '09:30 - 10:00',
  61. '10:00 - 10:30'
  62. ];
  63. //
  64. $res['store_list'] = [
  65. [
  66. 'store_nmae' => '五金杂货铺',
  67. 'price' => '100.00',
  68. 'note' => '多放辣椒',
  69. 'store_id' => 66,
  70. 'goods_list' =>
  71. [
  72. [
  73. 'id' => 3971,
  74. 'goods_id' => 1301,
  75. 'name' => '半边手撕鸡',
  76. 'num' => 4,
  77. 'price' => '90.00',
  78. 'total' => '360.00'
  79. ]
  80. ]
  81. ],
  82. [
  83. 'store_nmae' => '回味手撕鸡J009',
  84. 'note' => '手撕鸡加辣',
  85. 'store_price' => '720.00',
  86. 'store_id' => 123,
  87. 'goods_list' =>
  88. [
  89. [
  90. 'id' => 3971,
  91. 'goods_id' => 1301,
  92. 'name' => '半边手撕鸡',
  93. 'num' => 4,
  94. 'price' => '90.00',
  95. 'total' => '360.00'
  96. ],
  97. [
  98. 'id' => 3971,
  99. 'goods_id' => 1301,
  100. 'name' => '半边手撕鸡',
  101. 'num' => 4,
  102. 'price' => '90.00',
  103. 'total' => '360.00'
  104. ]
  105. ]
  106. ],
  107. ];
  108. //获取用户优惠券
  109. $res['coupon'] = $this->couponService->getUserAvailableCoupons('',$params['user_id'],'',2,'','');
  110. //获取配送费
  111. $res['distribution'] = '5.0';
  112. //增值服务接口
  113. $res['value_added_service'] = [
  114. 'select' => 1,
  115. 'price' => 3.50
  116. ];
  117. return $this->success($res);
  118. }
  119. public function check()
  120. {
  121. }
  122. public function undo()
  123. {
  124. }
  125. }