/** * 改变状态 */ function do_active($id) { //权限验证 role::check('user_charge'); if (!$id) { remind::set(Kohana::lang('o_global.bad_request'), 'user/user_charge'); } $db = Database::instance(); $data = array_shift($db->query('SELECT * FROM user_charge_order WHERE id=' . $id)->result_array(false)); if ($data['id'] <= 0 || $data['status'] > 0) { remind::set(Kohana::lang('o_global.bad_request'), 'user/user_charge'); } $logodata = array(); $logodata['manager_id'] = $this->manager_id; $logodata['ip'] = tool::get_str_ip(); $logodata['user_log_type'] = 27; $logodata['method'] = __CLASS__ . '::' . __METHOD__ . '()'; $logodata['memo'] = "充值订单号:" . $data['order_num'] . ", 购买拍点数:" . $data['price'] . ", 充值金额:" . $data['money']; $sql = "UPDATE user_charge_order SET status=1 WHERE id='" . $id . "' "; if ($db->query($sql)) { //充值用户Money $sql_reward = "UPDATE users \r\n SET user_money = user_money+" . $data['price'] . "\r\n WHERE id='" . $data['user_id'] . "'\r\n "; $db->query($sql_reward); //操作log ulog::add($logodata); remind::set(Kohana::lang('o_global.update_success'), 'user/user_charge', 'success'); } else { //操作log ulog::add($logodata, 1); remind::set(Kohana::lang('o_global.update_error'), 'user/user_charge', 'error'); } }
/** * 修改用户信息 */ function edit($id) { //权限检查 得到所有可管理站点ID列表 role::check('user_edit'); if ($_POST) { //标签过滤 tool::filter_strip_tags($_POST); if (Myuser::instance($id)->set_money($_POST['invite_user_id'], $_POST['reward_money'])) { $arr['guest_user_id'] = intval($_POST['user_id']); $arr['user_id'] = intval($_POST['invite_user_id']); $arr['reward_money'] = intval($_POST['reward_money']); $arr['memo'] = '邀请用户奖励'; $arr['reward_type'] = 'invite'; $arr['time_stamp'] = date("Y-m-d H:i:s", time()); User_inviteService::get_instance()->insert($arr); $logodata = array(); $logodata['manager_id'] = $this->manager_id; $logodata['ip'] = tool::get_str_ip(); $logodata['user_log_type'] = 28; $logodata['method'] = __CLASS__ . '::' . __METHOD__ . '()'; $logodata['memo'] = "邀请奖励审核通过, 奖励:" . $_POST['reward_money']; ulog::add($logodata); remind::set(Kohana::lang('o_global.update_success'), request::referrer(), 'success'); } else { remind::set(Kohana::lang('o_global.update_error'), request::referrer(), 'error'); } } $this->template->content = new View("user/user_invite_edit"); $id = intval($id); $data = Myuser::instance($id)->get(); $data['invite'] = Myuser::instance($data['invite_user_id'])->get(); $sql = " SELECT COUNT(id) AS id FROM user_reward WHERE guest_user_id = " . $data['id'] . " AND user_id = " . $data['invite']['id'] . " AND reward_type = 'invite' "; $data['reward'] = User_inviteService::get_instance()->get_one($sql); $data['reward'] = $data['reward']['id']; $this->template->content->data = $data; }