Colour.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Colour extends Start_Controller {
  3. public function __construct(){
  4. parent::__construct();
  5. $this->load->library('session');
  6. $this->load->_model('Model_colour','colour');
  7. $this->load->_model('Model_shop','shop');
  8. $this->load->_model('Model_warehouse','warehouse');
  9. $this->load->_model('Model_fullorder','fullorder');
  10. $this->load->_model('Model_fullordertt','fullordertt');
  11. $this->load->_model('Model_fullordersmt','fullordersmt');
  12. $this->load->_model("Model_logic_order","logic_order");
  13. $this->load->_model("Model_logic_tools","logic_tools");
  14. //getInfo
  15. }
  16. //定义方法的调用规则 获取URI第二段值
  17. public function _remap($arg,$arg_array)
  18. {
  19. if($arg == 'add')
  20. {
  21. $this->_add();
  22. }
  23. else if($arg == 'edit')
  24. {
  25. $this->_edit($arg_array);
  26. }
  27. else if($arg == 'see')
  28. {
  29. $this->_see($arg_array);
  30. }
  31. else if($arg == 'seeindex')
  32. {
  33. $this->_seeindex();
  34. }
  35. else if($arg == 'seephone')
  36. {
  37. $this->_seephone();
  38. }
  39. else if($arg == 'del')
  40. {
  41. $this->_del();
  42. }
  43. else if($arg == 'seebynumber'){
  44. $this->_seebynumber($arg_array);
  45. }
  46. else
  47. {
  48. $this->_index();
  49. }
  50. }
  51. public function _index()
  52. {
  53. if(isset($_SESSION['api']))
  54. {
  55. $user = $this->user->get_api($_SESSION['api']);
  56. $usp = $user;
  57. $fgshop = "";$sid = "";
  58. $usersp = explode('|',trim($user['shop'],'|'));
  59. foreach ($usersp as $value)
  60. {
  61. $fgshop .= " shop = ".$value." or";
  62. $sid .= " id = ".$value." or";
  63. }
  64. $fgshop .= " shop = '0' or";
  65. }
  66. $post = $this->input->post(NULL, TRUE);
  67. if(isset($post['page']))
  68. {
  69. $page = $this->input->post('page',true);
  70. $perpage = $this->input->post('perpage',true);
  71. $number = $this->input->post('number',true);
  72. $shop = $this->input->post('shop',true);
  73. $warehouse = $this->input->post('warehouse',true);
  74. $timetk = $this->input->post('timetk',true);
  75. $timetj = $this->input->post('timetj',true);
  76. $timetk = strtotime($timetk);
  77. $timetj = strtotime($timetj);
  78. $where = "(".rtrim($fgshop,'or').")";
  79. if($number)
  80. {
  81. $where .= " and number like '%$number%'";
  82. }
  83. if($shop)
  84. {
  85. $where .= " and shop = '$shop'";
  86. }
  87. if($warehouse)
  88. {
  89. $where .= " and warehouse = '$warehouse'";
  90. }
  91. if($timetk && $timetj)
  92. {
  93. $where .= " and time > '$timetk' and time < '$timetj'";
  94. }
  95. //数据排序
  96. $order_str = "id desc";
  97. if(empty($page))
  98. {
  99. $start = 0;
  100. $perpage = 1;
  101. }
  102. else
  103. {
  104. $start = ($page - 1)*$perpage;
  105. }
  106. $info_list = $this->colour->find_all($where,'id,number,shop,warehouse,time,library_time,img,img_two',$order_str,$start,$perpage);
  107. foreach ($info_list as $key=>$value)
  108. {
  109. $info_list[$key]['time'] = date('Y-m-d H:i:s',$value['time']);
  110. if($value['shop'] == '0')
  111. {
  112. $info_list[$key]['shop'] = '常用色';
  113. }
  114. else
  115. {
  116. $shop = $this->shop->read($value['shop']);
  117. $info_list[$key]['shop'] = $shop['shopname'];
  118. }
  119. $warehouse = $this->warehouse->read($value['warehouse']);
  120. $info_list[$key]['warehouse'] = $warehouse['title'];
  121. $info_list[$key]['library_time'] = empty($value['library_time'])?'未出库': date('Y-m-d H:i',$value['library_time'])."出库";
  122. $colorimg = explode('|',$value['img']);
  123. $v = $colorimg[0];
  124. $lx = explode(".",$v);
  125. $lx = strtolower(end($lx));
  126. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  127. {
  128. $info_list[$key]['img'] = '<video style="max-width: 150px; max-height: 150px; width: auto; height: auto;" src="'.$v.'" controls="controls"';
  129. }
  130. else if($v != '')
  131. {
  132. $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','https://1.wepolicy.cn','http://a.wepolicy.cn','/img/thumb?src='),'',$v)."&w=100&h=100' data-src='".$v."'>";
  133. //$info[$key]['img'] = "<img src='".$v."' width='100px' height='100' />";
  134. if(count($colorimg) > 1){
  135. $info_list[$key]['img'] .= "<img style='margin-left:5px;' 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','https://1.wepolicy.cn','http://a.wepolicy.cn','/img/thumb?src='),'',$colorimg[1])."&w=100&h=100' data-src='".$colorimg[1]."'>";
  136. }
  137. }
  138. else
  139. {
  140. $info_list[$key]['img'] = '';
  141. }
  142. $colorimg_two = explode('|',$value['img_two']);
  143. $v_two = $colorimg_two[0];
  144. $lx_two = explode(".",$v_two);
  145. $lx_two = strtolower(end($lx_two));
  146. if($lx_two == "3gp" || $lx_two == "rmvb" || $lx_two == "flv" || $lx_two == "wmv" || $lx_two == "avi" || $lx_two == "mkv" || $lx_two == "wav" || $lx_two == "mp4")
  147. {
  148. $info_list[$key]['img_two'] = '<video style="max-width: 150px; max-height: 150px; width: auto; height: auto;" src="'.$v_two.'" controls="controls"';
  149. }
  150. else if($v_two != '')
  151. {
  152. $info_list[$key]['img_two'] = "<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','https://1.wepolicy.cn','http://a.wepolicy.cn','/img/thumb?src='),'',$v_two)."&w=100&h=100' data-src='".$v_two."'>";
  153. //$info[$key]['img'] = "<img src='".$v."' width='100px' height='100' />";
  154. if(count($colorimg_two) > 1){
  155. $info_list[$key]['img_two'] .= "<img style='margin-left:5px;' 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','https://1.wepolicy.cn','http://a.wepolicy.cn','/img/thumb?src='),'',$colorimg_two[1])."&w=100&h=100' data-src='".$colorimg_two[1]."'>";
  156. }
  157. }
  158. else
  159. {
  160. $info_list[$key]['img_two'] = '';
  161. }
  162. }
  163. $total = $this->colour->find_count($where);
  164. $pagenum = ceil($total/$perpage);
  165. $over = $total-($start+$perpage);
  166. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list),'cs'=>$fgshop);
  167. echo json_encode($rows);exit;
  168. }
  169. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  170. $this->data['wlshop'] = $wlshop;
  171. $this->_Template('colour',$this->data);
  172. }
  173. public function _add()
  174. {
  175. $post = $this->input->post(NULL, TRUE);
  176. if(isset($post['number']))
  177. {
  178. $number = $this->input->post('number',true);
  179. $post['number'] = trim($number,' ');
  180. $post['warehouse'] = $this->input->post('warehouse',true);
  181. $img = $this->input->post('img',true);
  182. $img_two = $this->input->post('img_two',true);
  183. $post['img'] = rtrim($img,'|');
  184. $post['img_two'] = rtrim($img_two,'|');
  185. $post['content'] = $this->input->post('content',true);
  186. $post['time'] = time();
  187. if(empty($post['number'])){
  188. echo json_encode(array('msg'=>'订单编号不能为空!','success'=>false));exit;
  189. }
  190. if($this->colour->get_number($post['number']))
  191. {
  192. echo json_encode(array('msg'=>'此订单编号已存在!','success'=>false));exit;
  193. }
  194. if(stripos($post['number'],'#') !== false)
  195. {
  196. $post['shop'] = 0;
  197. }
  198. else
  199. {
  200. $number = $this->logic_order->getInfo("number = '".$post['number']."'");
  201. if(empty($number)){
  202. echo json_encode(array('msg'=>'订单中未找到此编号!','success'=>false));exit;
  203. }
  204. // $number = $this->fullorder->get_number($post['number']);
  205. // if(!$number)
  206. // {
  207. // $number = $this->fullordersmt->get_number($post['number']);
  208. // if(!$number)
  209. // {
  210. // $number = $this->fullordertt->get_number($post['number']);
  211. // if(!$number)
  212. // {
  213. // echo json_encode(array('msg'=>'订单中未找到此编号!','success'=>false));exit;
  214. // }
  215. // }
  216. // }
  217. }
  218. $post['shop'] = $number['shop'];
  219. if($this->colour->insert($post))
  220. {
  221. echo json_encode(array('msg'=>'添加成功','success'=>true));exit;
  222. }
  223. else
  224. {
  225. echo json_encode(array('msg'=>'添加失败,请重试','success'=>false));exit;
  226. }
  227. }
  228. $this->_Template('colour_add',$this->data);
  229. }
  230. public function _edit($arg_array)
  231. {
  232. $user = $this->user->get_api($_SESSION['api']);
  233. $post = $this->input->post(NULL, TRUE);
  234. if(isset($post['id']))
  235. {
  236. $id = $this->input->post('id',true);
  237. $post['warehouse'] = $this->input->post('warehouse',true);
  238. $img = $this->input->post('img',true);
  239. $post['img'] = rtrim($img,'|');
  240. $img_two = $this->input->post('img_two',true);
  241. $post['img_two'] = rtrim($img_two,'|');
  242. $post['content'] = $this->input->post('content',true);
  243. $post['edittime'] = time();
  244. $is_overimg = 0;
  245. if(!empty($img_two)){
  246. $is_overimg = 1;
  247. }
  248. $post['is_overimg'] = $is_overimg;
  249. if($this->colour->save($post,$id))
  250. {
  251. echo json_encode(array('msg'=>'修改成功','success'=>true));exit;
  252. }
  253. else
  254. {
  255. echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
  256. }
  257. }
  258. $arg_array = $arg_array[0];
  259. $colour = $this->colour->read($arg_array);
  260. $colourimg = explode('|',$colour['img']);
  261. $img = '';
  262. foreach ($colourimg as $v)
  263. {
  264. $lx = explode(".",$v);
  265. $lx = strtolower(end($lx));
  266. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  267. {
  268. $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>";
  269. }
  270. else if($v != '')
  271. {
  272. $url = str_replace(array('http://'.$_SERVER['HTTP_HOST'],'http://erp.hnwmzp.cn','http://a.wepolicy.cn','https://erp.hnwmzp.cn','http://1.wepolicy.cn/','https://1.wepolicy.cn/','/img/thumb?src='),'',$v);
  273. $url = explode('&',$url);
  274. $url = $url[0];
  275. $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>";
  276. }
  277. else
  278. {
  279. $img = '';
  280. }
  281. }
  282. $colourimg_two = explode('|',$colour['img_two']);
  283. $img_two = '';
  284. foreach ($colourimg_two as $v)
  285. {
  286. $lx = explode(".",$v);
  287. $lx = strtolower(end($lx));
  288. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  289. {
  290. $img_two .= '<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>";
  291. }
  292. else if($v != '')
  293. {
  294. $url = str_replace(array('http://'.$_SERVER['HTTP_HOST'],'http://erp.hnwmzp.cn','http://a.wepolicy.cn','https://erp.hnwmzp.cn','http://1.wepolicy.cn/','https://1.wepolicy.cn/','/img/thumb?src='),'',$v);
  295. $url = explode('&',$url);
  296. $url = $url[0];
  297. $img_two .= '<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>";
  298. }
  299. else
  300. {
  301. $img_two = '';
  302. }
  303. }
  304. $this->data['userid'] = $user['userid'];
  305. $colour['img'] = $img;
  306. $colour['img_two'] = $img_two;
  307. $this->data['colour'] = $colour;
  308. $this->_Template('colour_edit',$this->data);
  309. }
  310. public function _see($arg_array)
  311. {
  312. $arg_array = $arg_array[0];
  313. $colour = $this->colour->read($arg_array);
  314. $colourimg = explode('|',$colour['img']);
  315. $colourimg_two = explode('|',$colour['img_two']);
  316. $img = array();$i = 1;
  317. $host= $_SERVER['HTTP_HOST'];
  318. $host= "http://".$host;
  319. foreach ($colourimg as $v)
  320. {
  321. $lx = explode(".",$v);
  322. $lx = strtolower(end($lx));
  323. /**
  324. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  325. {
  326. $img .= '<video src="'.$v.'" controls="controls"></video>';
  327. }
  328. else if($v != '')
  329. {
  330. $img .= "<a href='".$v."' download='".$colour['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>";
  331. }
  332. else
  333. {
  334. $img = '';
  335. }
  336. **/
  337. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  338. {
  339. $img[] = array('sp',$v);
  340. }
  341. else if($v != '')
  342. {
  343. $tmp_ing_url = $this->logic_tools->transfer_img_url($v,$host);
  344. $img[] = array('tp',"<a href='javascript:void(0)' data-ulr='".$tmp_ing_url."' class='zoomable'><img src='".site_url('img/thumb')."?src=".str_replace(array('http://'.$_SERVER['HTTP_HOST'],'http://erp.hnwmzp.cn','http://a.wepolicy.cn','https://erp.hnwmzp.cn','http://1.wepolicy.cn/','https://1.wepolicy.cn/','img/thumb?src='),'',$v)."&w=200&h=200' data-src='".$v."' style='margin-right:3px;' ></a>");
  345. }
  346. $i++;
  347. }
  348. $colour['img'] = $img;
  349. $img_two = array();$i_two = 1;
  350. foreach ($colourimg_two as $v)
  351. {
  352. $lx_two = explode(".",$v);
  353. $lx_two = strtolower(end($lx_two));
  354. if($lx_two == "3gp" || $lx_two == "rmvb" || $lx_two == "flv" || $lx_two == "wmv" || $lx_two == "avi" || $lx_two == "mkv" || $lx_two == "wav" || $lx_two == "mp4")
  355. {
  356. $img_two[] = array('sp',$v);
  357. }
  358. else if($v != '')
  359. {
  360. $tmp_ing_url = $this->logic_tools->transfer_img_url($v,$host);
  361. $img_two[] = array('tp',"<a href='javascript:void(0)' data-ulr='".$tmp_ing_url."' class='zoomable'><img src='".site_url('img/thumb')."?src=".str_replace(array('http://'.$_SERVER['HTTP_HOST'],'http://erp.hnwmzp.cn','http://a.wepolicy.cn','https://erp.hnwmzp.cn','http://1.wepolicy.cn/','https://1.wepolicy.cn/','img/thumb?src='),'',$v)."&w=200&h=200' data-src='".$v."' style='margin-right:3px;'></a>");
  362. }
  363. $i_two++;
  364. }
  365. $colour['img_two'] = $img_two;
  366. $this->data['colour'] = $colour;
  367. $this->data['is_has'] =1;
  368. $this->_Template('colour_see',$this->data);
  369. }
  370. public function _seeindex()
  371. {
  372. if(isset($_SESSION['api']))
  373. {
  374. $user = $this->user->get_api($_SESSION['api']);
  375. $usp = $user;
  376. $fgshop = "";$sid = "";$wid="";$wtype="";
  377. $usersp = explode('|',trim($user['shop'],'|'));
  378. $userwh = explode('|',trim($user['warehouse'],'|'));
  379. foreach ($usersp as $value)
  380. {
  381. $fgshop .= " shop = ".$value." or";
  382. $sid .= " id = ".$value." or";
  383. }
  384. foreach ($userwh as $value)
  385. {
  386. $wid .= " id = ".$value." or";
  387. $wtype .= " warehouse = ".$value." or";
  388. }
  389. $fgshop .= " shop = '0' or";
  390. }
  391. $post = $this->input->post(NULL, TRUE);
  392. if(isset($post['page']))
  393. {
  394. $page = $this->input->post('page',true);
  395. $perpage = $this->input->post('perpage',true);
  396. $number = $this->input->post('number',true);
  397. $shop = $this->input->post('shop',true);
  398. $warehouse = $this->input->post('warehouse',true);
  399. $timetk = $this->input->post('timetk',true);
  400. $timetj = $this->input->post('timetj',true);
  401. $timetk = strtotime($timetk);
  402. $timetj = strtotime($timetj);
  403. $where = " 1 = 1 ";
  404. if($number)
  405. {
  406. $where .= " and number like '%$number%'";
  407. }
  408. if($shop)
  409. {
  410. $where .= " and shop = '$shop'";
  411. }
  412. if($warehouse)
  413. {
  414. $where .= " and warehouse = '$warehouse'";
  415. }
  416. if($timetk && $timetj)
  417. {
  418. $where .= " and time > '$timetk' and time < '$timetj'";
  419. }
  420. //数据排序
  421. $order_str = "id desc";
  422. if(empty($page))
  423. {
  424. $start = 0;
  425. $perpage = 1;
  426. }
  427. else
  428. {
  429. $start = ($page - 1)*$perpage;
  430. }
  431. $info_list = $this->colour->find_all($where,'id,number,shop,warehouse,time,library_time,img,img_two',$order_str,$start,$perpage);
  432. foreach ($info_list as $key=>$value)
  433. {
  434. $info_list[$key]['time'] = date('Y-m-d H:i:s',$value['time']);
  435. if($value['shop'] == '0')
  436. {
  437. $info_list[$key]['shop'] = '常用色';
  438. }
  439. else
  440. {
  441. $shop = $this->shop->read($value['shop']);
  442. $info_list[$key]['shop'] = $shop['shopname'];
  443. }
  444. $warehouse = $this->warehouse->read($value['warehouse']);
  445. $info_list[$key]['warehouse'] = $warehouse['title'];
  446. $info_list[$key]['library_time'] = empty($value['library_time'])?'未出库': date('Y-m-d H:i',$value['library_time'])."出库";
  447. $colorimg = explode('|',$value['img']);
  448. $v = $colorimg[0];
  449. $lx = explode(".",$v);
  450. $lx = strtolower(end($lx));
  451. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  452. {
  453. $info_list[$key]['img'] = '<video style="max-width: 150px; max-height: 150px; width: auto; height: auto;" src="'.$v.'" controls="controls"';
  454. }
  455. else if($v != '')
  456. {
  457. $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','https://1.wepolicy.cn','http://a.wepolicy.cn','/img/thumb?src='),'',$v)."&w=100&h=100' data-src='".$v."'>";
  458. //$info[$key]['img'] = "<img src='".$v."' width='100px' height='100' />";
  459. if(count($colorimg) > 1){
  460. $info_list[$key]['img'] .= "<img style='margin-left:5px;' 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','https://1.wepolicy.cn','http://a.wepolicy.cn','/img/thumb?src='),'',$colorimg[1])."&w=100&h=100' data-src='".$colorimg[1]."'>";
  461. }
  462. }
  463. else
  464. {
  465. $info_list[$key]['img'] = '';
  466. }
  467. $colorimg_two = explode('|',$value['img_two']);
  468. $v_two = $colorimg_two[0];
  469. $lx_two = explode(".",$v_two);
  470. $lx_two = strtolower(end($lx_two));
  471. if($lx_two == "3gp" || $lx_two == "rmvb" || $lx_two == "flv" || $lx_two == "wmv" || $lx_two == "avi" || $lx_two == "mkv" || $lx_two == "wav" || $lx_two == "mp4")
  472. {
  473. $info_list[$key]['img_two'] = '<video style="max-width: 150px; max-height: 150px; width: auto; height: auto;" src="'.$v_two.'" controls="controls"';
  474. }
  475. else if($v_two != '')
  476. {
  477. $info_list[$key]['img_two'] = "<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','https://1.wepolicy.cn','http://a.wepolicy.cn','/img/thumb?src='),'',$v_two)."&w=100&h=100' data-src='".$v_two."'>";
  478. //$info[$key]['img'] = "<img src='".$v."' width='100px' height='100' />";
  479. if(count($colorimg_two) > 1){
  480. $info_list[$key]['img_two'] .= "<img style='margin-left:5px;' 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','https://1.wepolicy.cn','http://a.wepolicy.cn','/img/thumb?src='),'',$colorimg_two[1])."&w=100&h=100' data-src='".$colorimg_two[1]."'>";
  481. }
  482. }
  483. else
  484. {
  485. $info_list[$key]['img_two'] = '';
  486. }
  487. }
  488. $total = $this->colour->find_count($where);
  489. $pagenum = ceil($total/$perpage);
  490. $over = $total-($start+$perpage);
  491. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  492. echo json_encode($rows);exit;
  493. }
  494. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  495. $this->data['wlshop'] = $wlshop;
  496. $shoplist = $this->shop->find_all('status = 0');
  497. $this->data['shoplist'] = $shoplist;
  498. $warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
  499. $this->data['warehouse'] = $warehouse;
  500. $this->_Template('colour_seeindex',$this->data);
  501. }
  502. public function _seephone()
  503. {
  504. $this->_Template('colour_seephone',$this->data);
  505. }
  506. //删除
  507. public function _del()
  508. {
  509. $post = $this->input->post(NULL, TRUE);
  510. if(isset($post['s']))
  511. {
  512. $id_arr = $this->input->post('s');
  513. $id_arr = explode(',',$id_arr);
  514. if(!$id_arr)
  515. {
  516. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  517. }
  518. //循环删除记录
  519. foreach ($id_arr as $v)
  520. {
  521. $this->colour->remove($v);
  522. }
  523. echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true));
  524. }
  525. }
  526. public function _seebynumber($arg_array){
  527. $number = $arg_array[0];
  528. $colour = $this->colour->find("number = '$number'");
  529. if(empty($colour)){
  530. $this->data['is_has'] = 0;
  531. $this->_Template('colour_see',$this->data);
  532. die;
  533. }
  534. $colourimg = explode('|',$colour['img']);
  535. $img = array();$i = 1;
  536. foreach ($colourimg as $v)
  537. {
  538. $lx = explode(".",$v);
  539. $lx = strtolower(end($lx));
  540. /**
  541. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  542. {
  543. $img .= '<video src="'.$v.'" controls="controls"></video>';
  544. }
  545. else if($v != '')
  546. {
  547. $img .= "<a href='".$v."' download='".$colour['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>";
  548. }
  549. else
  550. {
  551. $img = '';
  552. }
  553. **/
  554. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  555. {
  556. $img[] = array('sp',$v);
  557. }
  558. else if($v != '')
  559. {
  560. $img[] = array('tp',"<a href='".$v."' download='".$colour['number']."第".$i."张图片'><img src='".site_url('img/thumb')."?src=".str_replace(array('http://'.$_SERVER['HTTP_HOST'],'http://erp.hnwmzp.cn','http://a.wepolicy.cn','https://erp.hnwmzp.cn','http://1.wepolicy.cn/','https://1.wepolicy.cn/','img/thumb?src='),'',$v)."&w=500&h=500' data-src='".$v."'></a>");
  561. }
  562. $i++;
  563. }
  564. $colour['img'] = $img;
  565. $this->data['colour'] = $colour;
  566. $this->data['is_has'] = 1;
  567. $this->_Template('colour_see',$this->data);
  568. }
  569. }