credit.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 34983 2014-09-22 06:16:09Z nemohou $
  7. */
  8. if (!defined('IN_MOBILE_API')) {
  9. exit('Access Denied');
  10. }
  11. include_once 'misc.php';
  12. class mobile_api {
  13. function common() {
  14. global $_G;
  15. if (!$_G['uid'] || !in_array('wechat', $_G['setting']['plugins']['available'])) {
  16. mobile_core::result(mobile_core::variable(array()));
  17. }
  18. $_G['wechat']['setting'] = unserialize($_G['setting']['mobilewechat']);
  19. if (!$_G['wechat']['setting']['wsq_apicredit']) {
  20. mobile_core::result(mobile_core::variable(array()));
  21. }
  22. $extcredit = 'extcredits'.$_G['wechat']['setting']['wsq_apicredit'];
  23. $ac = $_GET['ac'];
  24. $return = array();
  25. if(submitcheck('creditsubmit') && ($ac == 'inc' || $ac == 'dec') && $_GET['value'] > 0) {
  26. $v = $ac == 'inc' ? $_GET['value'] : -$_GET['value'];
  27. $log = lang('plugin/wechat', 'wsq_apicredit_log_'.$ac);
  28. updatemembercount(array($_G['uid']), array($extcredit => $v), true, '', 0, '', $log);
  29. $data = C::t('common_member_count')->fetch($_G['uid']);
  30. $return['extcredit'] = $data[$extcredit];
  31. } elseif($ac == 'get') {
  32. $return['extcredit'] = getuserprofile($extcredit);
  33. }
  34. mobile_core::result(mobile_core::variable($return));
  35. }
  36. function output() {
  37. }
  38. }
  39. ?>