Colour.php 23 KB

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