Syncgoods.php 930 Bytes
<?php

/**
 * 同步产品
 * @author tongdesheng
 *
 */
class YHMSearch_Syncgoods extends YHMSearch_Core {

    private $_urlPath = 'sync';

    /**
     * 可同步字段
     * @var array
     */
    private $_fields = array('product_skc', 'goods_name', 'store_id', 'stock_number', 'status', 'uid', 'max_category_id', 'brand_id', 'brand_name', 'gender',
        'sale_price', 'last_update_time', 'hot_number', 'quality_level', 'create_time', 'store_type');

    /**
     * 执行同步
     * @param array $params
     */
    public function sync($params) {
        $syncParams = array();
        foreach ($this->_fields as $field) {
            if (isset($params[$field])) {
                $syncParams[$field] = $params[$field];
            }
        }
        $retData = $this->req($this->_urlPath, $syncParams);
        if ($retData['sync'] == 'success') {
            return true;
        }
        return false;
    }

}