public function fetch($url)
 {
     $id = $this->get_id($url);
     if (!$id) {
         return false;
     }
     $key = 'taobao_' . $id;
     $item_site = M('item_site')->where(array('code' => $this->_code))->find();
     $api_config = unserialize($item_site['config']);
     //使用淘宝开放平台API
     vendor('Taobaotop.TopClient');
     vendor('Taobaotop.RequestCheckUtil');
     vendor('Taobaotop.Logger');
     $tb_top = new TopClient();
     $tb_top->appkey = $api_config['app_key'];
     $tb_top->secretKey = $api_config['app_secret'];
     $req = $tb_top->load_api('ItemGetRequest');
     $req->setFields('detail_url,title,nick,pic_url,price,item_img');
     $req->setNumIid($id);
     $resp = $tb_top->execute($req);
     if (!isset($resp->item)) {
         return false;
     }
     $item = (array) $resp->item;
     $result = array();
     $result['item']['key_id'] = $key;
     $result['item']['title'] = strip_tags($item['title']);
     $result['item']['price'] = $item['price'];
     $result['item']['img'] = $item['pic_url'];
     $result['item']['url'] = $item['detail_url'];
     //商品相册
     $result['item']['imgs'] = array();
     $item_imgs = (array) $item['item_imgs'];
     $item_imgs = (array) $item_imgs['item_img'];
     foreach ($item_imgs as $_img) {
         $_img = (array) $_img;
         if ($_img['url']) {
             $result['item']['imgs'][] = array('url' => $_img['url'], 'ordid' => $_img['position']);
         }
     }
     if (empty($result['item']['imgs'])) {
         $result['item']['imgs'][] = array('url' => $result['item']['img']);
     }
     //淘客信息
     $req = $tb_top->load_api('TaobaokeItemsDetailGetRequest');
     $req->setFields("click_url");
     $req->setNumIids($id);
     $resp = $tb_top->execute($req);
     if (isset($resp->taobaoke_item_details)) {
         $taoke = (array) $resp->taobaoke_item_details->taobaoke_item_detail;
         if ($taoke['click_url']) {
             $result['item']['url'] = $taoke['click_url'];
         }
     }
     $result['item']['url'] = Url::replace($result['item']['url'], array('spm' => '2014.21069764.' . $api_config['app_key'] . '.0'));
     return $result;
 }
 /**
  * 短信发送的方法(单发)
  * @param string $cellPhone 目标手机号码
  * @param string $smsSign 短信签名(允许的值:http://www.alidayu.com/admin/service/sign)
  * @param string $product 短信主体内容
  * @param type $template 短信模板(允许的值:http://www.alidayu.com/admin/service/tpl)
  * @return stirng json格式的字符串
  */
 public function sendSms($cellPhone = '', $smsSign = '', $product = '', $template = 'SMS_4756069')
 {
     // 测试默认值
     //        $cellPhone = '15577375746';
     $smsSign = '身份验证';
     //        $product = '陈培捷商城的(我手机号被限制了,用别的测试一下)';
     if (empty($cellPhone)) {
         return false;
         // 缺少参数$cellphone
     }
     if (!@(include LIB_PATH . "Org/Aliyun/TopSdk.php")) {
         //引入淘宝SDK入口文件
         return false;
         // 找不到对应文件
     }
     $validTime = (int) 60;
     // 该次请求验证码有效时间
     $code = rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9);
     // 6位随机验证码
     // 60S不能再次发送
     $nowTime = (int) time();
     $Mo = M('system_message');
     $where['method'] = array('EQ', 'sms');
     $where['target'] = array('EQ', $cellPhone);
     $result = $Mo->field('send_time')->where($where)->order('send_time desc')->limit(1)->find();
     $lastTime = (int) $result['send_time'];
     $remainingTime = $nowTime - $lastTime;
     $fail_data = ['remainingTime' => $remainingTime];
     if ($remainingTime < $validTime) {
         return false;
         // 特定时间内不能重复发送手机验证码
     }
     // 调用阿里大鱼API进行发送操作
     $appkey = C('TAOBAO_KEY');
     $secret = C('TAOBAO_SECRET');
     $c = new \TopClient();
     $c->appkey = $appkey;
     $c->secretKey = $secret;
     $req = new \AlibabaAliqinFcSmsNumSendRequest();
     //	$req->setExtend("123456");
     $req->setSmsType("normal");
     $req->setSmsFreeSignName($smsSign);
     $req->setSmsParam(json_encode(['code' => $code, 'product' => $product]));
     $req->setRecNum($cellPhone);
     $req->setSmsTemplateCode($template);
     $resp = (array) $c->execute($req);
     $resp['result'] = (array) $resp['result'];
     // 成功后存入数据库中做记录
     if (!empty($resp['result']['success']) && $resp['result']['success'] == 'true') {
         $nowTime = (int) time();
         $insertData = ['method' => 'sms', 'type' => 'code', 'target' => (string) $req->getRecNum(), 'identification' => (string) $resp['request_id'], 'title' => (string) $req->getSmsFreeSignName(), 'content' => (string) $req->getSmsParam(), 'send_time' => $nowTime];
         $Mo->data($insertData)->add();
         $succ_data = ['smsCode' => $code, 'validTime' => $validTime, 'identification' => (string) $resp['request_id']];
         return $succ_data;
         // 发送成功
     } else {
         return false;
         // 阿里大鱼API导致的发送失败
     }
 }
 public function caijiApi()
 {
     $p = $_GET;
     $count = 0;
     Vendor('tbk.TopSdk');
     $c = new TopClient();
     $c->appkey = $this->setting['tb_api_key'];
     $c->secretKey = $this->setting['tb_api_secret'];
     $req = new TbkItemGetRequest();
     $req->setFields("num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url");
     $p['keyword'] && $req->setQ($p['keyword']);
     $p['cid'] && $req->setCat($p['cid']);
     $p['start_price'] > 0 && $req->setStartPrice($p['start_price']);
     $p['end_price'] > 0 && $req->setEndPrice($p['end_price']);
     $p['sort'] && $req->setSort($p['sort']);
     $p['start_commissionRate'] > 0 && $req->setStartTkRate($p['start_commissionRate']);
     $p['end_commissionRate'] > 0 && $req->setEndTkRate($p['end_commissionRate']);
     $p['mall_item'] && $req->setIsTmall("true");
     $req->setPageSize(100);
     $resp = $c->execute($req);
     $a = $resp->results->n_tbk_item;
     foreach ($a as $val) {
         if ($count >= $p['num']) {
             break;
         }
         $goods = array('title' => $val->title, 'num_iid' => $val->num_iid, 'item_url' => $val->item_url, 'price' => $val->reserve_price, 'discount_price' => $val->zk_final_price, 'goods_type' => $val->user_type ? 'tmall' : 'taobao', 'pic_url' => $val->pict_url, 'provcity' => $val->provcity, 'add_uid' => $this->my['uid'], 'add_uname' => $this->my['uname'], 'ctime' => TIME, 'sort_id' => $p['sort_id'], 'state' => $p['state'] ? 1 : 0);
         $count++;
         $goods_list[] = $goods;
     }
     echo json_encode(array('data' => $goods_list, 'count' => $count));
 }
 public function sendSMS($tel)
 {
     //>>1. 随机生成一个数字
     $randomNumber = String::randString(6, 1);
     session('SMS_CODE', $randomNumber);
     //为了和用户输入的短信验证码进行验证码
     //>>2.将该数字发送到$tel手机号D:\thinkphp\ThinkPHP\Library\Vendor\SMS
     vendor('SMS.TopSdk');
     $c = new \TopClient();
     date_default_timezone_set('Asia/Shanghai');
     //设置时区
     $c->appkey = '23268864';
     //创建应用上面的appkey
     $c->secretKey = '69f0728011dec573eb02f3f57583cb80';
     //创建应用上面的secretKey
     $req = new \AlibabaAliqinFcSmsNumSendRequest();
     // $req->setExtend("123456");
     $req->setSmsType("normal");
     //不改变
     $req->setSmsFreeSignName("注册验证");
     //用来验证
     $req->setSmsParam("{'code':'{$randomNumber}','product':'源代码商城'}");
     $req->setRecNum($tel);
     //接收的电话
     $req->setSmsTemplateCode("SMS_2345004");
     //模板id
     $resp = $c->execute($req);
     //判定发送的状态
     //        return ((string)$resp->result->success)==='true';
     return $resp->result->success;
 }
Exemple #5
0
function sendSMSAli($mobile, $mobile_code, $time = '', $mid = '')
{
    include "TopSdk.php";
    $c = new TopClient();
    $c->appkey = "23294546";
    //这里填写您申请的appkey
    $c->secretKey = "7f5f7a5d562089d01792ac5372f81d08";
    //这里填写您申请的secretKey
    $req = new AlibabaAliqinFcSmsNumSendRequest();
    $req->setExtend("123456");
    //填写什么都可以
    $req->setSmsType("normal");
    //短信类型,不用修改
    $req->setSmsFreeSignName("注册验证");
    //这里填写短信签名
    $req->setSmsParam("{\"code\":\"{$mobile_code}\",\"product\":\"技师达\"}");
    //按要求引入变量
    $req->setRecNum($mobile);
    //接收短信的手机变量
    $req->setSmsTemplateCode("SMS_3991033");
    //这里填写短信模板编号
    $resp = $c->execute($req);
    $reArray = xmlToArray($resp);
    //返回结果
    if (isset($reArray["code"]) && $reArray["code"] > 0) {
        return false;
    } else {
        return true;
    }
}
Exemple #6
0
 public function send()
 {
     include_once __DIR__ . "/../../taobao-sdk-PHP-auto/TopSdk.php";
     date_default_timezone_set('Asia/Shanghai');
     $c = new \TopClient();
     $c->appkey = $this->ak;
     $c->secretKey = $this->sk;
     $req = new \AlibabaAliqinFcSmsNumSendRequest();
     $sessionKey = null;
     $req->setSmsType($this->smsType);
     $req->setSmsFreeSignName($this->smsFreeSignName);
     $req->setSmsParam($this->smsParam);
     $req->setRecNum($this->recNum);
     $req->setSmsTemplateCode($this->smsTemplateCode);
     $resp = $c->execute($req, $sessionKey);
     $json = json_encode($resp);
     $result = json_decode($json, TRUE);
     $this->result = $json;
     if (isset($result['result']['success'])) {
         $this->sended = 1;
         $this->sended_at = new \DateTime('NOW');
         $this->save();
     } else {
         $this->sended = 0;
         $this->sended_at = null;
         $this->save();
     }
     return $result;
 }
Exemple #7
0
function keycaiji($u)
{
    global $key_appkey, $key_secretKey;
    include dirname(__FILE__) . '/top/TopSdk.php';
    $c = new TopClient();
    $c->appkey = $key_appkey;
    $c->secretKey = $key_secretKey;
    $req = new ItemGetRequest();
    $req->setFields("num_iid,title,pic_url,detail_url,price,num,nick,freight_payer,item_img");
    $req->setNumIid($u);
    $resp = $c->execute($req);
    if ($resp->item) {
        $arry["item"]["detail_url"] = $resp->item->detail_url;
        $arry["item"]["num_iid"] = $resp->item->num_iid;
        $arry["item"]["title"] = $resp->item->title;
        $arry["item"]["nick"] = $resp->item->nick;
        $arry["item"]["pic_url"] = $resp->item->pic_url;
        $arry["item"]["oldprice"] = $resp->item->price;
        $arry["item"]["price"] = $resp->item->price;
        $arry["item"]["auction_point"] = 0;
    }
    if (is_array($arry)) {
        $arry["id"] = 221;
        $arry["msg"] = "获取成功";
        return json_encode($arry);
    } else {
        $arry["id"] = 0;
        $arry["msg"] = "不存在这个商品";
        return json_encode($arry);
    }
}
 public function fetch_tb($url)
 {
     $id = $this->get_id($url);
     if (!$id) {
         return false;
     }
     $item_site = M('items_site')->where(array('code' => $this->_code))->find();
     $api_config = unserialize($item_site['config']);
     //使用淘宝开放平台API
     vendor('Taobaotop.TopClient');
     vendor('Taobaotop.RequestCheckUtil');
     vendor('Taobaotop.Logger');
     $tb_top = new TopClient();
     $tb_top->appkey = $api_config['app_key'];
     $tb_top->secretKey = $api_config['app_secret'];
     //淘客信息
     $req = $tb_top->load_api('TaobaokeItemsDetailGetRequest');
     $req->setFields("num_iid,title,nick,pic_url,click_url,price,detail_url,auction_point,commission");
     $req->setNumIids($id);
     $resp = $tb_top->execute($req);
     if (isset($resp->taobaoke_item_details)) {
         $taoke = (array) $resp->taobaoke_item_details->taobaoke_item_detail;
         if ($taoke['click_url']) {
             $taoke['click_url'] = Url::replace($taoke['click_url'], array('spm' => '2014.' . $api_config['app_key'] . '.1.0'));
         }
         return $taoke;
     }
     return false;
 }
Exemple #9
0
function sendSMSAli($mobile, $mobile_code, $time = '', $mid = '')
{
    include "TopSdk.php";
    $c = new TopClient();
    $c->appkey = "23278568";
    //这里填写您申请的appkey
    $c->secretKey = "87410133aa8ab0cdfd2ba521209a3793";
    //这里填写您申请的secretKey
    $req = new AlibabaAliqinFcSmsNumSendRequest();
    $req->setExtend("123456");
    //填写什么都可以
    $req->setSmsType("normal");
    //短信类型,不用修改
    $req->setSmsFreeSignName("注册验证");
    //这里填写短信签名
    $req->setSmsParam("{\"code\":\"{$mobile_code}\",\"product\":\"钰盈堂净颜梅\"}");
    //按要求引入变量
    $req->setRecNum($mobile);
    //接收短信的手机变量
    $req->setSmsTemplateCode("SMS_2950020");
    //这里填写短信模板编号
    $resp = $c->execute($req);
    $reArray = xmlToArray($resp);
    //返回结果
    if (isset($reArray["code"]) && $reArray["code"] > 0) {
        return false;
    } else {
        return true;
    }
}
Exemple #10
0
function apiGet($CidIn, $theP, $keyW)
{
    //$input:cat)
    include_once rootD . "/api/TopSdk.php";
    $c = new TopClient();
    $c->appkey = "23167663";
    //appkey及secretkey
    $c->secretKey = "e1980a4313fb60fb61a43d694066c8a3";
    $req1 = new TbkItemsGetRequest();
    $req1->setFields("num_iid,title,volume,pic_url,item_url,shop_url,nick");
    $req1->setKeyword($keyW);
    $req1->setCid($CidIn);
    $req1->setStartPrice("2");
    $req1->setEndPrice("9000000");
    $req1->setStartCredit("2heart");
    $req1->setEndCredit("5goldencrown");
    $req1->setSort("commissionNum_desc");
    $req1->setMallItem("false");
    $req1->setStartCommissionRate("500");
    $req1->setEndCommissionRate("5000");
    $req1->setStartCommissionNum("20");
    $req1->setEndCommissionNum("9000000");
    $req1->setStartTotalnum("50");
    $req1->setEndTotalnum("9000000");
    $req1->setPageNo($theP);
    $req1->setPageSize(40);
    $resp1 = $c->execute($req1);
    $resp1 = (array) $resp1;
    $resp1["tbk_items"] = (array) $resp1["tbk_items"];
    for ($j = 0; $j < 40; $j++) {
        $resp1["tbk_items"]["tbk_item"][$j] = (array) $resp1["tbk_items"]["tbk_item"][$j];
    }
    $req2 = new TbkItemInfoGetRequest();
    for ($k = 0; $k < 40; $k++) {
        $NumIIdGet = $resp1["tbk_items"]["tbk_item"][$k]["num_iid"];
        $req2->setFields("zk_final_price,provcity,reserve_price");
        $req2->setNumIids($NumIIdGet);
        $resp2 = $c->execute($req2);
        $resp2 = (array) $resp2;
        $resp2["results"] = (array) $resp2["results"];
        $resp2["results"]["n_tbk_item"] = (array) $resp2["results"]["n_tbk_item"];
        $resp2["results"]["n_tbk_item"][0] = (array) $resp2["results"]["n_tbk_item"][0];
        $re["i"][$k] = $resp1["tbk_items"]["tbk_item"][$k] + $resp2["results"]["n_tbk_item"][0];
    }
    $re["t"] = $resp1["total_results"];
    return $re;
}
 public function execute($request = null, $session = null, $bestUrl = null)
 {
     $currentDate = date('U');
     $syncDuration = $this->getDnsConfigSyncDuration();
     $bestUrl = $this->getBestVipUrl($this->gatewayUrl, $request->getApiMethodName(), $session);
     if ($currentDate - ClusterTopClient::$syncDate > $syncDuration * 60) {
         $httpdns = new HttpdnsGetRequest();
         ClusterTopClient::$dnsconfig = json_decode(parent::execute($httpdns, null, $bestUrl)->result, true);
         $syncDate = date('U');
         ClusterTopClient::$syncDate = $syncDate;
     }
     return parent::execute($request, $session, $bestUrl);
 }
Exemple #12
0
 function getCats($parentid)
 {
     $c = new TopClient();
     $c->appkey = APPKEY;
     $c->secretKey = SECRETKEY;
     $req = new ItemcatsGetRequest();
     $req->setFields("cid,parent_cid,name,is_parent");
     //50011740 男鞋
     //16 女装/女士精品
     //50006842 箱包皮具/热销女包/男包
     //50012029 运动鞋new
     //30 男装
     $req->setParentCid($parentid);
     return $c->execute($req);
 }
Exemple #13
0
 function send($mobile, $data, $template, $sign)
 {
     $a = (include APP_FILE . "use/alisdk/TopSdk.php");
     $c = new TopClient();
     $c->appkey = "23310798";
     $c->secretKey = "754cbdbd9aeff8f64077d522420fc3cb";
     $req = new AlibabaAliqinFcSmsNumSendRequest();
     $req->setSmsType("normal");
     $req->setSmsFreeSignName($sign);
     //短信签名
     $req->setSmsParam($data);
     $req->setRecNum($mobile);
     $req->setSmsTemplateCode($template);
     $resp = (array) $c->execute($req);
     return $resp['result']['err_code'] == 0;
 }
Exemple #14
0
/**
* 短信发送
* @param array $tag 配置信息模板标识 ['default','test']
配置信息
[
	'alisms'	=>	[
		'default'	=>	[
			'appkey'			=>	'23268950', //密钥
			'secretKey'	=>	'09003ad8710387cfd0742c9b7fd6aab2', //密钥
			'tags'	=>	[
				'test'=>'750_737' //短信模板标识
			]
		]
	]
]
* @param string $m 多手机号 以逗号分隔
* @param array $data 替换变量
*/
function AliSmsSend($tag, $m, $data)
{
    $c = new \TopClient();
    $smsconf = \H2O::getAppConfigs('alisms');
    if (empty($smsconf)) {
        throw new \Exception('Ali SMS config params is error');
    } else {
        if (isset($smsconf[$tag[0]])) {
            $config = $smsconf[$tag[0]];
        } else {
            throw new \Exception('Ali SMS config params is error: ' . $tag[0]);
        }
    }
    $c->appkey = $config['appkey'];
    $c->secretKey = $config['secretKey'];
    $req = new \OpenSmsSendmsgRequest();
    $smrequest = new \SendMessageRequest();
    $em = explode(',', $m);
    $ids = explode('_', $config['tags'][$tag[1]]);
    $smrequest->template_id = $ids[0];
    //模板ID
    $smrequest->signature_id = $ids[1];
    //签名ID
    $smrequest->context = json_decode(json_encode($data));
    //模板变量替换
    foreach ($em as $v) {
        // $smrequest->external_id="demo";
        // $smrequest->mobile="18610638306,13520839197";
        $smrequest->mobile = $v;
        // $smrequest->device_limit="123";
        // $smrequest->session_limit="123";
        // $smrequest->device_limit_in_time="123";
        // $smrequest->mobile_limit="123";
        // $smrequest->session_limit_in_time="123";
        // $smrequest->mobile_limit_in_time="123";
        // $smrequest->session_id="demo";
        // $smrequest->domain="demo";
        // $smrequest->device_id="demo";
        $req->setSendMessageRequest(json_encode($smrequest));
        $resp = $c->execute($req);
        return $resp->result->successful;
    }
}
Exemple #15
0
 public function fetch($url)
 {
     $id = $this->get_id($url);
     if (empty($id)) {
         return false;
     }
     $tb_top = new TopClient();
     $tb_top->appkey = C('taobao_app_key');
     $tb_top->secretKey = C('taobao_secret_key');
     $req = $this->load_api('ItemGetRequest');
     $req->setFields('detail_url,title,pic_url,price,item_img');
     $req->setNumIid($id);
     $resp = $tb_top->execute($req);
     if (!isset($resp->item)) {
         return false;
     }
     $item = (array) $resp->item;
     return $item;
 }
Exemple #16
0
 public static function sms($phone, $template, $smsParam = array())
 {
     if (empty($phone)) {
         return false;
     }
     $smsInfo = Config::getConfig('sms_info');
     $smsInfo = json_decode($smsInfo, true);
     $smsParam = json_encode($smsParam);
     $c = new \TopClient();
     $c->appkey = $smsInfo['appkey'];
     $c->secretKey = $smsInfo['secretKey'];
     $req = new \AlibabaAliqinFcSmsNumSendRequest();
     $req->setExtend($phone);
     $req->setSmsType("normal");
     $req->setSmsFreeSignName($smsInfo['signName']);
     $req->setSmsParam($smsParam);
     $req->setRecNum($phone);
     $req->setSmsTemplateCode($template);
     $resp = $c->execute($req);
     return !!$resp->result->success;
 }
 public function fetch_tmall($page)
 {
     $item_site = M('items_site')->where(array('code' => $this->_code))->find();
     $api_config = unserialize($item_site['config']);
     //使用飞天侠开放平台API
     vendor('Ftxia.TopClient');
     vendor('Ftxia.RequestCheckUtil');
     vendor('Ftxia.Logger');
     $top = new TopClient();
     $top->appkey = $api_config['app_key'];
     $top->secretKey = $api_config['app_secret'];
     //淘客信息
     $req = $top->load_api('TaobaokeItemsDetailGetRequest');
     $req->setPage($page);
     $resp = $top->execute($req);
     if (isset($resp->tmall_items)) {
         $items = (array) $resp->tmall_items;
         return $taoke;
     }
     return false;
 }
Exemple #18
0
 /**
  * 大鱼短信发送接口
  * @param $mobile   接受信息的手机号码
  * @param $content array  发送的信息
  * @param $template 模板ID
  * @author copoet
  *
  * 示例如下:
  * 模板名称: 用户注册
  * 模板ID: SMS_3990623
  * 验证码${code},您正在注册成为${product}用户,感谢您的支持!
  * @return mixed|\ResultSet|\SimpleXMLElement
  */
 public static function topSent($mobile, $content = array(), $template)
 {
     $config = self::getSmsConf();
     //获取短信配置
     $appkey = $config['appkey'];
     $secretKey = $config['secretkey'];
     $SignName = $config['signname'];
     //签名
     vendor('Topsdk.TopSdk');
     date_default_timezone_set('Asia/Shanghai');
     $c = new \TopClient();
     $code = json_encode($content);
     //内容转为json格式
     $c->appkey = $appkey;
     $c->secretKey = $secretKey;
     $req = new \AlibabaAliqinFcSmsNumSendRequest();
     $req->setExtend("");
     $req->setSmsType("normal");
     $req->setSmsFreeSignName("{$SignName}");
     $req->setSmsParam("{$code}");
     $req->setRecNum("{$mobile}");
     $req->setSmsTemplateCode("{$template}");
     $resp = $c->execute($req);
     $info = array();
     if ($resp->result->success == true) {
         $info['status'] = 10;
     } else {
         $info['status'] = 20;
     }
     $info['provider_name'] = '阿里大鱼';
     self::log_sms($mobile, $content['code'], $info['provider_name'], $info['status']);
     switch ($info['status']) {
         case 10:
             return true;
         case 20:
             return false;
         default:
             return false;
     }
 }
<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
header('Content-Type: text/html; charset=utf-8');
include_once dirname(dirname(__FILE__)) . '/sdk/TopSdk.php';
$c = new TopClient();
$c->appKey = '';
$c->secretKey = '';
$c->user = '';
$c->format = 'json';
$req = new HotelDetailRequest();
$req->setHotelIds('42407063');
$req->setArrivalDate(date('Y-m-d', time() + 3600 * 24));
$req->setDepartureDate(date('Y-m-d', time() + 3600 * 48));
$resp = $c->execute($req);
echo $resp;
Exemple #20
0
    public function collectReport($time, $page)
    {
        setTimeLimit(3600);
        global $_FANWE;
        if ($page <= 1) {
            FDB::query('TRUNCATE TABLE ' . FDB::table('taobaoke_report_temp'));
        }
        include_once FANWE_ROOT . 'sdks/taobao/TopClient.php';
        include_once FANWE_ROOT . 'sdks/taobao/request/TaobaokeReportGetRequest.php';
        Cache::getInstance()->loadCache('business');
        $client = new TopClient();
        $client->appkey = trim($_FANWE['cache']['business']['taobao']['app_key']);
        $client->secretKey = trim($_FANWE['cache']['business']['taobao']['app_secret']);
        $req = new TaobaokeReportGetRequest();
        $req->setFields("num_iid,outer_code,commission_rate,real_pay_fee,app_key,outer_code,pay_time,pay_price,commission,item_title,item_num,trade_id");
        $page_size = 100;
        $time = fToDate($time, 'Ymd');
        $req->setDate($time);
        $req->setPageNo($page);
        $req->setPageSize($page_size);
        $resp = (array) $client->execute($req, trim($_FANWE["cache"]["business"]["taobao"]["session_key"]));
        $is_complete = false;
        $total_results = 0;
        if (isset($resp['taobaoke_report'])) {
            $count = 0;
            $taobaoke_report = (array) $resp['taobaoke_report'];
            $total_results = (int) $taobaoke_report['total_results'];
            if ($total_results > 0) {
                $taobaoke_report_members = $taobaoke_report['taobaoke_report_members'];
                foreach ($taobaoke_report_members->taobaoke_report_member as $item) {
                    $item = (array) $item;
                    $item['pay_time'] = str2Time($item['pay_time']);
                    $item['outer_code'] = isset($item['outer_code']) ? $item['outer_code'] : '';
                    $pay_day = fToDate($item['pay_time'], 'Y-m-d 00:00:00');
                    $item['pay_day'] = str2Time($pay_day);
                    $item['commission_rate'] = $item['commission_rate'] * 100;
                    $item['item_title'] = addslashes($item['item_title']);
                    if (!empty($item['outer_code']) && preg_match("/^o\\d+\$/", $item['outer_code'])) {
                        $order_id = (double) substr($item['outer_code'], 1);
                        if ($order_id == 0) {
                            continue;
                        }
                        $bln = (int) FDB::resultFirst('SELECT COUNT(id) FROM ' . FDB::table('taobaoke_report') . " \n\t\t\t\t\t\t\tWHERE outer_code = '" . addslashes($item['outer_code']) . "' \n\t\t\t\t\t\t\t\tAND num_iid = '" . addslashes($item['num_iid']) . "' \n\t\t\t\t\t\t\t\tAND pay_time = '" . addslashes($item['pay_time']) . "'");
                        if ($bln > 0) {
                            continue;
                        }
                        $is_insert = false;
                        $res = FDB::query('SELECT * FROM ' . FDB::table('goods_order') . ' 
							WHERE order_id = ' . $order_id . ' AND keyid = \'taobao_' . $item['num_iid'] . '\' AND status = 0');
                        while ($order = FDB::fetch($res)) {
                            $commission = (double) $item['commission'] * ((double) $order['commission_rate'] / 100);
                            if ($_FANWE['setting']['goods_buy_score_type'] > 0 && $_FANWE['setting']['goods_buy_score_rate'] > 0) {
                                $score = 0;
                                $rate = (double) $_FANWE['setting']['goods_buy_score_rate'];
                                if ($_FANWE['setting']['goods_buy_score_type'] == 1) {
                                    $score = (double) $item['real_pay_fee'] * $rate;
                                } else {
                                    $score = (double) $item['commission'] * $rate;
                                }
                                $score = round($score);
                                if ($score > 0) {
                                    FS('User')->updateUserScore((int) $order['uid'], 'goods', 'commission', '成功购买商品 ' . $item['item_title'] . ' 获得积分', $order_id, $score);
                                }
                            }
                            FDB::query('UPDATE ' . FDB::table('goods_order') . ' SET status = 1,settlement_time = ' . TIME_UTC . ',commission = ' . $commission . ' WHERE order_id = ' . $order_id . ' AND uid = ' . (int) $order['uid']);
                            $is_insert = true;
                        }
                        if ($is_insert) {
                            FDB::insert('taobaoke_report_temp', $item);
                        }
                    }
                }
                if ($page * $page_size >= $total_results) {
                    FDB::query('INSERT INTO ' . FDB::table('taobaoke_report') . '(id,trade_id,num_iid,item_title,item_num,pay_price,real_pay_fee,commission_rate,commission,outer_code,app_key,pay_time,pay_day) SELECT NULL AS id,trade_id,num_iid,item_title,item_num,pay_price,real_pay_fee,commission_rate,commission,outer_code,app_key,pay_time,pay_day FROM ' . FDB::table('taobaoke_report_temp') . ' ORDER BY pay_time ASC,trade_id ASC');
                    return 1;
                } else {
                    return 0;
                }
            } else {
                return 1;
            }
        }
        return -1;
    }
Exemple #21
0
function justDemo()
{
    /*
     * 第一步: 接收页面提交上来的参数,简单校验一下
     */
    //    $itemUrl = $_REQUEST['itemUrl'];
    //    $appKey = $_REQUEST['appKey'];
    //    $appSecret = $_REQUEST['appSecret'];
    $itemUrl = 'https://detail.tmall.com/item.htm?id=520360573194&skuId=3101727199054';
    $appKey = '23285002';
    $appSecret = '0559365a08a6c5c71c321df373591512';
    if (empty($itemUrl) && empty($appKey) && empty($appSecret)) {
        Ajax::error('请求参数错误!');
    }
    $itemId = getIdInUrl($itemUrl);
    if (empty($itemId)) {
        Ajax::error('url错误,未能获取到商品id!');
    }
    /*
     * 第二步: 调用top接口拿到商品数据
     * 接口说明文档地址:
     * http://api.taobao.com/apidoc/api.htm?path=scopeId:11471-apiId:23731
     */
    $c = new TopClient();
    $c->appkey = $appKey;
    $c->secretKey = $appSecret;
    $req = new TaeItemsListRequest();
    $req->setFields('num,title,nick,pic_url,location,cid,price,post_fee,promoted_service');
    $req->setNumIids($itemId);
    $resp = $c->execute($req);
    if (!isset($resp['items'])) {
        //缺少权限包,则跳转到权限申请页面
        if (isset($resp['msg']) && isset($resp['sub_code']) && $resp['msg'] == 'Insufficient isv permissions' && $resp['sub_code'] == 'isv.permission-api-package-limit') {
            Ajax::error('isv.permission-api-package-limit');
        }
        Ajax::error('top接口获取商品失败');
    }
    /*
     * 第三步: 整理数据入库
     */
    $DB = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD);
    $table = DB_TABLE;
    if (isset($resp['items']) && isset($resp['items']['x_item']) && isset($resp['items']['x_item'][0])) {
        $tmp = $resp['items']['x_item'][0];
    }
    //检查一下是否存在表
    $sql = "SHOW TABLES LIKE '%{$table}%';";
    $rc = $DB->query($sql)->rowCount();
    if (!$rc) {
        $sqlFile = file_get_contents('items.sql');
        $DB->exec($sqlFile);
    }
    //检查是否存在该商品
    $openId = $tmp['open_auction_iid'];
    $sql = "SELECT * FROM `{$table}` WHERE `tb_item_id` LIKE '{$openId}'";
    $query = $DB->query($sql);
    $query->setFetchMode(PDO::FETCH_ASSOC);
    $rs = $query->fetchAll();
    if ($rs) {
        Ajax::error('已经存在该商品.');
    } else {
        $sql = "INSERT INTO `{$table}`\n        (`id`, `pic`, `reserve_price`, `price`, `tb_item_id`,`tb_iid`, `name`, `is_mall`)\n        VALUES\n        (NULL,\n        '" . $tmp['pic_url'] . "',\n        '" . $tmp['reserve_price'] * 100 . "',\n        '" . $tmp['price'] * 100 . "',\n        '" . $tmp['open_auction_iid'] . "',\n        '" . $itemId . "',\n        '" . $tmp['title'] . "',\n        '" . ($tmp['mall'] ? 1 : 0) . "');";
        $rs = $DB->exec($sql);
        if (!$rs) {
            Ajax::error('数据入库失败.');
        }
    }
    /*
     * 最后: 返回数据,前端可以通过控制台查看数据结果.
     */
    Ajax::go($resp);
}
Exemple #22
0
/**
 * 发送短信
 * @param $smsFreeSignName  签名
 * @param $smsParam      短信模板中的参数 : 例如:'{"code":"我爱你","product":"京西商城"}';
 * @param $recNum     接收号码
 * @param $smsTemplateCode   短信模板的编号
 */
function sendSMS($smsFreeSignName, $smsParam, $recNum, $smsTemplateCode)
{
    //加载vendor下的  阿里大鱼
    vendor('Alidayu.TopSdk');
    date_default_timezone_set('Asia/Shanghai');
    $c = new TopClient();
    //从配置文件中得到短信应用的配置
    $sms_config = C('SMS_CONFIG');
    //设置应用的APP_KEY
    $c->appkey = $sms_config['appkey'];
    //安全码
    $c->secretKey = $sms_config['secretKey'];
    //发送短信的对象
    $req = new AlibabaAliqinFcSmsNumSendRequest();
    //$req->setExtend("123456");
    //短信类型. 必须要修改
    $req->setSmsType("normal");
    //短信签名
    $req->setSmsFreeSignName($smsFreeSignName);
    //为短信模板中的变量赋值
    $req->setSmsParam($smsParam);
    //接收短信的手机号
    $req->setRecNum($recNum);
    //短信模板的编号
    $req->setSmsTemplateCode($smsTemplateCode);
    //   验证码${code},您正在注册成为${product}用户,感谢您的支持!
    //发送短信
    $resp = $c->execute($req);
}
 private function getDetail($id)
 {
     define('M_ROOT', dirname(dirname(__FILE__)));
     $ss = M_ROOT;
     $str = str_replace("\\", "/", $ss);
     include_once $str . "/API/taobao/TopSdk.php";
     $c = new \TopClient();
     $c->appkey = '23151483';
     $c->secretKey = 'aa5a861b141f7e294ed088315da46867';
     //淘宝客商品详情查询
     $req = new \TbkItemInfoGetRequest();
     $req->setFields("volume,num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url");
     $req->setPlatform(1);
     $req->setNumIids($id);
     $resp = $c->execute($req);
     //淘宝客商品详情(有销量)
     $reqs = new \TbkItemsDetailGetRequest();
     $reqs->setTrackIids($id);
     $reqs->setFields("num_iid,seller_id,nick,title,price,volume,pic_url,item_url,shop_url,click_url");
     $reqs->setNumIids($id);
     $resps = $c->execute($reqs);
     $tt = $resp->results->n_tbk_item;
     foreach ($tt->small_images->string as $k => $v) {
         $all .= $v . ',';
     }
     $back->image = rtrim($all, ",");
     //$yishou = $resps->tbk_items->tbk_item->volume;
     $yishou = $resp->results->n_tbk_item->volume;
     $back->yishou = $yishou;
     return $back;
 }
    public function fetch($url)
    {
        global $_FANWE;
        $id = $this->getID($url);
        if ($id == 0) {
            return false;
        }
        $key = 'taobao_' . $id;
        $share_goods = FDB::resultFirst('SELECT share_id,goods_id FROM ' . FDB::table('share_goods') . ' 
			WHERE uid = ' . $_FANWE['uid'] . " AND goods_key = '{$key}'");
        if ($share_goods) {
            $result['status'] = -1;
            $result['share_id'] = $share_goods['share_id'];
            $result['goods_id'] = $share_goods['goods_id'];
            return $result;
        }
        $client = new TopClient();
        $client->appkey = $_FANWE['cache']['business']['taobao']['app_key'];
        $client->secretKey = $_FANWE['cache']['business']['taobao']['app_secret'];
        $req = new ItemGetRequest();
        $req->setFields("detail_url,title,nick,pic_url,price");
        $req->setNumIid($id);
        $resp = $client->execute($req);
        if (!isset($resp->item)) {
            return false;
        }
        $result = array();
        $goods = (array) $resp->item;
        if (empty($goods['detail_url']) || empty($goods['pic_url'])) {
            return false;
        }
        if (FS("Image")->getIsServer()) {
            $args = array();
            $args['pic_url'] = $goods['pic_url'];
            $server = FS("Image")->formatServer($_FANWE['request']['image_server'], 'DE');
            $server = FS("Image")->getImageUrlToken($args, $server, 1);
            $body = FS("Image")->sendRequest($server, 'savetemp', true);
            if (empty($body)) {
                return false;
            }
            $image = unserialize($body);
            $result['image_server'] = $server['image_server'];
        } else {
            $image = copyFile($goods['pic_url'], "temp", false);
            if ($image === false) {
                return false;
            }
            $image['server_code'] = '';
        }
        $result['item']['key'] = $key;
        $result['item']['name'] = $goods['title'];
        $result['item']['price'] = $goods['price'];
        $result['item']['img'] = $image['path'];
        $result['item']['server_code'] = $image['server_code'];
        $result['item']['pic_url'] = $goods['pic_url'] . '_100x100.jpg';
        $result['item']['url'] = $goods['detail_url'];
        $tao_ke_pid = $_FANWE['cache']['business']['taobao']['tk_pid'];
        $shop_click_url = '';
        if (!empty($tao_ke_pid)) {
            $req = new TaobaokeItemsDetailGetRequest();
            $req->setFields("click_url,shop_click_url");
            $req->setNumIids($id);
            $req->setPid($tao_ke_pid);
            $resp = $client->execute($req);
            if (isset($resp->taobaoke_item_details)) {
                $taoke = (array) $resp->taobaoke_item_details->taobaoke_item_detail;
                if (!empty($taoke['click_url'])) {
                    $result['item']['taoke_url'] = $taoke['click_url'];
                }
                if (!empty($taoke['shop_click_url'])) {
                    $shop_click_url = $taoke['shop_click_url'];
                }
            }
        }
        if (!empty($goods['nick'])) {
            $req = new ShopGetRequest();
            $req->setFields("sid,nick,pic_path");
            $req->setNick($goods['nick']);
            $resp = $client->execute($req);
            if (isset($resp->shop)) {
                $shop = (array) $resp->shop;
                $result['shop']['name'] = $shop['nick'];
                if (!empty($shop['pic_path'])) {
                    if (FS("Image")->getIsServer()) {
                        $args = array();
                        $args['pic_url'] = 'http://logo.taobao.com/shop-logo' . $shop['pic_path'];
                        $server = FS("Image")->getImageUrlToken($args, '', 1);
                        $body = FS("Image")->sendRequest($server, 'savetemp', true);
                        if (!empty($body)) {
                            $image = unserialize($body);
                        } else {
                            $image = false;
                        }
                    } else {
                        $image = copyFile('http://logo.taobao.com/shop-logo' . $shop['pic_path'], "temp", false);
                        if ($image === false) {
                            $image['server_code'] = '';
                        }
                    }
                    if ($image !== false) {
                        $result['shop']['logo'] = $image['path'];
                        $result['shop']['server_code'] = $image['server_code'];
                    }
                }
                $result['shop']['shop_id'] = $shop['sid'];
                $result['shop']['url'] = 'http://shop' . $shop['sid'] . '.taobao.com';
                if (!empty($shop_click_url)) {
                    $result['shop']['taoke_url'] = $shop_click_url;
                }
            }
        }
        return $result;
    }
Exemple #25
0
 private function parseShop()
 {
     $c = new TopClient();
     $c->appkey = TAOBAO_APP_KEY;
     $c->secretKey = TAOBAO_APPSECRET;
     $req = new ShopGetRequest();
     $req->setFields("sid,cid,title,desc,bulletin,pic_path,created,modified");
     $req->setNick($this->_shopName);
     $resp = $c->execute($req);
     foreach ($resp as $key) {
         $key = (array) $key;
         foreach ($key as $k => $v) {
             if ($k == 'sid') {
                 $this->_data['shop_id'] = $v;
             } else {
                 if ($k == 'title') {
                     $this->_data['shop'] = $v;
                 }
             }
         }
     }
 }
Exemple #26
0
 /**
  * Author: chenyifan
  * Des: -baichuan-
  *
  * @param array $config
  *
  * @return Sms
  */
 public static function baichuan($config = [])
 {
     $sms = new self();
     foreach ($config as $key => $value) {
         $sms->config[$key] = $value;
     }
     $sms->callback = function () use($sms) {
         date_default_timezone_set('Asia/Shanghai');
         $c = new \TopClient();
         $c->appkey = $sms->config['appkey'];
         $c->secretKey = $sms->config['secret'];
         $c->format = 'json';
         $req = new \OpenSmsSendmsgRequest();
         $send_message_request = new \SendMessageRequest();
         $send_message_request->template_id = $sms->config['template_id'];
         $send_message_request->signature_id = $sms->config['signature_id'];
         $send_message_request->mobile = $sms->mobile;
         $send_message_request->context = $sms->config['context'];
         $req->setSendMessageRequest(json_encode($send_message_request));
         $resp = $c->execute($req);
         $result = $resp->result;
         if ($result->successful == true) {
             return true;
         }
         return $result;
     };
     return $sms;
 }
Exemple #27
0
/**
 * 发送短信
 * @param $SmsParam '参数json字符串'
 * @param $RecNum '手机号'
 */
function sendSMS($SmsParam, $RecNum)
{
    //引入文件
    vendor('Alidayu.TopSdk');
    //设置默认时区
    date_default_timezone_set('Asia/Shanghai');
    //实例化对象
    $c = new TopClient();
    //设置用户
    $SMS_config = C('SMS_CONFIG');
    $c->appkey = $SMS_config['appkey'];
    $c->secretKey = $SMS_config['secret'];
    $req = new AlibabaAliqinFcSmsNumSendRequest();
    //$req->setExtend("123456"); //回传参数
    $req->setSmsType("normal");
    //短信类型,默认normal即可
    $req->setSmsFreeSignName($SMS_config['SmsFreeSignName']);
    $req->setSmsParam($SmsParam);
    //{"code":"1234","product":"alidayu"} 传入json字符串
    $req->setRecNum($RecNum);
    $req->setSmsTemplateCode($SMS_config['SmsTemplateCode']);
    //发送短信
    $c->execute($req);
}
Exemple #28
0
 public function getGoods($url)
 {
     //商品基本信息
     $id = $this->getId($url);
     $topClient = new TopClient();
     $topClient->appkey = self::$appkey;
     $topClient->secretKey = self::$secretKey;
     $itemReq = new ItemGetRequest();
     $itemReq->setFields("detail_url,nick,props_name,num_iid,title,num_iid,input_str,pic_url,location,price,item_img,prop_img");
     $itemReq->setNumIid($id);
     $objResult = $topClient->execute($itemReq);
     if (!isset($objResult->item)) {
         return false;
     }
     $arrItem = (array) $objResult->item;
     $goodsInfo = array();
     if (empty($arrItem['num_iid']) || empty($arrItem['title'])) {
         return false;
     }
     $goodsInfo['goods_name'] = $arrItem['title'];
     $goodsInfo['goods_url'] = $arrItem['detail_url'];
     $goodsInfo['goods_site'] = self::$site;
     $goodsInfo['nick'] = $arrItem['nick'];
     $goodsInfo['goods_price'] = $arrItem['price'];
     $goodsInfo['goods_brand'] = $arrItem['props_name'];
     $goodsInfo['goods_pic'] = $arrItem['pic_url'];
     $goodsInfo['goods_tags'] = $arrItem['input_str'];
     $goodsInfo['item_img'] = isset($arrItem['item_imgs']) ? $arrItem['item_imgs'] : '';
     $goodsInfo['prop_img'] = isset($arrItem['prop_imgs']) ? $arrItem['prop_imgs'] : '';
     $goodsInfo['goods_key'] = $this->getKey($url);
     //淘宝信息
     $goodsInfo['taoke_url'] = '';
     $goodsInfo['shopclickurl'] = '';
     $goodsInfo['seller_credit_score'] = '';
     if (!empty(self::$pid)) {
         $objTaoke = new TaobaokeItemsDetailGetRequest();
         $objTaoke->setFields("click_url,shop_click_url,seller_credit_score");
         $objTaoke->setNumIids($id);
         $objTaoke->setPid(self::$pid);
         $objResult = $topClient->execute($objTaoke);
         if (isset($objResult->taobaoke_item_details)) {
             $arrTaoke = (array) $objResult->taobaoke_item_details->taobaoke_item_detail;
             if (!empty($arrTaoke['click_url'])) {
                 $goodsInfo['taoke_url'] = $arrTaoke['click_url'];
             }
             if (!empty($arrTaoke['shop_click_url'])) {
                 $goodsInfo['shopclickurl'] = $arrTaoke['shop_click_url'];
             }
             if (!empty($arrTaoke['shop_click_url'])) {
                 $goodsInfo['seller_credit_score'] = $arrTaoke['seller_credit_score'];
             }
         }
     }
     //店铺信息
     $goodsInfo['shop_name'] = '';
     if (!empty($arrItem['nick'])) {
         $objShop = new ShopGetRequest();
         $objShop->setFields("sid,cid,title,nick,desc,bulletin,pic_path,created,modified");
         $objShop->setNick($arrItem['nick']);
         $objResult = $topClient->execute($objShop);
         if (isset($objResult->shop)) {
             $arrShop = (array) $objResult->shop;
             if (!empty($arrShop['title'])) {
                 $goodsInfo['shop_name'] = $arrShop['title'];
             }
         }
     }
     return $goodsInfo;
 }
Exemple #29
0
    return array_map('objectToArray', (array) $object);
}
$app->get('/', function () {
    //存在的价值大概就是判断api服务有没有的拉
    echo '<h1>let barrage fly api</h1>';
});
$app->post('/register', function () use($client) {
    $requset = new OpenimUsersAddRequest();
    $userinfo = new Userinfos();
    $requestBody = json_decode(@file_get_contents('php://input'), true);
    $username = isset($requestBody['username']) && $requestBody['username'] != '' ? $requestBody['username'] : '';
    $password = isset($requestBody['password']) && $requestBody['password'] != '' ? md5($requestBody['password']) : '';
    $userinfo->userid = $username;
    $userinfo->password = $password;
    $requset->setUserinfos(json_encode($userinfo));
    $response = $client->execute($requset);
    $responseArray = objectToArray($response);
    if (isset($responseArray['uid_succ']['string']) && $responseArray['uid_succ']['string'] == $userinfo->userid) {
        //判断是否注册成功,直接返回密码,用来登录,也就是credential
        echo json_encode(array('msg' => 'success register', 'code' => 'success', 'username' => $userinfo->userid, 'password' => $userinfo->password));
    } else {
        throw new \Exception(json_encode($responseArray));
        //        echo json_encode($responseArray);
    }
});
$app->post('/login', function () use($client) {
    $request = new OpenimUsersGetRequest();
    $requestBody = json_decode(@file_get_contents('php://input'), true);
    if ($requestBody == null) {
        $username = isset($_POST['username']) ? $_POST['username'] : '';
        $password = isset($_POST['password']) ? $_POST['password'] : '';
    public function fetch($url)
    {
        global $_FANWE;
        $id = $this->getID($url);
        if ($id == 0) {
            return false;
        }
        $key = 'taobao_' . $id;
        $share_goods = FDB::resultFirst('SELECT share_id,goods_id FROM ' . FDB::table('share_goods') . ' 
			WHERE uid = ' . $_FANWE['uid'] . " AND goods_key = '{$key}'");
        if ($share_goods) {
            $result['status'] = -1;
            $result['share_id'] = $share_goods['share_id'];
            $result['goods_id'] = $share_goods['goods_id'];
            return $result;
        }
        //http://container.open.taobao.com/container?appkey=12324287&encode=utf-8
        $client = new TopClient();
        $client->appkey = $_FANWE['cache']['business']['taobao']['app_key'];
        $client->secretKey = $_FANWE['cache']['business']['taobao']['app_secret'];
        $req = new ItemGetRequest();
        $req->setFields("detail_url,title,nick,pic_url,price");
        $req->setNumIid($id);
        $resp = $client->execute($req);
        if (!isset($resp->item)) {
            return false;
        }
        $result = array();
        $goods = (array) $resp->item;
        if (empty($goods['detail_url']) || empty($goods['pic_url'])) {
            return false;
        }
        $image = copyFile($goods['pic_url'], "temp", md5(microtime(true)) . random('6') . ".jpg", false);
        if ($image === false) {
            return false;
        }
        $result['item']['key'] = $key;
        $result['item']['name'] = $goods['title'];
        $result['item']['price'] = $goods['price'];
        $result['item']['img'] = $image['url'];
        $result['item']['pic_url'] = $goods['pic_url'] . '_100x100.jpg';
        $result['item']['url'] = $goods['detail_url'];
        $tao_ke_pid = $_FANWE['cache']['business']['taobao']['tk_pid'];
        $shop_click_url = '';
        if (!empty($tao_ke_pid)) {
            $req = new TaobaokeItemsDetailGetRequest();
            $req->setFields("click_url,shop_click_url");
            $req->setNumIids($id);
            $req->setPid($tao_ke_pid);
            $resp = $client->execute($req);
            if (isset($resp->taobaoke_item_details)) {
                $taoke = (array) $resp->taobaoke_item_details->taobaoke_item_detail;
                if (!empty($taoke['click_url'])) {
                    $result['item']['taoke_url'] = $taoke['click_url'];
                }
                if (!empty($taoke['shop_click_url'])) {
                    $shop_click_url = $taoke['shop_click_url'];
                }
            }
        }
        if (!empty($goods['nick'])) {
            $req = new ShopGetRequest();
            $req->setFields("sid,nick,pic_path");
            $req->setNick($goods['nick']);
            $resp = $client->execute($req);
            if (isset($resp->shop)) {
                $shop = (array) $resp->shop;
                $result['shop']['name'] = $shop['nick'];
                if (!empty($shop['pic_path'])) {
                    $image = copyFile('http://logo.taobao.com/shop-logo' . $shop['pic_path'], "temp", md5(microtime(true)) . random('6') . ".jpg", false);
                    if ($image !== false) {
                        $result['shop']['logo'] = $image['url'];
                    }
                }
                $result['shop']['shop_id'] = $shop['sid'];
                $result['shop']['url'] = 'http://shop' . $shop['sid'] . '.taobao.com';
                if (!empty($shop_click_url)) {
                    $result['shop']['taoke_url'] = $shop_click_url;
                }
            }
        }
        return $result;
    }