1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
- class Model_Taxzhengzhousk extends Lin_Model
- {
- function __construct(){
- parent::__construct();
- $this->load->database();
- $this->table = 'taxzhengzhousk';
- $this->load_table('tax_zhengzhou_sk');
- }
- public function get_orders($data)
- {
- //需要加密的报文
- $dataInfo = '<?xml version="1.0" encoding="UTF-8"?>';
- $dataInfo = '<pay>';
- $dataInfo = '<ebpcode>'.$data['ebpcode'].'</ebpcode>';//总价=成交数量*单价
- $dataInfo = '<orderno>'.$data['orderno'].'</orderno>';//####海关标准的参数代码 海关标准的参数代码 《JGS-20 海关业务代码集》- 货币代码
- $dataInfo = '<paycode>'.$data['paycode'].'</paycode>';
- $dataInfo = '<payname>'.$data['payname'].'</payname>';
- $dataInfo = '<payno>'.$data['payno'].'</payno>';
- $dataInfo = '<charge>'.$data['charge'].'</charge>';
- $dataInfo = '<accountingdate>'.$data['accountingdate'].'</accountingdate>';
- $dataInfo = '<currencycus>'.$data['currencycus'].'</currencycus>';
- $dataInfo = '<currencyciq>'.$data['currencyciq'].'</currencyciq>';
- $dataInfo = '<note>'.$data['note'].'</note>';//备注
- $dataInfo = '</pay>';
-
- $abs_path = './data/caiwu/rsa_public_key.key';
- $content = file_get_contents($abs_path);
- $key = openssl_pkey_get_public($content);
- openssl_public_encrypt($dataInfo,$encrypted,$key);
- //请求信息
- $xml = '<?xml version="1.0" encoding="UTF-8"?>';
- $xml = '<root>';
- $xml = '<pubInfo>';
- $xml = '<version>'.$data['version'].'</version>';//Webservice接口版本2.0
- $xml = '<companyCode>'.$data['companycode'].'</companyCode>';//电商企业的海关注册登记编号或统一社会信用代码
- $xml = '<appType>'.$data['apptype'].'</appType>';//企业报送类型。1-新增 2-变更 3-删除。
- $xml = '<appStatus>'.$data['appstatus'].'</appStatus>';//企业报送状态。1-暂存,2-申报。默认申报
- $xml = '<signature>'.md5($dataInfo).'</signature>';//验证加密报文是否一致
- $xml = '<createTime>'.$data['createtime'].'</createTime>';//单据生成日期,格式:YYYYMMDDhhmmss。
- $xml = '<customCode>'.$data['customcode'].'</customCode>';//关区代码(郑州保税区4611)
- $xml = '</pubInfo>';
- $xml = '<dataInfo>'.base64_encode($encrypted).'</dataInfo>';//订单报文信息加密后内容
- $xml = '</root>';
- $xml = 'xml='.$xml;
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL,'http://emy.hnblc.com:9955/etouch-export/export/pay/pushPay');
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $data = curl_exec($ch);
- curl_close($ch);
- $data = utf8_encode($data);
- libxml_disable_entity_loader(true);
- @$values = json_decode(json_encode(simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
- return $values;
- }
- } //end class
|