Fullordererror.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Fullordererror extends Start_Controller {
  3. public function __construct(){
  4. parent::__construct();
  5. $this->load->library('session');
  6. $this->load->_model('Model_message','message');
  7. $this->load->_model('Model_shop','shop');
  8. $this->load->_model("Model_fullordererrors","fullordererrors");
  9. }
  10. //定义方法的调用规则 获取URI第二段值
  11. public function _remap($arg,$arg_array)
  12. {
  13. if($arg == 'outtime')//添加
  14. {
  15. $this->_outtime();
  16. }
  17. else
  18. {
  19. $this->_index();
  20. }
  21. }
  22. public function _index(){
  23. }
  24. public function _outtime(){
  25. if(isset($_SESSION['api']))
  26. {
  27. $user = $this->user->get_api($_SESSION['api']);
  28. $usp = $user;
  29. $fgshop = "";$sid = "";
  30. $user = explode('|',trim($user['shop'],'|'));
  31. foreach ($user as $value)
  32. {
  33. $fgshop .= " shop = ".$value." or";
  34. $sid .= " id = ".$value." or";
  35. }
  36. }
  37. $post = $this->input->post(NULL, TRUE);
  38. if(isset($post['page']))
  39. {
  40. $page = $this->input->post('page',true);
  41. $perpage = $this->input->post('perpage',true);
  42. $number = $this->input->post('number',true);
  43. $timetk = $this->input->post('timetk',true);
  44. $timetj = $this->input->post('timetj',true);
  45. $timetk = strtotime($timetk);
  46. $timetj = strtotime($timetj);
  47. $where = "error_type = 1 and (".rtrim($fgshop,'or').")";
  48. if($number)
  49. {
  50. $where .= " and number = '$number'";
  51. }
  52. if($timetk && $timetj)
  53. {
  54. $timetj = $timetj+24*3600;
  55. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  56. }
  57. //数据排序
  58. $order_str = "id desc";
  59. if(empty($page))
  60. {
  61. $start = 0;
  62. $perpage = 1;
  63. }
  64. else
  65. {
  66. $start = ($page - 1)*$perpage;
  67. }
  68. $info_list = $this->fullordererrors->find_all($where,'id,shop,number,error_time',$order_str,$start,$perpage);
  69. //格式化数据
  70. foreach ($info_list as $key=>$value)
  71. {
  72. //$ud = $this->fullorder->read($value['id']);
  73. $shop = $this->shop->read($value['shop']);
  74. $info_list[$key]['shop'] = $shop['shopname'];
  75. // $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'>".$value['orderinfo']."<p>";
  76. // $warehouse = $this->warehouse->read($value['type']);
  77. // $warehousetitle = $warehouse['title'];
  78. // if($value['type'] != 1){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}
  79. // $info_list[$key]['type'] = $warehousetitle;
  80. // if($value['express'] != 0)
  81. // {
  82. // $express = $this->express->read($value['express']);
  83. // $expressservicename = $express['servicename'];
  84. // if($value['express'] != 1){$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";}
  85. // $info_list[$key]['express'] = $expressservicename;
  86. // }
  87. // else
  88. // {
  89. // $info_list[$key]['express'] = "无";
  90. // }
  91. // $x = "";
  92. // if($ud['review'] >4 && $ud['print'] == 1)
  93. // {
  94. // $x = "<p class='ckn'><b class='fojzof' data-type='8' data-id='".$value['id']."'>允许打印</b></p>";
  95. // }
  96. // else
  97. // {
  98. // $x = "<p class='ckn'><b class='fojzof' data-type='9' data-id='".$value['id']."'>关闭</b></p>";
  99. // }
  100. // $info_list[$key]['operation'] = $x;
  101. }
  102. $total = $this->fullordererrors->find_count($where);
  103. $pagenum = ceil($total/$perpage);
  104. $over = $total-($start+$perpage);
  105. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  106. echo json_encode($rows);exit;
  107. }
  108. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  109. $this->data['wlshop'] = $wlshop;
  110. $this->_Template('fullordererror_errshow',$this->data);
  111. }
  112. }