Syncgoods.php
930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?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;
}
}