function updateErpOrderInfoFeedback($ordersn, $ebay_itemid, $ebay_tid, $feedback) { if ($ordersn == '' || $ebay_itemid == '' || $ebay_tid == '' || $feedback == '') { self::$errCode = '001'; self::$errMsg = "参数错误!"; return false; } $paArr = array('ordersn' => $ordersn, 'ebay_itemid' => $ebay_itemid, 'ebay_tid' => $ebay_tid, 'ebay_feedback' => $feedback); $info = self::getOpenSysApi('erp.updateErpOrderInfoFeedback', $paArr); return $info; }
/** * 调用开放系统指定接口的公用方法 * 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; } } }
public static function getOpenSysApiPost($method, $paArr, $idc = '') { 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', 'app_key' => 'valsun.cn', 'protocol' => 'param2'); $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 = createSign2($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 = @Curl($urls, $paramArr)) === FALSE) { $cnt++; } //print_r($result); // exit; $data = json_decode($result, true); // var_dump($data,$result,"++___+++");exit; if ($data) { self::$errCode = 200; self::$errMsg = 'Success'; return $data; } else { self::$errCode = "000"; self::$errMsg = "is empty!"; } } }
public static function getGoodsInfos($fields = '*', $where = 'id=1') { 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!"; } } }
/** * 调用开放系统指定接口的公用方法 * para:method:调用开发系统接口的接口名,paArr为传递的参数(参数均要用数组包装,不能直接传字段) * add by zqt */ public static function getOpenSysApi($method, $paArr) { require_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/>"; //构造Url $urls = self::$url . $strParam; //连接超时自动重试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!"; return false; } } }
/** * 调用开放系统指定接口的公用方法 * para:method:调用开发系统接口的接口名,paArr为传递的参数(参数均要用数组包装,不能直接传字段) * add by herman.xi */ public static function getOpenSysApi2($method, $paArr) { require_once WEB_PATH . "html/api/include/opensys_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' => 'purchase'); $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编码进行传递,否则直接传递数组会出错 } } $result = callOpenSystem($paramArr); $data = json_decode($result, true); if ($data) { self::$errCode = 200; self::$errMsg = 'Success'; return $data; } else { self::$errCode = "000"; self::$errMsg = "is empty!"; return false; } } }