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.

115 lines
3.8 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\OrderOnlineServiceInterface;
  9. use App\Service\v3\Interfaces\UserBindTelServiceInterface;
  10. use App\Service\v3\Interfaces\AppointmentTimeServiceInterface;
  11. class OrderOnlineController 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 $appointmentTimeService;
  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'] = $this->appointmentTimeService->do();
  58. //
  59. $res['store_list'] = [
  60. [
  61. 'store_nmae' => '五金杂货铺',
  62. 'price' => '100.00',
  63. 'note' => '多放辣椒',
  64. 'store_id' => 66,
  65. 'goods_list' =>
  66. [
  67. [
  68. 'id' => 3971,
  69. 'goods_id' => 1301,
  70. 'name' => '半边手撕鸡',
  71. 'num' => 4,
  72. 'price' => '90.00',
  73. 'total' => '360.00'
  74. ]
  75. ]
  76. ],
  77. [
  78. 'store_nmae' => '回味手撕鸡J009',
  79. 'note' => '手撕鸡加辣',
  80. 'store_price' => '720.00',
  81. 'store_id' => 123,
  82. 'goods_list' =>
  83. [
  84. [
  85. 'id' => 3971,
  86. 'goods_id' => 1301,
  87. 'name' => '半边手撕鸡',
  88. 'num' => 4,
  89. 'price' => '90.00',
  90. 'total' => '360.00'
  91. ],
  92. [
  93. 'id' => 3971,
  94. 'goods_id' => 1301,
  95. 'name' => '半边手撕鸡',
  96. 'num' => 4,
  97. 'price' => '90.00',
  98. 'total' => '360.00'
  99. ]
  100. ]
  101. ],
  102. ];
  103. //获取用户优惠券
  104. $res['coupon'] = $this->couponService->getUserAvailableCoupons('',$params['user_id'],'',2,'','');
  105. //获取配送费
  106. $res['distribution'] = '5.0';
  107. //增值服务接口
  108. $res['value_added_service'] = [
  109. 'select' => 1,
  110. 'price' => 3.50
  111. ];
  112. return $this->success($res);
  113. }
  114. }