<?php

/**
 * Created by PhpStorm.
 * User: stanley-king
 * Date: 16/7/19
 * Time: 下午10:48
 */
class order
{
    private $order_info;
    private function __construct($info)
    {
        $this->order_info = $info;
    }

    public function pd_amount()
    {
        return $this->order_info['pd_amount'];
    }

    static public function create_by_sn($order_sn)
    {
        $mod_order = Model('order');
        $info = $mod_order->getOrderInfo(array('order_sn' => $order_sn));
        if(empty($info)) {
            return false;
        } else {
            return new order($info);
        }
    }

    static public function create_by_id($order_id)
    {
        $mod_order = Model('order');
        $info = $mod_order->getOrderInfo(array('order_sn' => $order_id));
        if(empty($info)) {
            return false;
        } else {
            return new order($info);
        }
    }
}