Example #1
0
 public static function getOrderInfo($tableName, $orderId, $storeId = 1)
 {
     self::initDB();
     $where = " WHERE id = {$orderId} and is_delete = 0 and storeId = " . $storeId;
     $orderList = OrderindexModel::showOrderList($tableName, $where);
     $orderData = $orderList[$orderId];
     $orderInfo = array();
     /*$table = " `om_unshipped_order` a , `om_unshipped_order_detail` b , `om_unshipped_order_extension_ebay` c,`om_unshipped_order_userInfo` d,`om_platform` e ";
       $field = " a.id,a.recordNumber,a.accountId,a.platformId,a.ordersTime,a.paymentTime,a.actualTotal,a.calcShipping,b.sku,b.amount,b.itemPrice,c.PayPalPaymentId,c.currency,d.platformUsername,e.id as platformId,e.platform ";
       $where = " WHERE a.id = '$id' AND a.id = b.omOrderId AND a.id = c.omOrderId AND a.id = d.omOrderId AND a.platformId = e.id ";*/
     if ($orderData) {
         $platformListById = omAccountModel::platformListById();
         $orderInfo['id'] = $orderId;
         $orderInfo['recordNumber'] = $orderData['orderData']['recordNumber'];
         $orderInfo['accountId'] = $orderData['orderData']['accountId'];
         $orderInfo['platformId'] = $orderData['orderData']['platformId'];
         $orderInfo['ordersTime'] = $orderData['orderData']['ordersTime'];
         $orderInfo['paymentTime'] = $orderData['orderData']['paymentTime'];
         $orderInfo['actualTotal'] = $orderData['orderData']['actualTotal'];
         $orderInfo['calcShipping'] = $orderData['orderData']['calcShipping'];
         $orderInfo['countryName'] = $orderData['orderUserInfoData']['countryName'];
         $orderInfo['PayPalPaymentId'] = $orderData['orderExtenData']['PayPalPaymentId'];
         $orderInfo['currency'] = $orderData['orderExtenData']['currency'];
         $orderInfo['platformUsername'] = $orderData['orderUserInfoData']['platformUsername'];
         $orderInfo['platform'] = $platformListById[$orderData['orderData']['platformId']];
         $orderInfo['detail'] = array();
         if ($orderData['orderDetail']) {
             foreach ($orderData['orderDetail'] as $detailData) {
                 //$detail = array();
                 $detail['sku'] = $detailData['orderDetailData']['sku'];
                 $detail['amount'] = $detailData['orderDetailData']['amount'];
                 $detail['itemPrice'] = $detailData['orderDetailData']['itemPrice'];
                 $orderInfo['detail'][] = $detail;
             }
         }
         //$accountId = $orderInfo['accountId'];
         if (!$orderInfo['accountId']) {
             self::$errCode = 04;
             self::$errMsg = '对应账号ID为空!';
             return FALSE;
         }
         if ($orderInfo['platformId'] == 1) {
             //$accountInfo = OrderRefundModel::getTNameList($table, $field, $where);
             $accountInfo = self::getAccountInfo($orderInfo['accountId']);
             if (!$accountInfo) {
                 self::$errCode = 05;
                 self::$errMsg = '没有对应PayPal账号信息!';
                 return FALSE;
             }
             $orderInfo['paypalAccount1'] = $accountInfo['account1'];
             $orderInfo['pass1'] = $accountInfo['pass1'];
             $orderInfo['signature1'] = $accountInfo['signature1'];
             $orderInfo['paypalAccount2'] = $accountInfo['account2'];
             $orderInfo['pass2'] = $accountInfo['pass2'];
             $orderInfo['signature2'] = $accountInfo['signature2'];
         }
     }
     self::$errCode = 200;
     self::$errMsg = '获取信息成功';
     return $orderInfo;
 }