Colour.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  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,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. $colorimg = explode('|',$value['img']);
  122. $v = $colorimg[0];
  123. $lx = explode(".",$v);
  124. $lx = strtolower(end($lx));
  125. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  126. {
  127. $info_list[$key]['img'] = '<video style="max-width: 150px; max-height: 150px; width: auto; height: auto;" src="'.$v.'" controls="controls"';
  128. }
  129. else if($v != '')
  130. {
  131. $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."'>";
  132. //$info[$key]['img'] = "<img src='".$v."' width='100px' height='100' />";
  133. if(count($colorimg) > 1){
  134. $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]."'>";
  135. }
  136. }
  137. else
  138. {
  139. $info_list[$key]['img'] = '';
  140. }
  141. $colorimg_two = explode('|',$value['img_two']);
  142. $v_two = $colorimg_two[0];
  143. $lx_two = explode(".",$v_two);
  144. $lx_two = strtolower(end($lx_two));
  145. 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")
  146. {
  147. $info_list[$key]['img_two'] = '<video style="max-width: 150px; max-height: 150px; width: auto; height: auto;" src="'.$v_two.'" controls="controls"';
  148. }
  149. else if($v_two != '')
  150. {
  151. $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."'>";
  152. //$info[$key]['img'] = "<img src='".$v."' width='100px' height='100' />";
  153. if(count($colorimg_two) > 1){
  154. $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]."'>";
  155. }
  156. }
  157. else
  158. {
  159. $info_list[$key]['img_two'] = '';
  160. }
  161. }
  162. $total = $this->colour->find_count($where);
  163. $pagenum = ceil($total/$perpage);
  164. $over = $total-($start+$perpage);
  165. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list),'cs'=>$fgshop);
  166. echo json_encode($rows);exit;
  167. }
  168. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  169. $this->data['wlshop'] = $wlshop;
  170. $this->_Template('colour',$this->data);
  171. }
  172. public function _add()
  173. {
  174. $post = $this->input->post(NULL, TRUE);
  175. if(isset($post['number']))
  176. {
  177. $number = $this->input->post('number',true);
  178. $post['number'] = trim($number,' ');
  179. $post['warehouse'] = $this->input->post('warehouse',true);
  180. $img = $this->input->post('img',true);
  181. $img_two = $this->input->post('img_two',true);
  182. $post['img'] = rtrim($img,'|');
  183. $post['img_two'] = rtrim($img_two,'|');
  184. $post['content'] = $this->input->post('content',true);
  185. $post['time'] = time();
  186. if(empty($post['number'])){
  187. echo json_encode(array('msg'=>'订单编号不能为空!','success'=>false));exit;
  188. }
  189. if($this->colour->get_number($post['number']))
  190. {
  191. echo json_encode(array('msg'=>'此订单编号已存在!','success'=>false));exit;
  192. }
  193. if(stripos($post['number'],'#') !== false)
  194. {
  195. $post['shop'] = 0;
  196. }
  197. else
  198. {
  199. $number = $this->logic_order->getInfo("number = '".$post['number']."'");
  200. if(empty($number)){
  201. echo json_encode(array('msg'=>'订单中未找到此编号!','success'=>false));exit;
  202. }
  203. // $number = $this->fullorder->get_number($post['number']);
  204. // if(!$number)
  205. // {
  206. // $number = $this->fullordersmt->get_number($post['number']);
  207. // if(!$number)
  208. // {
  209. // $number = $this->fullordertt->get_number($post['number']);
  210. // if(!$number)
  211. // {
  212. // echo json_encode(array('msg'=>'订单中未找到此编号!','success'=>false));exit;
  213. // }
  214. // }
  215. // }
  216. }
  217. $post['shop'] = $number['shop'];
  218. if($this->colour->insert($post))
  219. {
  220. echo json_encode(array('msg'=>'添加成功','success'=>true));exit;
  221. }
  222. else
  223. {
  224. echo json_encode(array('msg'=>'添加失败,请重试','success'=>false));exit;
  225. }
  226. }
  227. $this->_Template('colour_add',$this->data);
  228. }
  229. public function _edit($arg_array)
  230. {
  231. $user = $this->user->get_api($_SESSION['api']);
  232. $post = $this->input->post(NULL, TRUE);
  233. if(isset($post['id']))
  234. {
  235. $id = $this->input->post('id',true);
  236. $post['warehouse'] = $this->input->post('warehouse',true);
  237. $img = $this->input->post('img',true);
  238. $post['img'] = rtrim($img,'|');
  239. $img_two = $this->input->post('img_two',true);
  240. $post['img_two'] = rtrim($img_two,'|');
  241. $post['content'] = $this->input->post('content',true);
  242. $post['edittime'] = time();
  243. if($this->colour->save($post,$id))
  244. {
  245. echo json_encode(array('msg'=>'修改成功','success'=>true));exit;
  246. }
  247. else
  248. {
  249. echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
  250. }
  251. }
  252. $arg_array = $arg_array[0];
  253. $colour = $this->colour->read($arg_array);
  254. $colourimg = explode('|',$colour['img']);
  255. $img = '';
  256. foreach ($colourimg as $v)
  257. {
  258. $lx = explode(".",$v);
  259. $lx = strtolower(end($lx));
  260. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  261. {
  262. $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>";
  263. }
  264. else if($v != '')
  265. {
  266. $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);
  267. $url = explode('&',$url);
  268. $url = $url[0];
  269. $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>";
  270. }
  271. else
  272. {
  273. $img = '';
  274. }
  275. }
  276. $colourimg_two = explode('|',$colour['img_two']);
  277. $img_two = '';
  278. foreach ($colourimg_two as $v)
  279. {
  280. $lx = explode(".",$v);
  281. $lx = strtolower(end($lx));
  282. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  283. {
  284. $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>";
  285. }
  286. else if($v != '')
  287. {
  288. $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);
  289. $url = explode('&',$url);
  290. $url = $url[0];
  291. $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>";
  292. }
  293. else
  294. {
  295. $img_two = '';
  296. }
  297. }
  298. $this->data['userid'] = $user['userid'];
  299. $colour['img'] = $img;
  300. $colour['img_two'] = $img_two;
  301. $this->data['colour'] = $colour;
  302. $this->_Template('colour_edit',$this->data);
  303. }
  304. public function _see($arg_array)
  305. {
  306. $arg_array = $arg_array[0];
  307. $colour = $this->colour->read($arg_array);
  308. $colourimg = explode('|',$colour['img']);
  309. $colourimg_two = explode('|',$colour['img_two']);
  310. $img = array();$i = 1;
  311. $host= $_SERVER['HTTP_HOST'];
  312. $host= "http://".$host;
  313. foreach ($colourimg as $v)
  314. {
  315. $lx = explode(".",$v);
  316. $lx = strtolower(end($lx));
  317. /**
  318. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  319. {
  320. $img .= '<video src="'.$v.'" controls="controls"></video>';
  321. }
  322. else if($v != '')
  323. {
  324. $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>";
  325. }
  326. else
  327. {
  328. $img = '';
  329. }
  330. **/
  331. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  332. {
  333. $img[] = array('sp',$v);
  334. }
  335. else if($v != '')
  336. {
  337. $tmp_ing_url = $this->logic_tools->transfer_img_url($v,$host);
  338. $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>");
  339. }
  340. $i++;
  341. }
  342. $colour['img'] = $img;
  343. $img_two = array();$i_two = 1;
  344. foreach ($colourimg_two as $v)
  345. {
  346. $lx_two = explode(".",$v);
  347. $lx_two = strtolower(end($lx_two));
  348. 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")
  349. {
  350. $img_two[] = array('sp',$v);
  351. }
  352. else if($v != '')
  353. {
  354. $tmp_ing_url = $this->logic_tools->transfer_img_url($v,$host);
  355. $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>");
  356. }
  357. $i_two++;
  358. }
  359. $colour['img_two'] = $img_two;
  360. $this->data['colour'] = $colour;
  361. $this->data['is_has'] =1;
  362. $this->_Template('colour_see',$this->data);
  363. }
  364. public function _seeindex()
  365. {
  366. if(isset($_SESSION['api']))
  367. {
  368. $user = $this->user->get_api($_SESSION['api']);
  369. $usp = $user;
  370. $fgshop = "";$sid = "";$wid="";$wtype="";
  371. $usersp = explode('|',trim($user['shop'],'|'));
  372. $userwh = explode('|',trim($user['warehouse'],'|'));
  373. foreach ($usersp as $value)
  374. {
  375. $fgshop .= " shop = ".$value." or";
  376. $sid .= " id = ".$value." or";
  377. }
  378. foreach ($userwh as $value)
  379. {
  380. $wid .= " id = ".$value." or";
  381. $wtype .= " warehouse = ".$value." or";
  382. }
  383. $fgshop .= " shop = '0' or";
  384. }
  385. $post = $this->input->post(NULL, TRUE);
  386. if(isset($post['page']))
  387. {
  388. $page = $this->input->post('page',true);
  389. $perpage = $this->input->post('perpage',true);
  390. $number = $this->input->post('number',true);
  391. $shop = $this->input->post('shop',true);
  392. $warehouse = $this->input->post('warehouse',true);
  393. $timetk = $this->input->post('timetk',true);
  394. $timetj = $this->input->post('timetj',true);
  395. $timetk = strtotime($timetk);
  396. $timetj = strtotime($timetj);
  397. $where = " 1 = 1 ";
  398. if($number)
  399. {
  400. $where .= " and number like '%$number%'";
  401. }
  402. if($shop)
  403. {
  404. $where .= " and shop = '$shop'";
  405. }
  406. if($warehouse)
  407. {
  408. $where .= " and warehouse = '$warehouse'";
  409. }
  410. if($timetk && $timetj)
  411. {
  412. $where .= " and time > '$timetk' and time < '$timetj'";
  413. }
  414. //数据排序
  415. $order_str = "id desc";
  416. if(empty($page))
  417. {
  418. $start = 0;
  419. $perpage = 1;
  420. }
  421. else
  422. {
  423. $start = ($page - 1)*$perpage;
  424. }
  425. $info_list = $this->colour->find_all($where,'id,number,shop,warehouse,time,img,img_two',$order_str,$start,$perpage);
  426. foreach ($info_list as $key=>$value)
  427. {
  428. $info_list[$key]['time'] = date('Y-m-d H:i:s',$value['time']);
  429. if($value['shop'] == '0')
  430. {
  431. $info_list[$key]['shop'] = '常用色';
  432. }
  433. else
  434. {
  435. $shop = $this->shop->read($value['shop']);
  436. $info_list[$key]['shop'] = $shop['shopname'];
  437. }
  438. $warehouse = $this->warehouse->read($value['warehouse']);
  439. $info_list[$key]['warehouse'] = $warehouse['title'];
  440. $colorimg = explode('|',$value['img']);
  441. $v = $colorimg[0];
  442. $lx = explode(".",$v);
  443. $lx = strtolower(end($lx));
  444. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  445. {
  446. $info_list[$key]['img'] = '<video style="max-width: 150px; max-height: 150px; width: auto; height: auto;" src="'.$v.'" controls="controls"';
  447. }
  448. else if($v != '')
  449. {
  450. $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."'>";
  451. //$info[$key]['img'] = "<img src='".$v."' width='100px' height='100' />";
  452. if(count($colorimg) > 1){
  453. $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]."'>";
  454. }
  455. }
  456. else
  457. {
  458. $info_list[$key]['img'] = '';
  459. }
  460. $colorimg_two = explode('|',$value['img_two']);
  461. $v_two = $colorimg_two[0];
  462. $lx_two = explode(".",$v_two);
  463. $lx_two = strtolower(end($lx_two));
  464. 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")
  465. {
  466. $info_list[$key]['img_two'] = '<video style="max-width: 150px; max-height: 150px; width: auto; height: auto;" src="'.$v_two.'" controls="controls"';
  467. }
  468. else if($v_two != '')
  469. {
  470. $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."'>";
  471. //$info[$key]['img'] = "<img src='".$v."' width='100px' height='100' />";
  472. if(count($colorimg_two) > 1){
  473. $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]."'>";
  474. }
  475. }
  476. else
  477. {
  478. $info_list[$key]['img_two'] = '';
  479. }
  480. }
  481. $total = $this->colour->find_count($where);
  482. $pagenum = ceil($total/$perpage);
  483. $over = $total-($start+$perpage);
  484. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  485. echo json_encode($rows);exit;
  486. }
  487. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  488. $this->data['wlshop'] = $wlshop;
  489. $shoplist = $this->shop->find_all('status = 0');
  490. $this->data['shoplist'] = $shoplist;
  491. $warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
  492. $this->data['warehouse'] = $warehouse;
  493. $this->_Template('colour_seeindex',$this->data);
  494. }
  495. public function _seephone()
  496. {
  497. $this->_Template('colour_seephone',$this->data);
  498. }
  499. //删除
  500. public function _del()
  501. {
  502. $post = $this->input->post(NULL, TRUE);
  503. if(isset($post['s']))
  504. {
  505. $id_arr = $this->input->post('s');
  506. $id_arr = explode(',',$id_arr);
  507. if(!$id_arr)
  508. {
  509. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  510. }
  511. //循环删除记录
  512. foreach ($id_arr as $v)
  513. {
  514. $this->colour->remove($v);
  515. }
  516. echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true));
  517. }
  518. }
  519. public function _seebynumber($arg_array){
  520. $number = $arg_array[0];
  521. $colour = $this->colour->find("number = '$number'");
  522. if(empty($colour)){
  523. $this->data['is_has'] = 0;
  524. $this->_Template('colour_see',$this->data);
  525. die;
  526. }
  527. $colourimg = explode('|',$colour['img']);
  528. $img = array();$i = 1;
  529. foreach ($colourimg as $v)
  530. {
  531. $lx = explode(".",$v);
  532. $lx = strtolower(end($lx));
  533. /**
  534. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  535. {
  536. $img .= '<video src="'.$v.'" controls="controls"></video>';
  537. }
  538. else if($v != '')
  539. {
  540. $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>";
  541. }
  542. else
  543. {
  544. $img = '';
  545. }
  546. **/
  547. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  548. {
  549. $img[] = array('sp',$v);
  550. }
  551. else if($v != '')
  552. {
  553. $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>");
  554. }
  555. $i++;
  556. }
  557. $colour['img'] = $img;
  558. $this->data['colour'] = $colour;
  559. $this->data['is_has'] = 1;
  560. $this->_Template('colour_see',$this->data);
  561. }
  562. }