| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <?php defined('BASEPATH') OR exit('No direct script access allowed');
- class Scanimgs extends Start_Controller {
- public function __construct(){
- parent::__construct();
- $this->load->library('session');
- $this->load->_model("Model_scanimgs","scanimgs");
- $this->load->_model("Model_shop","shop");
- }
- private $show_url = "https://lyerposs.wepolicy.cn";
- //定义方法的调用规则 获取URI第二段值
- public function _remap($arg,$arg_array)
- {
- if($arg == 'detail')//添加
- {
- $this->_detail($arg_array);
- }
- else
- {
- $this->_index($arg_array);
- }
- }
- private function _index(){
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
- $usp = $user;
- $fgshop = "";$sid = "";
- $usersp = explode('|',trim($user['shop'],'|'));
- foreach ($usersp as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- $fgshop .= " shop = '0' or";
- if($user['vip'] == 1)
- {
- $vip = 1;
- }
- else
- {
- $vip = 0;
- }
- }
- else
- {
- $vip = 0;
- }
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['page']))
- {
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $number = $this->input->post('number',true);
- $shop = $this->input->post('shop',true);
- $timetk = $this->input->post('timetk',true);
- $timetj = $this->input->post('timetj',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "(".rtrim($fgshop,'or').")";
- if($number)
- {
- $where .= " and number = '$number'";
- }
- if($shop != '')
- {
- $where .= " and shop = '$shop'";
- }
- if($timetk && $timetj)
- {
- $where .= " and updatetime > '$timetk' and updatetime < '$timetj'";
- }
- //数据排序
- $order_str = " id desc ";
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- $info_list = $this->scanimgs->find_all($where,'*',$order_str,$start,$perpage);
- $shop_list = $this->shop->find_all();
- $shop_list =array_column($shop_list,'shopname','id');
- $final_list = [];
- foreach ($info_list as $key=>$value)
- {
- $img_str = "<div style='display:flex;flex-direction:row;flex-wrap:wrap'>";
- $img_arr = json_decode($value['imgs'],true);
- foreach ($img_arr as $k => $v) {
- $img_str .= "<div>";
- $img_str .= "<div style=''>";
- foreach($v['imgurl'] as $img){
- $img_str .= "<img src='{$this->show_url}{$img}' style='width:150px;height:auto;margin-right:3px' onclick='showBigImg(this)'/>";
- }
-
- $img_str .= "</div>";
- $img_str .= "<div>".date("Y-m-d H:i:s",$value['addtime'])."</div></div>";
- }
- $img_str .= "</div>";
- $final_list[] = [
- 'id' => $value['id'],
- 'number'=>$value['number'],
- "shop" =>isset($shop_list[$value['shop']])?$shop_list[$value['shop']]:'',
- "imgs" => $img_str,
- "addtime" => date("Y-m-d H:i:s",$value['addtime']),
- "updatetime" => date("Y-m-d H:i:s",$value['updatetime']),
- ];
- }
- $total = $this->scanimgs->find_count($where);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($final_list));
- echo json_encode($rows);exit;
- }
- $this->_Template('scanimgs',$this->data);
- }
- private function _detail($arg_array){
- }
- }
|