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.

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