本文整理汇总了PHP中get_object_vars_final函数的典型用法代码示例。如果您正苦于以下问题:PHP get_object_vars_final函数的具体用法?PHP get_object_vars_final怎么用?PHP get_object_vars_final使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_object_vars_final函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: refresh_token
function refresh_token()
{
$client_id = $this->setting['taobao_appkey'];
//自己的APPKEY
$client_secret = $this->setting['taobao_appsecret'];
//自己的appsecret
$refresh_token = $this->setting['tao_session'];
//refresh_token
$grant_type = 'refresh_token';
//请求参数
$postfields = array('grant_type' => $grant_type, 'client_id' => $client_id, 'client_secret' => $client_secret, 'refresh_token' => $refresh_token);
$url = 'https://oauth.taobao.com/token';
$token = get_object_vars_final(json_decode(curl($url, $postfields)));
print_r($token);
if (!is_array($token)) {
$this->error('对不起,授权失败,授权不可用', U('items_collect/author_tao'));
}
if (isset($token['error'])) {
if ($token['error_description'] == 'refresh times limit exceed') {
$this->error('对不起,授权失败,自动刷新淘宝授权可用', U('items_collect/author_tao'));
//jump(-1,'自动刷新淘宝授权可用');
} else {
$this->error('对不起,检测失败,请从新获取淘宝授权后再检测', U('items_collect/author_tao'));
}
}
if (urldecode($token['taobao_user_nick']) == $this->setting['taobao_nick']) {
$this->success('恭喜您,授权成功', U('items_collect/author_tao'));
} else {
$this->error('对不起,授权失败,请核对后台淘宝账号是否正确', U('items_collect/author_tao'));
}
exit;
}
示例2: get_object_vars_final
function get_object_vars_final($obj)
{
if (is_object($obj)) {
$obj = get_object_vars($obj);
}
if (is_array($obj)) {
foreach ($obj as $key => $value) {
$obj[$key] = get_object_vars_final($value);
}
}
return $obj;
}
示例3: items_collect
function items_collect()
{
$this->uc_login_check();
//检测用户是否登录
$itemcollect_mod = D('itemcollect');
$items_cate_mod = D('items_cate');
$items_tags_mod = D('items_tags');
$items_mod = D('items');
$items_user_mod = D('items_user');
$url = isset($_REQUEST['url']) ? trim($_REQUEST['url']) : '';
$url = url_parse($url);
if (strpos($url, 'tmall.com') !== false || strpos($url, 'taobao.com') !== false) {
//说明此商品是淘宝的商品
$num_iid = get_id($url);
$key = 'taobao_' . $num_iid;
//item_key
$tb_top = $this->taobao_client();
$req = $tb_top->load_api('TaobaokeItemsDetailGetRequest');
$req->setFields("num_iid,detail_url,title,nick,pic_url,price,click_url ");
$req->setPid($this->setting['taobao_pid']);
$req->setNick($this->setting['taobao_usernick']);
$req->setNumIids($num_iid);
$resp = get_object_vars_final($tb_top->execute($req));
if (!is_array($resp)) {
$this->ajaxReturn(array('err' => 'remote_not_exist'));
} else {
$data = $resp['taobaoke_item_details']['taobaoke_item_detail'];
}
if (!is_array($data)) {
$this->ajaxReturn(array('err' => 'remote_not_exist'));
}
$commission = $this->get_commission($data['item']['title'], $data['item']['num_iid'], $p = 'commission');
$data['title'] = $data['item']['title'];
$data['price'] = $data['item']['price'];
$data['img'] = $data['item']['pic_url'] . '_210x1000.jpg';
$data['simg'] = $data['item']['pic_url'] . '_64x64.jpg';
$data['bimg'] = $data['item']['pic_url'];
$data['seller_name'] = $data['item']['nick'];
//返现金额
if (empty($commission)) {
$commission = 0;
}
$data['cash_back_rate'] = $commission . '元';
$data['url'] = $data['click_url'];
$data['author'] = 'taobao';
$data['item_key'] = 'taobao_' . $num_iid;
$tags = $items_tags_mod->get_tags_by_title($data['item']['title']);
$data['cid'] = $items_cate_mod->get_cid_by_tags($tags);
$data['tags'] = implode(' ', $tags);
$item_user_id = $items_user_mod->where("iid='{$num_iid}' AND uid='{$_COOKIE['user']['id']}'")->getField('id');
//此人已经分享过此商品了
if ($item_user_id) {
$this->ajaxReturn(array('err' => 'yet_exist'));
}
//此人没有分享过这个商品
//如果这个商品存在,则不弹窗
$items_data = $items_mod->where("item_key='{$data['item_key']}'")->find();
if ($items_data) {
$item_user_data = array('iid' => substr($items_data['item_key'], 7), 'item_id' => $items_data['id'], 'uid' => $_COOKIE['user']['id'], 'add_time' => time());
$items_user_rel = $items_user_mod->add($item_user_data);
if ($items_user_rel) {
//分享成功赠送积分
$map['uid'] = $_COOKIE['user']['id'];
M('userInfo')->where($map)->setInc("integral", $this->setting['share_goods_score']);
$this->ajaxReturn(array('err' => 'share_yes'));
}
}
} else {
//59miao 的商品开始
$miao_api = $this->miao_client();
//获取59秒api设置信息
$data = $miao_api->ListItemsDetail('', $url);
if (!is_array($data)) {
$this->ajaxReturn(array('err' => 'remote_not_exist'));
} else {
$data = $data['items']['item'];
}
if (!is_array($data)) {
$this->ajaxReturn(array('err' => 'remote_not_exist'));
}
$data['price'] = $data['price'];
if (strpos($data['pic_url'], 'taobao') !== false) {
$data['img'] = $data['pic_url'] . '_210x1000.jpg';
$data['simg'] = $data['pic_url'] . '_64x64.jpg';
//$data['bimg'] = $data['pic_url'].'_460x460.jpg';
$data['bimg'] = $data['pic_url'];
} else {
$data['img'] = str_replace('.jpg', '_210x1000.jpg', $data['pic_url']);
$data['simg'] = str_replace('.jpg', '_60x60.jpg', $data['pic_url']);
//$data['bimg'] = str_replace('.jpg', '_460x460.jpg', $data['pic_url']);
$data['bimg'] = $data['pic_url'];
}
$data['seller_name'] = $data['seller_name'];
$data['cash_back_rate'] = $data['cashback_scope'];
$data['url'] = $data['click_url'];
$data['author'] = 'miao';
$data['item_key'] = 'miao_' . $data['iid'];
$tags = $items_tags_mod->get_tags_by_title($data['title']);
$data['cid'] = $items_cate_mod->get_cid_by_tags($tags);
$data['tags'] = implode(' ', $tags);
//.........这里部分代码省略.........
示例4: tao
function tao()
{
$id = intval($_REQUEST['id']);
$res = $this->items_mod->where('id=' . $id)->find();
//跳转的时候检测用户,执行返利
//如果开启返现 1开启
if ($this->setting['is_cashback'] == 1) {
//如果用户登录则可以获取全部返现,如果用户没有登录,则把返现返给发布者
if (isset($_COOKIE['user']['id'])) {
$iid = substr($res['item_key'], 7);
$tb_top = $this->taobao_client();
$req = $tb_top->load_api('TaobaokeItemsDetailGetRequest');
$req->setFields("num_iid,detail_url,click_url");
$req->setPid($this->setting['taobao_pid']);
$req->setNick($this->setting['taobao_usernick']);
$req->setOuterCode($_COOKIE['user']['id']);
$req->setNumIids($iid);
$resp = $tb_top->execute($req);
$item_rel = get_object_vars_final($resp);
$url = $item_rel['taobaoke_item_details']['taobaoke_item_detail']['click_url'];
if (!empty($url)) {
redirect($url);
exit;
}
}
}
if ($res) {
redirect($res['url']);
}
}
示例5: get_commission
public function get_commission($title, $num_iid, $p = 'commission')
{
$tb_top = $this->taobao_client();
$req = $tb_top->load_api('TaobaokeItemsGetRequest');
$req->setFields("num_iid,title,nick,pic_url,price,click_url,shop_click_url,commission");
$req->setPid($this->setting['taobao_pid']);
$req->setNick($this->setting['taobao_usernick']);
$req->setKeyword($title);
$req->setPageNo(1);
$req->setPageSize(40);
$goods_list = get_object_vars_final($tb_top->execute($req));
if ($goods_list['total_results'] > 0) {
$good_list_rel = $goods_list['taobaoke_items']['taobaoke_item'];
} else {
if ($p == 'commission') {
return '0';
} else {
return;
}
}
if (!is_array($good_list_rel)) {
if ($p == 'commission') {
return '0';
} else {
return;
}
}
$c = count($good_list_rel);
for ($i = 0; $i < $c; $i++) {
if ($good_list_rel[$i]['num_iid'] == $num_iid && strip_tags($good_list_rel[$i]['title']) == strip_tags($title)) {
$re = $good_list_rel[$i];
}
}
if ($p == 'commission') {
return $re['commission'];
}
if ($p == 'click_url') {
return $re['click_url'];
}
}
示例6: addOptionsWhere
public function addOptionsWhere($opWhere, $dataPowerWhere, $type = "AND")
{
if (empty($dataPowerWhere)) {
return $opWhere;
}
if (!isset($opWhere) || is_string($opWhere) && trim($opWhere) == "" || is_array($opWhere) && sizeof($opWhere) == 0) {
$opWhere = $dataPowerWhere;
} else {
if (is_string($opWhere)) {
$opWhere = "(" . $opWhere . ") " . $type . " " . $dataPowerWhere;
} else {
if (is_array($opWhere) || is_object($opWhere)) {
if (is_object($opWhere)) {
$opWhere = get_object_vars_final($opWhere);
}
if (sizeof($opWhere) > 0) {
$where['_complex'] = $opWhere;
$where['_string'] = $dataPowerWhere;
$where['_logic'] = $type;
$opWhere = $where;
}
}
}
}
return $opWhere;
}
示例7: batch_add
function batch_add()
{
$items_cate_mod = D('items_cate');
$cate_list = $items_cate_mod->get_top2_list();
$this->assign('cate_list', $cate_list);
if (isset($_POST['dosubmit'])) {
$data = array();
$success_update_list = '';
$success_insert_list = '';
$fail_list = '';
$cid = $_POST['cid'];
$items_mod = M('items');
$items_site_mod = D('items_site');
$itemcollect_mod = D('itemcollect');
$items_tags_mod = D('items_tags');
$items_tags_item_mod = D('items_tags_item');
$urls = preg_split('/[\\r\\n]/', $_POST['urls']);
$items_nums = 0;
foreach ($urls as $url) {
$url = url_parse(urldecode(trim($url)));
//淘宝
if (strpos($url, 'tmall.com') !== false || strpos($url, 'taobao.com') !== false) {
//说明此商品是淘宝的商品
$num_iid = get_id($url);
$key = 'taobao_' . $num_iid;
//item_key
$tb_top = $this->taobao_client();
$req = $tb_top->load_api('TaobaokeItemsDetailGetRequest');
$req->setFields("num_iid,detail_url,title,nick,pic_url,price,click_url ");
$req->setPid($this->setting['taobao_pid']);
$req->setNick($this->setting['taobao_usernick']);
$req->setNumIids($num_iid);
$resp = get_object_vars_final($tb_top->execute($req));
if (is_array($resp)) {
$data = $resp['taobaoke_item_details']['taobaoke_item_detail'];
if (is_array($data)) {
$commission = $this->get_commission($data['item']['title'], $data['item']['num_iid'], $p = 'commission');
$data['title'] = $data['item']['title'];
$data['price'] = $data['item']['price'];
$data['img'] = $data['item']['pic_url'] . '_210x1000.jpg';
$data['simg'] = $data['item']['pic_url'] . '_64x64.jpg';
$data['bimg'] = $data['item']['pic_url'];
$data['seller_name'] = $data['item']['nick'];
$data['add_time'] = time();
//返现金额
if (empty($commission)) {
$commission = 0;
}
$data['cash_back_rate'] = $commission . '元';
$data['url'] = $data['click_url'];
$data['author'] = 'taobao';
$data['item_key'] = 'taobao_' . $num_iid;
$data['cid'] = $cid;
$data['sid'] = $items_site_mod->where("alias='" . $data['author'] . "'")->getField('id');
$item_id = $items_mod->where("item_key='" . $data['item_key'] . "'")->getField('id');
if ($item_id) {
//update
$item_id = $items_mod->where("id={$item_id}")->save($data);
$success_update_list .= $url . "<br/>";
} else {
//insert
$item_id = $items_mod->add($data);
$success_insert_list .= $url . "<br/>";
}
$tags = $items_tags_mod->get_tags_by_title($data['title']);
if ($tags) {
$tags_arr = array_unique($tags);
foreach ($tags_arr as $tag) {
$isset_id = $items_tags_mod->where("name='" . $tag . "'")->getField('id');
if ($isset_id) {
$items_tags_mod->where('id=' . $isset_id)->setInc('item_nums');
$items_tags_item_mod->add(array('item_id' => $item_id, 'tag_id' => $isset_id));
} else {
$tag_id = $items_tags_mod->add(array('name' => $tag));
$items_tags_item_mod->add(array('item_id' => $item_id, 'tag_id' => $tag_id));
}
}
}
$items_nums++;
} else {
//如果没有数据
$fail_list .= $url . "<br/>";
}
} else {
//如果没有数据
$fail_list .= $url . "<br/>";
}
} else {
//59秒
/*获取数据*/
$miao_api = $this->miao_client();
//获取59秒api设置信息
$data = $miao_api->ListItemsDetail('', $url);
$data = $data['items']['item'];
$data['img'] = str_replace('.jpg', '_210x1000.jpg', $data['pic_url']);
$data['simg'] = str_replace('.jpg', '_60x60.jpg', $data['pic_url']);
$data['bimg'] = $data['pic_url'];
/*结束*/
if (is_array($data)) {
$data['price'] = $data['price'];
//.........这里部分代码省略.........
示例8: search_tao
public function search_tao()
{
$_GET = setFormString($_GET);
$p = isset($_GET['p']) ? $_GET['p'] : 1;
$page_size = 40;
$cid = $_GET['cid'];
$start_price = $_GET['start_price'];
$end_price = $_GET['end_price'];
$start_commissionRate = $_GET['start_commissionRate'];
$end_commissionRate = $_GET['end_commissionRate'];
$start_commissionNum = $_GET['start_commissionNum'];
$end_commissionNum = $_GET['end_commissionNum'];
$start_totalnum = $_GET['start_totalnum'];
$end_totalnum = $_GET['end_totalnum'];
$levelstart = $_GET['levelstart'];
$levelend = $_GET['levelend'];
$keyword = $_GET['keyword'];
$tb_top = $this->taobao_client();
$req = $tb_top->load_api('TaobaokeItemsGetRequest');
$req->setFields('num_iid,title,nick,pic_url,price,click_url,commission,commission_rate,commission_num,commission_volume,shop_click_url,seller_credit_score,item_location,volume');
$req->setPid($this->setting['taobao_pid']);
$req->setNick($this->setting['taobao_usernick']);
$req->setKeyword($keyword);
$req->setCid($cid);
$req->setStartPrice($start_price);
$req->setEndPrice($end_price);
$req->setStartCredit($levelstart);
$req->setEndCredit($levelend);
$req->setStartCommissionRate($start_commissionRate);
$req->setEndCommissionRate($end_commissionRate);
$req->setStartCommissionNum($start_commissionNum);
$req->setEndCommissionNum($end_commissionNum);
$req->setStartTotalnum($start_totalnum);
$req->setEndTotalnum($end_totalnum);
$req->setPageNo($p);
$req->setPageSize($page_size);
$rel = $tb_top->execute($req);
$taobaoke_item_list = get_object_vars_final($rel);
$taobaoke_item_list = $taobaoke_item_list['taobaoke_items']['taobaoke_item'];
$total_results = $rel->total_results;
//print_r($taobaoke_item_list);
import("ORG.Util.Page");
$count = $total_results;
if ($count > 400) {
$count = 400;
}
$p = new Page($count, $page_size);
$page = $p->show();
$this->assign('page', $page);
$taobaoke_item_list_s = array();
foreach ($taobaoke_item_list as $val) {
$taobaoke_item_list_s[$val['num_iid']] = $val;
}
//每次保存
count($taobaoke_item_list_s) > 0 && F('taobaoke_item_list_s', $taobaoke_item_list_s);
$this->assign('list', $taobaoke_item_list);
$this->display();
}
示例9: execute
public function execute($request, $session = null)
{
if ($this->checkRequest) {
try {
$request->check();
} catch (Exception $e) {
$result->code = $e->getCode();
$result->msg = $e->getMessage();
return $result;
}
}
//组装系统参数
$sysParams["app_key"] = $this->appkey;
$sysParams["v"] = $this->apiVersion;
$sysParams["format"] = $this->format;
$sysParams["sign_method"] = $this->signMethod;
$sysParams["method"] = $request->getApiMethodName();
$sysParams["timestamp"] = date("Y-m-d H:i:s");
$sysParams["partner_id"] = $this->sdkVersion;
if (null != $session) {
$sysParams["session"] = $session;
}
//获取业务参数
$apiParams = $request->getApiParas();
//签名
$sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams));
//系统参数放入GET请求串
$requestUrl = $this->gatewayUrl . "?";
foreach ($sysParams as $sysParamKey => $sysParamValue) {
$requestUrl .= "{$sysParamKey}=" . urlencode($sysParamValue) . "&";
}
$requestUrl = substr($requestUrl, 0, -1);
//发起HTTP请求
try {
$resp = $this->curl($requestUrl, $apiParams);
} catch (Exception $e) {
$this->logCommunicationError($sysParams["method"], $requestUrl, "HTTP_ERROR_" . $e->getCode(), $e->getMessage());
$result->code = $e->getCode();
$result->msg = $e->getMessage();
return $result;
}
//解析TOP返回结果
$respWellFormed = false;
if ("json" == $this->format) {
$respObject = json_decode($resp);
if (null !== $respObject) {
$respWellFormed = true;
foreach ($respObject as $propKey => $propValue) {
$respObject = $propValue;
}
}
} else {
if ("xml" == $this->format) {
$respObject = @simplexml_load_string($resp);
if (false !== $respObject) {
$respWellFormed = true;
}
}
}
//返回的HTTP文本不是标准JSON或者XML,记下错误日志
if (false === $respWellFormed) {
$this->logCommunicationError($sysParams["method"], $requestUrl, "HTTP_RESPONSE_NOT_WELL_FORMED", $resp);
$result->code = 0;
$result->msg = "HTTP_RESPONSE_NOT_WELL_FORMED";
return $result;
}
//如果TOP返回了错误码,记录到业务错误日志中
if (isset($respObject->code)) {
$logger = new LtLogger();
$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_biz_err_" . $this->appkey . "_" . date("Y-m-d") . ".log";
$logger->log(array(date("Y-m-d H:i:s"), $resp));
}
$respObject = get_object_vars_final($respObject);
return $respObject;
}
示例10: get_tao_order_jump
public function get_tao_order_jump()
{
$order_mod = D('miao_order');
$star_data = isset($_GET['star_data']) ? trim($_GET['star_data']) : '';
$end_data = isset($_GET['end_data']) ? trim($_GET['end_data']) : '';
if (empty($star_data) || empty($end_data)) {
$this->collect_error('开始日期或者结束日期不能为空', U('miao_order/getorder'), 'getorder');
}
$star_ymd_data = date('Ymd', strtotime($star_data));
$end_ymd_data = date('Ymd', strtotime($end_data));
$tmp = '';
if ($star_ymd_data > $end_ymd_data) {
$tmp = $end_ymd_data;
$end_ymd_data = $star_ymd_data;
$star_ymd_data = $tmp;
}
//获取总共有多少条数据
$pages = get_diff_date($star_data, $end_data);
$p = isset($_GET['p']) && intval($_GET['p']) ? intval($_GET['p']) : 1;
//当前页
//要获取的当前日期
$now_date = date('Ymd', strtotime("{$star_ymd_data} +{$p} day"));
//要获取的当前日期
$tb_top = $this->taobao_client();
$req = $tb_top->load_api('TaobaokeReportGetRequest');
$req->setFields("trade_id,commission,outer_code,pay_time,pay_price,item_num,num_iid,seller_nick,real_pay_fee");
$req->setDate($now_date);
$req->setPageNo(1);
$req->setPageSize(40);
//此处如果每天的订单数大于40 将会有问题
$order_report = $tb_top->execute($req, $this->setting['tao_session']);
$order_report = get_object_vars_final($order_report);
//print_r($order_report);
if ($order_report['taobaoke_report']['taobaoke_report_members']['taobaoke_report_member']) {
$order_report_data = $order_report['taobaoke_report']['taobaoke_report_members']['taobaoke_report_member'];
} else {
$order_report_data = '';
}
if (!empty($order_report_data)) {
//不是二维数组转化为二维数组
if (IsTwoArray($order_report_data)) {
$order_report_data = array($order_report_data);
}
}
$add_num = 0;
$update_num = 0;
if (count($order_report_data) > 0) {
foreach ($order_report_data as $item) {
if ($this->setting['cashback_type'] == 1) {
$fanxian_bili = 100;
} else {
$fanxian_bili = $this->setting['tb_fanxian_bili'];
}
$cashbac = cashback_jifenbao($item['commission'], $fanxian_bili, $this->setting['cashback_rate'], $this->setting['integralback_rate']);
//获取用户名
if (!$item['outer_code'] || !is_numeric($item['outer_code'])) {
//如果outcode为空的话,从服务器获取的内容是一个数组
$item['outer_code'] = 0;
}
$uid = $item['outer_code'];
$user_info_data = $this->user_mode->where("id='{$uid}'")->find();
if ($user_info_data) {
$username = $user_info_data['name'];
} else {
$username = '';
$uid = '';
}
$data = array('uid' => $uid, 'username' => $username, 'order_id' => $item['num_iid'], 'order_code' => $item['trade_id'], 'seller_name' => $item['seller_nick'], 'order_time' => $item['pay_time'], 'item_price' => $item['pay_price'], 'commission' => $item['commission'], 'cash_back_jifenbao' => $cashbac['cacheback'], 'status' => '有效', 'item_count' => 1);
$one_rel = $order_mod->where("order_id='{$item['num_iid']}' and order_code='{$item['trade_id']}'")->find();
//如果此数据存在则执行更新操作
if (count($one_rel) > 0) {
//查看看该订单是否已经确认 并更新完毕
if ($one_rel['is_update'] == 0) {
//执行 update_cash_integral 方法
$this->update_cash_jifenbao_integral($cashbac['cacheback'], $cashbac['integralback'], $data['uid']);
$data['is_update'] = 1;
//1表示此数据已经返现了,再次同步的是不将不进行返现
}
$order_mod->where("order_id='{$item['num_iid']}' and order_code='{$item['trade_id']}'")->save($data);
$update_num++;
} else {
$this->update_cash_jifenbao_integral($cashbac['cacheback'], $cashbac['integralback'], $data['uid']);
$data['is_update'] = 1;
//1表示此数据已经返现了,再次同步的是不将不进行返现
$order_mod->add($data);
$add_num++;
}
}
}
if ($p >= $pages) {
//记录采集时间
$this->collect_success('订单获取完成', '', 'getorder');
} else {
$this->collect_success('第 <em class="blue">' . $p . '</em> 页采集完成,' . $now_date . '插入<em class="blue">' . $add_num . '</em>条数据,更新<em class="blue">' . $update_num . '</em>条数据,共 <em class="blue">' . $pages . '</em> 页', U('miao_order/get_tao_order_jump', array('star_data' => $star_data, 'end_data' => $end_data, 'p' => $p + 1)));
}
}