Ejemplo n.º 1
0
 public function weiXinUnifiedOrderByApp($orderId = 0, $orderLongId = 0)
 {
     $orderInfo = null;
     if ($orderId > 0) {
         $orderInfo = UserOrder::findFirst('order_id = ' . $orderId);
     } elseif ($orderLongId > 0) {
         $orderInfo = UserOrder::findFirst('order_long_id = ' . $orderLongId);
     }
     if (!$orderInfo) {
         return false;
     }
     $orderId = $orderInfo->order_id;
     $orderLongId = $orderInfo->order_long_id;
     $totalFee = $orderInfo->order_money;
     $titleArr = [];
     // 商品信息
     $goods = UserOrderGoods::query()->columns('service_name name')->where('order_id = :oid:', ['oid' => $orderId])->leftJoin('Apps\\Common\\Models\\BeautyParlorService', 'service_id = goods_id', 'bps')->execute();
     foreach ($goods as $d) {
         $titleArr[] = $d->name;
     }
     $title = implode(',', $titleArr);
     $payConfig = (include APP_COMMON_PATH . "base-config/pay.php");
     $wxPay = new WeiXinPay($payConfig['weixin']);
     $info = $wxPay->unifiedOrder($orderLongId, $title, $totalFee, 'APP');
     if ($info == false) {
         return false;
     }
     return $info['prepayId'];
 }
Ejemplo n.º 2
0
 private function getGoods($orderId)
 {
     $goodsList = UserOrderGoods::query()->columns(['shop_id', 'bp.bp_name shop_name', 'bp.bp_medal shop_medal_refund', 'bp.bp_medal shop_medal_verify', 'goods_id', 'bps.service_name goods_name', 'bps.service_cover goods_cover', 'goods_price', 'bps.service_unit goods_price_show', 'order_goods_number goods_number'])->leftJoin('Apps\\Common\\Models\\BeautyParlor', 'bp.bp_id = shop_id', 'bp')->leftJoin('Apps\\Common\\Models\\BeautyParlorService', 'bps.service_id = goods_id', 'bps')->where('order_id = :oid:', ['oid' => $orderId])->execute()->toArray();
     for ($i = 0; $i < count($goodsList); $i++) {
         $goodsList[$i]['shop_medal_refund'] = \Apps\Common\Libs\BeautyParlor::getMedalRefund($goodsList[$i]['shop_medal_refund']);
         $goodsList[$i]['shop_medal_verify'] = \Apps\Common\Libs\BeautyParlor::getMedalVerify($goodsList[$i]['shop_medal_verify']);
         $goodsList[$i]['goods_cover'] = PicUrl::BeautyParlorCover($goodsList[$i]['goods_cover'], $this->getDi());
         $unit = $goodsList[$i]['goods_price_show'];
         if ($goodsList[$i]['goods_price'] > 0) {
             $goodsList[$i]['goods_price_show'] = $goodsList[$i]['goods_price'] . '元' . ($unit ? '/' . $unit : '');
         } else {
             $goodsList[$i]['goods_price_show'] = '';
         }
     }
     return $goodsList;
 }