public function index() { $this->load->model('module/wm_express_api_setting_module'); $result = $this->model_module_wm_express_api_setting_module->getSettingByName('apiurl'); $apiurl = $result[0]['setting_value']; $result = $this->model_module_wm_express_api_setting_module->getSettingByName('username'); $username = $result[0]['setting_value']; $result = $this->model_module_wm_express_api_setting_module->getSettingByName('password'); $password = $result[0]['setting_value']; $api_sort = $_POST['api_sort']; if (empty($api_sort)) { return; } else { if ($api_sort === '2_2') { $no = $_POST['no']; $client = new SoapClient($apiurl); $param = array('Username' => $username, 'Password' => $password, 'WMLeaderNumber' => $no); try { $apiresult = $client->GetLabelByWMLeaderNumber($param); $api_errors = $apiresult->GetLabelByWMLeaderNumberResult->Errors; $api_lable_base64 = $apiresult->GetLabelByWMLeaderNumberResult->Label; if (!empty($api_errors)) { $this->data['api_test_result'] = '出错,错误原因看Errors!'; $this->data['api_errors'] = $api_errors->string; } else { $this->data['api_test_result'] = '成功!'; $this->data['api_errors'] = ''; } $this->data['api_lable_base64'] = $api_lable_base64; $this->data['api_lable'] = htmlspecialchars(base64_decode($api_lable_base64)); } catch (SoapFault $f) { $this->data['apiresult'] = "Error Message: {$f->getMessage()}"; } $this->template = 'module/wm_express_api_test_module.tpl'; } else { if ($api_sort === '2_3') { $no = $_POST['no']; $client = new SoapClient($apiurl); $param = array('Username' => $username, 'Password' => $password, 'TrackNumber' => $no); try { $apiresult = $client->GetLabelByTrackNumber($param); $api_errors = $apiresult->GetLabelByTrackNumberResult->Errors; $api_lable_base64 = $apiresult->GetLabelByTrackNumberResult->Label; if (!empty($api_errors)) { $this->data['api_test_result'] = '出错,错误原因看Errors!'; $this->data['api_errors'] = $api_errors->string; } else { $this->data['api_test_result'] = '成功!'; $this->data['api_errors'] = ''; } $this->data['api_lable_base64'] = $api_lable_base64; $this->data['api_lable'] = htmlspecialchars(base64_decode($api_lable_base64)); } catch (SoapFault $f) { $this->data['apiresult'] = "Error Message: {$f->getMessage()}"; } $this->template = 'module/wm_express_api_test_module.tpl'; } else { if ($api_sort === '2_4') { $no = $_POST['no']; $client = new SoapClient($apiurl); $param = array('Username' => $username, 'Password' => $password, 'PackageNumber' => $no); try { $apiresult = $client->GetLabelByPackgeNumber($param); $api_errors = $apiresult->GetLabelByPackgeNumberResult->Errors; $api_lable_base64 = $apiresult->GetLabelByPackgeNumberResult->Label; if (!empty($api_errors)) { $this->data['api_test_result'] = '出错,错误原因看Errors!'; $this->data['api_errors'] = $api_errors->string; } else { $this->data['api_test_result'] = '成功!'; $this->data['api_errors'] = ''; } $this->data['api_lable_base64'] = $api_lable_base64; $this->data['api_lable'] = htmlspecialchars(base64_decode($api_lable_base64)); } catch (SoapFault $f) { $this->data['apiresult'] = "Error Message: {$f->getMessage()}"; } $this->template = 'module/wm_express_api_test_module.tpl'; } } } } $this->response->setOutput($this->render()); }