Beispiel #1
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;
 }
Beispiel #2
0
 /**
  * 批量删除公告
  */
 public function batch_delete()
 {
     //初始化返回数据
     $return_data = array();
     //请求结构体
     $request_data = array();
     try {
         if ($this->manager_is_admin != 1) {
             throw new MyRuntimeException(Kohana::lang('o_global.permission_enough'), 403);
         }
         $notice_ids = $this->input->post('notice_ids');
         if (is_array($notice_ids) && count($notice_ids) > 0) {
             /* 删除失败的 */
             $failed_notice_names = '';
             /* 执行操作 */
             foreach ($notice_ids as $notice_id) {
                 if (!Mynotice::instance($notice_id)->delete()) {
                     $failed_notice_names .= ' | ' . $notice_id;
                 }
             }
             if (empty($failed_notice_names)) {
                 remind::set(Kohana::lang('o_manage.delete_notice_success'), 'manage/notice', 'success');
             } else {
                 /* 中转提示页面的停留时间 */
                 $return_struct['action']['time'] = 10;
                 $failed_notice_names = trim($failed_notice_names, ' | ');
                 remind::set(Kohana::lang('o_manage.delete_notice_error', $failed_notice_names), 'manage/notice');
                 //throw new MyRuntimeException(Kohana::lang('o_manage.delete_notice_error',$failed_notice_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;
         }
     }
 }