<?php defined('ADMIN_KEKE') or exit('Access Denied'); kekezu::admin_check_role(4); $finace_obj = new Keke_witkey_finance_class(); $page_obj = $kekezu->_page_obj; $w[page_size] and $page_size = intval($w[page_size]) or $page_size = 10; $page and $page = intval($page) or $page = '1'; $url = "index.php?do={$do}&view={$view}&w[fina_id]={$w['fina_id']}&w[username]={$w['username']}&w[fina_type]={$w['fina_type']}&w[page_size]={$page_size}&w[ord][0]={$w['ord']['0']}&w[ord][1]={$w['ord']['1']}&page={$page}&w[fina_action]={$w['fina_action']}"; if (isset($ac) && $fina_id) { switch ($ac) { case "del": $finace_obj->setWhere('fina_id=' . $fina_id); $res = $finace_obj->del_keke_witkey_finance(); kekezu::admin_system_log(kekezu::lang(delete_financial_records) . "_{$fina_id}"); $res and kekezu::admin_show_msg($_lang['list_finance_delete_success'], $url, 3, '', 'success') or kekezu::admin_show_msg($_lang['list_finance_delete_fail'], $url, 3, '', 'warning'); break; } } elseif (isset($ckb)) { $ckb_string = implode(',', $ckb); $finace_obj->setWhere('fina_id in (' . $ckb_string . ')'); switch ($sbt_action) { case $_lang['mulit_delete']: $res = $finace_obj->del_keke_witkey_finance(); kekezu::admin_system_log($_lang['mulit_delete_financial_records'] . "_{$ids}"); break; } $res and kekezu::admin_show_msg($_lang['mulit_operate_success'], $url, 3, '', 'success') or kekezu::admin_show_msg($_lang['mulit_operate_fail'], $url, 3, '', 'warning'); } else { $where = ' 1 = 1 '; $w['fina_type'] and $where .= " and fina_type = '{$w['fina_type']}' ";
public static function cash_in($uid, $cash, $action, $source = null, $obj_type = null, $obj_id = null, $profit = 0, $charge = null) { $user_info = self::init($uid); $sys_config = self::$_basic_config; $fo = new Keke_witkey_finance_class(); $fo->setFina_action($action); $fo->setFina_type("in"); $fo->setObj_type($obj_type); $fo->setObj_id($obj_id); $fo->setFina_cash($cash); if (empty(self::$_mem)) { $action_arr = keke_glob_class::get_finance_action($action); self::$_mem = $action_arr[$action]; } $fo->setFina_mem(self::$_mem); $fo->setUser_balance($user_info['balance'] + $cash); $fo->setUid($user_info['uid']); $fo->setUsername($user_info['username']); $fo->setFina_source($source); $fo->setSite_profit($profit); $fo->setFina_mem(self::$_mem); $fo->setRecharge_cash($charge !== null ? floatval($charge) : null); $sql = "update " . TABLEPRE . "witkey_space set balance = ifnull(balance,0)+" . $cash . " where uid ='{$user_info['uid']}'"; $res = db_factory::execute($sql); if ($res) { $fo->setFina_time(time()); $row = $fo->create_keke_witkey_finance(); return $row; } else { return false; } }