Exemplo n.º 1
0
 public function index()
 {
     $news = Mynews::instance();
     $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 = $news->count_site_news();
     $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;
     $news = Mynews::instance()->lists($query_struct);
     $categorys = array();
     foreach ($news as $row) {
         $categorys[$row['classid']] = $row['classid'];
     }
     foreach ($categorys as $v) {
         $str = '';
         $aa = array('where' => array('id' => $v), 'like' => array(), 'limit' => array());
         $categories = Mynews_category::instance()->list_news_categories($aa);
         if (count($categories)) {
             $str = $categories[0]['category_name'];
             if ($categories[0]['parent_id'] > 0) {
                 $aa = array('where' => array('id' => $categories[0]['parent_id']), 'like' => array(), 'limit' => array());
                 $cate = Mynews_category::instance()->list_news_categories($aa);
                 $str = $cate[0]['category_name'] . ' > ' . $str;
             }
         }
         $categorys[$v] = $str;
     }
     $this->template->content = new View("site/news_list");
     $this->template->content->data = $news;
     $this->template->content->categorys = $categorys;
     $this->template->content->title = "site news list";
 }
Exemplo n.º 2
0
 public function index($status = NULL)
 {
     //权限检查 得到所有可管理站点ID列表
     role::check('contact_us');
     $this->template->content = new View("user/contact_us_list");
     //搜索功能
     $search_arr = array('id', 'email', 'name', 'message', 'ip');
     $where = array();
     $where_view = array();
     if ($search_arr) {
         foreach ($search_arr as $search_value) {
             if ($this->input->get('search_type') == $search_value && strlen($this->input->get('search_value'))) {
                 $where[$search_value] = $this->input->get('search_value');
                 if ($search_value == 'ip') {
                     $where[$search_value] = tool::myip2long($this->input->get('search_value'));
                 }
             }
         }
         $where_view['search_type'] = $this->input->get('search_type');
         $where_view['search_value'] = $this->input->get('search_value');
     }
     //列表排序
     $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('id' => 'ASC'), 3 => array('id' => 'DESC'), 4 => array('email' => 'ASC'), 5 => array('email' => 'DESC'), 6 => array('name' => 'ASC'), 7 => array('name' => 'DESC'), 8 => array('message' => 'ASC'), 9 => array('message' => 'DESC'), 10 => array('date_add' => 'ASC'), 11 => array('date_add' => 'DESC'), 12 => array('ip' => 'ASC'), 13 => array('ip' => 'DESC'));
     $orderby = controller_tool::orderby($orderby_arr);
     //每页显示条数
     $per_page = controller_tool::per_page();
     //调用分页
     if (isset($status) && $status == 'active') {
         $where['active'] = 1;
     }
     $this->pagination = new Pagination(array('total_items' => Mycontact_us::instance()->count($where), 'items_per_page' => $per_page));
     //调用列表
     $this->template->content->contact_us_list = Mycontact_us::instance()->contact_uses($where, $orderby, $per_page, $this->pagination->sql_offset);
     $this->template->content->where = $where_view;
 }
Exemplo n.º 3
0
 /**
  * 数据列表
  */
 public function index()
 {
     role::check('product_attribute');
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //$profiler = new Profiler;
         //* 初始化返回数据 */
         $return_data = array();
         //* 收集请求数据 ==根据业务逻辑定制== */
         $request_data = $this->input->get();
         // 执行业务逻辑
         //* 初始化默认查询结构体 */
         $query_struct_default = array('where' => array('apply' => self::ATTRIBUTE_TYPE), 'orderby' => array('id' => 'DESC'), 'limit' => array('per_page' => 20, 'page' => 1));
         //* 初始化当前查询结构体 */
         $query_struct_current = array();
         //* 设置合并默认查询条件到当前查询结构体 */
         $query_struct_current = array_merge($query_struct_current, $query_struct_default);
         //列表排序
         $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('name' => 'ASC'), 3 => array('name' => 'DESC'), 4 => array('order' => 'ASC'), 5 => array('order' => 'DESC'));
         $orderby = controller_tool::orderby($orderby_arr);
         // 排序处理
         if (isset($request_data['orderby']) && is_numeric($request_data['orderby'])) {
             $query_struct_current['orderby'] = $orderby;
         }
         // 每页条目数
         controller_tool::request_per_page($query_struct_current, $request_data);
         //调用服务执行查询
         $attribute_service = AttributeService::get_instance();
         $count = $attribute_service->count($query_struct_current);
         // 模板输出 分页
         $this->pagination = new Pagination(array('total_items' => $count, 'items_per_page' => $query_struct_current['limit']['per_page']));
         $query_struct_current['limit']['page'] = $this->pagination->current_page;
         $return_data['list'] = $attribute_service->get_attribute_options($query_struct_current);
         //* 补充&修改返回结构体 */
         $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 {
             // html 输出
             //* 模板输出 */
             $content = new View('product/' . $this->class_name . '/' . __FUNCTION__);
             //* 变量绑定 */
             $this->template->title = '规格管理';
             $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) {
         $this->_ex($ex, $request_data, $return_struct);
     }
 }
Exemplo n.º 4
0
 /**
  * 数据列表
  */
 public function index()
 {
     role::check('product_rush');
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //* 初始化返回数据 */
         $return_data = $rid = array();
         //* 收集请求数据 ==根据业务逻辑定制== */
         $request_data = $this->input->get();
         // 执行业务逻辑
         //* 初始化默认查询结构体 */
         $query_struct_current = array('where' => array(), 'like' => array(), 'orderby' => array('id' => 'DESC'), 'limit' => array('per_page' => 20, 'page' => 1));
         //列表排序
         $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('title' => 'ASC'), 3 => array('title' => 'DESC'), 4 => array('start_time' => 'ASC'), 5 => array('end_time' => 'DESC'), 6 => array('position' => 'DESC'), 7 => array('position' => 'ASC'));
         $orderby = controller_tool::orderby($orderby_arr);
         // 排序处理
         if (isset($request_data['orderby']) && is_numeric($request_data['orderby'])) {
             $query_struct_current['orderby'] = $orderby;
         }
         // 每页条目数
         controller_tool::request_per_page($query_struct_current, $request_data);
         //调用服务执行查询
         $product_rush_service = Product_rushService::get_instance();
         $count = $product_rush_service->count($query_struct_current);
         // 模板输出 分页
         $this->pagination = new Pagination(array('total_items' => $count, 'items_per_page' => $query_struct_current['limit']['per_page']));
         $query_struct_current['limit']['page'] = $this->pagination->current_page;
         $return_data['list'] = $product_rush_service->index($query_struct_current);
         foreach ($return_data['list'] as $pd) {
             $rid[$pd['product_id']] = true;
         }
         //* 补充&修改返回结构体 */
         $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 {
             // html 输出
             //* 模板输出 */
             $content = new View('product/' . $this->class_name . '/' . __FUNCTION__, array('rid' => $rid));
             //* 变量绑定 */
             $this->template->title = '抢购商品管理';
             $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) {
         $this->_ex($ex, $return_struct, $request_data);
     }
 }
Exemplo n.º 5
0
 public function index()
 {
     $user_query_struct = array('where' => array(), 'like' => array(), 'orderby' => array(), 'limit' => array('per_page' => 20, 'offset' => 0));
     /* 搜索功能 */
     $search_arr = array('id', 'email', 'firstname', 'lastname', 'ip', 'mobile', 'real_name');
     $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) {
                 $user_query_struct['like'][$value] = $search_value;
                 //$user_query_struct['where'][$value] = $search_value;
                 if ($value == 'ip') {
                     $user_query_struct['like'][$value] = tool::myip2long($search_value);
                     //$user_query_struct['where'][$value] = tool::myip2long($search_value);
                 }
             }
         }
         $where_view['search_type'] = $search_type;
         $where_view['search_value'] = $search_value;
     }
     /* 列表排序 */
     $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 4 => array('email' => 'ASC'), 5 => array('email' => 'DESC'), 6 => array('firstname' => 'ASC'), 7 => array('firstname' => 'DESC'), 8 => array('lastname' => 'ASC'), 9 => array('lastname' => 'DESC'), 10 => array('date_add' => 'ASC'), 11 => array('date_add' => 'DESC'), 12 => array('ip' => 'ASC'), 13 => array('ip' => 'DESC'), 14 => array('active' => 'ASC'), 15 => array('active' => 'DESC'), 16 => array('register_mail_active' => 'ASC'), 17 => array('register_mail_active' => 'DESC'));
     $orderby = controller_tool::orderby($orderby_arr);
     $user_query_struct['orderby'] = $orderby;
     /* 每页显示条数 */
     $per_page = controller_tool::per_page();
     $user_query_struct['limit']['per_page'] = $per_page;
     /* 调用分页 */
     $this->pagination = new Pagination(array('total_items' => Myuser::instance()->query_count($user_query_struct), 'items_per_page' => $per_page));
     $user_query_struct['limit']['offset'] = $this->pagination->sql_offset;
     $user_list = Myuser::instance()->query_assoc($user_query_struct);
     //找出所有的站点的用户等级信息
     $user_levelservice = User_levelService::get_instance();
     $query_struct = array('where' => array('active' => 1));
     $user_levels = $user_levelservice->index($query_struct);
     $tmp = array();
     foreach ($user_levels as $user_level) {
         if ($user_level['is_default']) {
             $tmp['default'] = $user_level;
         }
         $tmp[$user_level['id']] = $user_level;
     }
     $user_levels = $tmp;
     foreach ($user_list as $key => $value) {
         $users[$key]['level'] = '';
         if (!empty($user_levels[$value['level_id']])) {
             $users[$key]['level'] = $user_levels[$value['level_id']]['name_manage'];
         } else {
             //$users[$key]['level'] = $user_levels['default']['name_manage'];
         }
     }
     $this->template->content = new View("superplaner/agent_select_list");
     $this->template->content->where = $where_view;
     $this->template->content->user_list = $user_list;
 }
Exemplo n.º 6
0
 /**
  * 页面分类列表
  */
 public function index()
 {
     $list_columns = array(array('name' => '名称', 'column' => 'category_name', 'class_num' => '200'));
     $orderby_arr = array(0 => array('id' => 'ASC'), 1 => array('id' => 'DESC'), 2 => array('p_order' => 'ASC'), 3 => array('p_order' => 'DESC'));
     $orderby = controller_tool::orderby($orderby_arr);
     $query_struct = array('where' => array('parent_id' => 0), 'like' => array(), 'orderby' => $orderby, 'limit' => array('per_page' => controller_tool::per_page(), 'offset' => 0));
     $categories = Mydoc_category::instance()->list_doc_categories($query_struct);
     $this->template->content = new View("site/doc_category_list");
     $this->template->content->list_columns = $list_columns;
     $this->template->content->categories = $categories;
 }
Exemplo n.º 7
0
 public function index()
 {
     role::check('card_system_manage');
     $query_condition = array();
     $query_condition['beginNum'] = null;
     $query_condition['endNum'] = null;
     $query_condition['selectKey'] = null;
     $query_condition['selectValue'] = null;
     $per_page = controller_tool::per_page();
     $orderby_arr = array(0 => array('id' => 'ASC'), 1 => array('id' => 'DESC'), 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));
     if ($_GET) {
         if (!empty($_GET['beginNum']) && !empty($_GET['endNum'])) {
             $query_condition['beginNum'] = $_GET['beginNum'];
             $query_condition['endNum'] = $_GET['endNum'];
             $query_struct['where']['mgrnum >='] = $_GET['beginNum'];
             $query_struct['where']['mgrnum <='] = $_GET['endNum'];
         }
         if (isset($_GET['selectValue']) && !empty($_GET['selectValue'])) {
             $query_condition['selectKey'] = $_GET['selectKey'];
             $query_condition['selectValue'] = $_GET['selectValue'];
             if ($query_condition['selectKey'] == 'mgrNum') {
                 $query_struct['where']['mgrnum'] = $_GET['selectValue'];
             } else {
                 if ($query_condition['selectKey'] == 'serialCode') {
                     $query_struct['where']['cardserialcode'] = $_GET['selectValue'];
                 } else {
                     if ($query_condition['selectKey'] == 'issueId') {
                         $query_struct['where']['issueid'] = $_GET['selectValue'];
                     } else {
                         if ($query_condition['selectKey'] == 'openId') {
                             $query_struct['where']['openid'] = $_GET['selectValue'];
                         } else {
                             if ($query_condition['selectKey'] == 'flag') {
                                 $query_struct['where']['flag'] = $_GET['selectValue'];
                             }
                         }
                     }
                 }
             }
         }
     }
     $total = $this->cardDao->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;
     $cardList = $this->cardDao->lists($query_struct);
     $this->template->content = new View("card/card_list");
     $this->template->content->data = $cardList;
     $this->template->content->query_condition = $query_condition;
     $this->template->content->selectMap = $this->selectMap;
 }
Exemplo n.º 8
0
 public function index()
 {
     $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);
     $link = Mysite_link::instance();
     $links = $link->lists($query_struct);
     $total = $link->count($query_struct);
     $this->template->content = new View("site/link_list");
     $this->template->content->data = $links;
     $this->template->content->total = $total;
 }
Exemplo n.º 9
0
 public function index()
 {
     $agentDao = Superplaner::instance();
     $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 = $agentDao->count_agents();
     $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;
     $agentList = $agentDao->lists($query_struct);
     $this->template->content = new View("superplaner/agent_list");
     $this->template->content->data = $agentList;
 }
Exemplo n.º 10
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->moneyExchangeDao->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;
     $moneyExchangeList = $this->moneyExchangeDao->lists($query_struct);
     $this->template->content = new View("card/money_exchange_list");
     $this->template->content->data = $moneyExchangeList;
 }
Exemplo n.º 11
0
 public function index()
 {
     $settlerealtimerptDao = Superplaner_settlerealtimerpt::instance();
     $agent_type = Kohana::config('settle.agent_type');
     $isbeidan = Kohana::config('settle.isbeidan');
     $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));
     /**
      * 搜索
      */
     $search_arr = array('type', 'agent_type', 'isbeidan', 'date_begin', 'date_end', 'user_id', 'lastname');
     foreach ($this->input->get() as $key => $value) {
         if (in_array($key, $search_arr)) {
             if ($key == 'date_begin') {
                 $query_struct['where']["settletime >"] = $value . ' 00:00:00';
             } elseif ($key == 'date_end') {
                 $query_struct['where']["settletime <"] = $value . ' 24:00:00';
             } elseif ($key == 'isbeidan' && !empty($value)) {
                 $query_struct['where']["type"] = $value - 1;
             } elseif ($key == 'agent_type' && !empty($value)) {
                 $query_struct['where']["agent_type"] = $value - 1;
             } elseif (!empty($value)) {
                 $query_struct['where'][$key] = $value;
             }
         }
     }
     $total = $settlerealtimerptDao->count_itmes();
     $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;
     //        $dataList = Superplaner_settlerealtimerpt::instance()->lists($query_struct);
     $dataList = Superplaner_settlerealtimerpt::instance()->mylists($query_struct);
     foreach ($dataList as $key => $value) {
         $dataList[$key]['agent_type'] = $agent_type[$value['agent_type']];
         $dataList[$key]['type'] = $isbeidan[$value['type']];
         foreach ($value as $k => $v) {
             if (!is_numeric($v) && empty($v)) {
                 $dataList[$key][$k] = '无';
             }
         }
     }
     $this->template->content = new View("superplaner/settle_realtime_rpt");
     $this->template->content->data = $dataList;
     $this->template->content->agent_type = $agent_type;
     $this->template->content->isbeidan = $isbeidan;
     $this->template->content->today = date("Y-m-d", time());
     $this->template->content->yesterday = date("Y-m-d", time() - 24 * 3600);
 }
Exemplo n.º 12
0
 public function index()
 {
     $settlemonthrptdtlDao = Mysettlemonthrptdtl::instance();
     $ticket_type = Kohana::config('ticket_type.type');
     $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));
     /**
      * 搜索
      */
     $search_arr = array('ticket_type', 'date_begin', 'date_end', 'agentid', 'user_id', 'agentlastname', 'masterid');
     foreach ($this->input->get() as $key => $value) {
         if (in_array($key, $search_arr)) {
             if ($key == 'date_begin') {
                 $query_struct['where']["settletime >"] = $value . ' 00:00:00';
             } elseif ($key == 'date_end') {
                 $query_struct['where']["settletime <"] = $value . ' 24:00:00';
             } elseif ($key == 'agentlastname' && !empty($value)) {
                 $query_struct['where']["agent.lastname ="] = $value;
             } elseif (!empty($value)) {
                 $query_struct['where'][$key] = $value;
             }
         }
     }
     $total = $settlemonthrptdtlDao->count_itmes();
     $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;
     //        $dataList = Mysettlemonthrptdtl::instance()->lists($query_struct);
     $dataList = Mysettlemonthrptdtl::instance()->mylists($query_struct);
     foreach ($dataList as $key => $value) {
         $dataList[$key]['urlbase'] = $this->getUrlBaseByTicketType($dataList[$key]['ticket_type']);
         if ($value['ticket_type'] != 0 && $value['ticket_type'] != 99) {
             $dataList[$key]['ticket_type'] = $ticket_type[$value['ticket_type']];
         } else {
             $dataList[$key]['ticket_type'] = '';
         }
         foreach ($value as $k => $v) {
             if (!is_numeric($v) && empty($v)) {
                 $dataList[$key][$k] = '无';
             }
         }
     }
     $this->template->content = new View("distribution/settle_month_dtl_rpt");
     $this->template->content->data = $dataList;
     $this->template->content->ticket_type = $ticket_type;
     $this->template->content->today = date("Y-m-d", time());
     $this->template->content->yesterday = date("Y-m-d", time() - 24 * 3600);
 }
Exemplo n.º 13
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;
 }
Exemplo n.º 14
0
 public function index()
 {
     $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(), 'like' => array(), 'orderby' => $orderby, 'limit' => array('per_page' => $per_page, 'offset' => 0));
     $faq = Myfaq::instance();
     $total = $faq->count($query_struct);
     $this->pagination = new Pagination(array('base_url' => url::current(), 'uri_segment' => 'page', 'total_items' => $total, 'items_per_page' => $per_page, 'style' => 'digg'));
     $faqs = $faq->lists($query_struct);
     $this->template->content = new View("site/faq_list");
     $this->template->content->data = $faqs;
     $this->template->content->title = "site faq list";
 }
Exemplo n.º 15
0
 public function index()
 {
     // 初始化默认查询条件
     $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('order' => 'ASC'), 3 => array('order' => 'DESC'), 4 => array('parent_id' => 'ASC'), 5 => array('parent_id' => 'DESC'), 6 => array('memo' => 'ASC'), 7 => array('memo' => 'DESC'));
     $orderby = controller_tool::orderby($orderby_arr);
     $query_struct = array('where' => array(), 'orderby' => $orderby);
     $site_menu = Mysite_menu::instance();
     $total = $site_menu->count($query_struct);
     $site_menus = $site_menu->lists($query_struct);
     $data = $site_menus;
     foreach ($site_menus as $key => $val) {
         $data[$key]['parent_name'] = Mysite_menu::instance($val['parent_id'])->get('name');
     }
     $this->template->content = new View("site/site_menu_list");
     $this->template->content->data = $data;
     $this->template->content->total = $total;
 }
Exemplo n.º 16
0
 /**
  * 菜单列表
  */
 public function index()
 {
     $orderby_arr = array(0 => array('order' => 'DESC'), 1 => array('order' => 'ASC'));
     $orderby = controller_tool::orderby($orderby_arr);
     $this->template->content = new View("manage/menu_list");
     $menus = Mymenu::instance()->menus(0, $orderby);
     foreach ($menus as $key => $value) {
         $menus[$key]['action_name'] = Myaction::instance($value['action_id'])->get('name');
     }
     foreach ($menus as $key => $value) {
         foreach ($value as $k => $v) {
             if (!is_numeric($v) && empty($v)) {
                 $menus[$key][$k] = 'NULL';
             }
         }
     }
     $this->template->content->menus = $menus;
 }
Exemplo n.º 17
0
 public function index()
 {
     $settlemonthrptDao = Mysettlelog::instance();
     $settlecls = Kohana::config('settle.settlecls');
     $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));
     /**
      * 搜索
      */
     $search_arr = array('settlecls', 'date_begin', 'date_end');
     foreach ($this->input->get() as $key => $value) {
         if (in_array($key, $search_arr)) {
             if ($key == 'date_begin') {
                 $query_struct['where']["date_add >"] = $value . ' 00:00:00';
             } elseif ($key == 'date_end') {
                 $query_struct['where']["date_add <"] = $value . ' 24:00:00';
             } elseif ($key == 'settlecls' && !empty($value)) {
                 $query_struct['like']["actname"] = $value;
             } elseif (!empty($value)) {
                 $query_struct['where'][$key] = $value;
             }
         }
     }
     $total = $settlemonthrptDao->count_itmes();
     $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;
     $dataList = Mysettlelog::instance()->lists($query_struct);
     foreach ($dataList as $key => $value) {
         $dataList[$key]['actname'] = $settlecls[$value['actname']];
         foreach ($value as $k => $v) {
             if (!is_numeric($v) && empty($v)) {
                 $dataList[$key][$k] = '无';
             }
         }
     }
     $this->template->content = new View("distribution/settle_log");
     $this->template->content->data = $dataList;
     $this->template->content->settlecls = $settlecls;
     $this->template->content->today = date("Y-m-d", time());
     $this->template->content->yesterday = date("Y-m-d", time() - 24 * 3600);
 }
Exemplo n.º 18
0
 public function index()
 {
     //权限验证
     role::check('manage_payment_type');
     $this->template->content = new View("manage/payment_type_list");
     //搜索功能
     $search_arr = array('id');
     $where = array();
     $where_view = array();
     //列表排序
     $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('name' => 'ASC'), 3 => array('name' => 'DESC'), 4 => array('image_url' => 'ASC'), 5 => array('image_url' => 'DESC'), 6 => array('driver' => 'ASC'), 7 => array('driver' => 'DESC'), 8 => array('submit_url' => 'ASC'), 9 => array('submit_url' => 'DESC'));
     $orderby = controller_tool::orderby($orderby_arr);
     //每页显示条数
     $per_page = 100;
     //调用分页
     $this->pagination = new Pagination(array('total_items' => 100, 'items_per_page' => $per_page));
     //调用列表
     $this->template->content->payment_type_list = Mypayment_type::instance()->payment_types($where, $orderby, $per_page, $this->pagination->sql_offset);
 }
Exemplo n.º 19
0
 public function index($userId)
 {
     //权限验证
     role::check('distribution_system_manage');
     if (!$userId) {
         remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
     }
     $aUser = $this->userDao->get_by_id($userId);
     $aAgent = $this->agentDao->get_by_user_id($userId);
     if ($aAgent == null) {
         remind::set(Kohana::lang('o_agent.agent_not_exists'), request::referrer(), 'error');
         return;
     }
     //排序
     $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));
     $query_struct['where']['agentid'] = $aAgent['user_id'];
     //搜索
     $search_arr = array('users.lastname', 'users.real_name', 'users.email', 'users.mobile', 'users.ip');
     $searchBox = array('search_key' => null, 'search_value' => null);
     $searchBox['search_key'] = $this->input->get('search_key');
     $searchBox['search_value'] = $this->input->get('search_value');
     if (in_array($searchBox['search_key'], $search_arr)) {
         if ($searchBox['search_key'] == 'ip') {
             $query_struct['like'][$value] = tool::myip2long($value);
         } elseif (!empty($searchBox['search_value'])) {
             //				$query_struct['where'][$key] = $value;
             $query_struct['like'][$searchBox['search_key']] = $searchBox['search_value'];
         }
     }
     $total = $this->relationDao->count_agent_client($aAgent['user_id']);
     $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;
     $dataList = $this->relationDao->mylists($query_struct);
     $this->template->content = new View("distribution/agent_client_list");
     $this->template->content->theUser = $aUser;
     $this->template->content->theAgent = $aAgent;
     $this->template->content->searchBox = $searchBox;
     $this->template->content->dataList = $dataList;
 }
Exemplo n.º 20
0
 public function index()
 {
     //权限验证
     role::check('manage_payment');
     $this->template->content = new View("manage/payment_list");
     //搜索功能
     $search_arr = array('id');
     $where = array();
     $where_view = array();
     $where['manager_id'] = role::root_manager_id();
     //列表排序
     $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('payment_type_id' => 'ASC'), 3 => array('payment_type_id' => 'DESC'), 4 => array('account' => 'ASC'), 5 => array('account' => 'DESC'), 6 => array('position' => 'ASC'), 7 => array('position' => 'DESC'), 8 => array('active' => 'ASC'), 9 => array('active' => 'DESC'));
     $orderby = controller_tool::orderby($orderby_arr);
     //每页显示条数
     $per_page = controller_tool::per_page();
     //调用分页
     $this->pagination = new Pagination(array('total_items' => Mypayment::instance()->count($where), 'items_per_page' => $per_page));
     //调用列表
     $this->template->content->payment_list = Mypayment::instance()->payments($where, $orderby, $per_page, $this->pagination->sql_offset);
 }
Exemplo n.º 21
0
 public function index()
 {
     $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->agentDao->count_agents();
     $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;
     $agentList = $this->agentDao->lists($query_struct);
     foreach ($agentList as $index => $aAgent) {
         if ($aAgent['agent_type'] == 12) {
             $relationQuery = array('user_id' => $aAgent['user_id']);
             $theRelationList = $this->relationDao->lists($relationQuery);
             $agentList[$index]['relation'] = $theRelationList[0];
         }
     }
     $this->template->content = new View("distribution/agent_list");
     $this->template->content->data = $agentList;
 }
Exemplo n.º 22
0
 public function index()
 {
     // 初始化国家结构体
     $country_query_struct = array('where' => array(), 'orderby' => array('id' => 'DESC'));
     $this->template->content = new View("site/country_manage_list");
     //列表排序
     $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('iso_code' => 'ASC'), 3 => array('iso_code' => 'DESC'), 4 => array('name' => 'ASC'), 5 => array('name' => 'DESC'), 6 => array('name_manage' => 'ASC'), 7 => array('name_manage' => 'DESC'), 8 => array('position' => 'ASC'), 9 => array('position' => 'DESC'));
     $orderby = controller_tool::orderby($orderby_arr);
     if (isset($orderby) && !empty($orderby)) {
         $country_query_struct['orderby'] = $orderby;
     }
     //每页显示条数
     $per_page = controller_tool::per_page();
     $country_query_struct['limit']['per_page'] = $per_page;
     //调用分页
     $this->pagination = new Pagination(array('total_items' => Mycountry::instance()->query_count($country_query_struct), 'items_per_page' => $per_page));
     $country_query_struct['limit']['offset'] = $this->pagination->sql_offset;
     //调用列表
     $this->template->content->country_list = Mycountry::instance()->query_assoc($country_query_struct);
 }
Exemplo n.º 23
0
 /**
  * 商户留言列表
  */
 public function index()
 {
     $request_data = $this->input->get();
     $message_service = MessageService::get_instance();
     $true = FALSE;
     //判断用户的角色是不是管理员
     if ($this->manager_is_admin == 1) {
         $true = TRUE;
     }
     //初始化请求结构体
     $query_struct = array('where' => array(), 'like' => array(), 'orderby' => array('id' => 'DESC'), 'limit' => array('per_page' => 20, 'offset' => 0));
     if ($true != TRUE) {
         $query_struct['where']['manager_id'] = $this->manager_id;
     }
     //列表排序
     $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('manager_id' => 'ASC'), 3 => array('manager_id' => 'DESC'), 4 => array('status' => 'ASC'), 5 => array('status' => 'DESC'), 6 => array('title' => 'ASC'), 7 => array('title' => 'DESC'), 8 => array('email' => 'ASC'), 9 => array('email' => 'DESC'), 10 => array('create_timestamp' => 'ASC'), 11 => array('create_timestamp' => 'DESC'), 12 => array('ip' => 'ASC'), 13 => array('ip' => 'DESC'), 14 => array('is_reply' => 'ASC'), 15 => array('is_reply' => 'DESC'));
     // 排序处理
     $orderby = controller_tool::orderby($orderby_arr);
     if (isset($orderby) && !empty($orderby)) {
         $query_struct['orderby'] = $orderby;
     }
     // 每页条目数
     controller_tool::request_per_page($query_struct, $request_data);
     $count = $message_service->query_count($query_struct);
     // 模板输出 分页
     $this->pagination = new Pagination(array('total_items' => $count, 'items_per_page' => $query_struct['limit']['per_page']));
     $query_struct['limit']['offset'] = $this->pagination->sql_offset;
     $query_struct['limit']['page'] = $this->pagination->current_page;
     if ($true === TRUE) {
         $messages = $message_service->messages($query_struct);
         $this->template->content = new View("manage/message_manage_list");
         $this->template->content->messages = $messages;
         $this->template->content->count = $count;
     } else {
         $messages = $message_service->get_message_reply_by_site_manage_role($query_struct);
         $this->template->content = new View("manage/message_list");
         $this->template->content->messages = $messages;
         $this->template->content->count = $count;
     }
 }
Exemplo n.º 24
0
 public function user_handsel_list($id = '')
 {
     $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);
     /* 初始化默认查询条件 */
     if (empty($id)) {
         $user_query_struct = array('where' => array('check_status' => 2), 'orderby' => $orderby, 'limit' => array('per_page' => $per_page, 'offset' => 0));
     } else {
         $user_query_struct = array('where' => array('check_status' => 3), 'orderby' => $orderby, 'limit' => array('per_page' => $per_page, 'offset' => 0));
     }
     $user_handsel_list = Myuser::instance();
     $total = $user_handsel_list->count($user_query_struct);
     $this->pagination = new Pagination(array('base_url' => url::current(), 'uri_segment' => 'page', 'total_items' => $total, 'items_per_page' => $per_page, 'style' => 'digg'));
     $user_query_struct['limit']['offset'] = $this->pagination->sql_offset;
     $user_handsel_list = Myuser::instance();
     $user_list = $user_handsel_list->lists($user_query_struct);
     $this->template->content = new View("handsel/user_handsel_list");
     $this->template->content->user_list = $user_list;
     $this->template->content->total = $total;
     $this->template->content->title = "site news list";
 }
Exemplo n.º 25
0
 public function index()
 {
     $request_data = $this->input->get();
     $delivery_service = DeliveryService::get_instance();
     //初始化请求结构体
     $query_struct = array('where' => array(), 'like' => array(), 'orderby' => array('id' => 'DESC'), 'limit' => array('per_page' => 20, 'offset' => 0));
     //列表排序
     $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('url' => 'ASC'), 3 => array('url' => 'DESC'), 4 => array('name' => 'ASC'), 5 => array('name' => 'DESC'), 6 => array('position' => 'ASC'), 7 => array('position' => 'DESC'), 8 => array('delay' => 'ASC'), 9 => array('delay' => 'DESC'), 10 => array('active' => 'ASC'), 11 => array('active' => 'DESC'), 12 => array('type' => 'ASC'), 13 => array('type' => 'DESC'), 14 => array('is_default' => 'ASC'), 15 => array('is_default' => 'DESC'));
     $orderby = controller_tool::orderby($orderby_arr);
     if (isset($orderby) && !empty($orderby)) {
         $query_struct['orderby'] = $orderby;
     }
     // 每页条目数
     controller_tool::request_per_page($query_struct, $request_data);
     $count = $delivery_service->query_count($query_struct);
     // 模板输出 分页
     $this->pagination = new Pagination(array('total_items' => $count, 'items_per_page' => $query_struct['limit']['per_page']));
     $query_struct['limit']['offset'] = $this->pagination->sql_offset;
     $query_struct['limit']['page'] = $this->pagination->current_page;
     //调用列表
     $deliveries = $delivery_service->query_assoc($query_struct);
     $this->template->content = new View("site/delivery_cn_list");
     $this->template->content->deliveries = $deliveries;
 }
Exemplo n.º 26
0
 /**
  * 数据列表
  */
 public function index()
 {
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     $return_data = array();
     $request_data = $this->input->get();
     /* 初始化默认查询结构体 */
     $query_struct_default = array('like' => array(), 'orderby' => array('id' => 'DESC'), 'limit' => array('per_page' => 20, 'page' => 1));
     /* 初始化当前查询结构体 */
     $query_struct_current = array();
     //* 设置合并默认查询条件到当前查询结构体 */
     $query_struct_current = array_merge($query_struct_current, $query_struct_default);
     //列表排序
     $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('type' => 'ASC'), 3 => array('type' => 'DESC'), 4 => array('version' => 'ASC'), 5 => array('version' => 'DESC'), 6 => array('agent_detail' => 'ASC'), 7 => array('agent_detail' => 'DESC'), 8 => array('ip' => 'ASC'), 9 => array('ip' => 'DESC'), 10 => array('date_add' => 'ASC'), 11 => array('date_add' => 'DESC'), 12 => array('date_upd' => 'ASC'), 13 => array('date_upd' => 'DESC'), 14 => array('quantity' => 'ASC'), 15 => array('quantity' => 'DESC'));
     $orderby = controller_tool::orderby($orderby_arr);
     // 排序处理
     if (isset($request_data['orderby']) && is_numeric($request_data['orderby'])) {
         $query_struct_current['orderby'] = $orderby;
     }
     // 每页条目数
     controller_tool::request_per_page($query_struct_current, $request_data);
     //调用服务执行查询
     $kc_browser_stat = Mykc_browser_stat::instance();
     $count = $kc_browser_stat->count($query_struct_current);
     // 模板输出 分页
     $this->pagination = new Pagination(array('total_items' => $count, 'items_per_page' => $query_struct_current['limit']['per_page']));
     $query_struct_current['limit']['page'] = $this->pagination->current_page;
     $return_data['list'] = Mykc_browser_stat::instance()->lists($query_struct_current);
     $return_struct['content'] = $return_data;
     $content = new View($this->class_name . '_' . __FUNCTION__);
     /* 变量绑定 */
     $this->template->title = '浏览器详细信息';
     $this->template->content = $content;
     $this->template->content->request_data = $request_data;
     /* 返回结构体绑定 */
     $this->template->content->return_struct = $return_struct;
 }
Exemplo n.º 27
0
 /**
  * 订单列表
  */
 public function index($status = NULL)
 {
     $time_expired = 60 * 60 * 2;
     //将要过期时间
     $time_delay = 5 * 60;
     //过期延迟显示时间
     //$mklasttime = mktime(date("H"), date("i"), date("s"), date("m"), date("d")-5, date("Y"));
     //$last_time = date('Y-m-d H:i:s', $mklasttime);
     //初始化默认查询结构体
     $query_struct_default = array('where' => array(), 'orderby' => array('id' => 'DESC'), 'limit' => array('per_page' => 10, 'page' => 1));
     if (!empty($status)) {
         switch ($status) {
             case 'hasbuy':
                 $query_struct_default['where']['status'] = 0;
                 break;
             case 'noprint':
                 $query_struct_default['where']['status'] = 1;
                 break;
             case 'beexpired':
                 $query_struct_default['where']['date_end <'] = date("Y-m-d H:i:s", time() + $time_expired);
                 //当离方案截止时间小于2小时时为将要到期
                 $query_struct_default['where']['date_end >'] = tool::get_date();
                 break;
             case 'hasexpired':
                 $query_struct_default['where']['date_end <'] = date("Y-m-d H:i:s", time() + $time_delay);
                 $query_struct_default['where']['status'] = array(0);
                 break;
             case 'hasprint':
                 $query_struct_default['where']['status'] = 2;
                 break;
             case 'nobonus':
                 $query_struct_default['where']['status'] = 3;
                 break;
             case 'hasbonus':
                 $query_struct_default['where']['status'] = 4;
                 break;
             case 'givehonus':
                 $query_struct_default['where']['status'] = 5;
                 break;
             case 'cancel':
                 $query_struct_default['where']['status'] = 6;
                 break;
             default:
         }
     }
     //d($query_struct_default);
     /* 搜索功能 */
     $search_arr = array('id', 'order_num', 'username');
     $search_value = $this->input->get('search_value');
     $search_type = $this->input->get('search_type');
     $where_view = array();
     //$query_struct_default['where']['date_end >='] = tool::get_date();
     if (strlen($this->input->get('start_time')) > 0) {
         $query_struct_default['where']['date_add >='] = $this->input->get('start_time') . ' 00:00:00';
         $where_view['start_time'] = $this->input->get('start_time');
     }
     if (strlen($this->input->get('end_time')) > 0) {
         $query_struct_default['where']['date_add <='] = $this->input->get('end_time') . ' 00:00:00';
         $where_view['end_time'] = $this->input->get('end_time');
     }
     if ($search_arr) {
         foreach ($search_arr as $value) {
             if ($search_type == $value && strlen($search_value) > 0) {
                 if ($value == 'lastname') {
                     $userobj = user::get_instance();
                     $userinfo = $userobj->get_search($search_value);
                     $userid = $userinfo['id'];
                     $query_struct_default['where']['start_user_id'] = $userid;
                     $query_struct_default['where']['user_id'] = $userid;
                 } else {
                     $query_struct_default['like'][$value] = $search_value;
                 }
             }
         }
         $where_view['search_type'] = $search_type;
         $where_view['search_value'] = $search_value;
     }
     $request_data = $this->input->get();
     //初始化当前查询结构体
     $query_struct_current = array();
     //设置合并默认查询条件到当前查询结构体
     $query_struct_current = array_merge($query_struct_current, $query_struct_default);
     //列表排序
     $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'));
     $orderby = controller_tool::orderby($orderby_arr);
     // 排序处理
     if (isset($request_data['orderby']) && is_numeric($request_data['orderby'])) {
         $query_struct_current['orderby'] = $orderby;
     }
     $query_struct_current['orderby'] = $orderby;
     //每页条目数
     controller_tool::request_per_page($query_struct_current, $request_data);
     //调用服务执行查询
     $return_data['count'] = $this->order_basic_obj->count($query_struct_current);
     //统计数量
     /* 调用分页 */
     $this->pagination = new Pagination(array('total_items' => $return_data['count'], 'items_per_page' => $query_struct_current['limit']['per_page']));
     $query_struct_current['limit']['page'] = $this->pagination->current_page;
     $return_data['list'] = $this->order_basic_obj->query_assoc($query_struct_current);
     //$return_data['ticket_type'] = Kohana::config('ticket_type');
     /* $planobj = plan::get_instance();
     
             $i = 0;
             foreach ($return_data['list'] as $rowlist)
             {
                 $planobj->get_result($return_data['list'][$i]);
                 if(empty($return_data['list'][$i]['detail'])) {
                     unset($return_data['list'][$i]);
                 }
                 $i++;
             }
             //d($return_data['list']);
     
             $return_data['status'] = $status;
             $return_data['time_expired'] = $time_expired;
     
             //d($return_data['list']);
     
             $return_data['site_config'] = Kohana::config('site_config.site');
             $host = $_SERVER['HTTP_HOST'];
             $dis_site_config = Kohana::config('distribution_site_config');
             if (array_key_exists($host, $dis_site_config) == true && isset($dis_site_config[$host])) {
             	$return_data['site_config']['site_title'] = $dis_site_config[$host]['site_name'];
             	$return_data['site_config']['keywords'] = $dis_site_config[$host]['keywords'];
             	$return_data['site_config']['description'] = $dis_site_config[$host]['description'];
             }
      */
     $this->template->content = new View("order/order_index", $return_data);
     $this->template->content->where = $where_view;
 }
Exemplo n.º 28
0
 /**
  * 评论列表
  */
 public function index()
 {
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //$profiler = new Profiler;
         //* 初始化返回数据 */
         $return_data = array('assoc' => NULL, 'count' => 0);
         //* 收集请求数据 ==根据业务逻辑定制== */
         $request_data = $this->input->get();
         //* 初始化默认查询结构体 ==根据业务逻辑定制== */
         $request_struct_default = array('type' => NULL, 'keyword' => NULL);
         //* 初始化请求结构体 */
         $request_struct_current = array();
         //* 设置合并默认请求结构数据到当前请求结构体 */
         $request_struct_current = array_merge($request_struct_current, $request_struct_default);
         //* 初始化默认查询结构体 ==根据业务逻辑定制== */
         $query_struct_default = array('where' => array(), 'like' => array(), 'orderby' => array('id' => 'DESC'), 'limit' => array('per_page' => Kohana::config('my.items_per_page'), 'page' => 1));
         //* 初始化当前查询结构体 */
         $query_struct_current = array();
         $product_all_ids = array();
         $product_get_ids = array();
         $product_id = 0;
         //* 设置合并默认查询条件到当前查询结构体 */
         $query_struct_current = array_merge($query_struct_current, $query_struct_default);
         $data = ProductcommentService::get_instance()->index($query_struct_current);
         //d($query_struct_current,1);d($data);
         foreach ($data as $key => $val) {
             if (isset($product_all_ids[$val['product_id']])) {
                 unset($data[$key]);
             } else {
                 $product_all_ids[$val['product_id']] = $val['product_id'];
             }
         }
         if (isset($request_data['status']) and in_array(trim($request_data['status']), array(ProductcommentService::COMMENT_EXAMINE_FALSE, ProductcommentService::COMMENT_EXAMINE_TRUE, ProductcommentService::COMMENT_NOT_EXAMINE))) {
             $query_struct_current['where']['status'] = trim($request_data['status']);
         }
         //* 当前支持的查询业务逻辑 ==根据业务逻辑定制== */
         if (isset($request_data['type']) && isset($request_data['keyword']) && !empty($request_data['keyword'])) {
             switch ($request_data['type']) {
                 case 'sku':
                     $products = ProductService::get_instance()->query_assoc(array('like' => array('sku' => trim($request_data['keyword']))));
                     if (empty($products)) {
                         $product_id = 0;
                     } else {
                         foreach ($products as $val) {
                             if (in_array($val['id'], $product_all_ids)) {
                                 $product_get_ids[$val['id']] = $val['id'];
                             }
                         }
                     }
                     if (is_array($product_get_ids) && count($product_get_ids) > 0) {
                         $query_struct_current['where']['product_id'] = $product_get_ids;
                     } else {
                         $query_struct_current['where']['product_id'] = $product_id;
                     }
                     $request_struct_current['keyword'] = trim($request_data['keyword']);
                     break;
                 case 'mail':
                     $query_struct_current['like'][$request_data['type']] = trim($request_data['keyword']);
                     $request_struct_current['keyword'] = $query_struct_current['like'][$request_data['type']];
                     /*
                                             $query_struct_current['where'][$request_data['type']] = trim($request_data['keyword']);
                                             $request_struct_current['keyword'] = $query_struct_current['where'][$request_data['type']];
                     */
                     break;
             }
             $request_struct_current['type'] = $request_data['type'];
         }
         //列表排序
         $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 4 => array('status' => 'ASC'), 5 => array('status' => 'DESC'), 6 => array('product_id' => 'ASC'), 7 => array('product_id' => 'DESC'), 8 => array('user_id' => 'ASC'), 9 => array('user_id' => 'DESC'), 10 => array('mail' => 'ASC'), 11 => array('mail' => 'DESC'), 12 => array('grade' => 'ASC'), 13 => array('grade' => 'DESC'), 14 => array('create_timestamp' => 'ASC'), 15 => array('create_timestamp' => 'DESC'), 16 => array('ip' => 'ASC'), 17 => array('ip' => 'DESC'));
         $orderby = controller_tool::orderby($orderby_arr);
         // 排序处理
         if (isset($request_data['orderby']) && is_numeric($request_data['orderby'])) {
             $query_struct_current['orderby'] = $orderby;
         }
         //设定默认分页
         $preset_perpages = Kohana::config('my.items_per_pages');
         if (isset($request_data['per_page']) && !empty($request_data['per_page'])) {
             $query_struct_current['limit']['per_page'] = $request_data['per_page'];
         }
         $request_struct_current['per_page'] = $query_struct_current['limit']['per_page'];
         if (isset($request_data['page']) && !empty($request_data['page']) && is_numeric($request_data['page']) && $request_data['page'] > 0) {
             $query_struct_current['limit']['page'] = $request_data['page'];
         }
         $request_struct_current['page'] = $query_struct_current['limit']['page'];
         try {
             //* 调用后端服务获取数据 */
             $comment_service = ProductcommentService::get_instance();
             //查询
             $return_data['assoc'] = $comment_service->index($query_struct_current);
             $return_data['count'] = $comment_service->count($query_struct_current);
             $product_ids = array();
             $user_ids = array();
             foreach ($return_data['assoc'] as $comment) {
                 if (!empty($comment['user_id'])) {
                     $user_ids[$comment['user_id']] = TRUE;
                 }
                 if (!empty($comment['product_id'])) {
                     $product_ids[$comment['product_id']] = TRUE;
                 }
             }
             $products = array();
             $users = array();
             if (!empty($product_ids)) {
                 foreach (ProductService::get_instance()->query_assoc(array('where' => array('id' => array_keys($product_ids)))) as $product) {
                     $products[$product['id']] = $product;
                 }
             }
             if (!empty($user_ids)) {
                 foreach (ORM::factory('user')->in('id', array_keys($user_ids))->find_all() as $user) {
                     $user = $user->as_array();
                     $users[$user['id']] = $user;
                 }
             }
             // 模板输出 分页
             $this->pagination = new Pagination(array('total_items' => $return_data['count'], 'items_per_page' => $query_struct_current['limit']['per_page']));
         } catch (MyRuntimeException $ex) {
             //* ==根据业务逻辑定制== */
             //FIXME 根据service层的异常做一些对应处理并抛出用户友好的异常Message
             throw $ex;
         }
         //* 如果是ajax请求缩减返回的字段 ==根据业务逻辑定制== */
         if ($this->is_ajax_request()) {
             $requestkeys = array('id', 'category_id', 'title', 'uri_name', 'store', 'on_sale', 'goods_price', 'sku');
             array_walk($return_data['assoc'], 'util::simplify_return_array', $requestkeys);
         }
         //* 补充&修改返回结构体 */
         $return_struct['status'] = 1;
         $return_struct['code'] = 200;
         $return_struct['msg'] = '';
         $return_struct['content'] = $return_data;
         //exit("<div id=\"do_debug\" style=\"clear:both;display:;\"><pre>\n".var_export($return_struct,TRUE)."\n</pre></div>");
         //* 请求类型 */
         if ($this->is_ajax_request()) {
             // ajax 请求
             // json 输出
             $this->template->content = $return_struct;
         } else {
             //* html 输出 ==根据业务逻辑定制== */
             //* 模板输出 */
             $this->template->return_struct = $return_struct;
             $content = new View($this->package_name . '/' . $this->class_name . '/' . __FUNCTION__);
             //* 变量绑定 */
             $this->template->title = Kohana::config('site.name');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             $this->template->content->request_struct = $request_struct_current;
             //* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
             //:: 当前应用专用数据
             $this->template->content->title = Kohana::config('site.name');
             $this->template->content->products = $products;
             $this->template->content->users = $users;
         }
     } 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;
         }
     }
 }
Exemplo n.º 29
0
 /**
  * 数据列表
  */
 public function index()
 {
     role::check('product_filter');
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //* 初始化返回数据 */
         $return_data = array();
         //* 收集请求数据 ==根据业务逻辑定制== */
         $request_data = $this->input->get();
         // 执行业务逻辑
         //* 初始化默认查询结构体 */
         $query_struct_default = array('where' => array(), 'like' => array(), 'orderby' => array('id' => 'DESC'), 'limit' => array());
         //* 初始化当前查询结构体 */
         $query_struct_current = array();
         //* 设置合并默认查询条件到当前查询结构体 */
         $query_struct_current = array_merge($query_struct_current, $query_struct_default);
         //列表排序
         $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('title' => 'ASC'), 3 => array('title' => 'DESC'), 4 => array('uri_name' => 'ASC'), 5 => array('uri_name' => 'DESC'), 6 => array('update_timestamp' => 'ASC'), 7 => array('update_timestamp' => 'DESC'), 8 => array('order' => 'ASC'), 9 => array('order' => 'DESC'));
         $orderby = controller_tool::orderby($orderby_arr);
         // 排序处理
         if (isset($request_data['orderby']) && is_numeric($request_data['orderby'])) {
             $query_struct_current['orderby'] = $orderby;
         }
         // 每页条目数
         //controller_tool::request_per_page($query_struct_current, $request_data);
         //调用服务执行查询
         $aliasfilter_service = Alias_filterService::get_instance();
         $return_data['total'] = $aliasfilter_service->count($query_struct_current);
         // 模板输出 分页
         /*
                     $this->pagination = new Pagination(array (
                         'total_items' => $count, 
                         'items_per_page' => $query_struct_current['limit']['per_page'] 
                     ));*/
         //$query_struct_current['limit']['page'] = $this->pagination->current_page;
         $result = $aliasfilter_service->index($query_struct_current);
         $return_data['list'] = array();
         if (!empty($result)) {
             foreach ($result as $key => $val) {
                 $val['create_timestamp'] = date('Y-m-d H:i:s', $val['create_timestamp']);
                 $val['update_timestamp'] = date('Y-m-d H:i:s', $val['update_timestamp']);
                 $return_data['list'][$val['id']] = $val;
             }
         }
         //* 补充&修改返回结构体 */
         $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 {
             // html 输出
             //* 模板输出 */
             $content = new View('product/' . $this->class_name . '/' . __FUNCTION__);
             //* 变量绑定 */
             $this->template->title = '别名过滤器管理';
             $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) {
         $this->_ex($ex, $return_struct, $request_data);
     }
 }
Exemplo n.º 30
0
 /**
  * 数据列表
  */
 public function index()
 {
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //* 初始化返回数据 */
         $return_data = array('site_list' => array(), 'list' => array());
         //* 收集请求数据 ==根据业务逻辑定制== */
         $request_data = $this->input->get();
         //* 权限验证 */
         $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);
         // 执行业务逻辑
         //* 初始化默认查询结构体 */
         $query_struct_default = array('where' => array('site_id' => $site_id), 'like' => array(), 'orderby' => array('id' => 'DESC'), 'limit' => array('per_page' => 20, 'page' => 1));
         //* 初始化当前查询结构体 */
         $query_struct_current = array();
         //* 设置合并默认查询条件到当前查询结构体 */
         $query_struct_current = array_merge($query_struct_current, $query_struct_default);
         //列表排序
         $orderby_arr = array(0 => array('id' => 'ASC'), 1 => array('id' => 'DESC'), 2 => array('name' => 'ASC'), 3 => array('name' => 'DESC'), 4 => array('update_timestamp' => 'ASC'), 5 => array('update_timestamp' => 'DESC'), 6 => array('position' => 'ASC'), 7 => array('position' => 'DESC'));
         $orderby = controller_tool::orderby($orderby_arr);
         // 排序处理
         if (isset($request_data['orderby']) && is_numeric($request_data['orderby'])) {
             $query_struct_current['orderby'] = $orderby;
         }
         // 每页条目数
         controller_tool::request_per_page($query_struct_current, $request_data);
         //调用服务执行查询
         $inquieysubject_service = InquirysubjectService::get_instance();
         $count = $inquieysubject_service->count($query_struct_current);
         // 模板输出 分页
         $this->pagination = new Pagination(array('total_items' => $count, 'items_per_page' => $query_struct_current['limit']['per_page']));
         $query_struct_current['limit']['page'] = $this->pagination->current_page;
         $return_data['list'] = $inquieysubject_service->index($query_struct_current);
         //* 补充&修改返回结构体 */
         $return_struct['status'] = 1;
         $return_struct['code'] = 200;
         $return_struct['msg'] = '';
         $return_struct['content'] = $return_data;
         //* 请求类型 */
         if ($this->is_ajax_request()) {
             $this->template->content = $return_struct;
         } else {
             // html 输出
             //* 模板输出 */
             $content = new View($this->package . '/' . $this->class_name . '/' . __FUNCTION__);
             //* 变量绑定 */
             $this->template->title = '商品咨询主题管理';
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             //* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
             //:: 当前应用专用数据
             $this->template->content->site_id = $site_id;
         }
         // 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;
         }
     }
 }