load->library('session'); $this->load->_model('Model_bhsq','bhsq'); $this->load->_model("Model_shop","shop"); $this->load->_model("Model_typeclass","typeclass"); $this->load->_model("Model_bhccwl","bhccwl"); $this->load->_model("Model_logic_u9tools","logic_u9tools"); $this->load->_model("Model_whlabel","whlabel"); $this->load->_model("Model_goods","goods"); $this->load->_model("Model_settingtest","settingtest"); $this->load->_model("Model_bhdcd","bhdcd"); } //定义方法的调用规则 获取URI第二段值 public function _remap($arg,$arg_array) { if(!isset($_SESSION['api'])){ header('Location: /');exit; } if($arg == 'dyapply')// { $this->_dyapply(); } elseif($arg == 'dyapplyadd')// { $this->_dyapplyadd(); } elseif($arg == 'dyapplyedit')// { $this->_dyapplyedit($arg_array); } elseif($arg == 'dyapplygxzt')// { $this->_dyapplygxzt(); } elseif($arg == 'dyapplyexcel'){ $this->_dyapplyexcel(); } elseif($arg == 'ccwlshlist'){ $this->_ccwlshlist(); } elseif($arg == 'ccwlbhindex'){ $this->_ccwlbhindex(); }elseif($arg == 'dyapplysave'){ $this->_dyapplysave(); }elseif($arg == 'ccwlbhmake'){ $this->_ccwlbhmake(); }elseif($arg == 'ccwlbhedit'){ $this->_ccwlbhedit($arg_array); }elseif($arg == 'ccwleditxzbh'){ $this->_ccwleditxzbh(); }elseif($arg == 'ccwlbhsavexzbh'){ $this->_ccwlbhsavexzbh(); }elseif($arg == 'ccwldelitem'){ $this->_ccwldelitem(); }elseif($arg == 'ccwlbhsave'){ $this->_ccwlbhsave(); }elseif($arg == 'ckbhindex'){ $this->_ckbhindex(); }elseif($arg == 'ckbhedit'){ $this->_ckbhedit($arg_array); }elseif($arg == 'makeu9scd'){ $this->_makeu9scd($arg_array); }elseif($arg == 'showckbh'){ $this->_showckbh($arg_array); }elseif($arg == 'ddscscd'){ $this->_ddscscd(); }elseif($arg == 'ckdcd'){ $this->_ckdcd(); }elseif($arg == 'ckbherprk'){ $this->_ckbherprk($arg_array); }elseif($arg == 'bhdcdsave'){ $this->_bhdcdsave(); } else { $this->_index(); } } private function _index(){ exit('No direct script access allowed 1'); } //备货申请单的列表 private function _dyapply(){ if($this->input->method() === 'post'){ $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $sqr = $this->input->post('sqr',true); $sqr = trim($sqr); $shop_id = $this->input->post('shop_id',true); $plat_id = $this->input->post('plat_id',true); $shop_ids = $this->input->post('shop_ids',true); $ktime = $this->input->post('ktime',true); $jtime = $this->input->post('jtime',true); $ktime = strtotime($ktime); $jtime = strtotime($jtime); $where = "add_time >= ".$ktime." and add_time < ".$jtime." "; if(!empty($sqr)){ $where .= " and sqr = ".$sqr." "; } if(!empty($shop_id)){ $where .= " and shop_id = ".$shop_id." "; }else{ $where .= " and shop_id in (".$shop_ids.") "; } if(!empty($plat_id)){ $where .= " and plat_id = ".$plat_id." "; } //数据排序 $order_str = "id desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } $list = $this->bhsq->find_all($where,"id,shop_id,plat_id,title,sku,sqr,sq_num,sq_status,add_time,update_time",$order_str,$start,$perpage); if(empty($list)){ $rows = array('total'=>0,'over'=>1,'pagenum'=>0,'rows'=>([])); echo json_encode($rows);exit; } $shop_list = $this->shop->find_all("1=1","id,shopname"); $shop_list = array_column($shop_list,'shopname','id'); $plat_list = $this->typeclass->find_all("classid = 32","id,title"); $plat_list = array_column($plat_list,'title','id'); $status_list = $this->bhsq->getSqStatus(); foreach($list as $k=>$v){ $list[$k]['shop_id'] = isset($shop_list[$v['shop_id']])?$shop_list[$v['shop_id']]:""; $list[$k]['plat_id'] = isset($plat_list[$v['plat_id']])?$plat_list[$v['plat_id']]:""; $list[$k]['sq_status'] = isset($status_list[$v['sq_status']])?$status_list[$v['sq_status']]:""; $list[$k]['add_time'] = date("Y-m-d",$v['add_time']); $str = ""; if($v['sq_status'] == 1 || $v['sq_status'] == 3){ $str .= "
"; $str .= "编辑"; $str .= "发布"; $str .= "取消"; $str .= "
"; } $list[$k]['update_time'] = $str; } $total = $this->bhsq->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list)); echo json_encode($rows);exit; }else{ $user = $this->user->get_api($_SESSION['api']); $usersp = explode('|',trim($user['shop'],'|')); $this->data['usersp'] = implode(",",$usersp); $this->_Template('beihuogl_dyapply',$this->data); } } //备货申请单的添加 private function _dyapplyadd(){ if($this->input->method() === 'post'){ $data = $this->input->post(); $time = strtotime(date("Y-m-d"),time()); $info = $this->bhsq->find("real_time >= ".$time,"*",'id desc'); if(empty($info)){ $num = 1; }else{ $arr = explode('-',$info['sb_no']); $num = (int)$arr[2]+1; } $num = str_pad($num, 3, '0', STR_PAD_LEFT); $sb_no = "SQ-".date("ymd")."-".$num; $insert_arr = []; $time = time(); foreach($data['title'] as $k=>$v){ $insert_arr[] = [ 'sb_no'=>$sb_no, 'sku'=>$data['sku'][$k], 'title'=>$data['title'][$k], 'shop_id'=>$data['shop_id'], 'plat_id'=>$data['plat_id'], 'sqr'=>$data['sqr'], 'sq_num'=>$data['sq_num'][$k], 'ccwl_num'=>$data['sq_num'][$k], 'ck_num'=>$data['sq_num'][$k], 'sq_status'=>1, 'remark'=>$data['remark'], 'add_time'=>$time, 'real_time'=>$time, 'update_time'=>$time, ]; } $r =$this->db->insert_batch('bhsq',$insert_arr); if($r){ echo json_encode(['code'=>1,'msg'=>'添加成功']); }else{ echo json_encode(['code'=>-1,'msg'=>'添加失败']); } exit; }else{ $plat_list = $this->typeclass->find_all("classid = 32 and id != 2297","id,title"); $this->data['plat_list'] = $plat_list; $this->_Template('beihuogl_dyapplyadd',$this->data); } } //备货申请单的 修改 private function _dyapplyedit($arg_array){ if($this->input->method() === 'post'){ $data = $this->input->post(); $id = $data['id']; $update_arr = [ 'shop_id'=>$data['shop_id'], 'plat_id'=>$data['plat_id'], 'sqr'=>$data['sqr'], 'sq_num'=>$data['sq_num'], 'ccwl_num'=>$data['sq_num'], 'ck_num'=>$data['sq_num'], 'sku'=>$data['sku'], 'remark'=>$data['remark'], ]; $r = $this->bhsq->save($update_arr,$id); if($r){ echo json_encode(['msg'=>'添加成功','success'=>true]); }else{ echo json_encode(['msg'=>'添加失败','success'=>false]); } exit; }else{ $id = $arg_array[0]; $info = $this->bhsq->find("id = ".$id); $plat_list = $this->typeclass->find_all("classid = 32 and id != 2297","id,title"); $this->data['plat_list'] = $plat_list; $this->data['info'] = $info; $this->_Template('beihuogl_dyapplyedit',$this->data); } } //备货申请单的 状态申请 如 发布 或者取消 private function _dyapplygxzt(){ if($this->input->method() === 'post'){ $data = $this->input->post(); $id = (int)$data['id']; $type = (int)$data['status']; $update_arr = []; $update_arr['sq_status'] = $type; if($type == 2){ $update_arr['public_time'] = time(); } $r = $this->bhsq->save($update_arr,$id); if($r){ echo json_encode(['msg'=>'修改成功','success'=>true]); }else{ echo json_encode(['msg'=>'修改失败','success'=>false]); } exit; }else{ echo json_encode(['success'=>false,'msg'=>'请求失败']); } } //备货申请单的 private function _dyapplysave(){ if($this->input->method() === 'post'){ $data = $this->input->post(); $id = (int)$data['id']; $val = $this->input->post('val',true); $column = $data['column']; if($column == 'ccwl_num'){ $update_arr = [ 'ccwl_num'=>(int)$val, 'ck_num'=>(int)$val, ]; }elseif($column == 'sku'){ $update_arr = [ 'sku'=>$val, ]; }elseif($column == 'ck_num'){ $update_arr = [ 'ck_num'=>(int)$val, ]; }elseif($column == 'drck'){ $update_arr = [ 'drck'=>(int)$val, ]; }else{ echo json_encode(['msg'=>'修改信息不合规','success'=>false]); exit; } $r = $this->bhsq->save($update_arr,$id); if($r){ echo json_encode(['msg'=>'修改成功','success'=>true]); }else{ echo json_encode(['msg'=>'修改失败','success'=>false]); } exit; }else{ echo json_encode(['success'=>false,'msg'=>'请求失败']); } } private function _dyapplyexcel(){ if($this->input->method() === 'post'){ $data = $this->input->post('list',true); if(empty($data)){ $json_data = $this->input->raw_input_stream; $tmp_data = json_decode($json_data,true); $data = $tmp_data['list']; if(empty($data)){ echo json_encode(['success'=>false,'msg'=>'未获取要保存的数据']); exit; } } $shop_list = $this->shop->find_all("1=1","id,shortname,type"); $shop_list = array_column($shop_list,null,'shortname'); $time = strtotime(date("Y-m-d"),time()); $info = $this->bhsq->find("real_time >= ".$time,"*",'id desc'); if(empty($info)){ $num = 1; }else{ $arr = explode('-',$info['sb_no']); $num = (int)$arr[2]+1; } $time = time(); $num = str_pad($num, 3, '0', STR_PAD_LEFT); $sb_no = "SQ-".date("ymd")."-".$num; $insert_arr = []; $error_list= []; foreach($data as $k=>$v){ $shopshortname = trim($v[4]); $shop_info = isset($shop_list[$shopshortname])?$shop_list[$shopshortname]:[]; if(empty($shop_info)){ $error_list[] = [ 'msg'=>"第".($k+1).'行店铺不存在,请核对表格信息'.$shopshortname, ]; continue; } $num = (int)$v[3]; if(empty($num)){ $error_list[] = [ 'msg'=>"第".($k+1).'行数量不能为空,请核对表格信息', ]; continue; } $tmp_time = trim($v[0]); if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $tmp_time)) { $add_time = strtotime($tmp_time); }else{ $error_list[] = [ 'msg'=>"第".($k+1).'行日期格式不正确,请核对表格信息', ]; continue; } if(empty($v[5])){ $error_list[] = [ 'msg'=>"第".($k+1).'行申请人信息不能为空,请核对表格信息', ]; continue; } if(empty($v[1])){ $error_list[] = [ 'msg'=>"第".($k+1).'行产品信息不能为空,请核对表格信息', ]; continue; } $insert_arr[] = [ 'sb_no'=>$sb_no, 'sku'=>trim($v[2]), 'title'=>trim($v[1]), 'shop_id'=>$shop_info['id'], 'plat_id'=>$shop_info['type'], 'sqr'=>trim($v[5]), 'sq_num'=>$num, 'ccwl_num'=>$num, 'ck_num'=>$num, 'sq_status'=>1, 'remark'=>$v[6], 'add_time'=>$add_time, 'real_time'=>$time, 'update_time'=>$time, ]; } $r =$this->db->insert_batch('bhsq',$insert_arr); if($r){ echo json_encode(['success'=>true,'msg'=>'添加成功','error_list'=>$error_list]); }else{ echo json_encode(['success'=>false,'msg'=>'添加失败','error_list'=>$error_list]); } exit; }else{ echo json_encode(['success'=>true,'msg'=>'请求失败']); exit; } } //仓储物流部的备货申请单的列表 private function _ccwlshlist(){ if($this->input->method() === 'post'){ $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $sqr = $this->input->post('sqr',true); $sqr = trim($sqr); $shop_id = $this->input->post('shop_id',true); $plat_id = $this->input->post('plat_id',true); $shop_ids = $this->input->post('shop_ids',true); $ktime = $this->input->post('ktime',true); $jtime = $this->input->post('jtime',true); $ktime = strtotime($ktime); $jtime = strtotime($jtime); $where = "sq_status = 2 and ccwl_status = 0 "; $where .= " and add_time >= ".$ktime." and add_time < ".$jtime." "; if(!empty($sqr)){ $where .= " and sqr = ".$sqr." "; } if(!empty($shop_id)){ $where .= " and shop_id = ".$shop_id." "; }else{ $where .= " and shop_id in (".$shop_ids.") "; } if(!empty($plat_id)){ $where .= " and plat_id = ".$plat_id." "; } //数据排序 $order_str = "id desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } $list = $this->bhsq->find_all($where,"id,shop_id,plat_id,title,sku,sqr,sq_num,ccwl_num,add_time,update_time",$order_str,$start,$perpage); if(empty($list)){ $rows = array('total'=>0,'over'=>1,'pagenum'=>0,'rows'=>([])); echo json_encode($rows);exit; } $shop_list = $this->shop->find_all("1=1","id,shopname"); $shop_list = array_column($shop_list,'shopname','id'); $plat_list = $this->typeclass->find_all("classid = 32","id,title"); $plat_list = array_column($plat_list,'title','id'); foreach($list as $k=>$v){ $list[$k]['shop_id'] = isset($shop_list[$v['shop_id']])?$shop_list[$v['shop_id']]:""; $list[$k]['plat_id'] = isset($plat_list[$v['plat_id']])?$plat_list[$v['plat_id']]:""; $list[$k]['add_time'] = date("Y-m-d",$v['add_time']); $list[$k]['sku'] = $v['sku']." "; $list[$k]['ccwl_num'] = $v['ccwl_num']." "; $list[$k]['update_time'] = "驳回"; } $total = $this->bhsq->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list)); echo json_encode($rows);exit; }else{ $user = $this->user->get_api($_SESSION['api']); $usersp = explode('|',trim($user['shop'],'|')); $this->data['usersp'] = implode(",",$usersp); $this->_Template('beihuogl_ccwlshlist',$this->data); } } //仓储物流合成备货单 private function _ccwlbhmake(){ if($this->input->method() === 'post'){ $data = $this->input->post(); $bh_no = $data['bh_no']; $select_id = $data['arr_id']; if(empty($select_id)){ echo json_encode(['success'=>false,'msg'=>'至少选一个呀!!!']); exit; } if(empty($bh_no)){ $tmp_time = strtotime(date("Y-m-d"),time()); $num = $this->bhccwl->find_count("create_time >= ".$tmp_time); $num = $num+1; $num = str_pad($num, 3, '0', STR_PAD_LEFT); $bh_no = "BH-".date("ymd")."-".$num; } $list = $this->bhsq->find_all('id in ('.implode(',',$select_id).')'); foreach($list as $k=>$v){ if(empty($v['sku'])){ echo json_encode(['success'=>false,'msg'=>'提交的数据中有的sku为空,请核对填写信息']); exit; } } $classid = $this->logic_u9tools->getClass(); $typeclass = $this->logic_u9tools->getTypeClass(); foreach($list as $k=>$v){ $whlabel_info = $this->goods->find("sku = '".$v['sku']."'",'sku,features,jm','id desc'); if(empty($whlabel_info)){ $whlabel_info = $this->whlabel->find("sku = '".$v['sku']."'",'sku,features','id desc'); if(empty($whlabel_info)){ echo json_encode(['success'=>false,'msg'=>$v['sku'].'未在进销存浏览那找到对应信息']); exit; } $r = $this->logic_u9tools->getOneU9bmHasGift($whlabel_info['features'],$classid,$typeclass); $this->bhsq->save([ 'jm'=>$r['jm'], 'drck'=>$this->getU9Drck($whlabel_info['features']), 'features'=>$whlabel_info['features'], ],$v['id']); }else{ $this->bhsq->save([ 'jm'=>$whlabel_info['jm'], 'drck'=>$this->getU9Drck($whlabel_info['features']), 'features'=>$whlabel_info['features'], ],$v['id']); } } $this->db->trans_start(); $this->db->where_in('id',$select_id); $this->db->update('bhsq',[ 'bh_no'=>$bh_no, 'sq_status'=>4, 'ccwl_status'=>1, ]); $this->db->select('SUM(ccwl_num) as total_ccwl_num'); $this->db->where_in('id',$select_id); $query = $this->db->get('bhsq'); $result = $query->row(); $total_ccwl_num = $result->total_ccwl_num? $result->total_ccwl_num:0; $time = time(); $this->bhccwl->insert([ 'bh_no'=>$bh_no, 'status'=>0, 'num'=>$total_ccwl_num, 'create_time'=>$time, 'update_time'=>$time, ]); if($this->db->trans_status() === FALSE){ $this->db->trans_rollback(); echo json_encode(['success'=>false,'msg'=>'生成备货单失败']); exit; }else{ $this->db->trans_commit(); echo json_encode(['success'=>true,'msg'=>'生成备货单成功']); exit; } }else{ echo json_encode(['success'=>false,'msg'=>'请求失败']); exit; } } private function getU9Drck($features){ if(stripos($features,'-126-') !== false) { $drck = '12003';//进入发条库 } else if(stripos($features,'-127-') !== false) { $drck = '12004';//进入发块库 } else { $drck = '12006';//其它进入完成库 } return $drck; } //仓储物流部的备货单列表 private function _ccwlbhindex(){ if($this->input->method() === 'post'){ $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $bh_no = $this->input->post('bh_no',true); $status = $this->input->post('status',true); $ktime = $this->input->post('ktime',true); $jtime = $this->input->post('jtime',true); $ktime = strtotime($ktime); $jtime = strtotime($jtime); $where = "create_time >= ".$ktime." and create_time < ".$jtime." "; if(!empty($bh_no)){ $where .= " and bh_no = '".$bh_no."' "; } if($status > -1){ $where .= " and status = ".$status." "; } //数据排序 $order_str = "id desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } $list = $this->bhccwl->find_all($where,"id,bh_no,status,create_time,public_time,update_time",$order_str,$start,$perpage); if(empty($list)){ $rows = array('total'=>0,'over'=>1,'pagenum'=>0,'rows'=>([])); echo json_encode($rows);exit; } $status_list = $this->bhccwl->getStatus(); foreach($list as $k=>$v){ $list[$k]['status'] = isset($status_list[$v['status']])?$status_list[$v['status']]:""; $list[$k]['create_time'] = date("Y-m-d",$v['create_time']); $list[$k]['public_time'] = empty($v['public_time'])?"":date("Y-m-d",$v['public_time']); $str = ""; if($v['status'] == 0){ $str .= "
"; $str .= "编辑"; $str .= "发布"; $str .= "
"; } $list[$k]['update_time'] = $str; } $total = $this->bhccwl->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list)); echo json_encode($rows);exit; }else{ $this->_Template('beihuogl_ccwlbhindex',$this->data); } } //仓储物流部备货 在编辑页面添加数据 private function _ccwlbhsavexzbh(){ if($this->input->method() === 'post'){ $data = $this->input->post(); $select_id = $data['select_id']; $id = $data['id']; $bh_no = $data['bh_no']; if(empty($select_id)){ echo json_encode(['success'=>false,'msg'=>'至少选一个呀!!!']); exit; } $info = $this->bhccwl->read($id); if(empty($info)){ echo json_encode(['success'=>false,'msg'=>'数据不存在']); exit; } if($info['bh_no'] != $bh_no){ echo json_encode(['success'=>false,'msg'=>'数据信息异常联系技术处理']); exit; } $bh_no = $info['bh_no']; $list = $this->bhsq->find_all('id in ('.implode(',',$select_id).') ' ); foreach($list as $k=>$v){ if(empty($v['sku'])){ echo json_encode(['success'=>false,'msg'=>'提交的数据中有的sku为空,请核对填写信息']); exit; } if(!empty($v['bh_no'])){ echo json_encode(['success'=>false,'msg'=>'提交的数据中有的已经被调用,请联系技术核对']); exit; } } $classid = $this->logic_u9tools->getClass(); $typeclass = $this->logic_u9tools->getTypeClass(); foreach($list as $k=>$v){ $whlabel_info = $this->goods->find("sku = '".$v['sku']."'",'sku,features,jm','id desc'); if(empty($whlabel_info)){ $whlabel_info = $this->whlabel->find("sku = '".$v['sku']."'",'sku,features','id desc'); if(empty($whlabel_info)){ echo json_encode(['success'=>false,'msg'=>$v['sku'].'未在进销存浏览那找到对应信息']); exit; } if(empty($v['jm'])){ $r = $this->logic_u9tools->getOneU9bmHasGift($whlabel_info['features'],$classid,$typeclass); $this->bhsq->save([ 'jm'=>$r['jm'], 'drck'=>$this->getU9Drck($whlabel_info['features']), 'features'=>$whlabel_info['features'], ],$v['id']); } $list[$k]['jm'] = $r['jm']; }else{ $this->bhsq->save([ 'jm'=>$whlabel_info['jm'], 'drck'=>$this->getU9Drck($whlabel_info['features']), 'features'=>$whlabel_info['features'], ],$v['id']); $list[$k]['jm'] = $whlabel_info['jm']; } } $status_list = $this->bhccwl->getStatus(); $info['status_show'] = isset($status_list[$info['status']])?$status_list[$info['status']]:""; $plat_list = $this->typeclass->find_all("classid = 32 and id != 2297","id,title"); $plat_list = array_column($plat_list,'title','id'); $shop_list = $this->shop->find_all("1=1","id,shopname"); $shop_list = array_column($shop_list,'shopname','id'); foreach($list as $k=>$v){ $list[$k]['shop_id'] = isset($shop_list[$v['shop_id']])?$shop_list[$v['shop_id']]:""; $list[$k]['plat_id'] = isset($plat_list[$v['plat_id']])?$plat_list[$v['plat_id']]:""; $list[$k]['public_time'] = date("Y-m-d",$v['public_time']); $list[$k]['bh_no'] = $info['bh_no']; } echo json_encode(['success'=>true,'msg'=>'编辑成功','data'=>$list]);exit; }else{ echo json_encode(['success'=>false,'msg'=>'请求失败']); exit; } } private function _ccwlbhedit($arg_array){ if($this->input->method() === 'post'){ $select_id = $this->input->post('arr_id',true); if(empty($select_id)){ echo json_encode(['success'=>false,'msg'=>'至少选一个呀!!!']); exit; } $id = $this->input->post('id',true); $info = $this->bhccwl->read($id); $bh_no = $info['bh_no']; $this->db->where_in('id',$select_id); $this->db->update('bhsq',[ 'bh_no'=>$bh_no, 'sq_status'=>4, 'ccwl_status'=>1, ]); $this->db->select('SUM(ccwl_num) as total_ccwl_num'); $this->db->where_in('id',$select_id); $query = $this->db->get('bhsq'); $result = $query->row(); $total_ccwl_num = $result->total_ccwl_num? $result->total_ccwl_num:0; $time = time(); $this->bhccwl->save([ 'num'=>$total_ccwl_num, 'update_time'=>$time, ],$info['id']); echo json_encode(['success'=>true,'msg'=>'修改成功']);exit; }else{ $id = $arg_array[0]; $info = $this->bhccwl->find("id = ".$id); $list = $this->bhsq->find_all("bh_no = '".$info['bh_no']."' and sq_status = 4 and ccwl_status = 1"); $status_list = $this->bhccwl->getStatus(); $info['status_show'] = isset($status_list[$info['status']])?$status_list[$info['status']]:""; $plat_list = $this->typeclass->find_all("classid = 32 and id != 2297","id,title"); $plat_list = array_column($plat_list,'title','id'); $shop_list = $this->shop->find_all("1=1","id,shopname"); $shop_list = array_column($shop_list,'shopname','id'); foreach($list as $k=>$v){ $list[$k]['shop_id'] = isset($shop_list[$v['shop_id']])?$shop_list[$v['shop_id']]:""; $list[$k]['plat_id'] = isset($plat_list[$v['plat_id']])?$plat_list[$v['plat_id']]:""; $list[$k]['public_time'] = date("Y-m-d",$v['public_time']); } // $this->data['info'] = $info; $this->data['list'] = $list; $this->data['info'] = $info; $this->_Template('beihuogl_ccwlbhedit',$this->data); } } private function _ccwldelitem(){ if($this->input->method() === 'post'){ $data = $this->input->post(); $id = $data['id']; $bh_no = $data['bh_no']; $info = $this->bhsq->read($id); $ccwl_num = $info['ccwl_num']; if(empty($info)){ echo json_encode(['success'=>false,'msg'=>'数据不存在']);exit; } if(empty($info['bh_no'])){ if($info['sq_status'] == 2 && $info['ccwl_status'] == 0){ echo json_encode(['success'=>true,'msg'=>'删除成功']);exit; }else{ echo json_encode(['success'=>false,'msg'=>'数据信息异常联系技术处理']);exit; } } if($info['bh_no'] != $bh_no){ echo json_encode(['success'=>false,'msg'=>'数据信息异常联系技术处理']);exit; } $ccwl_info = $this->bhccwl->find("bh_no = '".$info['bh_no']."'"); $ccwl_info['num'] = $ccwl_info['num'] - $ccwl_num; $this->db->trans_start(); $this->bhccwl->save([ 'num'=>$ccwl_info['num'], ],$ccwl_info['id']); $this->bhsq->save([ 'sq_status'=>2, 'ccwl_status'=>0, 'bh_no'=>'' ],$id); if($this->db->trans_status() === FALSE){ $this->db->trans_rollback(); echo json_encode(['success'=>false,'msg'=>'删除失败']);exit; }else{ $this->db->trans_commit(); echo json_encode(['success'=>true,'msg'=>'删除成功']);exit; } }else{ echo json_encode(['success'=>false,'msg'=>'请求失败']);exit; } } private function _ccwleditxzbh(){ if($this->input->method() === 'post'){ $data = $this->input->post(); //超过三月没审核的 就不展示了 $time = time() - 60*24*3600; $where = "sq_status = 2 and ccwl_status = 0 and public_time > ".$time." "; if(!empty($data['sqr'])){ $where .= " and sqr = '".$data['sqr']."' "; } if(!empty($data['shop_id'])){ $where .= " and shop_id = ".$data['shop_id']." "; } if(!empty($data['plat_id'])){ $where .= " and plat_id = ".$data['plat_id']." "; } if(!empty($data['sku'])){ $where .= " and sku = '".$data['sku']."' "; } $order_str = "id desc"; $list = $this->bhsq->find_all($where,"*",$order_str,0,20); $shop_list = $this->shop->find_all("1=1","id,shopname"); $shop_list = array_column($shop_list,'shopname','id'); $plat_list = $this->typeclass->find_all("classid = 32 and id != 2297","id,title"); $plat_list = array_column($plat_list,'title','id'); foreach($list as $k=>$v){ $list[$k]['shop_id'] = isset($shop_list[$v['shop_id']])?$shop_list[$v['shop_id']]:""; $list[$k]['plat_id'] = isset($plat_list[$v['plat_id']])?$plat_list[$v['plat_id']]:""; $list[$k]['public_time'] = date("Y-m-d",$v['public_time']); } if(empty($list)){ echo json_encode(['success'=>false,'msg'=>'查询失败']);exit; }else{ echo json_encode(['success'=>true,'msg'=>'查询成功','data'=>$list]);exit; } }else{ $data = $this->input->get(); $this->data['id'] = $data['id']; $this->data['bh_no'] = $data['bh_no']; $plat_list = $this->typeclass->find_all("classid = 32 and id != 2297","id,title"); $this->data['plat_list'] = $plat_list; $this->_Template('beihuogl_ccwleditxzbh',$this->data); } } private function _ccwlbhsave(){ if($this->input->method() === 'post'){ $data = $this->input->post(); $id = $data['id']; $val = $data['val']; $column = $data['column']; $update_arr = []; if($column == 'status'){ $update_arr = [ 'status'=>(int)$val, 'update_time'=>time(), 'public_time'=>time(), ]; }else{ echo json_encode(['success'=>false,'msg'=>'请求参数未设置']);exit; } $r = $this->bhccwl->save($update_arr,$id); if($r){ echo json_encode(['success'=>true,'msg'=>'修改成功']);exit; }else{ echo json_encode(['success'=>false,'msg'=>'修改失败']);exit; } }else{ echo json_encode(['success'=>false,'msg'=>'请求失败']);exit; } } //仓库的备货单列表 private function _ckbhindex(){ if($this->input->method() === 'post'){ $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $bh_no = $this->input->post('bh_no',true); $status = $this->input->post('status',true); $ktime = $this->input->post('ktime',true); $jtime = $this->input->post('jtime',true); $ktime = strtotime($ktime); $jtime = strtotime($jtime); $where = "public_time >= ".$ktime." and public_time < ".$jtime." and status = 1 "; if(!empty($bh_no)){ $where .= " and bh_no = '".$bh_no."' "; } if($status > -1){ $where .= " and status = ".$status." "; } //数据排序 $order_str = "id desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } $list = $this->bhccwl->find_all($where,"id,bh_no,ck_status,public_time,ckpublic_time",$order_str,$start,$perpage); if(empty($list)){ $rows = array('total'=>0,'over'=>1,'pagenum'=>0,'rows'=>([])); echo json_encode($rows);exit; } $status_list = $this->bhccwl->getCkStatus(); foreach($list as $k=>$v){ $list[$k]['bh_no'] = "

".$v['bh_no']."

"; $list[$k]['ck_status'] = isset($status_list[$v['ck_status']])?$status_list[$v['ck_status']]:""; $list[$k]['public_time'] = empty($v['public_time'])?"":date("Y-m-d",$v['public_time']); $list[$k]['ckpublic_time'] = empty($v['ckpublic_time'])?"":date("Y-m-d",$v['ckpublic_time']); $str = ""; if($v['ck_status'] == 0){ $str .= "
"; $str .= "审核"; // $str .= "审核"; $str .= "
"; } if($v['ck_status'] == 1 || $v['ck_status'] == 2){ $str .= "
"; $str .= "生成u9生产单"; $str .= "
"; } $list[$k]['update_time'] = $str; } $total = $this->bhccwl->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list)); echo json_encode($rows);exit; }else{ $this->_Template('beihuogl_ckbhindex',$this->data); } } private function _ckbhedit($arg_array){ if($this->input->method() === 'post'){ $id = $this->input->post('id',true); $bh_no = $this->input->post('bh_no',true); $info = $this->bhccwl->read($id); if(empty($info)){ echo json_encode(['success'=>false,'msg'=>'数据不存在']);exit; } if($info['ck_status'] == 0 && $info['status'] == 1){ }else{ echo json_encode(['success'=>false,'msg'=>'状态不对,不可审核']);exit; } if($info['bh_no'] != $bh_no){ echo json_encode(['success'=>false,'msg'=>'数据信息异常联系技术处理']);exit; } $num = 0; $list = $this->bhsq->find_all("bh_no = '".$info['bh_no']."' "); foreach($list as $k=>$v){ $num += $v['ck_num']; } $r = $this->bhccwl->save([ 'ck_status'=>1, 'ck_num'=>$num, 'update_time'=>time(), 'ckpublic_time'=>time(), ],$id); if($r){ echo json_encode(['success'=>true,'msg'=>'审核成功']);exit; }else{ echo json_encode(['success'=>false,'msg'=>'审核失败']);exit; } }else{ $id = $arg_array[0]; $info = $this->bhccwl->find("id = ".$id); $status_list = $this->bhccwl->getCkStatus(); $info['ck_status_show'] = isset($status_list[$info['ck_status']])?$status_list[$info['ck_status']]:""; $drck_list = $this->bhccwl->getDrck(); $this->data['drck_list'] = $drck_list; $this->data['drck_json'] = json_encode($drck_list); $this->data['info'] = $info; $list = $this->bhsq->find_all("bh_no = '".$info['bh_no']."'"); $shop_list = $this->shop->find_all("1=1","id,shopname"); $shop_list = array_column($shop_list,'shopname','id'); foreach($list as $k=>$v){ $list[$k]['shop_id'] = isset($shop_list[$v['shop_id']])?$shop_list[$v['shop_id']]:""; $list[$k]['drck_show'] = isset($drck_list[$v['drck']])?$drck_list[$v['drck']]:""; } $this->data['list'] = $list; $this->_Template('beihuogl_ckbhedit',$this->data); } } private function _makeu9scd($arg_array){ if($this->input->method() === 'post'){ $data = $this->input->post(null,true); $info = $this->bhccwl->read($data['id']); if(empty($info)){ echo json_encode(['success'=>false,'msg'=>'数据不存在']);exit; } if($info['ck_status'] == 1 && $info['status'] == 1){ }else{ echo json_encode(['success'=>false,'msg'=>'状态不对,不可生成u9生产单']); exit; } $list = $this->bhsq->find_all("bh_no = '".$info['bh_no']."' and is_u9sc = 0 "); $params = [ 'org_code'=>"120",//组织代码 龙盈工厂 'djhlx'=>'2000',//单号类型 备货生产单 'scbm_code'=>"12008",//龙盈生产部门 "time"=>time(), 'owner_org_code'=>"120", 'title'=>$info['bh_no'], 'shipremarks'=>$info['bh_no'], ]; $final_list = []; foreach($list as $k=>$v){ $final_list[] =[ 'do_id'=>$v['id'], 'drck'=>$v['drck'], 'jm'=>$v['jm'], 'sl'=>$v['ck_num'], ]; } $params['list'] = $final_list; $token = $this->settingtest->get_yytoken_120(); $res = $this->apiyyv1->scdCreate($params,$token); if(empty($res[0]['Data'])){ $this->logic_ding->sendToDing("生成u9生产单失败,错误信息:".json_encode($res,JSON_UNESCAPED_UNICODE)); echo json_encode(['success'=>false,'msg'=>'生成u9生产单失败']);exit; } $this->logic_ding->sendToDing("生成u9生产单成功,进行记录:".json_encode($res,JSON_UNESCAPED_UNICODE)); $r_s_list = $res[0]['Data']; foreach($list as $k=>$v){ $list[$k]['u9_data'] = $r_s_list[$k]; } //m_isSucess $flag_status = 0;//判断是否有创建失败的 $u9sc_status = 0;//判断是否有创建成功的 foreach($list as $k=>$v){ if($v['u9_data']['m_isSucess']== 1){ $u9sc_status += 1; $this->bhsq->save([ 'is_u9sc'=>1, 'u9sc_no'=>$v['u9_data']['m_code'], ],$v['id']); }else{ $flag_status += 0; $this->bhsq->save([ 'u9sc_remark'=>$v['u9_data']['m_errorMsg'], ],$v['id']); } } $len = count($list); //都创建失败了 就直接gg if($u9sc_status == 0){ echo json_encode(['success'=>false,'msg'=>'生成u9生产单失败']);exit; } if(($u9sc_status < $len) && ( $flag_status< $len) ){ $this->bhccwl->save([ 'ck_status'=>2, ],$info['id']); echo json_encode(['success'=>true,'msg'=>'生成u9生产单部分成功']);exit; } if($u9sc_status == $len){ $this->bhccwl->save([ 'ck_status'=>3, ],$info['id']); echo json_encode(['success'=>true,'msg'=>'生成u9生产单成功']);exit; } echo json_encode(['success'=>false,'msg'=>'代码异常']);exit; }else{ $id = $arg_array[0]; $info = $this->bhccwl->read($id); $list = $this->bhsq->find_all("bh_no = '".$info['bh_no']."' "); $shop_list = $this->shop->find_all("1=1","id,shopname"); $shop_list = array_column($shop_list,'shopname','id'); $drck_list = $this->bhccwl->getDrck(); $status_list = $this->bhccwl->getCkStatus(); $info['ck_status_show'] = isset($status_list[$info['ck_status']])?$status_list[$info['ck_status']]:""; foreach($list as $k=>$v){ $list[$k]['shop_id'] = isset($shop_list[$v['shop_id']])?$shop_list[$v['shop_id']]:""; $list[$k]['drck_show'] = isset($drck_list[$v['drck']])?$drck_list[$v['drck']]:""; } $this->data['list'] = $list; $this->data['info'] = $info; $this->_Template('beihuogl_makeu9scd',$this->data); } } private function _ddscscd(){ if($this->input->method() === 'post'){ $id = $this->input->post('id',true); $bh_no = $this->input->post('bh_no',true); $bhsq_info = $this->bhsq->read($id); $bhccwl_info = $this->bhccwl->find("bh_no = '".$bhsq_info['bh_no']."' "); if(empty($bhccwl_info)){ echo json_encode(['success'=>false,'msg'=>'数据不存在']);exit; } // if($bhccwl_info['ck_status'] != 1){ // echo json_encode(['success'=>false,'msg'=>'状态不对,不可生成u9生产单']); // exit; // } if(!in_array($bhccwl_info['ck_status'],[1,2])){ echo json_encode(['success'=>false,'msg'=>'状态不对,不可生成u9生产单']); exit; } if(!empty($bhsq_info['u9sc_no'])){ echo json_encode(['success'=>false,'msg'=>'状态不允许生成生产单,有疑问联系技术处理']); exit; } $params = [ 'org_code'=>"120",//组织代码 龙盈工厂 'djhlx'=>'2000',//单号类型 备货生产单 'scbm_code'=>"12008",//龙盈生产部门 "time"=>time(), 'owner_org_code'=>"120", 'title'=>$bhccwl_info['bh_no'], 'shipremarks'=>$bhccwl_info['bh_no'], ]; $list[] = [ 'do_id'=>$bhsq_info['id'], 'drck'=>$bhsq_info['drck'], 'jm'=>$bhsq_info['jm'], 'sl'=>$bhsq_info['ck_num'], ]; $params['list'] = $list; $token = $this->settingtest->get_yytoken_120(); $res = $this->apiyyv1->scdCreate($params,$token); if(empty($res[0]['Data'])){ echo json_encode(['success'=>false,'msg'=>'生成u9生产单失败']);exit; } if($res[0]['Data'][0]['m_isSucess']== 1){ $this->bhsq->save([ 'is_u9sc'=>1, 'u9sc_no'=>$res[0]['Data'][0]['m_code'], ],$bhsq_info['id']); $tmp_list = $this->bhsq->find_all("bh_no = '".$bh_no."' and is_u9sc = 0 "); if(empty($tmp_list)){ $tmp_status = 3; }else{ $tmp_status = 2; } $this->bhccwl->save([ 'ck_status'=>$tmp_status, ],$bhccwl_info['id']); echo json_encode(['success'=>true,'msg'=>'生成u9生产单成功']);exit; }else{ $this->bhsq->save([ 'u9sc_remark'=>$res[0]['Data'][0]['m_errorMsg'], ],$bhsq_info['id']); echo json_encode(['success'=>false,'msg'=>$res[0]['Data'][0]["m_errorMsg"]]);exit; } }else{ exit('No direct script access allowed'); } } private function _showckbh($arg_array){ if($this->input->method() === 'post'){ exit('No direct script access allowed'); } $id = $arg_array[0]; $drck_list = $this->bhccwl->getDrck(); $shop_list = $this->shop->find_all("1=1","id,shopname"); $shop_list = array_column($shop_list,'shopname','id'); $info = $this->bhccwl->read($id); $list = $this->bhsq->find_all("bh_no = '".$info['bh_no']."' "); $list_dcd = $this->bhdcd->find_all("bh_no = '".$info['bh_no']."' "); foreach($list as $k=>$v){ $list[$k]['shop_id'] = isset($shop_list[$v['shop_id']])?$shop_list[$v['shop_id']]:""; $list[$k]['drck_show'] = isset($drck_list[$v['drck']])?$drck_list[$v['drck']]:""; } $this->data['info'] = $info; $this->data['list'] = $list; $this->data['list_dcd'] = $list_dcd; $this->_Template('beihuogl_showckbh',$this->data); } //仓库录入调出单 private function _ckdcd(){ if($this->input->method() === 'post'){ $lrdcd = $this->input->post('lrdcd',true); if(empty($lrdcd)){ //列表展示 $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $bh_no = $this->input->post('bh_no',true); $dcd_no = $this->input->post('dcd_no',true); $status = $this->input->post('status',true); $ktime = $this->input->post('ktime',true); $jtime = $this->input->post('jtime',true); $ktime = strtotime($ktime); $jtime = strtotime($jtime); $where = "create_time >= ".$ktime." and create_time < ".$jtime." "; if(!empty($bh_no)){ $where .= " and bh_no = '".$bh_no."' "; } if($status > -1){ $where .= " and status = ".$status." "; } if(!empty($dcd_no)){ $where .= " and dcd_no = '".$dcd_no."' "; } //数据排序 $order_str = "id desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } $list = $this->bhdcd->find_all($where,"id,bh_no,dcd_no,drd_no,status,jm,num,kw,create_time",$order_str,$start,$perpage); if(empty($list)){ $rows = array('total'=>0,'over'=>1,'pagenum'=>0,'rows'=>([])); echo json_encode($rows);exit; } $status_list = $this->bhdcd->getStatus(); foreach($list as $k=>$v){ $list[$k]['dcd_no'] = "

".$v['dcd_no']."

"; $list[$k]['status'] = isset($status_list[$v['status']])?$status_list[$v['status']]:""; $list[$k]['drd_no'] = empty($v['drd_no'])?"":$v['drd_no']; $list[$k]['kw'] = empty($v['kw'])?"":$v['kw']; $list[$k]['create_time'] = empty($v['create_time'])?"":date("Y-m-d H:i:s",$v['create_time']); } $total = $this->bhdcd->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list)); echo json_encode($rows);exit; }else{ $num = $this->bhdcd->find("dcd_no = '".$lrdcd."'"); if(!empty($num)){ echo json_encode(['success'=>false,'msg'=>'调出单号已录入,不可重复录入']);exit; } //查询录入执行的调出单 $token = $this->settingtest->get_yytoken_120(); $res = $this->apiyyv1->cxDcdAboutErp($lrdcd,$token); if(empty($res[0]['Data'])){ echo json_encode(['success'=>false,'msg'=>'请检查调出单号,未在u9获取相关信息']);exit; } $time = time(); $final_list = []; foreach($res[0]['Data'] as $k=>$v){ $good_info = $this->goods->find("jm = '".$v['iteminfo_itemcode']."' "); $tmp_sku = ''; $tmp_title = ''; $tmp_features = ''; $tmp_number=''; if(!empty($good_info)){ $tmp_sku = $good_info['sku']; $tmp_title = $good_info['title']; $tmp_features = $good_info['features']; $tmp_number = str_replace("-","", $good_info['features']); } $final_list[] = [ 'sku'=>$tmp_sku, 'dcd_no'=>$v['docno'], 'jm'=>$v['iteminfo_itemcode'], 'zh'=>$v['iteminfo_itemname'], 'num'=>$v['costuomqty'], 'real_num'=>$v['costuomqty'], 'bh_no'=>$v['erp_no'], 'create_time'=>$time, 'title'=>$tmp_title, 'features'=>$tmp_features, 'number'=>$tmp_number, ]; } $r =$this->db->insert_batch('bhdcd',$final_list); if($r){ echo json_encode(['success'=>true,'msg'=>'录入成功']); }else{ echo json_encode(['success'=>false,'msg'=>'录入失败']); } exit; } }else{ $status_list = $this->bhdcd->getStatus(); $this->data['status_list'] = $status_list; $this->_Template('beihuogl_ckdcd',$this->data); } } private function _ckbherprk($arg_array){ if($this->input->method() === 'post'){ $data = $this->input->post(null,true); $dcd_no = $data['dcd_no']; $drd_no = $data['drd_no']; $list = $this->bhdcd->find_all("dcd_no = '".$dcd_no."' and drd_no = '".$drd_no."'"); $whlabel_arr = []; $time = time(); foreach($list as $k=>$v){ for($i=0;$i<$v['num'];$i++){ $whlabel_arr[] = [ 'sku'=>$v['sku'], 'number'=>$v['number'], 'features'=>$v['features'], 'title'=>$v['title'], 'zh'=>$v['zh'], 'warehouse'=>'13', 'enter'=>$time, 'state'=>0, 'retreatwarehouse'=>'13', 'time'=>$time, 'details'=>$v['kw'], 'bs'=>1, 'rktype'=>9, ]; } } $this->db->trans_start(); $this->db->insert_batch('whlabel',$whlabel_arr); $this->db->where('dcd_no',$dcd_no); $this->db->where('drd_no',$drd_no); $this->db->update('bhdcd',['status'=>3,'rk_time'=>$time]); if($this->db->trans_status() === FALSE){ $this->db->trans_rollback(); echo json_encode(['success'=>false,'msg'=>'录入失败']);exit; }else{ $this->db->trans_commit(); echo json_encode(['success'=>true,'msg'=>'录入成功']); } }else{ $dcd_no = $arg_array[0]; $list = $this->bhdcd->find_all("dcd_no = '".$dcd_no."'"); $jm_list = array_column($list,'jm'); $status_list = $this->bhdcd->getStatus(); $in_where = "( "; foreach($jm_list as $k=>$v){ $in_where .= "'".$v."',"; } $in_where = rtrim($in_where,","); $in_where .= " )"; foreach($list as $k=>$v){ $list[$k]['status_show'] = isset($status_list[$v['status']])?$status_list[$v['status']]:""; $list[$k]['drd_no'] = empty($v['drd_no'])?"":$v['drd_no']; if(!empty($v['kw'])){ $list[$k]['kw'] = $v['kw']; }else{ if(!empty($list[$k]['sku'])){ $whlabel_info = $this->whlabel->find(" warehouse = '13' and (sku = '".$list[$k]['sku']."') and ( details != '' and details IS NOT NULL )","*","id desc"); if(!empty($whlabel_info)){ if(!empty($whlabel_info['details'])){ $list[$k]['kw'] = $whlabel_info['details']; $this->bhdcd->save([ 'kw'=>$whlabel_info['details'], ],$v['id']); }else{ $list[$k]['kw'] = ""; } }else{ $list[$k]['kw'] = ""; } }else{ $list[$k]['kw'] = ""; } } $list[$k]['create_time'] = empty($v['create_time'])?"":date("Y-m-d H:i:s",$v['create_time']); } $this->data['list'] = $list; $this->_Template('beihuogl_ckbherprk',$this->data); } } private function _bhdcdsave(){ if($this->input->method() === 'post'){ $id = $this->input->post('id',true); $val = $this->input->post('val',true); $column = $this->input->post('column',true); $info = $this->bhdcd->read($id); $update_arr = []; if($column == 'real_num'){ if($val > $info['num']){ echo json_encode(['success'=>false,'msg'=>'录入数量不能大于原数量']);exit; } $update_arr = [ 'real_num'=>(int)$val, ]; }elseif($column == 'kw'){ $winfo = $this->whlabel->find("warehouse = '13' and sku = '".$info['sku']."' ","*","id desc"); if(!empty($winfo)){ $winfo = $this->whlabel->find("warehouse = '13' and sku = '".$info['sku']."' and details = '".$val."'","*","id desc"); if(empty($winfo)){ echo json_encode(['success'=>false,'msg'=>'请仔细核查该库位信息']);exit; } } $update_arr = [ 'kw'=>trim($val), ]; }else{ echo json_encode(['success'=>false,'msg'=>'请求参数未设置']);exit; } $r = $this->bhdcd->save($update_arr,$id); if($r){ echo json_encode(['success'=>true,'msg'=>'保存成功']); }else{ echo json_encode(['success'=>false,'msg'=>'保存失败']); } }else{ echo json_encode(['success'=>false,'msg'=>'请求方式错误']);exit; } } }