Colour.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  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. $is_overimg = 0;
  244. if(!empty($img_two)){
  245. $is_overimg = 1;
  246. }
  247. $post['is_overimg'] = $is_overimg;
  248. if($this->colour->save($post,$id))
  249. {
  250. echo json_encode(array('msg'=>'修改成功','success'=>true));exit;
  251. }
  252. else
  253. {
  254. echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
  255. }
  256. }
  257. $arg_array = $arg_array[0];
  258. $colour = $this->colour->read($arg_array);
  259. $colourimg = explode('|',$colour['img']);
  260. $img = '';
  261. foreach ($colourimg as $v)
  262. {
  263. $lx = explode(".",$v);
  264. $lx = strtolower(end($lx));
  265. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  266. {
  267. $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>";
  268. }
  269. else if($v != '')
  270. {
  271. $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);
  272. $url = explode('&',$url);
  273. $url = $url[0];
  274. $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>";
  275. }
  276. else
  277. {
  278. $img = '';
  279. }
  280. }
  281. $colourimg_two = explode('|',$colour['img_two']);
  282. $img_two = '';
  283. foreach ($colourimg_two as $v)
  284. {
  285. $lx = explode(".",$v);
  286. $lx = strtolower(end($lx));
  287. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  288. {
  289. $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>";
  290. }
  291. else if($v != '')
  292. {
  293. $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);
  294. $url = explode('&',$url);
  295. $url = $url[0];
  296. $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>";
  297. }
  298. else
  299. {
  300. $img_two = '';
  301. }
  302. }
  303. $this->data['userid'] = $user['userid'];
  304. $colour['img'] = $img;
  305. $colour['img_two'] = $img_two;
  306. $this->data['colour'] = $colour;
  307. $this->_Template('colour_edit',$this->data);
  308. }
  309. public function _see($arg_array)
  310. {
  311. $arg_array = $arg_array[0];
  312. $colour = $this->colour->read($arg_array);
  313. $colourimg = explode('|',$colour['img']);
  314. $colourimg_two = explode('|',$colour['img_two']);
  315. $img = array();$i = 1;
  316. $host= $_SERVER['HTTP_HOST'];
  317. $host= "http://".$host;
  318. foreach ($colourimg as $v)
  319. {
  320. $lx = explode(".",$v);
  321. $lx = strtolower(end($lx));
  322. /**
  323. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  324. {
  325. $img .= '<video src="'.$v.'" controls="controls"></video>';
  326. }
  327. else if($v != '')
  328. {
  329. $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>";
  330. }
  331. else
  332. {
  333. $img = '';
  334. }
  335. **/
  336. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  337. {
  338. $img[] = array('sp',$v);
  339. }
  340. else if($v != '')
  341. {
  342. $tmp_ing_url = $this->logic_tools->transfer_img_url($v,$host);
  343. $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>");
  344. }
  345. $i++;
  346. }
  347. $colour['img'] = $img;
  348. $img_two = array();$i_two = 1;
  349. foreach ($colourimg_two as $v)
  350. {
  351. $lx_two = explode(".",$v);
  352. $lx_two = strtolower(end($lx_two));
  353. 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")
  354. {
  355. $img_two[] = array('sp',$v);
  356. }
  357. else if($v != '')
  358. {
  359. $tmp_ing_url = $this->logic_tools->transfer_img_url($v,$host);
  360. $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>");
  361. }
  362. $i_two++;
  363. }
  364. $colour['img_two'] = $img_two;
  365. $this->data['colour'] = $colour;
  366. $this->data['is_has'] =1;
  367. $this->_Template('colour_see',$this->data);
  368. }
  369. public function _seeindex()
  370. {
  371. if(isset($_SESSION['api']))
  372. {
  373. $user = $this->user->get_api($_SESSION['api']);
  374. $usp = $user;
  375. $fgshop = "";$sid = "";$wid="";$wtype="";
  376. $usersp = explode('|',trim($user['shop'],'|'));
  377. $userwh = explode('|',trim($user['warehouse'],'|'));
  378. foreach ($usersp as $value)
  379. {
  380. $fgshop .= " shop = ".$value." or";
  381. $sid .= " id = ".$value." or";
  382. }
  383. foreach ($userwh as $value)
  384. {
  385. $wid .= " id = ".$value." or";
  386. $wtype .= " warehouse = ".$value." or";
  387. }
  388. $fgshop .= " shop = '0' or";
  389. }
  390. $post = $this->input->post(NULL, TRUE);
  391. if(isset($post['page']))
  392. {
  393. $page = $this->input->post('page',true);
  394. $perpage = $this->input->post('perpage',true);
  395. $number = $this->input->post('number',true);
  396. $shop = $this->input->post('shop',true);
  397. $warehouse = $this->input->post('warehouse',true);
  398. $timetk = $this->input->post('timetk',true);
  399. $timetj = $this->input->post('timetj',true);
  400. $timetk = strtotime($timetk);
  401. $timetj = strtotime($timetj);
  402. $where = " 1 = 1 ";
  403. if($number)
  404. {
  405. $where .= " and number like '%$number%'";
  406. }
  407. if($shop)
  408. {
  409. $where .= " and shop = '$shop'";
  410. }
  411. if($warehouse)
  412. {
  413. $where .= " and warehouse = '$warehouse'";
  414. }
  415. if($timetk && $timetj)
  416. {
  417. $where .= " and time > '$timetk' and time < '$timetj'";
  418. }
  419. //数据排序
  420. $order_str = "id desc";
  421. if(empty($page))
  422. {
  423. $start = 0;
  424. $perpage = 1;
  425. }
  426. else
  427. {
  428. $start = ($page - 1)*$perpage;
  429. }
  430. $info_list = $this->colour->find_all($where,'id,number,shop,warehouse,time,img,img_two',$order_str,$start,$perpage);
  431. foreach ($info_list as $key=>$value)
  432. {
  433. $info_list[$key]['time'] = date('Y-m-d H:i:s',$value['time']);
  434. if($value['shop'] == '0')
  435. {
  436. $info_list[$key]['shop'] = '常用色';
  437. }
  438. else
  439. {
  440. $shop = $this->shop->read($value['shop']);
  441. $info_list[$key]['shop'] = $shop['shopname'];
  442. }
  443. $warehouse = $this->warehouse->read($value['warehouse']);
  444. $info_list[$key]['warehouse'] = $warehouse['title'];
  445. $colorimg = explode('|',$value['img']);
  446. $v = $colorimg[0];
  447. $lx = explode(".",$v);
  448. $lx = strtolower(end($lx));
  449. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  450. {
  451. $info_list[$key]['img'] = '<video style="max-width: 150px; max-height: 150px; width: auto; height: auto;" src="'.$v.'" controls="controls"';
  452. }
  453. else if($v != '')
  454. {
  455. $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."'>";
  456. //$info[$key]['img'] = "<img src='".$v."' width='100px' height='100' />";
  457. if(count($colorimg) > 1){
  458. $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]."'>";
  459. }
  460. }
  461. else
  462. {
  463. $info_list[$key]['img'] = '';
  464. }
  465. $colorimg_two = explode('|',$value['img_two']);
  466. $v_two = $colorimg_two[0];
  467. $lx_two = explode(".",$v_two);
  468. $lx_two = strtolower(end($lx_two));
  469. 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")
  470. {
  471. $info_list[$key]['img_two'] = '<video style="max-width: 150px; max-height: 150px; width: auto; height: auto;" src="'.$v_two.'" controls="controls"';
  472. }
  473. else if($v_two != '')
  474. {
  475. $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."'>";
  476. //$info[$key]['img'] = "<img src='".$v."' width='100px' height='100' />";
  477. if(count($colorimg_two) > 1){
  478. $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]."'>";
  479. }
  480. }
  481. else
  482. {
  483. $info_list[$key]['img_two'] = '';
  484. }
  485. }
  486. $total = $this->colour->find_count($where);
  487. $pagenum = ceil($total/$perpage);
  488. $over = $total-($start+$perpage);
  489. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  490. echo json_encode($rows);exit;
  491. }
  492. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  493. $this->data['wlshop'] = $wlshop;
  494. $shoplist = $this->shop->find_all('status = 0');
  495. $this->data['shoplist'] = $shoplist;
  496. $warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
  497. $this->data['warehouse'] = $warehouse;
  498. $this->_Template('colour_seeindex',$this->data);
  499. }
  500. public function _seephone()
  501. {
  502. $this->_Template('colour_seephone',$this->data);
  503. }
  504. //删除
  505. public function _del()
  506. {
  507. $post = $this->input->post(NULL, TRUE);
  508. if(isset($post['s']))
  509. {
  510. $id_arr = $this->input->post('s');
  511. $id_arr = explode(',',$id_arr);
  512. if(!$id_arr)
  513. {
  514. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  515. }
  516. //循环删除记录
  517. foreach ($id_arr as $v)
  518. {
  519. $this->colour->remove($v);
  520. }
  521. echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true));
  522. }
  523. }
  524. public function _seebynumber($arg_array){
  525. $number = $arg_array[0];
  526. $colour = $this->colour->find("number = '$number'");
  527. if(empty($colour)){
  528. $this->data['is_has'] = 0;
  529. $this->_Template('colour_see',$this->data);
  530. die;
  531. }
  532. $colourimg = explode('|',$colour['img']);
  533. $img = array();$i = 1;
  534. foreach ($colourimg as $v)
  535. {
  536. $lx = explode(".",$v);
  537. $lx = strtolower(end($lx));
  538. /**
  539. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  540. {
  541. $img .= '<video src="'.$v.'" controls="controls"></video>';
  542. }
  543. else if($v != '')
  544. {
  545. $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>";
  546. }
  547. else
  548. {
  549. $img = '';
  550. }
  551. **/
  552. if($lx == "3gp" || $lx == "rmvb" || $lx == "flv" || $lx == "wmv" || $lx == "avi" || $lx == "mkv" || $lx == "wav" || $lx == "mp4")
  553. {
  554. $img[] = array('sp',$v);
  555. }
  556. else if($v != '')
  557. {
  558. $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>");
  559. }
  560. $i++;
  561. }
  562. $colour['img'] = $img;
  563. $this->data['colour'] = $colour;
  564. $this->data['is_has'] = 1;
  565. $this->_Template('colour_see',$this->data);
  566. }
  567. }