|
@@ -1,461 +1,471 @@
|
|
|
-<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
-class Color extends Start_Controller {
|
|
|
- public function __construct(){
|
|
|
- parent::__construct();
|
|
|
- $this->load->library('session');
|
|
|
- $this->load->_model('Model_color','color');
|
|
|
- $this->load->_model('Model_shop','shop');
|
|
|
- $this->load->_model('Model_warehouse','warehouse');
|
|
|
- $this->load->_model('Model_fullorder','fullorder');
|
|
|
- $this->load->_model('Model_fullordertt','fullordertt');
|
|
|
- $this->load->_model('Model_fullordersmt','fullordersmt');
|
|
|
- $this->load->_model('Model_excel','excel');
|
|
|
- }
|
|
|
- //定义方法的调用规则 获取URI第二段值
|
|
|
- public function _remap($arg,$arg_array)
|
|
|
- {
|
|
|
- if($arg == 'add')
|
|
|
- {
|
|
|
- $this->_add();
|
|
|
- }
|
|
|
- else if($arg == 'edit')
|
|
|
- {
|
|
|
- $this->_edit($arg_array);
|
|
|
- }
|
|
|
- else if($arg == 'see')
|
|
|
- {
|
|
|
- $this->_see($arg_array);
|
|
|
- }
|
|
|
- else if($arg == 'seeindex')
|
|
|
- {
|
|
|
- $this->_seeindex();
|
|
|
- }
|
|
|
- else if($arg == 'seephone')
|
|
|
- {
|
|
|
- $this->_seephone();
|
|
|
- }
|
|
|
- else if($arg == 'del')
|
|
|
- {
|
|
|
- $this->_del();
|
|
|
- }
|
|
|
- else if($arg == 'ex')
|
|
|
- {
|
|
|
- $this->_ex();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $this->_index();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public function _index()
|
|
|
- {
|
|
|
- $post = $this->input->post(NULL, TRUE);
|
|
|
- if(isset($post['page']))
|
|
|
- {
|
|
|
- $page = $this->input->post('page',true);
|
|
|
- $perpage = $this->input->post('perpage',true);
|
|
|
- $title = $this->input->post('title',true);
|
|
|
- $content = $this->input->post('content',true);
|
|
|
- $warehouse = $this->input->post('warehouse',true);
|
|
|
- $type = $this->input->post('type',true);
|
|
|
- $state = $this->input->post('state',true);
|
|
|
- $developer = $this->input->post('developer',true);
|
|
|
- $timetk = $this->input->post('timetk',true);
|
|
|
- $timetj = $this->input->post('timetj',true);
|
|
|
- $timetk = strtotime($timetk);
|
|
|
- $timetj = strtotime($timetj);
|
|
|
- $where = "1=1";
|
|
|
- if($title)
|
|
|
- {
|
|
|
- $where .= " and title like '%$title%'";
|
|
|
- }
|
|
|
- if($content)
|
|
|
- {
|
|
|
- $where .= " and content like '%$content%'";
|
|
|
- }
|
|
|
- if($warehouse)
|
|
|
- {
|
|
|
- $where .= " and warehouse = '$warehouse'";
|
|
|
- }
|
|
|
- if($type)
|
|
|
- {
|
|
|
- $where .= " and type = '$type'";
|
|
|
- }
|
|
|
- if($state)
|
|
|
- {
|
|
|
- $where .= " and state = '$state'";
|
|
|
- }
|
|
|
- if($developer){
|
|
|
- $where .= " and developer = '$developer'";
|
|
|
- }
|
|
|
- if($timetk && $timetj)
|
|
|
- {
|
|
|
- $where .= " and time > '$timetk' and time < '$timetj'";
|
|
|
- }
|
|
|
- //数据排序
|
|
|
- $order_str = "id desc";
|
|
|
- if(empty($page))
|
|
|
- {
|
|
|
- $start = 0;
|
|
|
- $perpage = 1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $start = ($page - 1)*$perpage;
|
|
|
- }
|
|
|
- $info_list = $this->color->find_all($where,'id,title,state,type,color,lowe,img,developer,craft_process,content,time',$order_str,$start,$perpage);
|
|
|
- foreach ($info_list as $key=>$value)
|
|
|
- {
|
|
|
-
|
|
|
- if(empty($value['developer'])){
|
|
|
- $info_list[$key]['developer'] = '';
|
|
|
- }
|
|
|
- if(empty($value['craft_process'])){
|
|
|
- $info_list[$key]['craft_process'] = '';
|
|
|
- }
|
|
|
- if($value['state'] == 1)
|
|
|
- {
|
|
|
- $info_list[$key]['state'] = '在售款';
|
|
|
- }
|
|
|
- else if($value['state'] == 2)
|
|
|
- {
|
|
|
- $info_list[$key]['state'] = '已停售';
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $info_list[$key]['state'] = '未选择';
|
|
|
- }
|
|
|
-
|
|
|
- if($value['type'] == 1)
|
|
|
- {
|
|
|
- $info_list[$key]['type'] = '编号款配图';
|
|
|
- }
|
|
|
- else if($value['type'] == 2)
|
|
|
- {
|
|
|
- $info_list[$key]['type'] = '颜色配图';
|
|
|
- }
|
|
|
- else if($value['type'] == 3)
|
|
|
- {
|
|
|
- $info_list[$key]['type'] = '曲度配图';
|
|
|
- }
|
|
|
- else if($value['type'] == 4)
|
|
|
- {
|
|
|
- $info_list[$key]['type'] = '其他配图';
|
|
|
- }
|
|
|
- else if($value['type'] == 5)
|
|
|
- {
|
|
|
- $info_list[$key]['type'] = '化纤编号款';
|
|
|
- }
|
|
|
- else if($value['type'] == 6)
|
|
|
- {
|
|
|
- $info_list[$key]['type'] = '化纤颜色';
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $info_list[$key]['type'] = '未选择';
|
|
|
- }
|
|
|
- $colorimg = explode('|',$value['img']);
|
|
|
- $v = $colorimg[0];
|
|
|
- $lx = explode(".",$v);
|
|
|
- $lx = strtolower(end($lx));
|
|
|
- if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
|
|
|
- {
|
|
|
- $info_list[$key]['img'] = '<video src="'.$v.'" controls="controls"';
|
|
|
- }
|
|
|
- else if($v != '')
|
|
|
- {
|
|
|
- $info_list[$key]['img'] = "<img src='".site_url('img/thumb')."?src=".str_replace(array('http://'.$_SERVER['HTTP_HOST'],'http://erp.hnwmzp.cn','https://erp.hnwmzp.cn','http://1.wepolicy.cn/','/img/thumb?src='),'',$v)."&w=100&h=100' data-src='".$v."'>";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $info_list[$key]['img'] = '';
|
|
|
- }
|
|
|
- $info_list[$key]['time'] = date('Y-m-d H:i:s',$value['time']);
|
|
|
- }
|
|
|
- $total = $this->color->find_count($where);
|
|
|
- $pagenum = ceil($total/$perpage);
|
|
|
- $over = $total-($start+$perpage);
|
|
|
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
|
|
|
- echo json_encode($rows);exit;
|
|
|
- }
|
|
|
- $this->_Template('color',$this->data);
|
|
|
- }
|
|
|
-
|
|
|
- public function _add()
|
|
|
- {
|
|
|
- $post = $this->input->post(NULL, TRUE);
|
|
|
- if(isset($post['title']))
|
|
|
- {
|
|
|
- $title = $this->input->post('title',true);
|
|
|
- $img = $this->input->post('img',true);
|
|
|
- if($img == '')
|
|
|
- {
|
|
|
- echo json_encode(array('msg'=>'必须上传图片或者视频!','success'=>false));exit;
|
|
|
- }
|
|
|
- $post['img'] = rtrim($img,'|');
|
|
|
- $post['content'] = $this->input->post('content',true);
|
|
|
- $post['time'] = time();
|
|
|
- if($this->color->insert($post))
|
|
|
- {
|
|
|
- echo json_encode(array('msg'=>'添加成功','success'=>true));exit;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- echo json_encode(array('msg'=>'添加失败,请重试','success'=>false));exit;
|
|
|
- }
|
|
|
- }
|
|
|
- $this->_Template('color_add',$this->data);
|
|
|
- }
|
|
|
-
|
|
|
- public function _edit($arg_array)
|
|
|
- {
|
|
|
- $user = $this->user->get_api($_SESSION['api']);
|
|
|
- $post = $this->input->post(NULL, TRUE);
|
|
|
- if(isset($post['id']))
|
|
|
- {
|
|
|
- $id = $this->input->post('id',true);
|
|
|
- $post['warehouse'] = $this->input->post('warehouse',true);
|
|
|
- $img = $this->input->post('img',true);
|
|
|
- if($img == '')
|
|
|
- {
|
|
|
- echo json_encode(array('msg'=>'必须上传图片或者视频!','success'=>false));exit;
|
|
|
- }
|
|
|
- $post['img'] = rtrim($img,'|');
|
|
|
- $post['content'] = $this->input->post('content',true);
|
|
|
- $post['edittime'] = time();
|
|
|
- if($this->color->save($post,$id))
|
|
|
- {
|
|
|
- echo json_encode(array('msg'=>'修改成功','success'=>true));exit;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
|
|
|
- }
|
|
|
- }
|
|
|
- $arg_array = $arg_array[0];
|
|
|
- $color = $this->color->read($arg_array);
|
|
|
- $colorimg = explode('|',$color['img']);
|
|
|
- $img = '';
|
|
|
- foreach ($colorimg as $v)
|
|
|
- {
|
|
|
- $lx = explode(".",$v);
|
|
|
- $lx = strtolower(end($lx));
|
|
|
- if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
|
|
|
- {
|
|
|
- $img .= '<span class="deldata"><video src="'.$v.'" controls="controls"></video>'."<em style='width:30px;height:30px;line-height:30px;text-align: center;display: inline-block;position: absolute;top: 0px;right: 20px;z-index: 10;background-color: #FFF;cursor: pointer;' title='点击删除'>X</em></span>";
|
|
|
- }
|
|
|
- else if($v != '')
|
|
|
- {
|
|
|
- $url = str_replace(array('http://'.$_SERVER['HTTP_HOST'],'http://erp.hnwmzp.cn','https://erp.hnwmzp.cn','http://1.wepolicy.cn/','https://1.wepolicy.cn/','/img/thumb?src='),'',$v);
|
|
|
- $url = explode('&',$url);
|
|
|
- $url = $url[0];
|
|
|
- $img .= '<span class="deldata"><a href="'.$url.'" target="_blank">'."<img src='".site_url('img/thumb')."?src=".$url."&w=500&h=500' data-src='".$v."'></a>"."<em style='width:30px;height:30px;line-height:30px;text-align: center;display: inline-block;position: absolute;top: 0px;right: 20px;z-index: 10;background-color: #FFF;cursor: pointer;' title='点击删除'>X</em></span>";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $img = '';
|
|
|
- }
|
|
|
- }
|
|
|
- $this->data['userid'] = $user['userid'];
|
|
|
- $color['img'] = $img;
|
|
|
- $this->data['color'] = $color;
|
|
|
- $this->_Template('color_edit',$this->data);
|
|
|
- }
|
|
|
-
|
|
|
- public function _see($arg_array)
|
|
|
- {
|
|
|
- $arg_array = $arg_array[0];
|
|
|
- $color = $this->color->read($arg_array);
|
|
|
- $colorimg = explode('|',$color['img']);
|
|
|
- $img = array();$i = 1;
|
|
|
- foreach ($colorimg as $v)
|
|
|
- {
|
|
|
- $lx = explode(".",$v);
|
|
|
- $lx = strtolower(end($lx));
|
|
|
- /**
|
|
|
- if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
|
|
|
- {
|
|
|
- $img .= '<video src="'.$v.'" controls="controls"></video>';
|
|
|
- }
|
|
|
- else if($v != '')
|
|
|
- {
|
|
|
- $img .= "<a href='".$v."' download='".$color['number']."第".$i."张图片'><img src='".site_url('img/thumb')."?src=".str_replace(array('http://'.$_SERVER['HTTP_HOST'],'http://erp.hnwmzp.cn','https://erp.hnwmzp.cn','http://1.wepolicy.cn/','img/thumb?src='),'',$v)."&w=500&h=500' data-src='".$v."'></a>";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $img = '';
|
|
|
- }
|
|
|
- **/
|
|
|
- if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
|
|
|
- {
|
|
|
- $img[] = array('sp',$v);
|
|
|
- }
|
|
|
- else if($v != '')
|
|
|
- {
|
|
|
- $img[] = array('tp',"<a href='".$v."' download='第".$i."张图片'><img src='".site_url('img/thumb')."?src=".str_replace(array('http://'.$_SERVER['HTTP_HOST'],'http://erp.hnwmzp.cn','https://erp.hnwmzp.cn','http://1.wepolicy.cn/','img/thumb?src='),'',$v)."&w=300&h=300' data-src='".$v."'></a>");
|
|
|
- }
|
|
|
- $i++;
|
|
|
- }
|
|
|
- $color['img'] = $img;
|
|
|
- $this->data['color'] = $color;
|
|
|
- $this->_Template('color_see',$this->data);
|
|
|
- }
|
|
|
-
|
|
|
- public function _seephone()
|
|
|
- {
|
|
|
- $this->_Template('color_seephone',$this->data);
|
|
|
- }
|
|
|
-
|
|
|
- //删除
|
|
|
- public function _del()
|
|
|
- {
|
|
|
- $post = $this->input->post(NULL, TRUE);
|
|
|
- if(isset($post['s']))
|
|
|
- {
|
|
|
- $id_arr = $this->input->post('s');
|
|
|
- $id_arr = explode(',',$id_arr);
|
|
|
- if(!$id_arr)
|
|
|
- {
|
|
|
- echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
|
|
|
- }
|
|
|
- //循环删除记录
|
|
|
- foreach ($id_arr as $v)
|
|
|
- {
|
|
|
- $this->color->remove($v);
|
|
|
- }
|
|
|
- echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public function _ex()
|
|
|
- {
|
|
|
- $title = $this->input->get('title',true);
|
|
|
- $content = $this->input->get('content',true);
|
|
|
- $warehouse = $this->input->get('warehouse',true);
|
|
|
- $type = $this->input->get('type',true);
|
|
|
- $developer = $this->input->post('developer',true);
|
|
|
- $state = $this->input->get('state',true);
|
|
|
- $timetk = $this->input->get('timetk',true);
|
|
|
- $timetj = $this->input->get('timetj',true);
|
|
|
- $timetk = strtotime($timetk);
|
|
|
- $timetj = strtotime($timetj);
|
|
|
- $where = "1=1";
|
|
|
- if($title)
|
|
|
- {
|
|
|
- $where .= " and title like '%$title%'";
|
|
|
- }
|
|
|
- if($content)
|
|
|
- {
|
|
|
- $where .= " and content like '%$content%'";
|
|
|
- }
|
|
|
- if($warehouse)
|
|
|
- {
|
|
|
- $where .= " and warehouse = '$warehouse'";
|
|
|
- }
|
|
|
- if($type)
|
|
|
- {
|
|
|
- $where .= " and type = '$type'";
|
|
|
- }
|
|
|
- if($state)
|
|
|
- {
|
|
|
- $where .= " and state = '$state'";
|
|
|
- }
|
|
|
- if($developer)
|
|
|
- {
|
|
|
- $where .= " and developer = '$developer'";
|
|
|
- }
|
|
|
- if($timetk && $timetj)
|
|
|
- {
|
|
|
- $where .= " and time > '$timetk' and time < '$timetj'";
|
|
|
- }
|
|
|
- //数据排序
|
|
|
- $order_str = "id desc";
|
|
|
- $info_list = $this->color->find_all($where,'id,title,state,type,color,lowe,content,img,developer,craft_process,time');
|
|
|
- foreach ($info_list as $key=>$value)
|
|
|
- {
|
|
|
- if(empty($value['developer'])){
|
|
|
- $info_list[$key]['developer'] = '';
|
|
|
- }
|
|
|
- if(empty($value['craft_process'])){
|
|
|
- $info_list[$key]['craft_process'] = '';
|
|
|
- }
|
|
|
-
|
|
|
- if($value['state'] == 1)
|
|
|
- {
|
|
|
- $info_list[$key]['state'] = '在售款';
|
|
|
- }
|
|
|
- else if($value['state'] == 2)
|
|
|
- {
|
|
|
- $info_list[$key]['state'] = '已停售';
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $info_list[$key]['state'] = '未选择';
|
|
|
- }
|
|
|
-
|
|
|
- if($value['type'] == 1)
|
|
|
- {
|
|
|
- $info_list[$key]['type'] = '编号款配图';
|
|
|
- }
|
|
|
- else if($value['type'] == 2)
|
|
|
- {
|
|
|
- $info_list[$key]['type'] = '颜色配图';
|
|
|
- }
|
|
|
- else if($value['type'] == 3)
|
|
|
- {
|
|
|
- $info_list[$key]['type'] = '曲度配图';
|
|
|
- }
|
|
|
- else if($value['type'] == 4)
|
|
|
- {
|
|
|
- $info_list[$key]['type'] = '编号款配图';
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $info_list[$key]['type'] = '未选择';
|
|
|
- }
|
|
|
- /**
|
|
|
- $colorimg = explode('|',$value['img']);
|
|
|
- $v = $colorimg[0];
|
|
|
- //foreach ($colorimg as $v)
|
|
|
- // {
|
|
|
- $lx = explode(".",$v);
|
|
|
- $lx = strtolower(end($lx));
|
|
|
- if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
|
|
|
- {
|
|
|
- $info_list[$key]['img'] = '<video src="'.$v.'" controls="controls"';
|
|
|
- }
|
|
|
- else if($v != '')
|
|
|
- {
|
|
|
- $info_list[$key]['img'] = "<img src='".site_url('img/thumb')."?src=".str_replace(array('http://'.$_SERVER['HTTP_HOST'],'http://erp.hnwmzp.cn','https://erp.hnwmzp.cn','http://1.wepolicy.cn/','/img/thumb?src='),'',$v)."&w=200&h=100' data-src='".$v."'>";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $info_list[$key]['img'] = '';
|
|
|
- }
|
|
|
- //}
|
|
|
- **/
|
|
|
- $info_list[$key]['img'] = '<a href="http://'.$_SERVER['HTTP_HOST'].'/color/see/'.$value['id'].'" target="_blank">点击查看</a>';
|
|
|
- $info_list[$key]['time'] = date('Y-m-d H:i:s',$value['time']);
|
|
|
- unset($info_list[$key]['id']);
|
|
|
- }
|
|
|
- $title = "新品/新色配图";
|
|
|
- $titlename = "<table border=1>
|
|
|
- <tr align='center'>
|
|
|
- <td>标题</td>
|
|
|
- <td>是否在售</td>
|
|
|
- <td>配图类型</td>
|
|
|
- <td>色号</td>
|
|
|
- <td>曲度</td>
|
|
|
- <td>备注</td>
|
|
|
- <td style='height:100px;width:200px;'>图片</td>
|
|
|
- <td>开发人</td>
|
|
|
- <td>工艺流程</td>
|
|
|
- <td>添加时间</td>
|
|
|
- </tr>
|
|
|
- </table>";
|
|
|
- $filename = $title.".xls";
|
|
|
- $tail = "";
|
|
|
- $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
|
|
|
- }
|
|
|
+<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
+class Color extends Start_Controller {
|
|
|
+ public function __construct(){
|
|
|
+ parent::__construct();
|
|
|
+ $this->load->library('session');
|
|
|
+ $this->load->_model('Model_color','color');
|
|
|
+ $this->load->_model('Model_shop','shop');
|
|
|
+ $this->load->_model('Model_warehouse','warehouse');
|
|
|
+ $this->load->_model('Model_fullorder','fullorder');
|
|
|
+ $this->load->_model('Model_fullordertt','fullordertt');
|
|
|
+ $this->load->_model('Model_fullordersmt','fullordersmt');
|
|
|
+ $this->load->_model('Model_excel','excel');
|
|
|
+ }
|
|
|
+ //定义方法的调用规则 获取URI第二段值
|
|
|
+ public function _remap($arg,$arg_array)
|
|
|
+ {
|
|
|
+ if($arg == 'add')
|
|
|
+ {
|
|
|
+ $this->_add();
|
|
|
+ }
|
|
|
+ else if($arg == 'edit')
|
|
|
+ {
|
|
|
+ $this->_edit($arg_array);
|
|
|
+ }
|
|
|
+ else if($arg == 'see')
|
|
|
+ {
|
|
|
+ $this->_see($arg_array);
|
|
|
+ }
|
|
|
+ else if($arg == 'seeindex')
|
|
|
+ {
|
|
|
+ $this->_seeindex();
|
|
|
+ }
|
|
|
+ else if($arg == 'seephone')
|
|
|
+ {
|
|
|
+ $this->_seephone();
|
|
|
+ }
|
|
|
+ else if($arg == 'del')
|
|
|
+ {
|
|
|
+ $this->_del();
|
|
|
+ }
|
|
|
+ else if($arg == 'ex')
|
|
|
+ {
|
|
|
+ $this->_ex();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $this->_index();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public function _index()
|
|
|
+ {
|
|
|
+ $post = $this->input->post(NULL, TRUE);
|
|
|
+ if(isset($post['page']))
|
|
|
+ {
|
|
|
+ $page = $this->input->post('page',true);
|
|
|
+ $perpage = $this->input->post('perpage',true);
|
|
|
+ $title = $this->input->post('title',true);
|
|
|
+
|
|
|
+ $color = $this->input->post('color',true);
|
|
|
+ $lowe = $this->input->post('lowe',true);
|
|
|
+
|
|
|
+ $content = $this->input->post('content',true);
|
|
|
+ $warehouse = $this->input->post('warehouse',true);
|
|
|
+ $type = $this->input->post('type',true);
|
|
|
+ $state = $this->input->post('state',true);
|
|
|
+ $developer = $this->input->post('developer',true);
|
|
|
+ $timetk = $this->input->post('timetk',true);
|
|
|
+ $timetj = $this->input->post('timetj',true);
|
|
|
+ $timetk = strtotime($timetk);
|
|
|
+ $timetj = strtotime($timetj);
|
|
|
+ $where = "1=1";
|
|
|
+ if($title)
|
|
|
+ {
|
|
|
+ $where .= " and title like '%$title%'";
|
|
|
+ }
|
|
|
+ if($content)
|
|
|
+ {
|
|
|
+ $where .= " and content like '%$content%'";
|
|
|
+ }
|
|
|
+ if($warehouse)
|
|
|
+ {
|
|
|
+ $where .= " and warehouse = '$warehouse'";
|
|
|
+ }
|
|
|
+ if($type)
|
|
|
+ {
|
|
|
+ $where .= " and type = '$type'";
|
|
|
+ }
|
|
|
+ if($state)
|
|
|
+ {
|
|
|
+ $where .= " and state = '$state'";
|
|
|
+ }
|
|
|
+ if($developer){
|
|
|
+ $where .= " and developer = '$developer'";
|
|
|
+ }
|
|
|
+ if($timetk && $timetj)
|
|
|
+ {
|
|
|
+ $where .= " and time > '$timetk' and time < '$timetj'";
|
|
|
+ }
|
|
|
+ if($color){
|
|
|
+ $where .= " and color like '%$color%'";
|
|
|
+ }
|
|
|
+ if($lowe){
|
|
|
+ $where .= " and lowe like '%$lowe%'";
|
|
|
+ }
|
|
|
+ //数据排序
|
|
|
+ $order_str = "id desc";
|
|
|
+ if(empty($page))
|
|
|
+ {
|
|
|
+ $start = 0;
|
|
|
+ $perpage = 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $start = ($page - 1)*$perpage;
|
|
|
+ }
|
|
|
+ $info_list = $this->color->find_all($where,'id,title,state,type,color,lowe,img,developer,craft_process,content,time',$order_str,$start,$perpage);
|
|
|
+ foreach ($info_list as $key=>$value)
|
|
|
+ {
|
|
|
+
|
|
|
+ if(empty($value['developer'])){
|
|
|
+ $info_list[$key]['developer'] = '';
|
|
|
+ }
|
|
|
+ if(empty($value['craft_process'])){
|
|
|
+ $info_list[$key]['craft_process'] = '';
|
|
|
+ }
|
|
|
+ if($value['state'] == 1)
|
|
|
+ {
|
|
|
+ $info_list[$key]['state'] = '在售款';
|
|
|
+ }
|
|
|
+ else if($value['state'] == 2)
|
|
|
+ {
|
|
|
+ $info_list[$key]['state'] = '已停售';
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $info_list[$key]['state'] = '未选择';
|
|
|
+ }
|
|
|
+
|
|
|
+ if($value['type'] == 1)
|
|
|
+ {
|
|
|
+ $info_list[$key]['type'] = '编号款配图';
|
|
|
+ }
|
|
|
+ else if($value['type'] == 2)
|
|
|
+ {
|
|
|
+ $info_list[$key]['type'] = '颜色配图';
|
|
|
+ }
|
|
|
+ else if($value['type'] == 3)
|
|
|
+ {
|
|
|
+ $info_list[$key]['type'] = '曲度配图';
|
|
|
+ }
|
|
|
+ else if($value['type'] == 4)
|
|
|
+ {
|
|
|
+ $info_list[$key]['type'] = '其他配图';
|
|
|
+ }
|
|
|
+ else if($value['type'] == 5)
|
|
|
+ {
|
|
|
+ $info_list[$key]['type'] = '化纤编号款';
|
|
|
+ }
|
|
|
+ else if($value['type'] == 6)
|
|
|
+ {
|
|
|
+ $info_list[$key]['type'] = '化纤颜色';
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $info_list[$key]['type'] = '未选择';
|
|
|
+ }
|
|
|
+ $colorimg = explode('|',$value['img']);
|
|
|
+ $v = $colorimg[0];
|
|
|
+ $lx = explode(".",$v);
|
|
|
+ $lx = strtolower(end($lx));
|
|
|
+ if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
|
|
|
+ {
|
|
|
+ $info_list[$key]['img'] = '<video src="'.$v.'" controls="controls"';
|
|
|
+ }
|
|
|
+ else if($v != '')
|
|
|
+ {
|
|
|
+ $info_list[$key]['img'] = "<img src='".site_url('img/thumb')."?src=".str_replace(array('http://'.$_SERVER['HTTP_HOST'],'http://erp.hnwmzp.cn','https://erp.hnwmzp.cn','http://1.wepolicy.cn/','/img/thumb?src='),'',$v)."&w=100&h=100' data-src='".$v."'>";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $info_list[$key]['img'] = '';
|
|
|
+ }
|
|
|
+ $info_list[$key]['time'] = date('Y-m-d H:i:s',$value['time']);
|
|
|
+ }
|
|
|
+ $total = $this->color->find_count($where);
|
|
|
+ $pagenum = ceil($total/$perpage);
|
|
|
+ $over = $total-($start+$perpage);
|
|
|
+ $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
|
|
|
+ echo json_encode($rows);exit;
|
|
|
+ }
|
|
|
+ $this->_Template('color',$this->data);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function _add()
|
|
|
+ {
|
|
|
+ $post = $this->input->post(NULL, TRUE);
|
|
|
+ if(isset($post['title']))
|
|
|
+ {
|
|
|
+ $title = $this->input->post('title',true);
|
|
|
+ $img = $this->input->post('img',true);
|
|
|
+ if($img == '')
|
|
|
+ {
|
|
|
+ echo json_encode(array('msg'=>'必须上传图片或者视频!','success'=>false));exit;
|
|
|
+ }
|
|
|
+ $post['img'] = rtrim($img,'|');
|
|
|
+ $post['content'] = $this->input->post('content',true);
|
|
|
+ $post['time'] = time();
|
|
|
+ if($this->color->insert($post))
|
|
|
+ {
|
|
|
+ echo json_encode(array('msg'=>'添加成功','success'=>true));exit;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ echo json_encode(array('msg'=>'添加失败,请重试','success'=>false));exit;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $this->_Template('color_add',$this->data);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function _edit($arg_array)
|
|
|
+ {
|
|
|
+ $user = $this->user->get_api($_SESSION['api']);
|
|
|
+ $post = $this->input->post(NULL, TRUE);
|
|
|
+ if(isset($post['id']))
|
|
|
+ {
|
|
|
+ $id = $this->input->post('id',true);
|
|
|
+ $post['warehouse'] = $this->input->post('warehouse',true);
|
|
|
+ $img = $this->input->post('img',true);
|
|
|
+ if($img == '')
|
|
|
+ {
|
|
|
+ echo json_encode(array('msg'=>'必须上传图片或者视频!','success'=>false));exit;
|
|
|
+ }
|
|
|
+ $post['img'] = rtrim($img,'|');
|
|
|
+ $post['content'] = $this->input->post('content',true);
|
|
|
+ $post['edittime'] = time();
|
|
|
+ if($this->color->save($post,$id))
|
|
|
+ {
|
|
|
+ echo json_encode(array('msg'=>'修改成功','success'=>true));exit;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $arg_array = $arg_array[0];
|
|
|
+ $color = $this->color->read($arg_array);
|
|
|
+ $colorimg = explode('|',$color['img']);
|
|
|
+ $img = '';
|
|
|
+ foreach ($colorimg as $v)
|
|
|
+ {
|
|
|
+ $lx = explode(".",$v);
|
|
|
+ $lx = strtolower(end($lx));
|
|
|
+ if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
|
|
|
+ {
|
|
|
+ $img .= '<span class="deldata"><video src="'.$v.'" controls="controls"></video>'."<em style='width:30px;height:30px;line-height:30px;text-align: center;display: inline-block;position: absolute;top: 0px;right: 20px;z-index: 10;background-color: #FFF;cursor: pointer;' title='点击删除'>X</em></span>";
|
|
|
+ }
|
|
|
+ else if($v != '')
|
|
|
+ {
|
|
|
+ $url = str_replace(array('http://'.$_SERVER['HTTP_HOST'],'http://erp.hnwmzp.cn','https://erp.hnwmzp.cn','http://1.wepolicy.cn/','https://1.wepolicy.cn/','/img/thumb?src='),'',$v);
|
|
|
+ $url = explode('&',$url);
|
|
|
+ $url = $url[0];
|
|
|
+ $img .= '<span class="deldata"><a href="'.$url.'" target="_blank">'."<img src='".site_url('img/thumb')."?src=".$url."&w=500&h=500' data-src='".$v."'></a>"."<em style='width:30px;height:30px;line-height:30px;text-align: center;display: inline-block;position: absolute;top: 0px;right: 20px;z-index: 10;background-color: #FFF;cursor: pointer;' title='点击删除'>X</em></span>";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $img = '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $this->data['userid'] = $user['userid'];
|
|
|
+ $color['img'] = $img;
|
|
|
+ $this->data['color'] = $color;
|
|
|
+ $this->_Template('color_edit',$this->data);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function _see($arg_array)
|
|
|
+ {
|
|
|
+ $arg_array = $arg_array[0];
|
|
|
+ $color = $this->color->read($arg_array);
|
|
|
+ $colorimg = explode('|',$color['img']);
|
|
|
+ $img = array();$i = 1;
|
|
|
+ foreach ($colorimg as $v)
|
|
|
+ {
|
|
|
+ $lx = explode(".",$v);
|
|
|
+ $lx = strtolower(end($lx));
|
|
|
+ /**
|
|
|
+ if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
|
|
|
+ {
|
|
|
+ $img .= '<video src="'.$v.'" controls="controls"></video>';
|
|
|
+ }
|
|
|
+ else if($v != '')
|
|
|
+ {
|
|
|
+ $img .= "<a href='".$v."' download='".$color['number']."第".$i."张图片'><img src='".site_url('img/thumb')."?src=".str_replace(array('http://'.$_SERVER['HTTP_HOST'],'http://erp.hnwmzp.cn','https://erp.hnwmzp.cn','http://1.wepolicy.cn/','img/thumb?src='),'',$v)."&w=500&h=500' data-src='".$v."'></a>";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $img = '';
|
|
|
+ }
|
|
|
+ **/
|
|
|
+ if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
|
|
|
+ {
|
|
|
+ $img[] = array('sp',$v);
|
|
|
+ }
|
|
|
+ else if($v != '')
|
|
|
+ {
|
|
|
+ $img[] = array('tp',"<a href='".$v."' download='第".$i."张图片'><img src='".site_url('img/thumb')."?src=".str_replace(array('http://'.$_SERVER['HTTP_HOST'],'http://erp.hnwmzp.cn','https://erp.hnwmzp.cn','http://1.wepolicy.cn/','img/thumb?src='),'',$v)."&w=300&h=300' data-src='".$v."'></a>");
|
|
|
+ }
|
|
|
+ $i++;
|
|
|
+ }
|
|
|
+ $color['img'] = $img;
|
|
|
+ $this->data['color'] = $color;
|
|
|
+ $this->_Template('color_see',$this->data);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function _seephone()
|
|
|
+ {
|
|
|
+ $this->_Template('color_seephone',$this->data);
|
|
|
+ }
|
|
|
+
|
|
|
+ //删除
|
|
|
+ public function _del()
|
|
|
+ {
|
|
|
+ $post = $this->input->post(NULL, TRUE);
|
|
|
+ if(isset($post['s']))
|
|
|
+ {
|
|
|
+ $id_arr = $this->input->post('s');
|
|
|
+ $id_arr = explode(',',$id_arr);
|
|
|
+ if(!$id_arr)
|
|
|
+ {
|
|
|
+ echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
|
|
|
+ }
|
|
|
+ //循环删除记录
|
|
|
+ foreach ($id_arr as $v)
|
|
|
+ {
|
|
|
+ $this->color->remove($v);
|
|
|
+ }
|
|
|
+ echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public function _ex()
|
|
|
+ {
|
|
|
+ $title = $this->input->get('title',true);
|
|
|
+ $content = $this->input->get('content',true);
|
|
|
+ $warehouse = $this->input->get('warehouse',true);
|
|
|
+ $type = $this->input->get('type',true);
|
|
|
+ $developer = $this->input->post('developer',true);
|
|
|
+ $state = $this->input->get('state',true);
|
|
|
+ $timetk = $this->input->get('timetk',true);
|
|
|
+ $timetj = $this->input->get('timetj',true);
|
|
|
+ $timetk = strtotime($timetk);
|
|
|
+ $timetj = strtotime($timetj);
|
|
|
+ $where = "1=1";
|
|
|
+ if($title)
|
|
|
+ {
|
|
|
+ $where .= " and title like '%$title%'";
|
|
|
+ }
|
|
|
+ if($content)
|
|
|
+ {
|
|
|
+ $where .= " and content like '%$content%'";
|
|
|
+ }
|
|
|
+ if($warehouse)
|
|
|
+ {
|
|
|
+ $where .= " and warehouse = '$warehouse'";
|
|
|
+ }
|
|
|
+ if($type)
|
|
|
+ {
|
|
|
+ $where .= " and type = '$type'";
|
|
|
+ }
|
|
|
+ if($state)
|
|
|
+ {
|
|
|
+ $where .= " and state = '$state'";
|
|
|
+ }
|
|
|
+ if($developer)
|
|
|
+ {
|
|
|
+ $where .= " and developer = '$developer'";
|
|
|
+ }
|
|
|
+ if($timetk && $timetj)
|
|
|
+ {
|
|
|
+ $where .= " and time > '$timetk' and time < '$timetj'";
|
|
|
+ }
|
|
|
+ //数据排序
|
|
|
+ $order_str = "id desc";
|
|
|
+ $info_list = $this->color->find_all($where,'id,title,state,type,color,lowe,content,img,developer,craft_process,time');
|
|
|
+ foreach ($info_list as $key=>$value)
|
|
|
+ {
|
|
|
+ if(empty($value['developer'])){
|
|
|
+ $info_list[$key]['developer'] = '';
|
|
|
+ }
|
|
|
+ if(empty($value['craft_process'])){
|
|
|
+ $info_list[$key]['craft_process'] = '';
|
|
|
+ }
|
|
|
+
|
|
|
+ if($value['state'] == 1)
|
|
|
+ {
|
|
|
+ $info_list[$key]['state'] = '在售款';
|
|
|
+ }
|
|
|
+ else if($value['state'] == 2)
|
|
|
+ {
|
|
|
+ $info_list[$key]['state'] = '已停售';
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $info_list[$key]['state'] = '未选择';
|
|
|
+ }
|
|
|
+
|
|
|
+ if($value['type'] == 1)
|
|
|
+ {
|
|
|
+ $info_list[$key]['type'] = '编号款配图';
|
|
|
+ }
|
|
|
+ else if($value['type'] == 2)
|
|
|
+ {
|
|
|
+ $info_list[$key]['type'] = '颜色配图';
|
|
|
+ }
|
|
|
+ else if($value['type'] == 3)
|
|
|
+ {
|
|
|
+ $info_list[$key]['type'] = '曲度配图';
|
|
|
+ }
|
|
|
+ else if($value['type'] == 4)
|
|
|
+ {
|
|
|
+ $info_list[$key]['type'] = '编号款配图';
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $info_list[$key]['type'] = '未选择';
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ $colorimg = explode('|',$value['img']);
|
|
|
+ $v = $colorimg[0];
|
|
|
+ //foreach ($colorimg as $v)
|
|
|
+ // {
|
|
|
+ $lx = explode(".",$v);
|
|
|
+ $lx = strtolower(end($lx));
|
|
|
+ if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
|
|
|
+ {
|
|
|
+ $info_list[$key]['img'] = '<video src="'.$v.'" controls="controls"';
|
|
|
+ }
|
|
|
+ else if($v != '')
|
|
|
+ {
|
|
|
+ $info_list[$key]['img'] = "<img src='".site_url('img/thumb')."?src=".str_replace(array('http://'.$_SERVER['HTTP_HOST'],'http://erp.hnwmzp.cn','https://erp.hnwmzp.cn','http://1.wepolicy.cn/','/img/thumb?src='),'',$v)."&w=200&h=100' data-src='".$v."'>";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $info_list[$key]['img'] = '';
|
|
|
+ }
|
|
|
+ //}
|
|
|
+ **/
|
|
|
+ $info_list[$key]['img'] = '<a href="http://'.$_SERVER['HTTP_HOST'].'/color/see/'.$value['id'].'" target="_blank">点击查看</a>';
|
|
|
+ $info_list[$key]['time'] = date('Y-m-d H:i:s',$value['time']);
|
|
|
+ unset($info_list[$key]['id']);
|
|
|
+ }
|
|
|
+ $title = "新品/新色配图";
|
|
|
+ $titlename = "<table border=1>
|
|
|
+ <tr align='center'>
|
|
|
+ <td>标题</td>
|
|
|
+ <td>是否在售</td>
|
|
|
+ <td>配图类型</td>
|
|
|
+ <td>色号</td>
|
|
|
+ <td>曲度</td>
|
|
|
+ <td>备注</td>
|
|
|
+ <td style='height:100px;width:200px;'>图片</td>
|
|
|
+ <td>开发人</td>
|
|
|
+ <td>工艺流程</td>
|
|
|
+ <td>添加时间</td>
|
|
|
+ </tr>
|
|
|
+ </table>";
|
|
|
+ $filename = $title.".xls";
|
|
|
+ $tail = "";
|
|
|
+ $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
|
|
|
+ }
|
|
|
}
|