Model_settingtest.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. class Model_settingtest extends Lin_Model
  3. {
  4. function __construct(){
  5. parent::__construct();
  6. $this->load_table('setting');
  7. }
  8. public function get_yytoken_101()
  9. {
  10. $setting = $this->setting->get_data();
  11. $time = time();
  12. $yytoken = $setting['yytoken']['svalue'];
  13. $yytokentime = $setting['yytoken']['time'];
  14. // if(($yytokentime - $time) < 0)
  15. // {
  16. /** 获取Token **/
  17. $url = 'http://139.129.33.38:80/U9C/webapi/OAuth2/AuthLogin?clientid=test&entCode=001&orgCode=101&clientsecret='.$setting['yy-clientsecret']['svalue'].'&userCode='.$setting['yy-usercode']['svalue'];
  18. $ch = curl_init();
  19. curl_setopt($ch, CURLOPT_URL, $url);
  20. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  21. //curl_setopt($ch, CURLOPT_HTTPHEADER, $headerA);
  22. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  23. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  24. $res = curl_exec($ch);
  25. $headerA = curl_getinfo($ch);
  26. $a = json_decode($res,true);
  27. return $a['Data'];
  28. /** 获取Token **/
  29. // }
  30. // else
  31. // {
  32. // return $yytoken;
  33. // }
  34. }
  35. public function get_yytoken_120()
  36. {
  37. $setting = $this->setting->get_data();
  38. $time = time();
  39. $yytoken = $setting['yytoken_gc']['svalue'];
  40. $yytokentime = $setting['yytoken_gc']['time'];
  41. // if(($yytokentime - $time) < 0)
  42. // {
  43. /** 获取Token **/
  44. $url = 'http://139.129.33.38:80/U9C/webapi/OAuth2/AuthLogin?clientid=test&entCode=001&orgCode=120&clientsecret='.$setting['yy-clientsecret']['svalue'].'&userCode='.$setting['yy-usercode']['svalue'];
  45. $ch = curl_init();
  46. curl_setopt($ch, CURLOPT_URL, $url);
  47. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  48. //curl_setopt($ch, CURLOPT_HTTPHEADER, $headerA);
  49. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  50. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  51. $res = curl_exec($ch);
  52. $headerA = curl_getinfo($ch);
  53. $a = json_decode($res,true);
  54. return $a['Data'];
  55. /** 获取Token **/
  56. // }
  57. // else
  58. // {
  59. // return $yytoken;
  60. // }
  61. }
  62. public function get_yytoken_130()
  63. {
  64. $setting = $this->setting->get_data();
  65. $time = time();
  66. $yytoken = $setting['yytoken_xs']['svalue'];
  67. $yytokentime = $setting['yytoken_xs']['time'];
  68. // if(($yytokentime - $time) < 0)
  69. // {
  70. /** 获取Token **/
  71. $url = 'http://139.129.33.38:80/U9C/webapi/OAuth2/AuthLogin?clientid=test&entCode=001&orgCode=130&clientsecret='.$setting['yy-clientsecret']['svalue'].'&userCode='.$setting['yy-usercode']['svalue'];
  72. $ch = curl_init();
  73. curl_setopt($ch, CURLOPT_URL, $url);
  74. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  75. //curl_setopt($ch, CURLOPT_HTTPHEADER, $headerA);
  76. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  77. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  78. $res = curl_exec($ch);
  79. $headerA = curl_getinfo($ch);
  80. $a = json_decode($res,true);
  81. return $a['Data'];
  82. /** 获取Token **/
  83. // }
  84. // else
  85. // {
  86. // return $yytoken;
  87. // }
  88. }
  89. public function get_yytoken_140()
  90. {
  91. $setting = $this->setting->get_data();
  92. $time = time();
  93. $yytoken = $setting['yytoken_xs']['svalue'];
  94. $yytokentime = $setting['yytoken_xs']['time'];
  95. // if(($yytokentime - $time) < 0)
  96. // {
  97. /** 获取Token **/
  98. $url = 'http://139.129.33.38:80/U9C/webapi/OAuth2/AuthLogin?clientid=test&entCode=001&orgCode=140&clientsecret='.$setting['yy-clientsecret']['svalue'].'&userCode='.$setting['yy-usercode']['svalue'];
  99. $ch = curl_init();
  100. curl_setopt($ch, CURLOPT_URL, $url);
  101. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  102. //curl_setopt($ch, CURLOPT_HTTPHEADER, $headerA);
  103. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  104. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  105. $res = curl_exec($ch);
  106. $headerA = curl_getinfo($ch);
  107. $a = json_decode($res,true);
  108. return $a['Data'];
  109. /** 获取Token **/
  110. // }
  111. // else
  112. // {
  113. // return $yytoken;
  114. // }
  115. }
  116. } //end class