function callOpenSystem($paramArr, $url = '', $cachetime = 0) { global $memc_obj; $url = $url | C('OPEN_SYS_URL'); //请求地址 $token = C('OPEN_SYS_TOKEN'); //用户token $strParam = array2http($paramArr) . "&sign=" . createSign($paramArr, $token); //生成签名,组织参数 $urls = $url . $strParam; //构造Url $cachekey = "om_callOpenSystem_" . md5($urls); if ($cachetime > 0 && ($result = $memc_obj->get($cachekey))) { return $result; } //连接超时自动重试3次 $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } if ($cachetime > 0) { $memc_obj->set($cachekey, $result, $cachetime); } return $result; }
function callOpenSystem($paramArr, $local = false) { if ($local) { $url = C('OPEN_SYS_URL_LOCAL'); //开放系统内网地址;默认值 } else { $url = C('OPEN_SYS_URL'); //开放系统外网地址 } $token = C('OPEN_SYSTOKEN'); //用户notice token $sign = createSign($paramArr, $token); //生成签名 $strParam = createStrParam($paramArr); //组织参数 $strParam .= 'sign=' . $sign; $urls = $url . $strParam; //构造Url $cnt = 0; //连接超时自动重试3次 while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } return $result; }
function callOpenSystem($paramArr, $local = false) { $token = '12aead0936276c4d8bbe32947b9e94b3'; //用户 token if ($local) { $url = C('OPEN_SYS_URL_LOCAL'); //开放系统内网地址;默认值 } else { $url = C('OPEN_SYS_URL'); //开放系统外网地址 } //生成签名 $sign = createSign($paramArr, $token); //echo $sign,"<br/>"; //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //echo $strParam,"<br/>"; //构造Url $urls = $url . $strParam; //echo $urls;exit; //连接超时自动重试3次 $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } return $result; }
public function act_setOpenApiParamArr($paramArr) { $url = 'http://gw.open.valsun.cn:88/router/rest?'; //开放系统入口地址 $paramArr = array('method' => 'trans.carrier.fix.get', 'format' => 'json', 'v' => '1.0', 'username' => 'valsun.cn', 'carrier' => $carrier, 'country' => $country, 'weight' => $weight, 'shaddr' => $shaddr); //生成签名 $sign = createSign($paramArr, $token); //echo $sign,"<br/>"; //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //echo $strParam,"<br/>"; //构造Url $urls = $url . $strParam; //echo $urls,"<br/>";exit; //连接超时自动重试3次 $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } //$result = file_get_contents($urls); //$jsondata_arr = json_decode($result,true); echo "<pre>"; print_r($result); }
function getArrayResult($methord, $rooturl, $session, $appKey, $appSecret, $fields, $col, $ch, $extra) { if ($extra != '') { } else { $extra = array(); } //参数数组 $param = array('method' => $methord, 'session' => $session, 'timestamp' => date('Y-m-d H:i:s'), 'format' => 'xml', 'app_key' => $appKey, 'v' => '2.0', 'sign_method' => 'md5', 'fields' => $fields); $paramArr = array_merge($param, $extra); //生成签名 $sign = createSign($paramArr, $appSecret); //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //构造Url $url = $rooturl . $strParam; //连接超时自动重试 $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($url)) === FALSE) { $cnt++; } //解析Xml数据 $result = getXmlData($result); //获取错误信息 $sub_msg = $result['sub_msg']; //echo $sub_msg; //返回结果 if ($ch == 's') { $taoresult = $result[$col . 's'][$col]; } else { $taoresult = $result[$col]; } return $taoresult; }
function callOpenSystem($paramArr, $url = '') { //global $url,$token; if (empty($url)) { $url = C('OPEN_SYS_URL'); } else { $url = C('OPEN_SYS_URL_LOCAL'); } $token = C('OPEN_SYS_TOKEN'); //用户token //生成签名 $sign = createSign($paramArr, $token); //echo $sign,"<br/>"; //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //echo $strParam,"<br/>"; //构造Url $urls = $url . $strParam; // echo $urls."<br/>"; //连接超时自动重试3次 $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } return $result; }
function getPushResult($url, $appKey, $masterSecret, $taskId) { $params = array(); $params["action"] = "getPushMsgResult"; $params["appkey"] = $appKey; $params["taskId"] = $taskId; $sign = createSign($params, $masterSecret); $params["sign"] = $sign; $data = json_encode($params); $result = httpPost($url, $data); return $result; }
public function sendRequest($parameter) { $sign = createSign($parameter); //生成签名 $strParam = createStrParam($parameter); //组装参数 $strParam .= 'sign=' . $sign; //构造Url $urls = $this->url . $strParam; $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } return $result; }
/** 取得老系统的eabay_products数据 */ public static function getProductsCache($method, $idc = '', $decode = true) { include_once WEB_PATH . "api/include/functions.php"; if (empty($method)) { //参数不规范 self::$errCode = 301; self::$errMsg = '参数信息不规范'; return false; } else { $paramArr = array('format' => 'json', 'v' => '1.0', 'username' => 'valsun.cn'); $paramArr['method'] = $method; //调用接口名称,系统级参数 //生成签名 $sign = createSign($paramArr, self::$token); //echo $sign,"<br/>"; //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //echo $strParam,"<br/>"; if ($idc == '') { $url = self::$url; } else { $url = 'http://gw.open.valsun.cn:88/router/rest?'; } //构造Url $urls = $url . $strParam; //连接超时自动重试3次 $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } if ($decode) { $data = json_decode($result, true); } else { $data = $result; } //var_dump($data);exit; if ($data) { self::$errCode = 200; self::$errMsg = 'Success'; return $data; } else { self::$errCode = "000"; self::$errMsg = "is empty!"; } } }
/** * sendEbayCaseMailModel::getTranNumFromErp() * 从erp接口获取跟踪号 * @param string $ebay_account ebay账号 * @param string $ebay_userid 买家账号 * @return json string */ public static function getTranNumFromErp($ebay_account, $ebay_userid) { include_once WEB_PATH . 'lib/opensys_functions.php'; $paramList = array('method' => 'order.getOrderInfoByUserId', 'format' => 'json', 'v' => '1.0', 'username' => 'Message', 'type' => 'orderinfo', 'buyeraccount' => $ebay_account, 'selleraccount' => $ebay_userid); //生成签名 $sign = createSign($paramList); //组织参数 $strParam = createStrParam($paramList); $strParam .= 'sign=' . $sign; //构造Url $urls = $url . $strParam; $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } $data = json_decode($result, true); return $data; }
function callOpenSystem($paramArr) { $url = C('OPEN_SYS_URL_LOCAL'); //开放系统入口地址 $token = C('OPEN_SYS_TOKEN'); //用户notice token //生成签名 $sign = createSign($paramArr, $token); //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //echo $strParam,"<br/>"; //构造Url $urls = $url . $strParam; // echo $urls."<br/>";exit; //连接超时自动重试3次 $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } return $result; }
function callOpenSystem($paramArr) { $url = 'http://idc.gw.open.valsun.cn/router/rest?'; //开放系统入口地址 $token = '350dea37a2c2e3275f98de0f563c6760'; //用户finejo token //$token = '5f5c4f8c005f09c567769e918fa5d2e3'; //生成签名 $sign = createSign($paramArr, $token); //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //构造Url $urls = $url . $strParam; //echo $urls; //连接超时自动重试3次 $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } return $result; }
function callOpenSystem($paramArr) { //global $url,$token; $url = 'http://gw.open.valsun.cn:88/router/rest?'; //开放系统入口地址 $token = 'a6c94667ab1820b43c0b8a559b4bc909'; //用户purchase token //生成签名 $sign = createSign($paramArr, $token); //echo $sign,"<br/>"; //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; // echo $strParam,"<br/>"; //构造Url $urls = $url . $strParam; //连接超时自动重试3次 $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } return $result; }
function callOpenSystem($paramArr, $url = '') { //global $url,$token; $url = 'http://idc.gw.open.valsun.cn/router/rest?'; //开放系统入口地址 $token = '12aead0936276c4d8bbe32947b9e94b3'; //用户 token //生成签名 $sign = createSign($paramArr, $token); //echo $sign,"<br/>"; //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //echo $strParam,"<br/>"; //构造Url $urls = $url . $strParam; //echo $urls;exit; //连接超时自动重试3次 $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } return $result; }
function callOpenSystem($paramArr) { //global $url,$token; $url = 'http://gw.open.valsun.cn/router/rest?'; //开放系统入口地址 $token = 'eaab14a3b421d8a0422e3de2ef82c4f8'; //用户purchase token //生成签名 $sign = createSign($paramArr, $token); //echo $sign,"<br/>"; //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //echo $strParam,"<br/>"; //构造Url $urls = $url . $strParam; // echo $urls."<br/>"; //连接超时自动重试3次 $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } return $result; }
function getArrayCount($methord, $rooturl, $session, $appKey, $appSecret, $fields, $extra) { if ($extra != '') { } else { $extra = array(); } //参数数组 $param = array('timestamp' => date('Y-m-d H:i:s'), 'method' => $methord, 'session' => $session, 'format' => 'xml', 'app_key' => $appKey, 'v' => '2.0', 'sign_method' => 'md5', 'fields' => $fields); $paramArr = array_merge($param, $extra); //生成签名 $sign = createSign($paramArr, $appSecret); //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //构造Url $url = $rooturl . $strParam; //连接超时自动重试 $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($url)) === FALSE) { $cnt++; } //解析Xml数据 $result = getXmlData($result); //获取错误信息 $msg = $result['msg']; //返回结果 $resultcount = $result['total_results']; $arr = array("msg" => $msg, "total_results" => $resultcount); return $arr; }
/** * 获取供应商列表信息 * * @access public * @param * * @return void */ function rebate_list($act = '') { $result = get_filter(); if ($result === false) { //$aiax = isset($_GET['is_ajax']) ? $_GET['is_ajax'] : 0; /* 过滤信息 */ $filter['rebate_paytime_start'] = !empty($_REQUEST['rebate_paytime_start']) ? local_strtotime($_REQUEST['rebate_paytime_start']) : 0; $filter['rebate_paytime_end'] = !empty($_REQUEST['rebate_paytime_end']) ? local_strtotime($_REQUEST['rebate_paytime_end'] . " 23:59:59") : 0; $filter['status'] = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : -1; $filter['sort_by'] = empty($_REQUEST['sort_by']) ? ' sr.supplier_id' : trim($_REQUEST['sort_by']); $filter['sort_order'] = empty($_REQUEST['sort_order']) ? ' ASC' : trim($_REQUEST['sort_order']); $filter['is_pay_ok'] = empty($_REQUEST['is_pay_ok']) ? '0' : intval($_REQUEST['is_pay_ok']); $filter['actname'] = empty($act) ? trim($_REQUEST['act']) : $act; $where = 'WHERE 1 '; $where .= $filter['rebate_paytime_start'] ? " AND sr.rebate_paytime_start >= '" . $filter['rebate_paytime_start'] . "' " : " "; $where .= $filter['rebate_paytime_end'] ? " AND sr.rebate_paytime_end <= '" . $filter['rebate_paytime_end'] . "' " : " "; $where .= $filter['is_pay_ok'] ? " AND sr.is_pay_ok = '" . $filter['is_pay_ok'] . "' " : " AND sr.is_pay_ok = '0' "; $where .= $filter['status'] > -1 ? " AND sr.status = '" . $filter['status'] . "' " : " "; /* 分页大小 */ $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']); if (isset($_REQUEST['page_size']) && intval($_REQUEST['page_size']) > 0) { $filter['page_size'] = intval($_REQUEST['page_size']); } elseif (isset($_COOKIE['ECSCP']['page_size']) && intval($_COOKIE['ECSCP']['page_size']) > 0) { $filter['page_size'] = intval($_COOKIE['ECSCP']['page_size']); } else { $filter['page_size'] = 15; } /* 记录总数 */ $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('supplier_rebate') . " AS sr " . $where; $filter['record_count'] = $GLOBALS['db']->getOne($sql); $filter['page_count'] = $filter['record_count'] > 0 ? ceil($filter['record_count'] / $filter['page_size']) : 1; /* 查询 */ $sql = "SELECT sr.* , s.supplier_name, s.supplier_rebate " . "FROM " . $GLOBALS['ecs']->table("supplier_rebate") . " AS sr left join " . $GLOBALS['ecs']->table("supplier") . " AS s on sr.supplier_id=s.supplier_id \n {$where}\n ORDER BY " . $filter['sort_by'] . " " . $filter['sort_order'] . "\n LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ", " . $filter['page_size'] . " "; set_filter($filter, $sql); } else { $sql = $result['sql']; $filter = $result['filter']; } $list = array(); $res = $GLOBALS['db']->query($sql); while ($row = $GLOBALS['db']->fetchRow($res)) { $row['sign'] = createSign($row['rebate_id'], $row['supplier_id']); $row['rebate_paytime_start'] = local_date('Y.m.d', $row['rebate_paytime_start']); $endtime = $row['rebate_paytime_end']; //+$GLOBALS['_CFG']['tuihuan_days_qianshou']*3600*24; $row['rebate_paytime_end'] = local_date('Y.m.d', $endtime); //$row['all_money'] = $GLOBALS['db']->getOne("select sum(money_paid + surplus) from ". $GLOBALS['ecs']->table('order_info') ." where rebate_id=". $row['rebate_id'] ." and rebate_ispay=2"); $row['all_money'] = $GLOBALS['db']->getOne("select sum(" . order_amount_field() . ") from " . $GLOBALS['ecs']->table('order_info') . " where rebate_id=" . $row['rebate_id'] . " and rebate_ispay=2"); $row['all_money_formated'] = price_format($row['all_money']); $row['rebate_money'] = round($row['all_money'] * $row['supplier_rebate'] / 100, 2); $row['rebate_money_formated'] = price_format($row['rebate_money']); $row['pay_money'] = $row['all_money'] - $row['rebate_money']; $row['pay_money_formated'] = price_format($row['pay_money']); $row['pay_status'] = $row['is_pay_ok'] ? "已处理,已返佣" : "未处理"; $row['pay_time'] = local_date('Y.m.d', $row['pay_time']); $row['user'] = $_SESSION['user_name']; $row['payable_price'] = price_format($row['payable_price']); $row['status_name'] = rebateStatus($row['status']); $row['caozuo'] = getRebateDo($row['status'], $row['rebate_id'], $filter['actname']); $list[] = $row; } $arr = array('result' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); return $arr; }
public function act_getAllPicApi() { require_once WEB_PATH . "html/api/include/opensys_functions.php"; if (empty($spu)) { $spu = strlen(htmlentities($_REQUEST['spu'], ENT_QUOTES)) > 0 ? htmlentities($_REQUEST['spu'], ENT_QUOTES) : ''; } if (empty($picType)) { $picType = strlen(htmlentities($_REQUEST['picType'], ENT_QUOTES)) > 0 ? htmlentities($_REQUEST['picType'], ENT_QUOTES) : ''; } $errStr = ''; if (empty($spu)) { $errStr .= '料号输入错误!<br />'; } if (empty($picType)) { $errStr .= '站点输入错误!<br />'; } if (!empty($errStr)) { self::$errCode = '001'; self::$errMsg = $errStr; return false; } $token = "5f5c4f8c005f09c567769e918fa5d2e3"; $url = 'http://idc.gw.open.valsun.cn/router/rest?'; $paramArr = array('method' => 'datacenter.picture.getAllSizePic', 'format' => 'json', 'v' => '1.0', 'username' => 'datacenter', 'spu' => $spu, 'picType' => $picType); //生成签名 $sign = createSign($paramArr, $token); //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //构造Url $urls = $url . $strParam; //echo $urls; //return $urls; $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } $data = json_decode($result, true); return $data; }
public static function getOpenSysApi($method, $paArr, $idc = '', $decode = true) { include_once WEB_PATH . "api/include/functions.php"; if (empty($method) || empty($paArr) || !is_array($paArr)) { //参数不规范 self::$errCode = 301; self::$errMsg = '参数信息不规范'; return false; } else { $paramArr = array('format' => 'json', 'v' => '1.0', 'username' => 'valsun.cn'); $paramArr['method'] = $method; //调用接口名称,系统级参数 foreach ($paArr as $key => $value) { if (!is_array($value)) { //如果传递的应用级参数不是数组的话,直接加入到paramArr中 $paramArr[$key] = $value; } else { $paramArr['jsonArr'] = base64_encode(json_encode($value)); //对数组进行jsonencode再对其进行base64编码进行传递,否则直接传递数组会出错 } } //生成签名 $sign = createSign($paramArr, self::$token); //echo $sign,"<br/>"; //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //echo $strParam,"<br/>"; if ($idc == '') { $url = self::$url; } else { $url = 'http://gw.open.valsun.cn:88/router/rest?'; } //构造Url $urls = $url . $strParam; // echo self::$token.'<br>'; //echo $urls; // exit; //连接超时自动重试3次 $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } //print_r($result); // exit; if ($decode) { $data = json_decode($result, true); } else { $data = $result; } // var_dump($data,$result,"++___+++");exit; if ($data) { self::$errCode = 200; self::$errMsg = 'Success'; return $data; } else { self::$errCode = "000"; self::$errMsg = "is empty!"; } } }
//$sessArr2 = array(); //foreach ($sessArr as $key => $val) { // $sessArr1 = explode('=', $val); // $sessArr2[$sessArr1[0]] = $sessArr1[1]; //} $sessionKey = $_GET['top_session']; $page_no = 1; $total_results = 101; //显示数据集合 $hltDatas = array(); //拉取分页数据 for ($i = 0; $i <= $total_results / 100; $i++) { //参数数组 $paramArr = array('timestamp' => date('Y-m-d H:i:s'), 'app_key' => $appKey, 'method' => 'taobao.trades.sold.get', 'format' => 'xml', 'session' => $sessionKey, 'fields' => 'tid,buyer_nick,seller_nick,status,price,num,total_fee,end_time', "page_size" => 100, "page_no" => $i + 1, 'status' => 'TRADE_FINISHED', 'v' => '2.0'); //生成签名 $sign = createSign($paramArr, $appSecret); //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //访问服务 $url = 'http://gw.api.taobao.com/router/rest?' . $strParam; //echo $url; $result = @file_get_contents($url); $result = getXmlData($result); if (!$result) { echo '没有交易记录!'; exit; } $total_results = $result['total_results']; $radeArray = $result['trades']['trade']; $hltDatas = getDisPlays('ss', $radeArray, $hltDatas);
//require(dirname(__FILE__) . '/includes/lib_store.php'); //require(ROOT_PATH . 'languages/' .$_CFG['lang']. '/admin/supplier.php'); $smarty->assign('lang', $_LANG); /*------------------------------------------------------ */ //-- 查看、编辑返佣 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'view') { /* 检查权限 */ admin_priv('store_rebate'); /* 取得供货商返佣信息 */ $id = intval($_REQUEST['rid']); $order_type = isset($_REQUEST['otype']) && intval($_REQUEST['otype']) > 0 ? intval($_REQUEST['otype']) : 0; if (($rebate = rebateHave($id)) === false) { sys_msg('该返佣记录不存在!'); } else { $rebate['sign'] = createSign($rebate['rebate_id'], $rebate['store_id']); $nowtime = gmtime(); $rebate['rebate_paytime_start'] = local_date('Y.m.d', $rebate['rebate_paytime_start']); $paytime_end = $rebate['rebate_paytime_end']; $rebate['rebate_paytime_end'] = local_date('Y.m.d', $paytime_end); $rebate['isdo'] = $paytime_end + $GLOBALS['_CFG']['okgoods_time'] * 3600 * 24 >= $nowtime ? 0 : 1; $rebate['chadata'] = datecha($paytime_end + $GLOBALS['_CFG']['okgoods_time'] * 3600 * 24); $rebate['caozuo'] = getRebateDo($rebate['status'], $rebate['rebate_id'], trim($_REQUEST['act'])); if ($rebate['status'] > 0) { //非冻结状态 $money = getRebateOrderMoney($id); $money_info = array(); foreach ($money['all'] as $key => $val) { $money_info[$key]['allmoney'] = $val; $money_info[$key]['allmoney'] = price_format($val); $money_info[$key]['supplier_rebate'] = $rebate['rebate'];
* the specific language governing rights and limitations under the License. * The Original Code is: SugarCRM Open Source * The Initial Developer of the Original Code is SugarCRM, Inc. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.; * All Rights Reserved. * Contributor(s): ______________________________________. ********************************************************************************/ /********************************************************************************* * $Header: /advent/projects/wesat/ec_crm/sugarcrm/modules/Users/Logout.php,v 1.8 2005/03/21 04:51:21 ray Exp $ * Description: TODO: To be written. ********************************************************************************/ session_start(); require_once 'modules/Synchronous/Synfunction.php'; //参数数组 $param = array('timestamp' => date('Y-m-d H:i:s'), 'app_key' => $_SESSION['appKey'], 'sign_method' => 'md5'); $paramArr = array_merge($param); $sign = createSign($paramArr, $_SESSION['appSecret']); //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; $rooturl = "http://container.api.taobao.com/container/logoff?"; //构造Url $url = $rooturl . $strParam; unset($_SESSION['sign']); unset($_SESSION['nick']); unset($_SESSION['authenticated_user_id']); unset($_SESSION['app_unique_key']); unset($_SESSION['appKey']); unset($_SESSION['appSecret']); unset($_SESSION['topsession']); redirect($url);
<?php error_reporting(-1); include "../api/include/functions.php"; $url = 'http://gw.open.valsun.cn:88/router/rest?'; //开放系统入口地址 $carrier = '3'; $country = 'USA'; $weight = 0.5; $shaddr = '中国深圳'; $paramArr = array('method' => 'trans.carrier.fix.get', 'format' => 'json', 'v' => '1.0', 'username' => 'valsun.cn', 'carrier' => $carrier, 'country' => $country, 'weight' => $weight, 'shaddr' => $shaddr); //生成签名 $sign = createSign($paramArr, $token); //echo $sign,"<br/>"; //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //echo $strParam,"<br/>"; //构造Url $urls = $url . $strParam; //echo $urls,"<br/>";exit; //连接超时自动重试3次 $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } //$result = file_get_contents($urls); //$jsondata_arr = json_decode($result,true); echo "<pre>"; print_r($result); exit;
function getOpenSysApi($method, $paArr, $gateway = '') { if (empty($method) || empty($paArr) || !is_array($paArr)) { //参数不规范 return false; } else { $paramArr = array('format' => 'json', 'v' => '1.0', 'username' => 'Message'); $paramArr['method'] = $method; //调用接口名称,系统级参数 foreach ($paArr as $key => $value) { if (!is_array($value)) { //如果传递的应用级参数不是数组的话,直接加入到paramArr中 $paramArr[$key] = $value; } else { $paramArr['jsonArr'] = base64_encode(json_encode($value)); //对数组进行jsonencode再对其进行base64编码进行传递,否则直接传递数组会出错 } } //生成签名 $sign = createSign($paramArr, OPENTOKEN); //echo $sign,"<br/>"; //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //构造Url $urls = OPENURL . $strParam; if (!empty($gateway)) { $urls = $gateway . $strParam; } else { $urls = OPENURL . $strParam; } echo $urls; // var_dump($urls);exit; //连接超时自动重试3次 $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } //$result = file_get_contents($urls); $data = json_decode($result, true); // var_dump($result);exit; //var_dump($data,$result,"++___+++"); if ($data) { return $data; } else { return FALSE; } } }
function callOpenSystem($paramArr) { global $memc_obj; $url = isset($paramArr['requesturl']) ? array_shift($paramArr) : C('OPEN_SYS_URL'); $cachetime = isset($paramArr['cachetime']) ? array_shift($paramArr) : 0; $token = C('OPEN_SYS_TOKEN'); //用户token if (!empty($paramArr['app_key'])) { //POST方式 $sign = createSign2($paramArr, $token); } else { $sign = createSign($paramArr, $token); } $strParam = array2http($paramArr) . "&sign=" . $sign; //生成签名,组织参数 $urls = $url . $strParam; //构造Url $cachekey = "om_callOpenSystem_" . md5($urls); if ($cachetime > 0 && ($result = $memc_obj->get($cachekey))) { return $result; } //连接超时自动重试3次 $cnt = 0; if (!empty($paramArr['app_key'])) { //POST方式 while ($cnt < 3 && ($result = @vita_get_url_content2($urls, $paramArr)) == FALSE) { $cnt++; } } else { //GET方式 while ($cnt < 3 && ($result = @vita_get_url_content($urls)) == FALSE) { $cnt++; } //added by andy 09.04 if (empty($result)) { $result = file_get_contents($urls); } } $memc_obj->set($cachekey, $result, $cachetime); return $result; }
function callOpenSystem($paramArr, $url = '', $type = "get") { //global $url,$token; if (empty($url)) { $url = C('OPEN_SYS_URL'); } else { $url = C('OPEN_SYS_URL_LOCAL'); } $token = C('OPEN_SYS_TOKEN'); //用户token //生成签名 if ($type == "post") { $sign = createSignP($paramArr, $token); } else { $sign = createSign($paramArr, $token); } //echo $sign,"<br/>"; //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //echo $strParam,"<br/>"; //构造Url $urls = $url . $strParam; /* if($_GET['debug'] == 1){ echo $urls; }*/ //连接超时自动重试3次 $cnt = 0; while ($cnt < 3 && @$result == false) { if ($type == "post") { $result = curl($urls, $paramArr); //post 方法 } else { $result = @vita_get_url_content($urls); } $cnt++; } return $result; }
/** * 调用开放系统指定接口的公用方法 * para:method:调用开发系统接口的接口名,paArr为传递的参数(参数均要用数组包装,不能直接传字段) * add by hws */ public static function callOpenSystemForRq($paArr, $type = "get") { include_once "/data/web/wh.valsun.cn/api/include/functions.php"; if (empty($paArr) || !is_array($paArr)) { //参数不规范 self::$errCode = 301; self::$errMsg = '参数信息不规范'; return false; } else { $paramArr = $paArr; $paramArr['format'] = 'json'; $paramArr['v'] = '1.0'; $paramArr['username'] = '******'; //生成签名 if ($type == "post") { $sign = createSignP($paramArr, self::$token); } else { $sign = createSign($paramArr, self::$token); } //echo $sign,"<br/>"; //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //echo $strParam,"<br/>"; //构造Url $urls = self::$url . $strParam; //echo $urls,"<br/>"; //连接超时自动重试3次 $cnt = 0; if ($type == "post") { while ($cnt < 3 && ($result = @curl($urls, $paramArr)) === FALSE) { $cnt++; } } else { while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } } //$result = file_get_contents($urls); //print_r($result);die; $data = json_decode($result, true); if ($data) { self::$errCode = 200; self::$errMsg = 'Success'; return $data; } else { self::$errCode = $data['errCode']; self::$errMsg = $data['errMsg']; return false; } } }
//require(ROOT_PATH . 'languages/' .$_CFG['lang']. '/admin/supplier.php'); $smarty->assign('lang', $_LANG); /*------------------------------------------------------ */ //-- 查看、编辑返佣 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'view') { /* 检查权限 */ admin_priv('rebate_manage'); /* 取得供货商返佣信息 */ $id = intval($_REQUEST['rid']); $is_pay_ok = $_REQUEST['is_pay_ok'] ? intval($_REQUEST['is_pay_ok']) : 0; $order_type = isset($_REQUEST['otype']) && intval($_REQUEST['otype']) > 0 ? intval($_REQUEST['otype']) : 0; if (($rebate = rebateHave($id)) === false) { sys_msg('该返佣记录不存在!'); } else { $rebate['sign'] = createSign($rebate['rebate_id'], $rebate['supplier_id']); $nowtime = gmtime(); $rebate['rebate_paytime_start'] = local_date('Y.m.d', $rebate['rebate_paytime_start']); $paytime_end = $rebate['rebate_paytime_end']; $rebate['rebate_paytime_end'] = local_date('Y.m.d', $paytime_end); $rebate['isdo'] = $paytime_end + $GLOBALS['_CFG']['tuihuan_days_qianshou'] * 3600 * 24 >= $nowtime ? 0 : 1; $rebate['chadata'] = datecha($paytime_end + $GLOBALS['_CFG']['tuihuan_days_qianshou'] * 3600 * 24); //$rebate['caozuo'] = getRebateDo($rebate['status'],$rebate['rebate_id'],trim($_REQUEST['act'])); if ($rebate['status'] > 0) { //非冻结状态 $money = getRebateOrderMoney($id); $money_info = array(); foreach ($money as $key => $val) { $money_info[$key]['allmoney'] = $val; $money_info[$key]['allmoney'] = price_format($val); $money_info[$key]['supplier_rebate'] = $rebate['supplier_rebate'];
public static function getGoodsInfos($fields = '*', $where = 'id=1') { require_once WEB_PATH . "html/api/include/opensys_functions.php"; if (empty($fields) || empty($where)) { //参数不完整 self::$errCode = 301; self::$errMsg = '参数信息不完整'; return false; } else { $paramArr = array('method' => 'pc.goods.info.get', 'format' => 'json', 'v' => '1.0', 'username' => 'valsun.cn', 'fields' => $fields, 'where' => $where); //生成签名 $sign = createSign($paramArr, self::$token); //echo $sign,"<br/>"; //组织参数 $strParam = createStrParam($paramArr); $strParam .= 'sign=' . $sign; //echo $strParam,"<br/>"; //构造Url $urls = self::$url . $strParam; //echo $urls,"<br/>";exit; //连接超时自动重试3次 $cnt = 0; while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } //$result = file_get_contents($urls); $data = json_decode($result, true); if ($data) { self::$errCode = 200; self::$errMsg = 'Success'; return $data; } else { self::$errCode = "000"; self::$errMsg = "is empty!"; } } }
function callOpenSystem($paramArr) { global $memc_obj; $url = isset($paramArr['requesturl']) ? array_shift($paramArr) : C('OPEN_SYS_URL'); $cachetime = isset($paramArr['cachetime']) ? array_shift($paramArr) : 0; $token = C('OPEN_SYS_TOKEN'); //用户token $strParam = array2http($paramArr) . "&sign=" . createSign($paramArr, $token); //生成签名,组织参数 $urls = $url . $strParam; //构造Url // echo $urls;exit; $cachekey = C('DB_PREFIX') . "callOpenSystem_" . md5($urls); if ($cachetime > 0 && ($result = $memc_obj->get($cachekey))) { return $result; } //连接超时自动重试3次 $cnt = 0; if ($paramArr['getOrPost'] == '2') { //POST方式 while ($cnt < 3 && ($result = @vita_get_url_content2($url . 'sign=' . createSign2($paramArr, $token), $paramArr)) === FALSE) { $cnt++; } } else { //GET方式 while ($cnt < 3 && ($result = @vita_get_url_content($urls)) === FALSE) { $cnt++; } } if (strpos($result, "[") > 0 && strpos($result, "[") < strpos($result, "{")) { $result = substr($result, strpos($result, "[")); } else { $result = substr($result, strpos($result, "{")); } $memc_obj->set($cachekey, $result, $cachetime); return $result; }