当前位置: 首页>>代码示例>>PHP>>正文


PHP CommonModel::get_list方法代码示例

本文整理汇总了PHP中CommonModel::get_list方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonModel::get_list方法的具体用法?PHP CommonModel::get_list怎么用?PHP CommonModel::get_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CommonModel的用法示例。


在下文中一共展示了CommonModel::get_list方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: batch_delete

 /**
  * @description 批量删除产品分类
  * @author
  * @final
  * @param array $ids 产品分类id
  */
 public function batch_delete()
 {
     if (!$this->check_power_new('production_category_batch_delete')) {
         return;
     }
     $ids = $this->input->post('ids');
     if (empty($ids) or !is_array($ids)) {
         message('请选择要删除的项目!');
         return;
     }
     // 检查被关联试题
     $success = $fail = 0;
     foreach ($ids as $id) {
         $pc_id = intval($id);
         $bool = true;
         $pc_ids = CommonModel::get_product_category($pc_id);
         if (empty($pc_ids)) {
             $bool = false;
         }
         $query = array();
         $data = array();
         $query['pc_id'] = $pc_id;
         $res = CommonModel::get_list($query, 'v_trans_log', 'count(pt_id) as pt_id_count');
         $pt_id_count = $res[0]['pt_id_count'];
         if ($pt_id_count > 0) {
             $bool = false;
         }
         if (!$bool) {
             $fail++;
             continue;
         }
         $num = Fn::db()->delete('rd_product_category', "pc_id={$pc_id}");
         admin_log('delete', 'product_category', $pc_id);
         if ($num > 0) {
             $success += $num;
         } else {
             $fail++;
         }
     }
     message('批量操作完成,成功删除:' . $success . ' 个,失败:' . $fail . ' 个。', 'javascript');
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:47,代码来源:production_category.php

示例2: batch_delete

 /**
  * @description 批量删除产品信息
  * @author
  * @final
  * @param array $ids 产品id
  */
 public function batch_delete()
 {
     if (!$this->check_power_new('production_batch_delete')) {
         return;
     }
     $ids = $this->input->post('ids');
     if (empty($ids) or !is_array($ids)) {
         message('请选择要删除的项目!');
         return;
     }
     // 检查被关联试题
     $success = $fail = 0;
     foreach ($ids as $id) {
         $p_id = intval($id);
         $p_ids = CommonModel::get_product_list($p_id);
         $bool = true;
         if (empty($p_ids)) {
             $bool = false;
         }
         $admin = $this->session->userdata('admin_id');
         /*
                     $managers = explode(',',$p_ids['p_managers']);
                     if(!in_array($admin, $managers)&&!$this->check_power_new('production_del'))
                     {
            $bool = false;
                     }
         */
         $query = array();
         $query['p_id'] = $p_id;
         $res = CommonModel::get_list($query, 'v_trans_log_count', 'pt_id_count');
         $pt_id_count = $res[0]['pt_id_count'];
         if ($pt_id_count > 0) {
             $bool = false;
         }
         if (!$bool) {
             $fail++;
             continue;
         }
         $num = Fn::db()->delete('rd_product', "p_id={$p_id}");
         admin_log('delete', 'product', $p_id);
         if ($num > 0) {
             $success += $num;
         } else {
             $fail++;
         }
     }
     $back_url = 'admin/prodution/index/';
     message('批量操作完成,成功删除:' . $success . ' 个,失败:' . $fail . ' 个。', 'javascript');
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:55,代码来源:production.php

示例3: info_check

 /**
  * 学生报名信息核对
  */
 public function info_check()
 {
     if ($this->input->post('grade_id')) {
         $this->load->library('PHPExcel');
         $this->load->library('PHPExcel/IOFactory');
         $grade_id = intval($this->input->post('grade_id'));
         $school_id = intval($this->input->post('school_id'));
         if (!$grade_id) {
             message('请选择年级');
         }
         if (!$school_id) {
             message('请选择学校');
         }
         $file = $_FILES['infos']['name'];
         $desc = '../../cache/excel/' . $file;
         $tmp_name = $_FILES['infos']['tmp_name'];
         $extend = strrchr($file, '.');
         if (!in_array($extend, array('.xlsx', '.xls'))) {
             message('文件类型不合法');
         }
         if (!move_uploaded_file($tmp_name, $desc)) {
             message('文件移动失败,请联系管理员');
         }
         $reader = new PHPExcel_Reader_Excel2007();
         $reader_type = $extend == '.xlsx' ? 'Excel2007' : 'Excel5';
         $obj = new IOFactory();
         $objreader = $obj::createReader($reader_type)->load($desc);
         $sheet = $objreader->getSheet(0);
         $allRow = $sheet->getHighestRow();
         $file2 = $file . '信息核对反馈表';
         $objexcel = new PHPExcel();
         $objexcel->setActiveSheetIndex(0)->setCellValue('A1', '姓名');
         $objexcel->setActiveSheetIndex(0)->setCellValue('B1', '学号');
         $objexcel->setActiveSheetIndex(0)->setCellValue('C1', '年级');
         $objexcel->setActiveSheetIndex(0)->setCellValue('D1', '准考证号');
         $objexcel->setActiveSheetIndex(0)->setCellValue('E1', '报名');
         $objexcel->getActiveSheet()->setTitle($file2);
         $objwriter = IOFactory::createWriter($objexcel, $reader_type);
         for ($i = 2; $i <= $allRow; $i++) {
             $arr = array();
             $student_name = $objreader->getActiveSheet()->getCell('A' . $i)->getValue();
             $student_number = $objreader->getActiveSheet()->getCell('B' . $i)->getValue();
             $student_grade = $objreader->getActiveSheet()->getCell('C' . $i)->getValue();
             $space = " ";
             $student_name = str_ireplace($space, "", $student_name);
             $count = 0;
             $objexcel->setActiveSheetIndex(0)->setCellValue('A' . $i, $student_name);
             $objexcel->setActiveSheetIndex(0)->setCellValue('B' . $i, $student_number);
             $objexcel->setActiveSheetIndex(0)->setCellValue('C' . $i, $student_grade);
             $student_search = array('school_id' => $school_id, 'grade_id' => $grade_id, 'keyword' => "CONCAT(last_name,first_name) LIKE '%" . trim($student_name) . "%'");
             $student_list = CommonModel::get_list($student_search, 'rd_student', '*');
             $number = count($student_list);
             if ($number) {
                 if ($number > 1) {
                     //2代表错误,一个学校一个年纪有多个重名学生情况
                     $objexcel->setActiveSheetIndex(0)->setCellValue('D' . $i, '报名出错了(重名情况)');
                     $objexcel->setActiveSheetIndex(0)->setCellValue('E' . $i, 2);
                 } else {
                     $student_info = array_shift($student_list);
                     $idcard = $student_info['idcard'];
                     $objexcel->setActiveSheetIndex(0)->setCellValue('D' . $i, $student_info['exam_ticket']);
                     $objexcel->setActiveSheetIndex(0)->setCellValue('E' . $i, 1);
                 }
             } else {
                 $objexcel->setActiveSheetIndex(0)->setCellValue('D' . $i, '未报名');
                 $objexcel->setActiveSheetIndex(0)->setCellValue('E' . $i, 0);
             }
         }
         $objwriter->save($desc);
         $data = array('url' => $desc, 'act' => 'update', 'name' => $file);
     } else {
         $grades = C('grades');
         $data = array('act' => 'add', 'grades' => $grades);
     }
     $this->load->view('/student/info_check', $data);
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:79,代码来源:student.php

示例4: transactionp

 /**
  * @按产品查询交易数据信息
  * @param int $p_id 产品id
  */
 public function transactionp($p_id)
 {
     if (!$this->check_power('statistics_manage')) {
         return;
     }
     $p_id = intval($p_id);
     $student = CommonModel::get_product_list($p_id);
     if (empty($student)) {
         message('信息不存在');
         return;
     }
     $admin = $this->session->userdata('admin_id');
     $managers = explode(',', $student['p_managers']);
     if (!in_array($admin, $managers) && !$this->is_super_user()) {
         message('没有管理权限');
         return;
     }
     /*
      * 基本信息
      */
     $p_id = intval($p_id);
     $student = CommonModel::get_product_list($p_id);
     if (empty($student)) {
         message('信息不存在');
         return;
     }
     $data = array();
     $data['p_id'] = $p_id;
     $data['p_name'] = $student[p_name];
     $query = array();
     $query['p_id'] = $p_id;
     $query['pt_type'] = 0;
     /* 搜索条件 */
     if (isset($_GET['begin_time']) && !empty($_GET['begin_time'])) {
         $query['pt_u_time >='] = strtotime($_GET['begin_time'] . '00:00:59');
         $search['begin_time'] = $_GET['begin_time'];
     }
     if (isset($_GET['end_time']) && !empty($_GET['end_time'])) {
         $query['pt_u_time <='] = strtotime($_GET['end_time'] . '23:59:59');
         $search['end_time'] = $_GET['end_time'];
     }
     // 公共数据
     $res = CommonModel::get_list($query, 'v_trans_log', 'count(pt_id) as pt_id_count,sum(pt_money)*(-1) as pt_money_count');
     $data['p_id_count'] = $res[0]['pt_id_count'];
     $data['p_money_count'] = !empty($res[0]['pt_money_count']) ? $res[0]['pt_money_count'] : 0;
     $total = $res[0]['pt_id_count'];
     /*
      * 分页读取数据列表,并处理相关数据
      */
     $size = 10;
     $page = isset($_GET['page']) && intval($_GET['page']) > 1 ? intval($_GET['page']) : 1;
     $offset = ($page - 1) * $size;
     $list = array();
     if ($total) {
         $res = CommonModel::get_list($query, 'v_trans_log', 'pt_id,p_name,pc_name,end_time,start_time,a_name,pt_money', $page, $size);
         foreach ($res as $row) {
             $row['start_time'] = $row['start_time'] > 0 ? date('Y-m-d H:i:s', $row['start_time']) : date('Y-m-d H:i:s', time());
             $row['end_time'] = $row['end_time'] > 0 ? date('Y-m-d H:i:s', $row['end_time']) : date('Y-m-d H:i:s', time());
             $row['p_name'] = !empty($row['p_name']) ? $row['p_name'] : '充值';
             $row['pt_money'] = !empty($row['pt_money']) ? $row['pt_money'] * -1 : '0';
             $row['pc_name'] = !empty($row['pc_name']) ? $row['pc_name'] : '充值';
             $list[] = $row;
         }
     }
     $data['list'] = $list;
     // 分页
     $purl = site_url('admin/account/transactionp/' . $p_id);
     $data['pagination'] = multipage($total, $size, $page, $purl);
     $data['search'] = $search;
     // 模版
     $this->load->view('account/transactionp', $data);
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:76,代码来源:account.php


注:本文中的CommonModel::get_list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。