load->library('session'); $this->load->_model('Model_fullorder_smt','fullorder_smt'); $this->load->_model('Model_fullorder','fullorder'); $this->load->_model('Model_fullordertt','fullordertt'); $this->load->_model('Model_fullorderexcel','fullorderexcel'); $this->load->_model('Model_shop','shop'); $this->load->_model('Model_typeclass','typeclass'); $this->load->_model('Model_express','express'); $this->load->_model('Model_country','country'); $this->load->_model('Model_productdescribe','productdescribe'); $this->load->_model('Model_customs','customs'); $this->load->_model('Model_detailed','detailed'); $this->load->_model('Model_productdescription','productdescription'); $this->load->_model('Model_logistics','logistics'); $this->load->_model('Model_hl','hl'); $this->load->_model('Model_excel','excel'); $this->load->_model('Model_warehouse','warehouse'); $this->load->_model('Model_customer','customer'); $this->load->_model('Model_user','user'); $this->load->_model('Model_dhl','dhl'); $this->load->_model('Model_notice','notice'); $this->load->_model('Model_api','api'); } //定义方法的调用规则 获取URI第二段值 public function _remap($arg,$arg_array) { if($arg == 'hcd') { $this->_hcd(); } else { $this->_index(); } } //管理 public function _index() { $dt = 0; if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $timetk = $this->input->post('timetk',true); $timetj = $this->input->post('timetj',true); $timetk = strtotime($timetk)+12*3600; $timetj = strtotime($timetj)+12*3600; $data = $this->input->post('data',true); $where = "mergeid = 0 and (".rtrim($fgshop,'or').")"; if($data == 1) { $where .= " and print = 2 and state = 207"; } else if($data == 2) { $where .= " and print = 3 and library = 1 and printtime > '$timetk' and printtime < '$timetj'"; } else if($data == 3) { $where .= " and print = 3 and library = 2 and librarytime > '$timetk' and librarytime < '$timetj'"; } else if($data == 4) { $where .= " and print = 3 and library = 3 and retreattime > '$timetk' and retreattime < '$timetj'"; } //数据排序 $order_str = "dtime desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } $info_list = $this->fullorder_smt->find_all($where,'id,shop,type,orderinfo,number,client,state,buytime,libraryconfirm,express,waybill,orderremarks,reviewremarks,printnumber,black,clientremarks',$order_str,$start,$perpage); //格式化数据 foreach ($info_list as $key=>$value) { $ud = $this->fullorder_smt->read($value['id']); $ud['address'] = str_replace("'","’",$ud['address']); $ud['name'] = str_replace("'","’",$ud['name']); $customer = $this->customer->get_email($ud['email'],$value['shop']); $customerb = $this->customer->get_shopdata($ud['name'],$ud['email'],$ud['address'],$value['shop']); //$a = array_column($customer, 'email'); //三维找其中健的数组 //$a = array_flip($a); //键和值调换 $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; //$info_list[$key]['user'] = $shop['shopuser']; $warehouse = $this->warehouse->read($value['type']); $warehousetitle = $warehouse['title']; if($value['type'] != 1){$warehousetitle = "".$warehouse['title']."";} $info_list[$key]['type'] = $warehousetitle; $typeclass = $this->typeclass->read($value['state']); $info_list[$key]['state'] = $typeclass['spare']; if($ud['source'] == 1) //线下单用订单时间,其他用付款时间 { $info_list[$key]['buytime'] = '
'.date('Y-m-d',$ud['dtime']).'
'.date('H:i:s',$ud['dtime']).'
'; } else { $info_list[$key]['buytime'] = ''.date('Y-m-d',$value['buytime']+$dt).'
'.date('H:i:s',$value['buytime']+$dt).'
'; } if($value['waybill'] != "") { $info_list[$key]['waybill'] = "".$value['waybill']."
"; } if($value['express'] != 0) { $express = $this->express->read($value['express']); $expressservicename = $express['servicename']; if($value['express'] != 1){$expressservicename = "".$express['servicename']."";} $info_list[$key]['express'] = $expressservicename; } else { $info_list[$key]['express'] = "无"; } $x = ""; if($value['libraryconfirm'] == 2 && $ud['review'] > 4 && $ud['library'] == 1) { $x = "禁止发货
"; } else if(($ud['review'] > 4) && $ud['print'] != 1 && $value['libraryconfirm'] == 1) { $x = "允许发货
"; } if(($ud['review'] > 4) && $ud['print'] == 2) { $x = "禁止打印
"; } else if($ud['review'] >4 && $ud['print'] == 1) { $x = "允许打印
"; } if($value['waybill'] == "" && $ud['review'] > 4) { $x = $x."填写运单
"; } else if($value['waybill'] != "" && $ud['review'] > 4) { $x = $x."修改运单
"; } if(($ud['review'] == 1 || $ud['review'] == 3) && $ud['express'] > 0 && $ud['dtsbjz'] != 0 && $ud['ts'] != 0 && $ud['zsbjz'] != 0 && $ud['zjs'] != 0 && $ud['ts'] != 0) { $x = $x."提交审核
"; } if($value['black'] == 0) { $x = $x."加黑名单
"; } $info_list[$key]['black'] = $x; $tly = ""; if($value['clientremarks'] != "") { $tly = "有客户留言
"; } $info_list[$key]['orderinfo'] = "".$value['orderinfo']."
".$tly."'.date('Y-m-d',$ud['dtime']).'
'.date('H:i:s',$ud['dtime']).'
'; } else { $info_list[$key]['buytime'] = ''.date('Y-m-d',$value['buytime']+$dt).'
'.date('H:i:s',$value['buytime']+$dt).'
'; } if($value['waybill'] != "") { $info_list[$key]['waybill'] = "".$value['waybill']."
"; } if($value['express'] != 0) { $express = $this->express->read($value['express']); $expressservicename = $express['servicename']; if($value['express'] != 1){$expressservicename = "".$express['servicename']."";} $info_list[$key]['express'] = $expressservicename; } else { $info_list[$key]['express'] = "无"; } $x = ""; if($value['libraryconfirm'] == 2 && $ud['review'] > 4 && $ud['library'] == 1) { $x = "禁止发货
"; } else if(($ud['review'] > 4) && $ud['print'] != 1 && $value['libraryconfirm'] == 1) { $x = "允许发货
"; } if(($ud['review'] > 4) && $ud['print'] == 2) { $x = "禁止打印
"; } else if($ud['review'] >4 && $ud['print'] == 1) { $x = "允许打印
"; } if($value['waybill'] == "" && $ud['review'] > 4) { $x = $x."填写运单
"; } else if($value['waybill'] != "" && $ud['review'] > 4) { $x = $x."修改运单
"; } if(($ud['review'] == 1 || $ud['review'] == 3) && $ud['express'] > 0 && $ud['dtsbjz'] != 0 && $ud['ts'] != 0 && $ud['zsbjz'] != 0 && $ud['zjs'] != 0 && $ud['ts'] != 0) { $x = $x."提交审核
"; } if($value['black'] == 0) { $x = $x."加黑名单
"; } $info_list[$key]['black'] = $x; $tly = ""; if($value['clientremarks'] != "") { $tly = "有客户留言
"; } $info_list[$key]['orderinfo'] = "".$value['orderinfo']."
".$tly."