Example #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;
 }
 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');
 }
Example #3
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');
     }
 }
Example #4
0
 public function __construct()
 {
     role::check('site_seo');
     parent::__construct();
     if ($this->is_ajax_request() == TRUE) {
         $this->template = new View('layout/default_json');
     }
 }
Example #5
0
 public function __construct()
 {
     parent::__construct();
     if ($this->is_ajax_request()) {
         $this->template = new View('layout/default_json');
     }
     role::check('order_edit');
 }
Example #6
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();
 }
Example #7
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');
     }
 }
Example #8
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;
         }
     }
 }
Example #9
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;
 }
Example #10
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');
     }
 }
Example #12
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;
 }
Example #13
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;
     }
 }
Example #14
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;
 }
Example #15
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;
     }
 }
Example #16
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');
         }
     }
 }
Example #17
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;
 }
Example #18
0
 public function __construct()
 {
     parent::__construct();
     role::check('site_carrier');
 }
Example #19
0
 public function option_relation_data()
 {
     role::check('product_feature_delete');
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //$profiler = new Profiler;
         //* 初始化返回数据 */
         $return_data = array();
         //* 收集请求数据 ==根据业务逻辑定制== */
         $request_data = $this->input->get();
         //必须为ajax请求
         if (!$this->is_ajax_request()) {
             throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 404);
         }
         //数据验证
         if (!isset($request_data['option_id']) || !is_numeric($request_data['option_id'])) {
             throw new MyRuntimeException(Kohana::lang('o_global.input_error'), 404);
         }
         // 调用底层服务
         $attributeoption_service = AttributeoptionService::get_instance();
         if ($attributeoption_service->is_relation_by_attributeoption_id($request_data['option_id'])) {
             throw new MyRuntimeException('该特性已被关联,请取消关联之后重试!', 500);
         }
         //* 补充&修改返回结构体 */
         $return_struct['status'] = 1;
         $return_struct['code'] = 200;
         $return_struct['msg'] = '';
         $return_struct['content'] = $return_data;
         //* 请求类型 */
         if ($this->is_ajax_request()) {
             // ajax 请求
             // json 输出
             $this->template->content = $return_struct;
         } else {
             throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 404);
         }
         // end of request type determine
     } catch (MyRuntimeException $ex) {
         $this->_ex($ex, $request_data, $return_struct);
     }
 }
Example #20
0
 public function __construct()
 {
     parent::__construct();
     role::check('superplaner_system_manage');
 }
Example #21
0
 public function search_category()
 {
     role::check('promotion_promotion');
     // 收集请求数据
     $request_data = $this->input->get();
     $request_struct_current = array('where' => array(), 'like' => array(), 'limit' => array('per_page' => 6, 'page' => 1), 'orderby' => array('position' => 'ASC', 'id' => 'DESC'));
     $record_data = array();
     if (isset($request_data['page']) && !empty($request_data['page'])) {
         $request_struct_current['limit']['page'] = $request_data['page'];
         $record_data['page'] = $request_data['page'];
     }
     // 当前支持的查询业务逻辑
     if (isset($request_data['type']) && isset($request_data['keyword']) && !empty($request_data['keyword'])) {
         switch ($request_data['type']) {
             case 'id':
                 $request_struct_current['where'][$request_data['type']] = intval(trim($request_data['keyword']));
                 break;
             case 'title_manage':
                 $request_struct_current['like'][$request_data['type']] = trim($request_data['keyword']);
                 break;
             case 'title':
                 $request_struct_current['like'][$request_data['type']] = trim($request_data['keyword']);
                 break;
         }
     }
     $categories = CategoryService::get_instance()->index($request_struct_current);
     $returnData['content'] = $categories;
     $returnData['page'] = isset($record_data['page']) ? $record_data['page'] : 1;
     $returnData['count'] = ceil(CategoryService::get_instance()->count($request_struct_current) / $request_struct_current['limit']['per_page']);
     //header('Content-Type: text/javascript; charset=UTF-8');
     echo json_encode($returnData);
     exit;
 }
Example #22
0
 public function __construct()
 {
     parent::__construct();
     role::check('manage_mail_template');
 }
 public function edit($agentId)
 {
     //权限检查 得到所有可管理站点ID列表
     role::check('distribution_system_manage');
 }
Example #24
0
 public function set_order()
 {
     role::check('user_attribute');
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //收集数据
         $request_data = $this->input->post();
         if (empty($request_data['setorder'])) {
             throw new MyRuntimeException(kohana::lang('o_user_attribute.data_lost'), 400);
         }
         $query_struct = array('where' => array('id' => $request_data['setorder']));
         //调用底层服务
         $user_attribute_service = User_attributeService::get_instance();
         $user_attributes = $user_attribute_service->index($query_struct);
         //检查所提交的数据数据库里是否有
         if (count($user_attributes) != count($request_data['setorder'])) {
             throw new MyRuntimeException(kohana::lang('o_user_attribute.data_lost'), 400);
         }
         //修改排序值
         $i = 0;
         foreach ($request_data['setorder'] as $id) {
             $user_attribute_service->set($id, array('attribute_order' => count($request_data['setorder']) - $i));
             $i++;
         }
         //* 补充&修改返回结构体 */
         $return_struct['status'] = 1;
         $return_struct['code'] = 200;
         $return_struct['msg'] = kohana::lang('o_global.position_success');
         $return_struct['action'] = array('type' => 'location', 'url' => url::base() . 'user/' . $this->class_name . '/' . 'index');
         //* 请求类型 */
         if ($this->is_ajax_request()) {
             // ajax 请求
             // json 输出
             $this->template->content = $return_struct;
         } else {
             // html 输出
             $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;
         }
         // end of request type determine
     } 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->content = $return_struct;
         } 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;
         }
     }
 }
Example #25
0
 public function delete_all()
 {
     role::check('product_filter');
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         $return_data = array();
         //* 收集请求数据 ==根据业务逻辑定制== */
         $request_data = $this->input->post();
         if (!isset($request_data['id']) || empty($request_data['id'])) {
             throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 404);
         }
         $alias_filter_service = Alias_filterService::get_instance();
         //执行删除
         if (isset($request_data['id']) || !empty($request_data['id'])) {
             foreach ($request_data['id'] as $val) {
                 $alias_filter_service->delete_filter_by_filter_id($val);
             }
         }
         //* 补充&修改返回结构体 */
         $return_struct['status'] = 1;
         $return_struct['code'] = 200;
         $return_struct['msg'] = '删除成功';
         $return_struct['content'] = $return_data;
         $return_struct['action'] = array('type' => 'location', 'url' => url::base() . 'product/' . $this->class_name . '/' . 'index');
         //* 请求类型 */
         if ($this->is_ajax_request()) {
             // ajax 请求
             // json 输出
             $this->template->content = $return_struct;
         } else {
             // html 输出
             $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;
         }
         // end of request type determine
     } 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->content = $return_struct;
         } 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;
         }
     }
 }
Example #26
0
 public function edit($agentId)
 {
     //权限检查 得到所有可管理站点ID列表
     role::check('Superplaner_system_manage');
 }
Example #27
0
 public function __construct()
 {
     parent::__construct();
     /* 权限验证 */
     role::check('site_doc');
 }
Example #28
0
 public function __construct()
 {
     parent::__construct();
     role::check('lottnum_jobs');
 }
Example #29
0
 public function delete_all()
 {
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //* 初始化返回数据 */
         $return_data = array();
         //* 收集请求数据 ==根据业务逻辑定制== */
         $request_data = $this->input->post();
         //* 权限验证 */
         $site_id = site::id();
         if ($site_id == 0) {
             throw new MyRuntimeException(Kohana::lang('o_global.select_site'), 400);
         }
         role::check('inquiry_subject', $site_id, 0);
         //数据验证
         if (!isset($request_data['site_id']) || !is_numeric($request_data['site_id'])) {
             throw new MyRuntimeException(Kohana::lang('o_global.input_error'), 404);
         }
         if (!isset($request_data['id']) || empty($request_data['id'])) {
             throw new MyRuntimeException(Kohana::lang('o_global.input_error'), 404);
         }
         if ($request_data['site_id'] != $site_id) {
             throw new MyRuntimeException(Kohana::lang('o_global.access_denied'), 403);
         }
         $inquieysubject_service = InquirysubjectService::get_instance();
         //执行删除
         if (isset($request_data['id']) || !empty($request_data['id'])) {
             $inquieysubject_service->delete_subjects($request_data['id']);
         }
         //* 补充&修改返回结构体 */
         $return_struct['status'] = 1;
         $return_struct['code'] = 200;
         $return_struct['msg'] = '删除成功';
         $return_struct['content'] = $return_data;
         $return_struct['action'] = array('type' => 'location', 'url' => url::base() . 'product/' . $this->class_name . '/' . 'index');
         //* 请求类型 */
         if ($this->is_ajax_request()) {
             // ajax 请求
             // json 输出
             $this->template->content = $return_struct;
         } else {
             // html 输出
             $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;
         }
         // end of request type determine
     } 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->content = $return_struct;
         } 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;
         }
     }
 }
Example #30
0
 public function onchange()
 {
     role::check('product_auction');
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => '');
     try {
         $return_data = array();
         $request_data = $this->input->get();
         $id = (int) $request_data['id'];
         $v = $request_data['v'] > 0 ? 0 : 1;
         $name = trim($request_data['name']);
         if (!isset($request_data['id']) || !in_array($name, array('status', 'recommend'))) {
             throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 400);
         }
         $auction_service = Product_auctionService::get_instance();
         $p = $auction_service->get($id);
         if (!isset($p['id']) || $p['status'] == 2) {
             throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 400);
         }
         $data = array();
         $data['id'] = $id;
         $data[$name] = $v;
         $result = $auction_service->update($data);
         if (!$result) {
             throw new MyRuntimeException('Internal Error', 500);
         }
         //* 补充&修改返回结构体 */
         $return_struct['status'] = 1;
         $return_struct['code'] = 200;
         $return_struct['msg'] = '成功!';
         $return_struct['content'] = $v;
         //* 请求类型 */
         if ($this->is_ajax_request()) {
             // ajax 请求
             // json 输出
             die(json_encode($return_struct));
         } else {
             throw new MyRuntimeException('成功', 200);
         }
     } catch (MyRuntimeException $ex) {
         $this->_ex($ex, $return_struct, $request_data);
     }
 }