/** * 功能:调用发送短信接口 * @param array $paramArr * @param str $token * @return void * @author wxb * date: 2013/11/1 */ function view_sendMessage() { if (!isset($_SESSION)) { @session_start(); } if (!isset($_SESSION['userId'])) { echo 'sendResult({"error_response":{"code":"176","msg":"no login"}})'; return; } if (empty($_GET['content']) || empty($_GET['from']) || empty($_GET['to']) || empty($_GET['type'])) { echo 'sendResult({"error_response":{"code":"044","msg":"get param fail"}})'; return; } $content = trim($_GET['content']); $from = trim($_GET['from']); $to = trim($_GET['to']); $type = trim($_GET['type']); $callback = trim($_GET['callback']); include_once "../api/include/opensys_functions.php"; $paramArr = array('method' => 'notice.send.message', 'format' => 'json', 'v' => '1.0', 'username' => 'Purchase', "content" => $content, "from" => $from, "to" => $to, "type" => $type, "callback" => $callback); $res = callOpenSystem($paramArr); if ($res) { echo $res; } else { echo 'sendResult({"error_response":{"code":"1120","msg":"call open fail"}})'; } }
/** * MailApiModel::sendMessage() * 发送信息 * @param string $type ems手机短信,email 邮件 * @param string $from 发件人 * @param string $to 收件人 * @param string $content 内容 * @param string $title 标题 * @return json string */ public static function sendMessage($type, $from, $to, $content, $title = '') { $paramArr = array('method' => 'notice.send.message', 'format' => 'json', 'v' => '1.0', 'username' => C('OPEN_SYS_USER'), 'type' => $type, 'from' => $from, 'to' => $to, 'content' => $content, 'title' => urlencode($title), 'sysName' => urlencode(C('AUTH_SYSNAME'))); $messageInfo = callOpenSystem($paramArr); unset($paramArr); return $messageInfo; }
function trans_carriers_fix_get($ebay_carrier, $totalweight, $ebay_countryname) { //$b = microtime()."\r\n"; $username = '******'; require_once "opensys_functions.php"; //开放系统文件 $paramArr = array('method' => 'trans.carriers.fix.get', 'format' => 'json', 'v' => '2.0', 'username' => $username); if ($ebay_carrier == "新加坡小包挂号") { $ebay_carrier = "新加坡邮政"; } //$CarrierLists = getCarrierListById(); $CarrierLists = array(1 => "中国邮政平邮", 2 => "中国邮政挂号", 3 => "香港小包平邮", 4 => "香港小包挂号", 5 => "EMS", 6 => "EUB", 8 => "DHL", 9 => "FedEx", 10 => "Global Mail", 46 => "UPS Ground", 47 => "USPS", 48 => "顺丰快递", 49 => "圆通快递", 50 => "申通快递", 51 => "韵达快递", 52 => "新加坡邮政", 53 => "德国邮政挂号", 54 => "中通快递", 55 => "汇通快递", 56 => "国通快递", 57 => "加运美快递", 58 => "UPS", 59 => "飞腾DHL", 60 => "上门提货", 61 => "运德物流", 62 => "UPS美国专线", 63 => "英国专线挂号", 64 => "天天快递", 65 => "SurePost", 66 => "同城速递", 67 => "国内快递", 68 => "自提", 69 => "送货上门", 70 => "TNT", 71 => "城市之星物流", 72 => "优速快递", 73 => "速尔快递", 74 => "天地华宇物流", 75 => "德邦物流", 76 => "盛辉物流", 77 => "vietnam", 78 => "快捷快递", 79 => "俄速通挂号", 80 => "俄速通平邮", 81 => "俄速通大包", 82 => "海运运输", 83 => "新加坡DHL GM挂号", 84 => "新加坡DHL GM平邮", 85 => "郑州小包平邮", 86 => "郑州小包挂号", 87 => "瑞士小包平邮", 88 => "瑞士小包挂号", 89 => "比利时小包挂号", 90 => "比利时小包平邮", 91 => "USPS FirstClass", 92 => "UPS Ground Commercia", 93 => "澳邮宝挂号", 94 => "澳邮宝平邮", 95 => "UPS SurePost"); $flip_CarrierLists = array_flip($CarrierLists); if (!isset($flip_CarrierLists[$ebay_carrier])) { return false; } else { $carrierId = $flip_CarrierLists[$ebay_carrier]; } $paramArr['carrierId'] = $carrierId; $paramArr['country'] = $ebay_countryname; $paramArr['weight'] = $totalweight; $rtn = callOpenSystem($paramArr); $rtn = json_decode($rtn, true); //$e = microtime()."\r\n"; //file_put_contents("/usr/local/php/var/log/xxx.txt","B=".$b,FILE_APPEND); //file_put_contents("/usr/local/php/var/log/xxx.txt","T=".$e,FILE_APPEND); if (!isset($rtn['data'])) { return false; } return $rtn['data']; }
/** * 功能:调用发送短信接口 用于js调用 * @param array $paramArr * @param str $token * @return void * @author wxb * @date: 2013/11/09 */ function view_sendMessage() { if (!isset($_SESSION)) { @session_start(); } $callback = $_GET['callback']; if (!isset($_SESSION['userId'])) { echo $callback . '({"error_response":{"code":"176","msg":"no login"}})'; return; } if (empty($_GET['content']) || empty($_GET['from']) || empty($_GET['to']) || empty($_GET['type'])) { echo $callback . '({"error_response":{"code":"044","msg":"get param fail"}})'; return; } $content = $_GET['content']; $from = $_GET['from']; $to = $_GET['to']; $type = $_GET['type']; $paramArr = array('method' => 'notice.send.message', 'format' => 'json', 'v' => '1.0', 'username' => C('OPEN_SYS_USER'), "content" => $content, "from" => $from, "to" => $to, "type" => $type, "callback" => $callback); $res = callOpenSystem($paramArr, 'local'); if ($res) { echo $res; } else { echo $callback . '({"error_response":{"code":"1120","msg":"call open fail"}})'; } }
/** * ApiModel::getAuthCompanyList() * 获取鉴权公司列表 * @return array */ public static function getAuthCompanyList() { $paramArr = array('method' => 'power.user.getApiCompany.get', 'format' => 'json', 'v' => '1.0', 'username' => C('OPEN_SYS_USER'), 'sysName' => C('AUTH_SYSNAME'), 'sysToken' => C('AUTH_SYSTOKEN')); $companyInfo = callOpenSystem($paramArr); $companyInfo = json_decode($companyInfo, true); $companyInfo = is_array($companyInfo) ? $companyInfo : array(); unset($paramArr); return $companyInfo; }
/** * 转发图片至图片系统分销商文件夹下 * @param json imgInfor * @return int * @author zjr */ public function saveDistributorWaterMark($imgInfor) { $conf = $this->getRequestConf(__FUNCTION__); $conf['imgInfor'] = $imgInfor; $result = callOpenSystem($conf); $data = json_decode($result, true); if ($data['errCode'] > 0) { self::$errMsg[$data['errCode']] = "[{$data['errCode']}]{$data['errMsg']}"; } return $this->changeArrayKey($data['data']); }
public static function getText() { require_once WEB_PATH . "api/include/functions.php"; $start = time(); $url = 'http://gw.open.valsun.cn:88/router/rest?'; $paramArr = array('method' => 'om.showSuperOrder', 'format' => 'json', 'v' => '1.0', 'username' => C('OPEN_SYS_USER'), 'purchaseId' => '149'); $result = callOpenSystem($paramArr); $data = json_decode($result, true); $end = time(); echo "<pre>"; var_dump($end - $start); var_dump($data); }
public function act_SendList() { $from = trim($_GET['from']); $page = trim($_GET['page']); $type = trim($_GET['type']); $paramArr = array('method' => 'notice.show.get', 'format' => 'json', 'v' => '1.0', 'username' => 'notice', "from" => $from, "page" => $page, "type" => $type); $res = callOpenSystem($paramArr); if ($res) { return json_decode($res); } else { return json_decode('{"errCode":"1120","errMsg":"call open fail"}'); } }
/** * 功能:获取旧erp系统中的实时库存信息 * @param $sku */ public function getOldErpSkuStockInfo($sku = '') { $conf = $this->getRequestConf(__FUNCTION__); if (empty($conf)) { return false; } $conf['sku'] = $sku; $result = callOpenSystem($conf); $data = json_decode($result, true); if ($data['error_response']['code'] != 200) { self::$errMsg[$data['error_response']['code']] = "[{$data['error_response']['code']}]{$data['error_response']['msg']}"; } return $data; }
/** *功能:搜索用用户名 *@author wxb *@date 2013/12/3 */ public function view_searchUser() { if (!isset($_SESSION)) { @session_start(); } $callback = trim($_GET['callback']); if (!isset($_SESSION['userId'])) { echo $callback . '({"errCode":"176","errMsg":"no login"})'; return; } $name = trim($_GET['name']); $paramArr = array('method' => 'notice.searchUser', 'format' => 'json', 'v' => '1.0', 'username' => 'notice', "name" => base64_encode($name), "callback" => $callback); $res = callOpenSystem($paramArr); echo $res; }
/** * TrackShipFeeModel::calcOpenShipFee() * 获取物流系统开发运费计算结果 * @param string $addId 发货地址ID * @param string $country 国家 * @param string $weight 重量 * @return array */ public static function calcOpenShipFee($addId, $country, $weight, $transitId, $postCode, $apiToken, $noShipId, $weightFlag) { $res = array(); $paramArr = array('method' => 'trans.open.ship.fee.get', 'format' => 'json', 'v' => '1.0', 'username' => C('OPEN_SYS_USER'), 'shipAddId' => $addId, 'country' => $country, 'weight' => $weight, 'apiToken' => $apiToken, 'transitId' => $transitId, 'postCode' => $postCode, 'noShipId' => $noShipId, 'weightFlag' => $weightFlag); $shipFeeInfo = callOpenSystem($paramArr); $shipFeeInfo = json_decode($shipFeeInfo, true); if (empty($shipFeeInfo['data'])) { self::$errCode = 20000; self::$errMsg = "Not to find the open freight, please confirm the selected conditions of this!"; return false; } else { $res = $shipFeeInfo['data']; } unset($paramArr); return $res; }
function calcshippingfee($shaddr, $weight, $country, $transportId) { require_once WEB_PATH . "api/include/functions.php"; $method = 'trans.carrier.fix.get'; $paramArr = array('method' => $method, 'format' => 'json', 'v' => '1.0', 'username' => C('OPEN_SYS_USER')); $paramArr['country'] = $country; $paramArr['weight'] = $weight; $paramArr['shaddr'] = $shaddr; $paramArr['carrier'] = $transportId; $result = callOpenSystem($paramArr); $data = json_decode($result, true); if (empty($data['data'])) { return false; } return $data['data']['fee']; }
public function getAdjustransportFromPurchase($get = 1) { require_once WEB_PATH . "api/include/functions.php"; $url = 'http://gw.open.valsun.cn:88/router/rest?'; $paramArr = array('method' => 'purchase.getAdjustransport', 'format' => 'json', 'v' => '1.0', 'username' => 'purchase', 'get' => $get); $result = callOpenSystem($paramArr); //var_dump($result); $data = json_decode($result, true); /*var_dump($data); if(!isset($data['data'])){ return array(); }*/ $__liquid_items_array = array(); foreach ($data as $dataValue) { $__liquid_items_array[$dataValue['category']] = $dataValue['skulist']; } /*foreach($data['data'] as $dataValue){ $__liquid_items_array[$dataValue['category']] = $dataValue['skulist']; }*/ return $__liquid_items_array; }
/** * 将审核超大订单的结果更新到订单系统 */ public static function pushBigOrder() { $id = $_POST['id']; $status = $_POST['status']; $note = $_POST['note']; if (empty($id) || empty($status)) { $arr = array('code' => '2', 'msg' => '参数有误'); return json_encode($arr); } $where = "id='{$id}'"; $row = SuperorderAuditModel::getOne('*', $where); if (empty($row) || $row['status'] == 1) { $arr = array('code' => '3', 'msg' => '已经审核'); return json_encode($arr); } $paramArr = array('method' => 'order.updateOrderAuditFromPh', 'format' => 'json', 'v' => '1.0', 'username' => C('OPEN_SYS_USER')); /* API应用级输入参数 Start*/ $paramArr['omOrderId'] = $row['omOrderId']; $paramArr['omOrderdetailId'] = $row['omOrderdetailId']; $paramArr['sku'] = $row['sku']; $paramArr['auditStatus'] = $status; $paramArr['auditUser'] = $_SESSION['sysUserId']; $paramArr['note'] = $note; /* API应用级输入参数 End*/ $result = callOpenSystem($paramArr, 'local'); $result = json_decode($result, true); //add log //$filename = C("LOG_PATH").'/pushbigorder.txt'; //write_log($filename, $result); if ($result['data'] == true) { $res['code'] = '1'; $res['msg'] = 'success'; } else { $res['code'] = '2'; $res['msg'] = $result['errMsg']; } return json_encode($res); }
public static function getMaterInfoById($MaterId) { /*$materInfoList = self::getMaterInfo(); return $materInfoList[$MaterId];*/ require_once WEB_PATH . "api/include/functions.php"; $url = 'http://gw.open.valsun.cn:88/router/rest?'; $paramArr = array('method' => 'pc.getPmInfoById', 'format' => 'json', 'v' => '1.0', 'username' => 'purchase', 'id' => $MaterId); $result = callOpenSystem($paramArr); $data = json_decode($result, true); return $data['data']; }
public function act_getGoodsInfoBySku($sku) { require_once WEB_PATH . "html/api/include/opensys_functions.php"; $url = 'http://gw.open.valsun.cn:88/router/rest?'; $paramArr = array('method' => 'pc.getGoodsInfoBySku', 'format' => 'json', 'v' => '1.0', 'username' => 'purchase', 'sku' => $sku); $result = callOpenSystem($paramArr); $data = json_decode($result, true); return $data; }
/** * DeptModel::deptDelete() * 删除部门走开放系统 * add by 管拥军 2013-08-31 * @return string */ public static function deptDelete($deptId) { require_once WEB_PATH . "html/api/include/opensys_functions.php"; $paramArr = array('method' => 'power.new.deleteApiDept.get', 'format' => 'json', 'v' => '1.0', 'username' => 'purchase', 'action' => 'deleteApiDept', 'deptId' => $deptId, 'sysName' => self::$sysName, 'sysToken' => self::$sysToken); $deleteApiDeptInfo = callOpenSystem($paramArr); unset($paramArr); $deleteApiDeptInfo = json_decode($deleteApiDeptInfo, true); if ($deleteApiDeptInfo['errCode'] == '0') { return "ok"; } else { return $deleteApiDeptInfo['errMsg']; } }
/** * 获取所有的料号转换记录数组 * @return array('old_sku'=>'new_sku','old_sku'=>'new_sku',……) * @author zqt */ public function getRootCategoryInfo() { $conf = $this->getRequestConf(__FUNCTION__); if (empty($conf)) { return false; } $result = callOpenSystem($conf); $data = json_decode($result, true); if ($data['errCode'] > 0) { self::$errMsg[$data['errCode']] = "[{$data['errCode']}]{$data['errMsg']}"; } $data = $data['data']; $rootCategoryInfo = array(); foreach ($data as $k => $v) { if (strpos($v['path'], '-') == false && $v['is_delete'] == '0') { $rootCategoryInfo[$v['id']] = $v['name']; } } return $rootCategoryInfo; }
/** * UserModel::getAllUser() * 获取系统所有用户走开放系统 * add by 管拥军 2013-08-26 * @return json string */ public static function getAllUser() { $paramArr = array('method' => 'power.user.getAllUserInfo.get', 'format' => 'json', 'v' => '1.0', 'username' => C('OPEN_SYS_USER'), 'sysName' => C('AUTH_SYSNAME'), 'sysToken' => C('AUTH_SYSTOKEN')); $allUserInfo = callOpenSystem($paramArr); unset($paramArr); return $allUserInfo; }
/** * JobModel::jobDelete() * 删除岗位权限信息接口 * add by 管拥军 2013-08-30 * @return bool */ public static function jobDelete($jobId, $jobPowerId) { //删除岗位信息 $paramArr = array('method' => 'power.new.deleteApiJob.get', 'format' => 'json', 'v' => '1.0', 'username' => 'purchase', 'action' => 'deleteApiJob', 'jobId' => $jobId, 'sysName' => self::$sysName, 'sysToken' => self::$sysToken); $deleteJob = callOpenSystem($paramArr); unset($paramArr); $deleteJob = json_decode($deleteJob, true); if ($deleteJob['errCode'] == '0') { //echo "deleteJob ok"; } else { echo $deleteJob['errMsg']; exit; } //删除岗位权限信息 $paramArr = array('method' => 'power.new.deleteApiJobPower.get', 'format' => 'json', 'v' => '1.0', 'username' => 'purchase', 'action' => 'deleteApiJobPower', 'jobpowerId' => $jobPowerId, 'sysName' => self::$sysName, 'sysToken' => self::$sysToken); $deleteJobpower = callOpenSystem($paramArr); unset($paramArr); $deleteJobpower = json_decode($deleteJobpower, true); if ($deleteJobpower['errCode'] == '0') { return "ok"; } else { echo $deleteJobpower['errMsg']; return false; } }
/** * WaveOrderPrintingView::view_prints() * 对配货单进行打印预览 * @author cxy * @return void */ public function view_prints() { $shipOrderId = trim($_GET['shipOrderId']); $waveId = trim($_GET['waveId']); $wave = WhWaveInfoModel::find($waveId); if ($wave['waveType'] == 2) { //单料号的配货单 //if($shipOrderId !='null'){ // echo $shipOrderId; // $orderlist = WhWaveScanRecordModel::getShipOrders($waveId, $shipOrderId); // }else{ $orderlist = WhWaveScanRecordModel::getShipOrders($waveId); // } $onesku = true; } else { // if($shipOrderId !='null'){ // $orderlist = WhWaveShippingRelationModel::getShipOrders($waveId, $shipOrderId); //}else{ $orderlist = WhWaveShippingRelationModel::getShipOrders($waveId); // } $onesku = false; } if (!$orderlist) { $return = array('status' => 1, 'msg' => '该配货单下无此发货单,不能打印'); echo $return; exit; } $carries = WhBaseModel::cache('trans.carrier.info.get'); if (!$carries) { //接口获取快递运输方式 require_once WEB_PATH . "html/api/include/opensys_functions.php"; $paramArr = array('method' => 'trans.carrier.info.get', 'format' => 'json', 'v' => '1.0', 'username' => 'purchase', 'type' => 1); $result = json_decode(callOpenSystem($paramArr), true); $templist = $result['data']; if ($templist) { foreach ($templist as $val) { $carries[$val['id']] = $val; $carries['express_ids'][] = $val['id']; } } WhBaseModel::cache('trans.carrier.info.get', $carries); } foreach ($orderlist as $key => $val) { if ($val['transportId'] && in_array($val['transportId'], $carries['express_ids'])) { $val['isexpress'] = 1; $express_ordids[] = $val['shipOrderId']; } else { $val['isexpress'] = 0; $ordids[] = $val['shipOrderId']; } $orderlist[$key] = $val; } // var_dump($onesku); // print_r($orderlist); $this->smarty->assign('onesku', $onesku); $this->smarty->assign('orderlist', $orderlist); $this->smarty->display('waveOrderPrinting_startprint.htm'); }
/** * 获取所有的用户信息(只包含本公司的) * add by zqt * @return array */ public function getAllUserIdUserNameInfo() { $conf = $this->getRequestConf(__FUNCTION__); if (empty($conf)) { return false; } $result = callOpenSystem($conf); $data = json_decode($result, true); if ($data['errCode'] > 0) { self::$errMsg[$data['errCode']] = "[{$data['errCode']}]{$data['errMsg']}"; } return $this->changeArrayKey($data['data']); }
/** * TransOpenApiModel::cacheExRateInfo() * memcache缓存汇率方法 * @param string $fromRate 需要转换的币种 * @param string $toRate 目标币种 * @param string $cacheName 键名 * @param int $cacheTime 缓存时间 * @param int $is_new 是否强制更新,0否 * @return array */ public static function cacheExRateInfo($fromRate, $toRate, $cacheName, $cacheTime = 86400, $is_new = 0) { $memc_obj = new Cache(C('CACHEGROUP')); $cacheName = md5("{$cacheName}"); $cacheInfo = $memc_obj->get_extral($cacheName); if (!empty($cacheInfo) && empty($is_new)) { $cacheInfo = unserialize($cacheInfo); } else { // 取消暂时屏蔽走刊登系统汇率接口 $paramList = array('method' => 'pa.getCurrencyRateByArr', 'format' => 'json', 'v' => '1.0', 'username' => C('OPEN_SYS_USER'), 'fromCodeArr' => json_encode($fromRate), 'toCodeArr' => json_encode($toRate)); for ($i = 0; $i < 3; $i++) { $cacheInfo = callOpenSystem($paramList); if (!empty($cacheInfo)) { break; } } $cacheInfo = json_decode($cacheInfo, true); $cacheInfo = json_decode($cacheInfo['data'], true); // $cacheInfo = TransOpenApiAct::act_getCurrencyExchange($fromRate,$toRate); if (!empty($cacheInfo)) { $isok = $memc_obj->set_extral($cacheName, serialize($cacheInfo), $cacheTime); } } return $cacheInfo; }
/** * UserModel::getAllUser() * 获取系统所有用户走开放系统 * add by 管拥军 2013-08-26 * @return json string */ public static function getAllUser() { require_once WEB_PATH . "html/api/include/opensys_functions.php"; $paramArr = array('method' => 'power.user.getAllUserInfo.get', 'format' => 'json', 'v' => '1.0', 'username' => 'purchase', 'sysName' => self::$sysName, 'sysToken' => self::$sysToken); $allUserInfo = callOpenSystem($paramArr); unset($paramArr); return $allUserInfo; }
<?php require "/data/web/purchase.valsun.cn/framework.php"; Core::getInstance(); global $dbConn; echo date('Y-m-d H:i') . "\n"; $totalNum = getOwSkuIsWarnCount(); $page = 1; $totalPage = ceil($totalNum / 50); echo '海外料号共[' . $totalNum . ']个暂时停售料号,每页更新[50]条记录,共分[' . $totalPage . ']页同步' . "\n"; while ($page <= $totalPage) { echo '开始同步第[' . $page . ']页' . "\n"; $skuArr = getOwSkuIsWarnInfo($page); $skuArr = json_encode($skuArr); $paramArr = array('method' => 'pur.getSkuInStockQty', 'format' => 'json', 'v' => '1.0', 'username' => 'purchase', 'sku' => $skuArr); $rtnInfo = callOpenSystem($paramArr); $rtnResult = json_decode($rtnInfo, true); $errCode = $rtnResult['errCode']; if ($errCode == 200) { $result = $rtnResult['data']; if (!empty($result)) { foreach ($result as $k => $v) { $sku = $v['sku']; $totalQty = $v['totalNum']; $status = getOwSkuStatus($sku); if ($totalQty == 0) { echo '[' . $sku . ']近三天没有入库信息' . "\n"; } else { if ($status == 2) { $upd = "UPDATE ph_sku_status_change SET ebay_status = 1,`b2b_status` = 1, `amazon_status` = 1, `gongxiaoshan_status` = 1,`oversea_status` = 1, `guonei_status` = 1 WHERE sku = '{$sku}'"; $rtnUpd = self::$dbConn->query($upd);
/** * 整合ebay刊登系统的数据库(获取log和整合情况) * @param int $compayId * @return array * @author wcx */ public function getCreateEbayDBInfo($compayId, $cateIds) { $conf = $this->getRequestConf(__FUNCTION__); $conf['compayId'] = $compayId; $result = callOpenSystem($conf); $data = json_decode($result, true); if ($data['errCode'] > 0) { self::$errMsg[$data['errCode']] = "[{$data['errCode']}]{$data['errMsg']}"; } return $this->changeArrayKey($data['data']); }
public function act_getUserInfo($userToken) { $paramArr = array('method' => 'power.user.getUserInfo.get', 'format' => 'json', 'v' => '1.0', 'username' => 'notice', 'userToken' => $userToken, 'sysName' => self::$sysName, 'sysToken' => self::$sysToken); $userInfo = callOpenSystem($paramArr); $userInfo = json_decode($userInfo); if (isset($userInfo->errCode)) { self::$errCode = $userInfo->errCode; self::$errMsg = $userInfo->errMsg; return self::$errMsg; } return $userInfo; }
public static function getPositionBySku($sku) { require_once WEB_PATH . "api/include/functions.php"; $url = 'http://gw.open.valsun.cn:88/router/rest?'; $paramArr = array('method' => 'wh.getSkuPositions', 'format' => 'json', 'v' => '1.0', 'username' => C('OPEN_SYS_USER'), 'sku' => $sku, 'storeId' => '1'); $result = callOpenSystem($paramArr); $data = json_decode($result, true); $data = json_decode($data['data'], true); return $data[0]['pName']; }
/** * 调用开放系统指定接口的公用方法 * para:method:调用开发系统接口的接口名,paArr为传递的参数(参数均要用数组包装,不能直接传字段) * add by zqt */ public static function getOpenSysApi($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, self::$url); $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; } } }
public function view_passSku() { $ebayid = isset($_POST['ebayid']) ? trim($_POST['ebayid']) : false; $detailid = isset($_POST['detailid']) ? trim($_POST['detailid']) : false; $type = isset($_POST['type']) ? trim($_POST['type']) : false; $sku = isset($_POST['sku']) ? trim($_POST['sku']) : false; $passornot = isset($_POST['passornot']) ? trim($_POST['passornot']) : false; $pcontent = isset($_POST['pcontent']) ? trim($_POST['pcontent']) : false; $paramArr = array('method' => 'erp.check.order', 'format' => 'json', 'v' => '1.0', 'username' => C('OPEN_SYS_USER'), 'ebay_id' => $ebayid, 'detail_id' => $detailid, 'sku' => $sku, 'type' => $type, 'check_status' => $passornot, 'pcontent' => $pcontent); //print_r($paramArr);exit; $data = callOpenSystem($paramArr, "local"); //var_dump($data);exit; //$data = json_decode($data, true); echo $data; }