<?php
class Service_ProductSearch extends Common_Service
{
    /**
     * @var null
     */
    public static $_modelClass = null;

    /**
     * @return Table_ProductSearch|null
     */
    public static function getModelInstance()
    {
        if (is_null(self::$_modelClass)) {
            self::$_modelClass = new Table_ProductSearch();
        }
        return self::$_modelClass;
    }

    /**
     * @param $row
     * @return mixed
     */
    public static function add($row)
    {
        $model = self::getModelInstance();
        return $model->add($row);
    }


    /**
     * @param $row
     * @param $value
     * @param string $field
     * @return mixed
     */
    public static function update($row, $value, $field = "ps_id")
    {
        $model = self::getModelInstance();
        return $model->update($row, $value, $field);
    }

    /**
     * @param $value
     * @param string $field
     * @return mixed
     */
    public static function delete($value, $field = "ps_id")
    {
        $model = self::getModelInstance();
        return $model->delete($value, $field);
    }

    /**
     * @param $value
     * @param string $field
     * @param string $colums
     * @return mixed
     */
    public static function getByField($value, $field = 'ps_id', $colums = "*")
    {
        $model = self::getModelInstance();
        return $model->getByField($value, $field, $colums);
    }


    /**
     * @return mixed
     */
    public static function getAll()
    {
        $model = self::getModelInstance();
        return $model->getAll();
    }

    /**
     * @param array $condition
     * @param string $type
     * @param int $pageSize
     * @param int $page
     * @param string $order
     * @return mixed
     */
    public static function getByCondition($condition = array(), $type = '*', $pageSize = 0, $page = 1, $order = "")
    {
        $model = self::getModelInstance();
        return $model->getByCondition($condition, $type, $pageSize, $page, $order);
    }

    public static function getLikeByCondition($condition = array(), $type = '*', $pageSize = 0, $page = 1, $order = "")
    {
        $model = self::getModelInstance();
        return $model->getLikeByCondition($condition, $type, $pageSize, $page, $order);
    }


    /**
     * @param array $params
     * @return array
     */
    // public  function getFields()
    // {
    //     $row = array(
    //           'E1'=>'product_sku',
    //           'E2'=>'product_barcode',
    //           'E3'=>'customer_code',
    //           'E4'=>'customer_id',
    //           'E5'=>'product_title_en',
    //           'E6'=>'product_title',
    //           'E7'=>'product_status',
    //           'E8'=>'product_receive_status',
    //           'E9'=>'pu_code',
    //           'E10'=>'product_length',
    //           'E11'=>'product_width',
    //           'E12'=>'product_height',
    //           'E13'=>'product_net_weight',
    //           'E14'=>'product_weight',
    //           'E15'=>'product_sales_value',
    //           'E16'=>'product_purchase_value',
    //           'E17'=>'product_declared_value',
    //           'E18'=>'product_is_qc',
    //           'E19'=>'product_barcode_type',
    //           'E20'=>'product_type',
    //           'E21'=>'pc_id',
    //           'E22'=>'pce_id',
    //           'E23'=>'product_add_time',
    //           'E24'=>'product_update_time',
    //           'E022'=>'product_category_ebay.pce_title',
    //           'E25'=>'goods_id',
    //           'E26'=>'has_invoice',
    //           'E27'=>'hs_code',
    //           'E28'=>'customer.customer_company_name_like',
    //     );
    //     return $row;
    // }



    
}