Colour.php 26 KB

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