Model_taxzhengzhousk.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. class Model_Taxzhengzhousk extends Lin_Model
  3. {
  4. function __construct(){
  5. parent::__construct();
  6. $this->load->database();
  7. $this->table = 'taxzhengzhousk';
  8. $this->load_table('tax_zhengzhou_sk');
  9. }
  10. public function get_orders($data)
  11. {
  12. //需要加密的报文
  13. $dataInfo = '<?xml version="1.0" encoding="UTF-8"?>';
  14. $dataInfo = '<pay>';
  15. $dataInfo = '<ebpcode>'.$data['ebpcode'].'</ebpcode>';//总价=成交数量*单价
  16. $dataInfo = '<orderno>'.$data['orderno'].'</orderno>';//####海关标准的参数代码 海关标准的参数代码 《JGS-20 海关业务代码集》- 货币代码
  17. $dataInfo = '<paycode>'.$data['paycode'].'</paycode>';
  18. $dataInfo = '<payname>'.$data['payname'].'</payname>';
  19. $dataInfo = '<payno>'.$data['payno'].'</payno>';
  20. $dataInfo = '<charge>'.$data['charge'].'</charge>';
  21. $dataInfo = '<accountingdate>'.$data['accountingdate'].'</accountingdate>';
  22. $dataInfo = '<currencycus>'.$data['currencycus'].'</currencycus>';
  23. $dataInfo = '<currencyciq>'.$data['currencyciq'].'</currencyciq>';
  24. $dataInfo = '<note>'.$data['note'].'</note>';//备注
  25. $dataInfo = '</pay>';
  26. $abs_path = './data/caiwu/rsa_public_key.key';
  27. $content = file_get_contents($abs_path);
  28. $key = openssl_pkey_get_public($content);
  29. openssl_public_encrypt($dataInfo,$encrypted,$key);
  30. //请求信息
  31. $xml = '<?xml version="1.0" encoding="UTF-8"?>';
  32. $xml = '<root>';
  33. $xml = '<pubInfo>';
  34. $xml = '<version>'.$data['version'].'</version>';//Webservice接口版本2.0
  35. $xml = '<companyCode>'.$data['companycode'].'</companyCode>';//电商企业的海关注册登记编号或统一社会信用代码
  36. $xml = '<appType>'.$data['apptype'].'</appType>';//企业报送类型。1-新增 2-变更 3-删除。
  37. $xml = '<appStatus>'.$data['appstatus'].'</appStatus>';//企业报送状态。1-暂存,2-申报。默认申报
  38. $xml = '<signature>'.md5($dataInfo).'</signature>';//验证加密报文是否一致
  39. $xml = '<createTime>'.$data['createtime'].'</createTime>';//单据生成日期,格式:YYYYMMDDhhmmss。
  40. $xml = '<customCode>'.$data['customcode'].'</customCode>';//关区代码(郑州保税区4611)
  41. $xml = '</pubInfo>';
  42. $xml = '<dataInfo>'.base64_encode($encrypted).'</dataInfo>';//订单报文信息加密后内容
  43. $xml = '</root>';
  44. $xml = 'xml='.$xml;
  45. $ch = curl_init();
  46. curl_setopt($ch, CURLOPT_URL,'http://emy.hnblc.com:9955/etouch-export/export/pay/pushPay');
  47. curl_setopt($ch, CURLOPT_POST, 1);
  48. curl_setopt($ch, CURLOPT_HEADER, 0);
  49. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  50. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  51. curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
  52. curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
  53. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  54. $data = curl_exec($ch);
  55. curl_close($ch);
  56. $data = utf8_encode($data);
  57. libxml_disable_entity_loader(true);
  58. @$values = json_decode(json_encode(simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
  59. return $values;
  60. }
  61. } //end class