hook = true; $uid = Dever::param('uid', $data); $cash = Dever::param('cash', $data); $desc = Dever::param('desc', $data); $config_id = Dever::param('config_id', $data); $type_id = Dever::param('type_id', $data); $config = $type = array(); if ($config_id) { $config = Dever::db('account/config')->find($config_id); } if ($type_id) { $type = Dever::db('account/config_type')->find($type_id); } if (!$config) { Dever::alert('账户信息不存在'); } if (!$type) { Dever::alert('交易类型不存在'); } Dever::load('account/lib/info.up_commit', $uid, $cash, $type['key'], $config['key'], $desc, 'account/push', $id, 2); } /** * 设置主账户 * * @return mixed */ public function config($id, $name, $param) { Dever::config('base')->hook = true; $type = Dever::param('type', $param); if ($type == 1) { Dever::db('account/config')->updates(array('option_type' => 1, 'set_type' => 2)); Dever::db('account/config')->update(array('where_id' => $id, 'type' => 1)); } } public function getSearch($config_id) { $result = ''; $info = Dever::db('account/config')->find($config_id); if ($info) { $project = Dever::db('account/config_project')->find($info['project_id']); $result = array ( 'api' => $project['source'] . '-all', 'col' => $project['source_name'], 'result' => 'id', 'search' => 'uid', 'project_name' => $project['name'], 'name' => $info['name'], ); } return $result; } # 获取钱包信息 public function getInfo($uid, $account) { if (!$account) { return '无账户信息'; } $config = Dever::db('account/config')->getData(array('ids' => $account)); $table = array(); $table['head'] = array('账户名称', '余额', '总获取金额', '总消耗金额'); $table['body'] = array(); if ($config) { foreach ($config as $k => $v) { $info = Dever::db('account/info')->find(array('uid' => $uid, 'config_id' => $v['id'])); if ($info) { $table['body'][$k] = array ( $v['name'], $info['cash'], $info['z_cash'], $info['t_cash'] ); } } } $body[''] = array ( 'type' => 'table', 'content' => $table, ); if ($table['body']) { return Dever::show('', $body); } else { return '无账户信息'; } } # 获取日志记录 public function getLog($order_table, $order_id) { $log = Dever::load('account/lib/log')->getListBySource($source, $source_id); if ($log) { $content['head'] = array('用户名称', '账户名称', '交易类型', '金额', '操作后余额', '资金说明', '交易时间'); $content['body'] = array(); foreach ($log as $k => $v) { $detail = array(); $detail[] = $v['username']; $detail[] = $v['config_name']; $detail[] = $v['type_name']; $detail[] = $v['cash']; $detail[] = $v['yue']; $detail[] = $v['desc']; $detail[] = $v['cdate']; $content['body'][] = $detail; } return array ( 'type' => 'table', 'content' => $content, ); } return array(); } # 资金审核 public function audit($id, $name, $data) { Dever::config('base')->hook = true; $audit = Dever::param('audit_status', $data); if ($audit > 1) { $list = Dever::mul($id); foreach ($list as $k => $v) { if (is_array($v)) { $id = $v['id']; $info = Dever::db('account/info_log')->find(array('id' => $id, 'clear' => true)); } else { $id = $v; $info = Dever::db('account/info_log')->find(array('id' => $id, 'clear' => true)); } if ($info['status'] != 1) { continue; } # 已作废 if ($audit == 4) { $update = array(); $update['where_id'] = $info['info_id']; $update['set_cash'] = $info['cash']; $update['set_col'] = $info['cash']; Dever::db('account/info')->inc($update); } $update = array('where_id' => $id, 'status' => $audit, 'audit_date' => time()); $admin = Dever::load('manage/auth.data'); $update['audit_admin'] = $admin['id']; Dever::db('account/info_log')->update($update); } } } }