credit.php
1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: credit.php 35024 2014-10-14 07:43:43Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'misc.php';
class mobile_api {
function common() {
global $_G;
if (!$_G['uid'] || !in_array('wechat', $_G['setting']['plugins']['available'])) {
mobile_core::result(mobile_core::variable(array()));
}
$_G['wechat']['setting'] = unserialize($_G['setting']['mobilewechat']);
if (!$_G['wechat']['setting']['wsq_apicredit']) {
mobile_core::result(mobile_core::variable(array()));
}
$extcredit = 'extcredits'.$_G['wechat']['setting']['wsq_apicredit'];
$ac = $_GET['ac'];
$return = array();
if(submitcheck('creditsubmit') && ($ac == 'inc' || $ac == 'dec') && $_GET['value'] > 0) {
$v = $ac == 'inc' ? $_GET['value'] : -$_GET['value'];
$log = lang('plugin/wechat', 'wsq_apicredit_log_'.$ac);
updatemembercount(array($_G['uid']), array($extcredit => $v), true, '', 0, '', $log);
$data = C::t('common_member_count')->fetch($_G['uid']);
$return['extcredit'] = $data[$extcredit];
} elseif($ac == 'get') {
$return['extcredit'] = getuserprofile($extcredit);
}
mobile_core::result(mobile_core::variable($return));
}
function output() {
}
}
?>