|
@@ -20,42 +20,17 @@ class tmrequest
|
|
|
$this->tm_shop = Model('tm_shop');
|
|
|
$this->tm_goods = Model('tm_goods');
|
|
|
}
|
|
|
+ public function proc_one($shopid)
|
|
|
+ {
|
|
|
+ $items = $this->tm_shop->where(array('shop_id' => $shopid))->field('shop_id,shop_name,appKey,sercetCode,sessionKey')->limit(false)->select();
|
|
|
+ $this->request($items);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
public function proc()
|
|
|
{
|
|
|
- //->where(array('shop_id' => 17))
|
|
|
$items = $this->tm_shop->field('shop_id,shop_name,appKey,sercetCode,sessionKey')->limit(false)->select();
|
|
|
- foreach($items as $item)
|
|
|
- {
|
|
|
- echo "Inof: shop id =".$item["shop_id"]." name=".$item["shop_name"]." appKey=".$item['appKey']." sercetCode=".$item['sercetCode']." sessionKey=".$item['sessionKey']."\r\n";
|
|
|
-
|
|
|
- $this->appkey = $item['appKey'];
|
|
|
- $this->secretKey = $item['sercetCode'];
|
|
|
- $this->sessionKey = $item['sessionKey'];
|
|
|
-
|
|
|
- $shop_id = $item["shop_id"];
|
|
|
-
|
|
|
- $sale_items = $this->get_onsale();
|
|
|
- if(empty($sale_items)) {
|
|
|
- echo "Error: get product info from taobao err where "."shop id =".$item["shop_id"]." name=".$item["shop_name"]."\r\n";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- foreach($sale_items as $sale_item)
|
|
|
- {
|
|
|
- $num_iid = $sale_item->num_iid;
|
|
|
- $issale = $sale_item->approve_status == "onsale" ? true : false;
|
|
|
- if($issale)
|
|
|
- {
|
|
|
- $body = $this->get_body($num_iid);
|
|
|
- $desc = $this->get_desc($num_iid);
|
|
|
- if(!empty($body)) {
|
|
|
- $this->store_data($body,$desc,$shop_id);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ $this->request($items);
|
|
|
}
|
|
|
|
|
|
//添加基础数据。
|
|
@@ -91,7 +66,6 @@ sell_point,valid_thru,outer_id,
|
|
|
barcode,sold_quantity,price,post_fee,express_fee,ems_fee,global_stock_type,global_stock_country,prop_img';
|
|
|
|
|
|
//desc wireless_desc wap_desc
|
|
|
-
|
|
|
$c = new TopClient;
|
|
|
$c->appkey = $this->appkey;
|
|
|
$c->secretKey = $this->secretKey;
|
|
@@ -137,4 +111,41 @@ barcode,sold_quantity,price,post_fee,express_fee,ems_fee,global_stock_type,globa
|
|
|
$req = new tm_pagereq($this->appkey,$this->secretKey,$this->sessionKey);
|
|
|
return $req->proc();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param $items
|
|
|
+ */
|
|
|
+ private function request($items)
|
|
|
+ {
|
|
|
+ foreach ($items as $item)
|
|
|
+ {
|
|
|
+ echo "Inof: shop id =" . $item["shop_id"] . " name=" . $item["shop_name"] . " appKey=" . $item['appKey'] . " sercetCode=" . $item['sercetCode'] . " sessionKey=" . $item['sessionKey'] . "\r\n";
|
|
|
+
|
|
|
+ $this->appkey = $item['appKey'];
|
|
|
+ $this->secretKey = $item['sercetCode'];
|
|
|
+ $this->sessionKey = $item['sessionKey'];
|
|
|
+
|
|
|
+ $shop_id = $item["shop_id"];
|
|
|
+
|
|
|
+ $sale_items = $this->get_onsale();
|
|
|
+ if (empty($sale_items)) {
|
|
|
+ echo "Error: get product info from taobao err where " . "shop id =" . $item["shop_id"] . " name=" . $item["shop_name"] . "\r\n";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ foreach ($sale_items as $sale_item)
|
|
|
+ {
|
|
|
+ $num_iid = $sale_item->num_iid;
|
|
|
+ $issale = $sale_item->approve_status == "onsale" ? true : false;
|
|
|
+ if ($issale) {
|
|
|
+ $body = $this->get_body($num_iid);
|
|
|
+ $desc = $this->get_desc($num_iid);
|
|
|
+ if (!empty($body)) {
|
|
|
+ $this->store_data($body, $desc, $shop_id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|