Browse Source

上传数据

lvhao 11 hours ago
parent
commit
f3d3bebe5b

+ 126 - 0
core/CoreApp/controllers/Scanimgs.php

@@ -0,0 +1,126 @@
+<?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'>";
+                    }
+                    
+                    $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){
+
+    }
+}

+ 11 - 0
core/CoreApp/models/Model_scanimgs.php

@@ -0,0 +1,11 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 
+class Model_scanimgs extends Lin_Model 
+{
+	function __construct(){
+        parent::__construct();
+        $this->load->database();
+        $this->table = 'scanimgs';
+        $this->load_table('scanimgs');
+    }
+	
+}  //end class

+ 57 - 0
template/erp/scanimgs.html

@@ -0,0 +1,57 @@
+{Template header}
+<body>
+<div class="warp">
+<div class="fixed">
+<ul class="search">
+    <li>
+        所属店铺:<select name="shop" class="select" >
+        <option value="">请选择</option>
+        <option value="0">不确定</option>
+        {loop usershop() as $val}
+        <option value="{$val['id']}">{$val['shopname']}</option>
+        {/loop}</select>
+        </li>
+<li>订单编号:<input value="" name="number" type="text"  ></li>
+
+<li>最后扫描时间:
+<li><input id="timetk"  value="{date('Y-m-d',time()-30*3*24*3600)} 0:00" name="timetk" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})"  style="width:110px !important;">
+至&nbsp;&nbsp;&nbsp;&nbsp; <input id="timetj" value="{date('Y-m-d',time()+24*3600)} 0:00" name="timetj" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})"   style="width:110px !important;"></li>
+<li><span>确 定</span></li>
+</ul>
+
+<table class="datatitle data" border="0" style="border-collapse:collapse;">
+<tr>
+<td><label onClick="swapCheck()"><input name="checkbox" type="checkbox" class="regular-checkbox"></label></td>
+<td>编号</td>
+<td>所属店铺</td>
+<td>扫描信息</td>
+<td>添加时间</td>
+<td>更新时间</td>
+</tr>
+</table>
+</div>
+<table class="datatext data" border="0" style="border-collapse:collapse;">
+</table>
+<div class="bomf"></div>
+</div>
+<script>
+var dataurl = "/scanimgs/data/";
+var editurl = "/scanimgs/detail/";
+var editdj = 1;
+var editt = "详情";
+var customon = 1;
+function custom(){
+    $(".data tr").each(function() {
+        $(this).find('td:eq(0)').css("width","1%");
+        $(this).find('td:eq(1)').css("width","10%");
+        $(this).find('td:eq(2)').css("width","10%");
+        $(this).find('td:eq(3)').css("width","50%");
+        $(this).find('td:eq(4)').css("width","10%");
+        $(this).find('td:eq(5)').css("width","10%");
+    });
+}
+
+</script>
+<script type="text/javascript" src="{$theme}js/laydate.js"></script>
+<script type="text/javascript" src="{$theme}js/excel/xlxs.js" ></script>
+{Template footer}