order = $order; // $this->deliveryTypes = GoodsEnum::getDeliveryTypeList(); } /** * 设置微信支付相关的参数 * * @param array $uploadParams * @param \think\Model $wechatPay * @return array */ protected function setWechatParams($uploadParams, $wechatPay) { $order_key = [ 'order_number_type' => 2, 'transaction_id' => $wechatPay->transaction_id, 'out_trade_no' => $wechatPay->pay_sn, ]; $payer = [ 'openid' => $wechatPay['buyer_info'] ]; foreach ($uploadParams as &$params) { $params['order_key'] = $order_key; $params['payer'] = $payer; } return $uploadParams; } /** * 获取订单中的微信支付 pay 记录 * * @return think\Model */ protected function getWechatPay($type = 1) { $wechatPay = PayModel::where('order_type', $type) ->where('order_id', $this->order['id']) ->where('status', '<>', PayEnum::PAY_STATUS_UNPAID) ->where('pay_type', PayEnum::METHOD_WECHAT) ->order('id', 'desc')->find(); if (!$wechatPay) { throw new BusinessException('未找到订单微信支付记录'); } return $wechatPay; } /** * 配送方式转换 * * @param string $deliveryType * @return integer */ protected function getLogisticsType($deliveryType) { switch ($deliveryType) { case 'express': $logistics_type = 1; break; case 'store_delivery': $logistics_type = 2; break; case 'autosend': $logistics_type = 3; break; case 'custom': $logistics_type = 3; break; case 'selfetch': $logistics_type = 4; break; default: $logistics_type = 1; break; } return $logistics_type; } }