Client.php 9.32 KB
<?php

/**
 * Created by JetBrains PhpStorm.
 * User: elkan
 * Date: 14-8-5
 * Time: 下午6:04
 * To change this template use File | Settings | File Templates.
 */
class YHMOrders_Models_Orders_Client {

    /**
     *
     * @var YHMOrders_Models_Orders_Dao
     */
    private static $dao;

    /**
     *
     * @return YHMOrders_Models_Orders_Dao
     */
    static private function dao() {
        if (empty(self::$dao)) {
            self::$dao = new YHMOrders_Models_Orders_Dao();
        }
        return self::$dao;
    }

    /**
     * 获取用户已售商品订单总数
     * @param int $store_id
     * @return string
     */
    static function getCountByStoreId($store_id) {
        if ((int) $store_id < 1) {
            return 0;
        }
        return self::dao()->countSoldListByStoreId((int) $store_id);
    }

    /**
     * 获取用户已购商品订单总数
     * @param int $store_id
     * @return string
     */
    static function getCountByUid($uid) {
        if ((int) $uid < 1) {
            return 0;
        }
        return self::dao()->getCountByUid((int) $uid);
    }

    /**
     * 获取店铺订单总数
     * @param int $store_id
     */
    static function getCountSellByStoreId($store_id) {
        if ((int) $store_id < 1) {
            return 0;
        }
        return self::dao()->getCountSellByStoreId((int) $store_id);
    }

    /**
     * 已购总数
     * @param type $buyer_uid
     */
    static function getCountBuyedByBuyerId($buyer_uid, $status = 600) {
        if ((int) $buyer_uid < 1) {
            return 0;
        }
        return self::dao()->getCountBuyedByBuyerId((int) $buyer_uid, $status);
    }

    /**
     * 根据店铺id和状态获取已售商品列表
     * @param int $store_id
     * @param int $orderStatus
     * @param int $offset
     * @param int $size
     * @return int
     */
    static function getListByStoreId($store_id, $orderStatus, $offset, $size) {
        if ((int) $store_id < 1 || (int) $orderStatus < 1) {
            return 0;
        }
        return self::dao()->getListByStoreId((int) $store_id, (int) $orderStatus, (int) $offset, (int) $size);
    }

    /**
     * 根据店铺id获取已售商品列表
     * @param int $store_id
     * @param int $orderStatus
     * @param int $offset
     * @param int $size
     * @return int
     */
    static function getOrderListByStoreId($store_id, $offset, $size) {
        if ((int) $store_id < 1) {
            return 0;
        }
        return self::dao()->getOrderListByStoreId((int) $store_id, (int) $offset, (int) $size);
    }

    /**
     * 根据用户id获取已购商品列表
     * @param int $uid
     * @param int $orderStatus
     * @param int $offset
     * @param int $size
     * @return int
     */
    static function getBuyListByUid($uid, $orderStatus, $offset, $size) {
        if ((int) $uid < 1 || (int) $orderStatus < 1) {
            return 0;
        }
        if ($orderStatus == 600) {
            return self::dao()->getBuyListByFinish((int) $uid, (int) $orderStatus, (int) $offset, (int) $size);
        } else {
            return self::dao()->getBuyListByUid((int) $uid, (int) $orderStatus, (int) $offset, (int) $size);
        }
    }

    /**
     * 获取订单商品信息
     * @param int $order_code
     * @return int
     */
    static function getGoodsByOrderCode($order_code) {
        if ((int) $order_code < 1) {
            return 0;
        }
        return self::dao()->getGoodsByOrderCode((int) $order_code);
    }

    /**
     * 获取订单获取一个商品信息
     * @param type $uid
     * @param type $orderCode
     * @return type
     */
    static function getOneGoodsByOrderCode($orderCode) {
        return self::dao()->getOneGoodsByOrderCode($orderCode);
    }

    /**
     * 更改订单状态
     * @param int $order_code
     * @param int $order_status
     * @return int
     */
    static function updateOrderStatus($order_code, $order_status, $reason = '') {
        if ((int) $order_code < 1 || (int) $order_status < 1) {
            return 0;
        }
        return self::dao()->updateOrderStatus((int) $order_code, (int) $order_status, $reason);
    }

    /**
     * 根据订单号获取订单信息
     * @param int $order_code
     * @return int
     */
    static function getOrdersInfoByOrderCode($order_code) {
        if ((int) $order_code < 1) {
            return 0;
        }
        return self::dao()->getOrdersInfoByOrderCode($order_code);
    }

    /**
     * 获取单品出售总数
     * @param int $product_skc
     * @return int
     */
    static function getCountSoldOneBySkc($product_skc) {
        if ((int) $product_skc < 1) {
            return 0;
        }
        return self::dao()->getCountSoldOneBySkc((int) $product_skc);
    }

    /**
     * 获取可提现金额
     * @param integer $seller_uid
     * @param integer $delay_day 延迟天数
     */
    public static function getCanWithdrawBySelleruid($seller_uid, $delay_day) {
        if (intval($seller_uid) < 1) {
            return 0;
        }
        return self::dao()->getCanWithdrawBySelleruid($seller_uid, $delay_day);
    }

    /**
     * 获取冻结的金额
     * @param integer $seller_uid
     */
    public static function getFreezeBySelleruid($seller_uid) {
        if (intval($seller_uid) < 1) {
            return 0;
        }
        return self::dao()->getFreezeBySelleruid($seller_uid);
    }

    /**
     * 更新支付状态
     * @param $orderCode
     * @param $paymentID
     * @param $alipayTradeCode
     * @param $bankCode
     */
    static public function updateOrderPayInfo($orderCode, $paymentID, $alipayTradeCode = 0, $buyerPayProfile = '', $bankCode = '') {
        return self::dao()->updateOrderPayInfo((int) $orderCode, $paymentID, $alipayTradeCode, $buyerPayProfile, $bankCode);
    }

    /**
     * 根据skc获取订单信息
     * @param type $product_skc
     * @return int
     */
    static public function getGoodsBySkc($product_skc) {
        if ((int) $product_skc < 1) {
            return 0;
        }
        return self::dao()->getGoodsBySkc((int) $product_skc);
    }

    /**
     * 获取订单商品信息
     * @param type $product_skc
     * @return int
     */
    static public function getGoodsInfo($order_code, $skc, $sku) {
        if ((int) $skc < 1) {
            return 0;
        }
        return self::dao()->getGoodsInfo($order_code, $skc, $sku);
    }

    public static function UpdateOrderComments($order_code, $is_comments, $trigger_user) {
        return self::dao()->UpdateOrderComments($order_code, $is_comments, $trigger_user);
    }

    /**
     * 根据店铺id获取数据
     * @param $storeID
     * @param $offset
     * @param $size
     * @return mixed
     */
    static function getBuyGoodsByStore($storeID, $offset, $size) {
        return self::dao()->getBuyGoodsByStore($storeID, $offset, $size);
    }

    /**
     * 根据店铺id获取数据
     * @param $storeID
     * @return mixed
     */
    static function getBuyGoodsByStoreTotal($storeID) {
        return self::dao()->getBuyGoodsByStoreTotal($storeID);
    }

    /**
     * 根据类型获取在售总数
     * @param type $store_id
     * @param type $status
     * @return type
     */
    static function getCountOrderByStatus($store_id, $status = 600) {
        if ((int) $store_id < 1) {
            return 0;
        }
        return self::dao()->getCountOrderByStatus($store_id, $status);
    }

    /**
     * 获取用户已购商品订单
     * @param type $uid
     * @param type $offset
     * @param type $num
     */
    static function getListBuyByUid($uid, $offset, $num) {
        if ((int) $uid < 1) {
            return 0;
        }
        return self::dao()->getListBuyByUid((int)$uid, $offset, $num);
    }

    /**
     * 根据商品获取已售商品订单
     * @param type $store_id
     * @param type $status
     * @return type
     */
    static function getGoodsByOrder($offset, $num, $skc) {
     
        return self::dao()->getGoodsByOrder($offset, $num, $skc);
    }
    /**
     * 根据商品获取已售商品订单总数
     * @param type $store_id
     * @param type $status
     * @return type
     */
    static function getGoodsByOrderCount( $skc) {
     
        return self::dao()->getGoodsByOrderCount( $skc);
    }
    /*
     * 搜索订单
     * @param type $startTime
     * @param type $endTime
     * @param type
     * @param $id
     */
   static function  getOrderListCount($startTime,$endTime,$type,$id){
       
       return self::dao()->getOrderListCount($startTime,$endTime,$type,$id); 
   }
       /*
     * 搜索订单
     * @param type $startTime
     * @param type $endTime
     * @param type
     * @param $id
     */
   static function  getOrderList($offset, $num,$startTime,$endTime,$type,$id,$filed,$orderBy,$orderstatus){
       return self::dao()->getOrderList($offset, $num,$startTime,$endTime,$type,$id,$filed,$orderBy,$orderstatus); 
   }
    /**
     * 获取订单商品信息
     * @param int $order_code
     * @return int
     */
    static function getGoodsInfoByOrderCode($order_code) {
        if ((int) $order_code < 1) {
            return 0;
        }
        return self::dao()->getGoodsInfoByOrderCode((int) $order_code);
    }
    static function getGoodsImg()
    {
        return self::dao()->getGoodsImg(); 
    }
     static function editGoodsImg($id,$goods_images)
    {
        return self::dao()->editGoodsImg($id,$goods_images); 
    }
}