hook = true; $update = array(); $audit = Dever::param('audit', $data); $info = Dever::db('option/account')->one($id); if ($audit > 2 && $info) { $update['audit_date'] = time(); $update['where_id'] = $info['id']; Dever::db('option/account')->update($update); } } # 协议审核 public function setAgreement($id, $name, $data) { Dever::config('base')->hook = true; $update = array(); $audit = Dever::param('audit', $data); $info = Dever::db('option/agreement')->one($id); if ($audit > 1 && $info) { $admin = Dever::load('manage/auth.info'); $update['audit_date'] = time(); $update['audit_admin'] = $admin['id']; if ($audit == 3) { $update['status'] = 2; } $update['where_id'] = $info['id']; $state = Dever::db('option/agreement')->update($update); if ($state && $audit == 3) { Dever::load('option/lib/cash.setValue_commit', $info); } } } # 交付审核 已废弃 public function setJiaofu($id, $name, $data) { Dever::config('base')->hook = true; $update = array(); $audit = Dever::param('audit', $data); $info = Dever::db('option/bill_jiaofu')->one($id); if ($audit > 1 && $info) { $admin = Dever::load('manage/auth.info'); $update['audit_date'] = time(); $update['audit_admin'] = $admin['id']; $update['where_id'] = $info['id']; $state = Dever::db('option/bill_jiaofu')->update($update); if ($state && $audit == 3) { Dever::load('option/lib/cash.setValue_commit', $info); } } } public function setFafang($id, $name, $data) { Dever::config('base')->hook = true; $update = array(); $audit = Dever::param('audit', $data); $info = Dever::db('option/bill_fafang')->one($id); if ($audit > 1 && $info) { $admin = Dever::load('manage/auth.info'); $update['audit_date'] = time(); $update['audit_admin'] = $admin['id']; $update['where_id'] = $info['id']; $state = Dever::db('option/bill_fafang')->update($update); if ($state && $audit == 2) { # 已作废,减掉这个数据 $account_cash = Dever::db('option/cash')->find(array('type' => $info['type'], 'aid' => $info['aid'])); if ($account_cash) { $update['where_id'] = $account_cash['id']; $update['fafang'] = $account_cash['fafang'] - $info['cash']; $update['jiaofu'] = $account_cash['jiaofu'] + $info['cash']; if ($update['fafang'] < 0) { $update['fafang'] = 0; } $update['clear'] = true; Dever::db('option/cash')->update($update); } } } } public function setDuifu($id, $name, $data) { Dever::config('base')->hook = true; $update = array(); $audit = Dever::param('audit', $data); $info = Dever::db('option/bill_duifu')->one($id); if ($audit && $audit > 1 && $info) { $admin = Dever::load('manage/auth.info'); $update['audit_date'] = time(); $update['audit_admin'] = $admin['id']; $update['where_id'] = $info['id']; $state = Dever::db('option/bill_duifu')->update($update); if ($state && $audit == 2) { # 已作废,恢复这个数据 $account_cash = Dever::db('option/cash')->find(array('type' => $info['type'], 'aid' => $info['aid'])); if ($account_cash) { $update['where_id'] = $account_cash['id']; $update['duifu'] = $account_cash['duifu'] - $info['cash']; $update['fafang'] = $account_cash['fafang'] + $info['cash']; if ($update['duifu'] < 0) { $update['duifu'] = 0; } $update['clear'] = true; Dever::db('option/cash')->update($update); } } } } public function cashUpdate($id, $name, $data) { Dever::config('base')->hook = true; $aid = Dever::param('aid', $data); $type = Dever::param('type', $data); $cash = Dever::param('cash', $data); $desc = Dever::param('desc', $data); if ($aid && $type && $cash && $desc) { $account = Dever::db('option/account')->find($aid); if ($account && $account['status'] <= 2) { Dever::load('option/lib/cash')->up($aid, $type, $cash, $desc); $where['where_id'] = $aid; $where['cash'] = $cash; Dever::db('agent/member')->upCash($where); } else { Dever::db('option/push_cash')->update(array('where_id' => $id, 'status' => 2)); Dever::alert('期权账户已停用或者未审核,操作失败'); } } } public function updateAccountAudit($id, $name, $data) { $data['add_audit'] = 1; return $data; } public function getDate($id) { $info = Dever::db('option/agreement')->find($id); if ($info) { $html = ''; $html .= '处理时间:' . date('Y-m-d H:i', $info['cdate']); if ($info['qdate']) { $html .= '
确认时间:' . date('Y-m-d H:i', $info['qdate']); } if ($info['audit_date']) { $html .= '
审核时间:' . date('Y-m-d H:i', $info['audit_date']); } return $html; } return ''; } public function upAgreement_api() { $id = Dever::input('id'); if ($id) { Dever::load('option/lib/agreement')->upContent($id); } return 'reload'; } public function dropAgreement_api() { $id = Dever::input('id'); if ($id) { Dever::load('option/lib/agreement')->drop($id); } return 'reload'; } }