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