Exemplo n.º 1
0
 /**
  * 添加
  */
 public function add()
 {
     $this->site_ids = role::check('role_edit');
     if ($_POST) {
         //标签过滤
         tool::filter_strip_tags($_POST);
         $name = $this->input->post('name');
         $role = Myrole::instance()->get_by_name($name);
         $parent_id = $this->input->post('parent_id');
         if ($role['id']) {
             remind::set(Kohana::lang('o_manage.group_has_exist'), 'manage/role/add');
         }
         if ($parent_id > 0) {
             $role = Myrole::instance($parent_id)->get();
             //zhu add
             if ($role['type'] != $this->input->post('type')) {
                 remind::set(Kohana::lang('o_manage.parent_group_type_not_match'), 'manage/role/add');
             }
             $_POST['level_depth'] = $role['level_depth'] + 1;
         } else {
             $_POST['level_depth'] = 1;
         }
         if (Myrole::instance()->add($_POST)) {
             remind::set(Kohana::lang('o_global.add_success'), 'manage/role', 'success');
         } else {
             remind::set(Kohana::lang('o_global.add_error'), 'manage/role/add');
         }
     }
     $roles = Myrole::instance()->roles();
     $this->template->content = new View("manage/role_add");
     $this->template->content->roles = $roles;
 }
Exemplo n.º 2
0
 /**
  * 改变状态
  */
 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');
     }
 }
Exemplo n.º 3
0
 /**
  * Template loading and setup routine.
  */
 public function __construct()
 {
     parent::__construct();
     // checke request is ajax
     $this->ajax_request = request::is_ajax();
     // Load the template
     $this->template = new View($this->template);
     if ($this->auto_render == TRUE) {
         Event::add('system.post_controller', array($this, '_render'));
     }
     /**
      * 判断用户登录情况
      */
     if (isset($_REQUEST['session_id'])) {
         $session = Session::instance($_REQUEST['session_id']);
         $manager = role::get_manager($_REQUEST['session_id']);
     } else {
         $session = Session::instance();
         $manager = role::get_manager();
     }
     /* 当前请求的URL */
     $current_url = urlencode(url::current(TRUE));
     //当前用户管理的站点的ID
     $this->site_id = site::id();
 }
Exemplo n.º 4
0
 public function index()
 {
     role::check('user_charge_orders');
     /* 初始化默认查询条件 */
     $user_query_struct = array('where' => array(), 'like' => array(), 'orderby' => array('id' => "DESC"), 'limit' => array('per_page' => 20, 'offset' => 0));
     /* 用户列表模板 */
     $this->template->content = new View("user/user_charge_orders");
     /* 搜索功能 */
     $search_arr = array('order_num');
     $search_value = $this->input->get('search_value');
     $where_view = array();
     $user_query_struct['like']['order_num'] = $search_value;
     //$user_query_struct['like']['ret_order_num'] = $search_value;
     $where_view['search_value'] = $search_value;
     /* 每页显示条数 */
     $per_page = controller_tool::per_page();
     $user_query_struct['limit']['per_page'] = $per_page;
     /* 调用分页 */
     $this->pagination = new Pagination(array('total_items' => User_chargeService::get_instance()->query_count($user_query_struct), 'items_per_page' => $per_page));
     //d($this->pagination->sql_offset);
     $user_query_struct['limit']['offset'] = $this->pagination->sql_offset;
     $users = User_chargeService::get_instance()->lists($user_query_struct);
     $userobj = user::get_instance();
     foreach ($users as $key => $rowuser) {
         $users[$key]['userinfo'] = $userobj->get($rowuser['user_id']);
     }
     /* 调用列表 */
     $this->template->content->user_list = $users;
     $this->template->content->where = $where_view;
     $this->template->content->pay_banks = Kohana::config('pay_banks');
 }
Exemplo n.º 5
0
 public function __construct()
 {
     role::check('site_seo');
     parent::__construct();
     if ($this->is_ajax_request() == TRUE) {
         $this->template = new View('layout/default_json');
     }
 }
Exemplo n.º 6
0
 public function __construct()
 {
     parent::__construct();
     if ($this->is_ajax_request()) {
         $this->template = new View('layout/default_json');
     }
     role::check('order_edit');
 }
Exemplo n.º 7
0
 function index()
 {
     //判断用户是否是已经登录状态
     $data = role::get_manager();
     if ($data['id'] > 0) {
         $data['success'] = 'true';
         $data['msg'] = 1;
     } else {
         $data['success'] = 'false';
         $data['msg'] = 1;
     }
     $username = $this->input->post('username');
     $password = $this->input->post('password');
     $secode = $this->input->post('secode');
     $remember = $this->input->post('remember');
     $data['success'] = 'false';
     //验证登录
     $manager = role::log_in($username, $password);
     if (isset($manager['username'])) {
         //判断普通账号的状态、权限
         if (!role::is_root($manager['username'])) {
             if ($manager['active'] != 1) {
                 ulog::login($manager['id'], 1);
                 $data['msg'] = Kohana::lang('o_global.account_was_locked');
             }
             $actions = role::manager_actions($manager['id'], TRUE);
             if (count($actions) < 1) {
                 ulog::login($manager['id'], 2);
                 $data['msg'] = Kohana::lang('o_global.account_permission_enough');
             }
         }
         //是否记录用户名
         if ($remember == 1) {
             cookie::set('opococ_username', $username);
         } else {
             cookie::delete('opococ_username');
         }
         //清除记录登录错误记录
         //Session::instance()->delete('login_error_count');
         //记入SESSION
         role::set_manager_session($manager);
         //记录日志
         ulog::login($manager['id']);
         $data['success'] = 'true';
         $data['msg'] = 1;
         /*if(empty($request_url))
         		{
         			remind::set(Kohana::lang('o_global.login_success'), '/index', 'success');
         		}
                    else
                    {
         			$request_url = url::base() . urldecode($request_url);
         			remind::set(Kohana::lang('o_global.login_success'), $request_url, 'success');
         		}*/
     }
     die(json_encode($data));
 }
Exemplo n.º 8
0
 public function __construct()
 {
     role::check('product_inquiry');
     $this->package_name = 'product';
     $this->class_name = strtolower(substr(__CLASS__, 0, strpos(__CLASS__, '_')));
     parent::__construct();
     if ($this->is_ajax_request()) {
         $this->template = new View('layout/default_json');
     }
 }
Exemplo n.º 9
0
 public function __construct()
 {
     parent::__construct();
     if ($this->is_ajax_request() == TRUE) {
         $this->template = new View('layout/default_json');
     }
     role::check('orders');
     $this->order_basic_obj = OrderBasic::instance();
     $this->order_detail_obj = OrderDetail::instance();
 }
Exemplo n.º 10
0
 public static function init()
 {
     if (!isset(self::$roles)) {
         $qry = DBFactory::getDBQuery();
         $qry->execute('select rol_id,rol_name, rol_descr from kb3_roles where rol_site=\'' . KB_SITE . "' order by rol_name");
         while ($row = $qry->getRow()) {
             self::$roles['keys'][$row['rol_name']] = $row['rol_descr'];
             self::$roles['hard'][$row['rol_name']] = $row['rol_descr'];
         }
         role::register('admin', 'Basic Admin Role');
     }
 }
Exemplo n.º 11
0
 /**
  * 批量删除支付方式
  */
 public function batch_delete()
 {
     //初始化返回数据
     $return_data = array();
     //请求结构体
     $request_data = array();
     /* 可管理的站点ID列表 */
     role::check('manage_payment_type');
     try {
         $payment_type_ids = $this->input->post('payment_type_id');
         if (is_array($payment_type_ids) && count($payment_type_ids) > 0) {
             /* 初始化默认查询条件 */
             $query_struct = array('where' => array('id' => $payment_type_ids), 'like' => array(), 'limit' => array('per_page' => 300, 'offset' => 0));
             $payment_types = Mypayment_type::instance()->query_assoc($query_struct);
             /* 删除失败的 */
             $failed_payment_type_names = '';
             /* 执行操作 */
             foreach ($payment_types as $key => $payment_type) {
                 if (!Mypayment_type::instance($payment_type['id'])->delete()) {
                     $failed_payment_type_names .= ' | ' . $payment_type['name'];
                 }
             }
             if (empty($failed_payment_type_names)) {
                 throw new MyRuntimeException(Kohana::lang('o_manage.delete_payment_type_success'), 403);
             } else {
                 /* 中转提示页面的停留时间 */
                 $return_struct['action']['time'] = 10;
                 $failed_payment_type_names = trim($failed_payment_type_names, ' | ');
                 throw new MyRuntimeException(Kohana::lang('o_manage.delete_payment_type_error', $failed_payment_type_names), 403);
             }
         } else {
             throw new MyRuntimeException(Kohana::lang('o_global.data_load_error'), 403);
         }
     } catch (MyRuntimeException $ex) {
         $return_struct['status'] = 0;
         $return_struct['code'] = $ex->getCode();
         $return_struct['msg'] = $ex->getMessage();
         //TODO 异常处理
         //throw $ex;
         if ($this->is_ajax_request()) {
             $this->template = new View('layout/empty_html');
             $this->template->content = $return_struct['msg'];
         } else {
             $this->template->return_struct = $return_struct;
             $content = new View('info');
             $this->template->content = $content;
             /* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             /* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
         }
     }
 }
Exemplo n.º 12
0
function login($obj)
{
    $name = isset($obj->name) ? $obj->name : '';
    $password = isset($obj->password) ? $obj->password : '';
    $rememberme = isset($obj->rememberme) ? $obj->rememberme : false;
    $user = new user();
    $listUser = $user->getbynameandpassword($name, $password);
    if (count($listUser) > 0) {
        $role = new role();
        $_SESSION['id'] = $listUser[0]->id;
        $_SESSION['name'] = $listUser[0]->name;
        $_SESSION['group_id'] = $listUser[0]->group_id;
        $_SESSION['role'] = $role->getbyid($listUser[0]->group_id);
        if ($rememberme) {
            setcookie("tasktrack", "id=" . $listUser[0]->id, time() + 86400, "/");
        }
        return array("status" => "success", "msg" => "Login Successful");
    } else {
        return array("status" => "warning", "msg" => "Your User name and password is incorrect!");
    }
}
Exemplo n.º 13
0
 /**
  * 列表
  */
 public function index()
 {
     $this->template->content = new View("manage/action_list");
     $actions = Myaction::instance()->actions();
     //用户可管理权限资源的ID
     $user_action_ids = role::get_action_ids();
     foreach ($actions as $key => $value) {
         if (!in_array($value['id'], $user_action_ids)) {
             unset($actions[$key]);
         }
     }
     $this->template->content->actions = $actions;
 }
Exemplo n.º 14
0
 /**
  * Template loading and setup routine.
  */
 public function __construct()
 {
     parent::__construct();
     // checke request is ajax
     $this->ajax_request = request::is_ajax();
     // Load the template
     $this->template = new View($this->template);
     if ($this->auto_render == TRUE) {
         Event::add('system.post_controller', array($this, '_render'));
     }
     /**
      * 判断用户登录情况
      */
     if (isset($_REQUEST['session_id'])) {
         $session = Session::instance($_REQUEST['session_id']);
         $manager = role::get_manager($_REQUEST['session_id']);
     } else {
         $session = Session::instance();
         $manager = role::get_manager();
     }
     /* 当前请求的URL */
     $current_url = urlencode(url::current(TRUE));
     //zhu
     if (isset($manager['id'])) {
         $active_time = $session->get('Opococ_manager_active_time');
         //用户最后操作时间
         $session->set('Opococ_manager_active_time', time());
         //用户最后操作时间
         $login_ip = $session->get('Opococ_manager_login_ip');
         //用户登录的IP
         //操作超时
         if (time() - $active_time > Kohana::config('login.time_out')) {
             $session->delete('Opococ_manager');
             $session->delete('Opococ_manager_active_time');
             $session->delete('Opococ_manager_login_ip');
             remind::set(Kohana::lang('o_global.first_login'), 'login?request_url=' . $current_url);
         }
         //用户IP(登录状态更换IP需要重新登录)
         $ip = tool::get_long_ip();
         if ($ip != $login_ip) {
             remind::set(Kohana::lang('o_global.login_again'), 'login?request_url=' . $current_url);
         }
         $this->manager = $manager;
         $this->manager_id = $manager['id'];
         $this->manager_name = $manager['name'];
         $this->manager_is_admin = role::is_root($manager['name']) ? 1 : $manager['is_admin'];
         $this->template->manager_data = $manager;
     } else {
         remind::set(Kohana::lang('o_global.first_login'), 'login?request_url=' . $current_url);
     }
 }
Exemplo n.º 15
0
 public function index()
 {
     role::check('card_system_manage');
     $per_page = controller_tool::per_page();
     $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('order' => 'ASC'), 3 => array('order' => 'DESC'));
     $orderby = controller_tool::orderby($orderby_arr);
     $query_struct = array('where' => array(), 'orderby' => $orderby, 'limit' => array('per_page' => $per_page, 'offset' => 0));
     $total = $this->cardLogDao->count_items_with_condition($query_struct['where']);
     $this->pagination = new Pagination(array('base_url' => url::current(), 'uri_segment' => 'page', 'total_items' => $total, 'items_per_page' => $per_page, 'style' => 'digg'));
     $query_struct['limit']['offset'] = $this->pagination->sql_offset;
     $cardLogList = $this->cardLogDao->lists($query_struct);
     $this->template->content = new View("card/card_log_list");
     $this->template->content->data = $cardLogList;
 }
Exemplo n.º 16
0
 /**
  * 构造方法
  */
 public function __construct()
 {
     $package_name = substr(dirname(__FILE__), strlen(APPPATH . 'controllers/'));
     empty($package_name) && ($package_name = 'default');
     $this->package_name = $package_name;
     $this->class_name = strtolower(substr(__CLASS__, 0, strpos(__CLASS__, '_')));
     $this->phprpc_server = Kohana::config('phprpc.remote.statking.host');
     $this->site_ids = role::get_site_ids();
     $this->site_id = site::id();
     parent::__construct();
     if ($this->is_ajax_request() == TRUE) {
         $this->template = new View('layout/default_json');
     }
 }
Exemplo n.º 17
0
 public function index()
 {
     /* 初始化默认查询条件 */
     $newsletter_query_struct = array('where' => array('user_id' => 0), 'like' => array(), 'orderby' => array(), 'limit' => array('per_page' => 20, 'offset' => 0));
     /* 权限检查 得到所有可管理站点ID列表 */
     $site_id_list = role::check('newsletter');
     /* Newsletter列表模板 */
     $this->template->content = new View("user/newsletter");
     /* 搜索功能 */
     $search_arr = array('email', 'ip');
     $search_value = $this->input->get('search_value');
     $search_type = $this->input->get('search_type');
     $where_view = array();
     if ($search_arr) {
         foreach ($search_arr as $value) {
             if ($search_type == $value && strlen($search_value) > 0) {
                 $newsletter_query_struct['where'][$value] = $search_value;
                 if ($value == 'ip') {
                     $newsletter_query_struct['where'][$value] = tool::myip2long($search_value);
                 }
             }
         }
         $where_view['search_type'] = $search_type;
         $where_view['search_value'] = $search_value;
     }
     //当前切入的站点查询条件
     $site_in = site::current_query_site_ids();
     $where_view['site_id'] = '';
     $newsletter_query_struct['where']['site_id'] = $site_in;
     /* 列表排序 */
     $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('site_id' => 'ASC'), 3 => array('site_id' => 'DESC'), 4 => array('email' => 'ASC'), 5 => array('email' => 'DESC'), 6 => array('date_add' => 'ASC'), 7 => array('date_add' => 'DESC'), 8 => array('ip' => 'ASC'), 9 => array('ip' => 'DESC'), 10 => array('active' => 'ASC'), 11 => array('active' => 'DESC'));
     $orderby = controller_tool::orderby($orderby_arr);
     $newsletter_query_struct['orderby'] = $orderby;
     /* 每页显示条数 */
     $per_page = controller_tool::per_page();
     $newsletter_query_struct['limit']['per_page'] = $per_page;
     /* 调用分页 */
     $this->pagination = new Pagination(array('total_items' => Mynewsletter::instance()->query_count($newsletter_query_struct), 'items_per_page' => $per_page));
     $newsletter_query_struct['limit']['offset'] = $this->pagination->sql_offset;
     $newsletters = Mynewsletter::instance()->query_assoc($newsletter_query_struct);
     foreach ($newsletters as $key => $value) {
         $site = Mysite::instance($value['site_id'])->get();
         $newsletters[$key]['site'] = $site;
     }
     /* 调用列表 */
     $this->template->content->newsletter_list = $newsletters;
     /* 搜索信息保存 */
     $this->template->content->where = $where_view;
 }
 public function delete($templateId)
 {
     //权限检查 得到所有可管理站点ID列表
     role::check('distribution_system_manage');
     $templateDao = Superplaner_Realtime_contract_template::instance();
     $template = $templateDao->get_by_id($templateId);
     if ($template == null) {
         remind::set(Kohana::lang('o_contract.contract_not_exists'), request::referrer(), 'error');
     }
     if (Superplaner_Realtime_contract_template::instance($templateId)->delete()) {
         remind::set(Kohana::lang('o_global.delete_success'), request::referrer(), 'success');
     } else {
         remind::set(Kohana::lang('o_global.delete_error'), request::referrer(), 'error');
     }
 }
Exemplo n.º 19
0
 /**
  * 用户 acl对象初始化
  * @return acl
  */
 public static function acl_init()
 {
     /* 用户详情 */
     $manager = role::get_manager();
     $username = $manager["username"];
     $action_resourses = role::get_action_resources();
     // Role 权限注册表
     $acl = Acl::instance();
     $acl->add_role($username);
     for ($i = 0; $i < count($action_resourses); $i++) {
         $acl->allow($username, null, $action_resourses[$i]);
     }
     self::_cache($acl);
     return $acl;
 }
Exemplo n.º 20
0
 public function open_bill_detail($openBillId)
 {
     //权限检查 得到所有可管理站点ID列表
     role::check('card_system_manage');
     if ($openBillId == null) {
         remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
         return;
     }
     $openBill = $this->issueBillDao->get_by_id($openBillId);
     if ($openBill == null) {
         remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
         return;
     }
     $this->template->content = new View("card/open_bill_detail");
     $this->template->content->openBill = $openBill;
     $this->template->content->channelList = $this->salesChannelMap;
 }
Exemplo n.º 21
0
 public function delete($cardTypeId)
 {
     //权限检查 得到所有可管理站点ID列表
     role::check('card_system_manage');
     $cardType = $this->cardTypeDao->get_by_id($cardTypeId);
     if ($cardType == null) {
         remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
         return;
     }
     if ($this->cardTypeDao->delete($cardTypeId)) {
         remind::set(Kohana::lang('o_global.delete_success'), 'card/card_type', 'success');
         return;
     } else {
         remind::set(Kohana::lang('o_global.delete_error'), request::referrer(), 'error');
         return;
     }
 }
Exemplo n.º 22
0
 /**
  * 验证是否有权限操作
  * @param string $model_flag
  * @return Boolean
  */
 public static function verify($permission = 'default')
 {
     $verify = false;
     //超级管理员root不需要检查权限 zhu modify
     if (role::is_root()) {
         $verify = true;
     } else {
         $acl = Session::instance()->get(self::$acl_tag);
         if ($acl) {
             $acl = unserialize($acl);
         } else {
             $acl = self::acl_init();
         }
         $manager = self::get_manager();
         //d($manager, false);
         $verify = $acl->is_allowed($manager["username"], $permission);
     }
     //var_dump($verify);
     return $verify;
 }
Exemplo n.º 23
0
 function desktop()
 {
     //权限验证
     role::check('default');
     //各个时间段的订单数量
     $stat_date = Myorder::instance()->stat_by_date();
     //已支付订单数量
     // 初始化默认查询条件
     $order_query_struct = array('where' => array('active' => 1), 'like' => array(), 'orderby' => array('order' => 'ASC'), 'limit' => array('per_page' => 20, 'offset' => 0));
     /* 已支付未做处理的订单 */
     $order_query_struct['where']['pay_status'] = 3;
     $order_query_struct['where']['order_status'] = 1;
     $order_query_struct['where']['ship_status'] = 1;
     $count_pay = Myorder::instance()->query_count($order_query_struct);
     //有订单用户数量
     $count_order_user = Myorder::instance()->count_order_user();
     /* 初始化默认查询条件 */
     $user_query_struct = array('where' => array(), 'like' => array(), 'orderby' => array(), 'limit' => array());
     //用户总数
     $count_user = Myuser::instance()->query_count();
     //今日用户
     $today = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d'), date('Y')));
     $user_query_struct['where']['date_add >='] = $today;
     $count_today_user = Myuser::instance()->query_count($user_query_struct);
     //有留言的订单数量
     $count_order_message = Myorder_message::instance()->count_order();
     //新的网站留言
     $count_contact_us = Mycontact_us::instance()->count(array('active' => '1'));
     /* 平台公告列表 */
     $notice_query_struct = array('where' => array(), 'like' => array(), 'orderby' => array('id' => 'DESC'), 'limit' => array('per_page' => 3, 'offset' => 0));
     $notices = Mynotice::instance()->query_assoc($notice_query_struct);
     $this->template->content = new View("index_desktop");
     $this->template->content->count_pay = $count_pay;
     $this->template->content->count_order_message = $count_order_message;
     $this->template->content->count_contact_us = $count_contact_us;
     $this->template->content->count_order_user = $count_order_user;
     $this->template->content->count_user = $count_user;
     $this->template->content->count_today_user = $count_today_user;
     $this->template->content->notices = $notices;
     $this->template->content->stat_date = $stat_date;
 }
Exemplo n.º 24
0
function show_perm_select()
{
    global $person;
    if ($person->have_perm(PERM_PERSON_WRITE_ROLES)) {
        $selected = explode(",", $person->get_value("perms"));
        $ops = role::get_roles_array("person");
        foreach ($ops as $p => $l) {
            unset($sel);
            in_array($p, $selected) and $sel = " checked";
            echo $br . "<input type=\"checkbox\" name=\"perm_select[]\" value=\"" . $p . "\"" . $sel . "> " . $l;
            $br = "<br>";
        }
    } else {
        $selected = explode(",", $person->get_value("perms"));
        $ops = role::get_roles_array("person");
        foreach ($selected as $sel) {
            echo $br . $ops[$sel];
            $br = "<br>";
        }
    }
}
Exemplo n.º 25
0
 public function delete($moneyExchangeId)
 {
     //权限检查 得到所有可管理站点ID列表
     role::check('card_system_manage');
     $moneyExchange = $this->moneyExchangeDao->get_by_id($moneyExchangeId);
     if ($moneyExchange == null) {
         remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
         return;
     }
     if ($moneyExchange['flag'] == 2) {
         remind::set("不能删除生效中的汇率方案", request::referrer(), 'error');
         return;
     }
     if ($this->moneyExchangeDao->delete($moneyExchange)) {
         remind::set(Kohana::lang('o_global.delete_success'), 'card/money_exchange', 'success');
         return;
     } else {
         remind::set(Kohana::lang('o_global.delete_error'), request::referrer(), 'error');
         return;
     }
 }
Exemplo n.º 26
0
 public function check_status($id = '')
 {
     //权限检查 得到所有可管理站点ID列表
     role::check('user_edit');
     if (!empty($id)) {
         $data['check_status'] = 2;
         if (Myuser::instance($id)->edit_handsel_users($id, $data)) {
             $user = user::get_instance();
             //彩金赠送开始
             $handsel = handsel::get_instance();
             $handsel_info = $handsel->get(1);
             //$data_money = array('free_money' => $handsel_info['total']);
             //$flag = $user->update_user_free_money($id,$data_money);
             //account_log::get_instance()->add($data_log);
             user_money::get_instance()->update_money(0, $id, $handsel_info['total'], 7, date('YmdHis') . rand(0, 99999), 'FREE_MONEY', '赠送彩金');
             //彩金赠送结束
             remind::set(Kohana::lang('o_global.update_success'), request::referrer(), 'success');
         } else {
             remind::set(Kohana::lang('o_global.update_error'), request::referrer(), 'error');
         }
     }
 }
Exemplo n.º 27
0
 /**
  * 修改用户信息
  */
 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;
 }
Exemplo n.º 28
0
 function index()
 {
     $nodes = array();
     $empty_menu = array('#', 'javascript:void(0);', 'javascript:void(0)');
     $action_ids = role::get_action_ids();
     $orderby = array('order' => 'DESC');
     $menus = ORM::factory('menu')->where('parent_id', 0)->where('active', 1)->in('action_id', $action_ids)->orderby($orderby)->find_all();
     foreach ($menus as $item) {
         $value = $item->as_array();
         $value['name'] = '<b>' . $value['name'] . '</b>';
         $sub_menus = $this->sub_menus($value['id'], $action_ids);
         if (empty($sub_menus)) {
             continue;
         }
         foreach ($sub_menus as $sub_menu_key => $sub_menu_value) {
             $sub_menus[$sub_menu_key]['children'] = $this->sub_menus($sub_menu_value['id'], $action_ids);
         }
         $value['children'] = $sub_menus;
         $value = self::to_node($value);
         $nodes[] = $value;
     }
     die(json_encode($nodes));
     //echo 'Docs.classData =[];';
 }
Exemplo n.º 29
0
 public function __construct()
 {
     parent::__construct();
     /* 权限验证 */
     role::check('site_doc');
 }
Exemplo n.º 30
0
                                                    <a class="sysiconBtnNoIcon" href="/manage/theme/set/<?php 
    echo $item['id'];
    ?>
">使用</a>
                                                    <?php 
    echo role::view_check('<a class="sysiconBtnNoIcon" href="/manage/theme/edit/' . $item['id'] . '">编辑</a>', 'theme_config');
    ?>
                                                    <?php 
    echo role::view_check('<a class="sysiconBtnNoIcon" href="/manage/theme/config/' . $item['id'] . '">配置</a>', 'theme_config');
    ?>
                                                    <a target="_blank" class="sysiconBtnNoIcon" href="/manage/theme/view_theme_img/<?php 
    echo $item['id'];
    ?>
">查看</a>
                                                    <?php 
    echo role::view_check('<a class="sysiconBtnNoIcon" onclick="return confirm(\'确认模板?\');" href="/manage/theme/delete/' . $item['id'] . '">删除</a>', 'theme_delete');
    ?>
                                                </div>
                                            </div>
                                            <span style="color:#ccc; font-size: 11px; font-weight: normal;"> 更新时间:<?php 
    echo $item['add_time'];
    ?>
</span> </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        <?php 
}
?>
                    </div>