OEM.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: OEM.php 33992 2013-09-17 01:01:52Z nemohou $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. Cloud::loadFile('Service_Client_Restful');
  12. class Cloud_Service_Client_OEM extends Cloud_Service_Client_Restful {
  13. protected static $_instance;
  14. public static function getInstance($debug = false) {
  15. if (!(self::$_instance instanceof self)) {
  16. self::$_instance = new self($debug);
  17. }
  18. return self::$_instance;
  19. }
  20. public function __construct($debug = false) {
  21. return parent::__construct($debug);
  22. }
  23. public function checkApp() {
  24. if(!$this->_sId) {
  25. return array();
  26. }
  27. global $_G;
  28. if($_G['uid']) {
  29. $connectUser = C::t('#qqconnect#common_member_connect')->fetch($_G['uid']);
  30. $openid = $connectUser['conopenid'];
  31. } else {
  32. $openid = '';
  33. }
  34. return $this->_callMethod('oem.checkApp', array('sId' => $this->_sId, 'uId' => $_G['uid'], 'openId' => $openid));
  35. }
  36. public function getDownloadUrl() {
  37. if(!$this->_sId) {
  38. return '';
  39. }
  40. global $_G;
  41. loadcache('mobileoem_data');
  42. if(!$_G['cache']['mobileoem_data']['downloadPath']) {
  43. return '';
  44. }
  45. if($_G['uid']) {
  46. $connectUser = C::t('#qqconnect#common_member_connect')->fetch($_G['uid']);
  47. $openid = $connectUser['conopenid'];
  48. } else {
  49. $openid = '';
  50. }
  51. $utilService = Cloud::loadClass('Service_Util');
  52. return $_G['cache']['mobileoem_data']['downloadPath'].'?'.$utilService->generateSiteSignUrl(array('sId' => $this->_sId, 'uId' => $_G['uid'], 'openId' => $openid));
  53. }
  54. }