Beispiel #1
0
/**
 * Reduce credit from user
 *
 * @param integer $uid
 *        	User ID
 * @param decimal $amount
 *        	Credit amount to reduce (positive value)
 * @return boolean TRUE on success
 */
function credit_reduce($uid, $amount)
{
    $amount = (double) $amount;
    return rate_deductusercredit($uid, $amount);
}
Beispiel #2
0
function webservices_credit_deduct($username, $amount)
{
    $uid = user_username2uid($username);
    $amount = (double) $amount;
    if (rate_deductusercredit($uid, $amount)) {
        $json['status'] = 'OK';
        $json['error'] = '0';
        $json['amount'] = $amount;
        $json['balance'] = rate_getusercredit($username);
    } else {
        $json['status'] = 'ERR';
        $json['error'] = '624';
    }
    return $json;
}