Credit.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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: Credit.php 34004 2013-09-18 05:06:47Z nemohou $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class Cloud_Service_Server_Credit extends Cloud_Service_Server_Restful {
  12. protected static $_instance;
  13. public static function getInstance() {
  14. if (!(self::$_instance instanceof self)) {
  15. self::$_instance = new self();
  16. }
  17. return self::$_instance;
  18. }
  19. public function onCreditGet($uId) {
  20. global $_G;
  21. $_G['setting']['myapp_credit'] = '';
  22. if($_G['setting']['creditstransextra'][7]) {
  23. $_G['setting']['myapp_credit'] = 'extcredits'.intval($_G['setting']['creditstransextra'][7]);
  24. } elseif ($_G['setting']['creditstrans']) {
  25. $_G['setting']['myapp_credit'] = 'extcredits'.intval($_G['setting']['creditstrans']);
  26. }
  27. if(empty($_G['setting']['myapp_credit'])) {
  28. return 0;
  29. }
  30. $row = C::t('common_member_count')->fetch($uId);
  31. return $row[$_G['setting']['myapp_credit']];
  32. }
  33. public function onCreditSign($uId) {
  34. global $_G;
  35. if($uId) {
  36. return updatecreditbyaction('mobileoemdaylogin', $uId) ? 1 : 0;
  37. }
  38. return 0;
  39. }
  40. }