lvhao 1 день назад
Родитель
Сommit
5869ac7c0a
2 измененных файлов с 9 добавлено и 4 удалено
  1. 8 3
      core/CoreApp/controllers/Goodimglibrary.php
  2. 1 1
      template/erp/goodimglibrary.html

+ 8 - 3
core/CoreApp/controllers/Goodimglibrary.php

@@ -4,6 +4,7 @@ class Goodimglibrary extends Start_Controller {
 		parent::__construct();
 		$this->load->library('session');
         $this->load->_model('Model_goodimgs','goodimgs');
+        $this->load->_model('Model_goods','goods');
     }
 	private $show_url = "https://lyerposs.wepolicy.cn";	
     public function _remap($arg,$arg_array)
@@ -54,7 +55,7 @@ class Goodimglibrary extends Start_Controller {
                 $start = ($page - 1)*$perpage;
             }
 
-            $this->db->select('g.id, g.features, g.title, g.sku, g.zh, g.jm, gi.id as img_id, gi.source_cont');
+            $this->db->select('g.id, g.features, g.title, g.sku, g.zh, g.jm,g.has_source,g.update_time, gi.id as img_id, gi.source_cont');
             $this->db->from('crowd_goods as g');
             $this->db->join('crowd_goodimgs as gi', 'g.id = gi.goods_id', 'left');
             if($title){
@@ -111,7 +112,7 @@ class Goodimglibrary extends Start_Controller {
             }
 
             $this->db->order_by('g.id', 'asc');
-
+            $this->db->order_by('g.has_source', 'desc');
             
 
             // 分页 (limit, offset)
@@ -126,7 +127,7 @@ class Goodimglibrary extends Start_Controller {
                 $info_list[$k]['sku'] = $v['sku'];
                 $info_list[$k]['title'] = $v['title'];
                 $info_list[$k]['zh'] = $v['zh'];
-                //$info_list[$k]['jm'] = $v['jm'];
+                $info_list[$k]['update_time'] = empty($v['update_time'])? '' : date('Y-m-d H:i:s',$v['update_time']);
                 $info_list[$k]['imgs'] = $this->transimg($v['source_cont']);
             }
 			$this->db->from('crowd_goods');
@@ -224,8 +225,11 @@ class Goodimglibrary extends Start_Controller {
             }
             $info  =  $this->db->get_where('crowd_goods',array('id'=>$id))->row_array();    
             $images = $this->goodimgs->find("goods_id = ".$id);
+            $has_source = empty($img)?0:5;
+            $update_time = time();
             if(empty($images)){
                 if($this->goodimgs->insert(array('goods_id'=>$id,'features'=>$info['features'],'source_cont'=>json_encode($img,JSON_UNESCAPED_SLASHES)))){
+                    $this->goods->save(array('has_source'=>$has_source,'update_time'=>$update_time),$id);
                     echo json_encode(array('msg'=>'修改成功','success'=>true));exit;
                 }else{
                     echo json_encode(array('msg'=>'修改失败,请重试1','success'=>false));exit;
@@ -233,6 +237,7 @@ class Goodimglibrary extends Start_Controller {
 
             }else{
                 if($this->goodimgs->save(array('features'=>$info['features'],'source_cont'=>json_encode($img,JSON_UNESCAPED_SLASHES)),$images['id'])){
+                    $this->goods->save(array('has_source'=>$has_source,'update_time'=>$update_time),$id);
                     echo json_encode(array('msg'=>'修改成功','success'=>true));exit;
                 }else{
                     echo json_encode(array('msg'=>'修改失败,请重试2','success'=>false));exit;

+ 1 - 1
template/erp/goodimglibrary.html

@@ -61,7 +61,7 @@
 <td>SKU</td>
 <td>商品名称</td>
 <td>仓库品名</td>
-<!-- <td>料号</td> -->
+<td>上传时间</td>
 <td>图片|视频</td>
 </tr>
 </table>