|
|
<?php
namespace App\Controller\v3;
use App\Constants\v3\ErrorCode;use App\Controller\BaseController;use App\Exception\ErrorCodeException;use App\Request\v3\OrderOnlineDetailRequest;use App\Service\CouponServiceInterface;use Hyperf\Di\Annotation\Inject;use App\Service\v3\Interfaces\OrderOnlineServiceInterface;use App\Service\v3\Interfaces\UserBindTelServiceInterface;use App\Service\v3\Interfaces\AppointmentTimeServiceInterface;use Psr\Http\Message\ResponseInterface;
class OrderOnlineController extends BaseController{ /** * @Inject * @var UserBindTelServiceInterface */ protected $userBindTelService; /** * @Inject * @var CouponServiceInterface */ protected $couponService; /** * @Inject * @var AppointmentTimeServiceInterface */ protected $appointmentTimeService;
/** * @Inject * @var OrderOnlineServiceInterface */ protected $orderOnlineService;
/* * 如果没有绑手机号去绑定页面 * 收货地址接口 * 返回预约送达时间 * 商品数据接口 * 红包独立接口 * 配送费独立接口 可根据距离动态计算费用 * 增值服务接口 * */ public function review() { $params = $this->request->all(); //判断用户有没有绑定手机
// $telExists = $this->userBindTelService->check($params['user_id']);
// if(!$telExists){
// throw new ErrorCodeException(ErrorCode::NOT_BIND_TEL_ERROR);
// }
//获取用户收货地址
$res['address'] = [ 'address' => '南宁市良庆区五象海尔·青啤联合广场', 'area' => 'A栋八单元' , 'lat' => '22.759950637817383', 'lng' => '108.3835678100586', 'sex' => '1', 'tel' => '15677717734', 'user_name' => '李小龙', 'user_id' => '214' ]; //返回预约送达时间 数组
$res['appointment_time'] = $this->appointmentTimeService->do(); //
$res['store_list'] = [ [ 'store_nmae' => '五金杂货铺', 'price' => '100.00', 'note' => '多放辣椒', 'store_id' => 66, 'goods_list' => [ [ 'id' => 3971, 'goods_id' => 1301, 'name' => '半边手撕鸡', 'num' => 4, 'price' => '90.00', 'total' => '360.00' ] ] ], [ 'store_nmae' => '回味手撕鸡J009', 'note' => '手撕鸡加辣', 'store_price' => '720.00', 'store_id' => 123, 'goods_list' => [ [ 'id' => 3971, 'goods_id' => 1301, 'name' => '半边手撕鸡', 'num' => 4, 'price' => '90.00', 'total' => '360.00' ], [ 'id' => 3971, 'goods_id' => 1301, 'name' => '半边手撕鸡', 'num' => 4, 'price' => '90.00', 'total' => '360.00' ] ] ], ]; //获取用户优惠券
$res['coupon'] = $this->couponService->getUserAvailableCoupons('',$params['user_id'],'',2,'',''); //获取配送费
$res['distribution'] = '5.0'; //增值服务接口
$res['value_added_service'] = [ 'select' => 1, 'price' => 3.50 ]; return $this->success($res); }
/** * 订单详情 * 1、主订单信息,用户配送信息(地址、姓名、电话、配送时间、配送类型)、基础信息(订单ID、订单编号、下单时间、订单金额、付款时间、支付方式、红包优惠、服务站电话、增值服务费) * 2、子订单以及订单商品,按商户分组,有商户信息(ID、商户名、商户logo),商品信息(id、名字、封面、规格、tag、原价、售价、库存、总销、月销、是否失效、失效原因) * @param OrderOnlineDetailRequest $request * @return ResponseInterface */ public function detailByUser(OrderOnlineDetailRequest $request) { $params = $request->validated(); return $this->success(['detail' => $this->orderOnlineService->detailByUser($params['order_id'], $params['user_id'])]); }}
|