request->post(); $token = isset($post['token']) ? trim($post['token']) : ""; // if($token==""){ // return error_show(101,'token不能为空'); // // } // $effetc = VerifyTokens($token); // if(!empty($effetc) && $effetc['code']!=0){ // return error_show($effetc['code'],$effetc['message']); // // } } public function add(){ $post =$this->request->post(); $name = isset($post['name'])&& $post['name']!='' ?trim($post['name']) :''; if($name==''){ return error_show(1004,'参数name 不能为空'); } $supplier = isset($post['supplierNo'])&& $post['supplierNo']!='' ?trim($post['supplierNo']) :''; if($supplier==''){ return error_show(1004,'参数supplierNo 不能为空'); } $supplierinfo = Db::name("supplier")->where(["code"=>$supplier])->find(); if(empty($supplierinfo)){ return error_show(1004,'未找到供应商数据'); } $wsmtype = isset($post['wsmtype'])&& $post['wsmtype']!='' ?intval($post['wsmtype']) :''; if($wsmtype==''){ return error_show(1004,'参数wsmtype 不能为空'); } $isT = Db::name('warehouse_info')->where([['name',"=",$name]])->find(); if(!empty($isT)){ return error_show(1004,'仓库名称已存在'); } $addr = isset($post['addr'])&& $post['addr']!='' ?trim($post['addr']) :''; if($addr==''){ return error_show(1004,'参数addr 不能为空'); } $contactor = isset($post['contactor'])&& $post['contactor']!='' ?trim($post['contactor']) :''; if($contactor==''){ return error_show(1004,'参数contactor 不能为空'); } $mobile = isset($post['mobile'])&& $post['mobile']!='' ?trim($post['mobile']) :''; if($mobile==''){ return error_show(1004,'参数mobile 不能为空'); } $position = isset($post['position'])&& $post['position']!='' ?trim($post['position']) :''; $data =[ 'wsm_code'=>makeNo("WSM"), 'name'=>$name, 'wsm_type'=>$wsmtype, 'supplierNo'=>$supplier, 'addr'=>$addr, 'contactor'=>$contactor, 'mobile'=>$mobile, 'position'=>$position, 'status'=>1, 'addtime'=>date("Y-m-d H:i:s"), 'updatetime'=>date("Y-m-d H:i:s") ]; $add = Db::name('warehouse_info')->insert($data); return $add ? app_show(0,'仓库创建成功'): error_show(1005,'仓库创建失败'); } public function list(){ $post =$this->request->post(); $condition = [['is_del'=>0]]; $supplier = isset($post['supplierNo'])&&$post['supplierNo']!="" ? trim($post['supplierNo']) :""; if($supplier!=""){ $condition[]=["supplierNo"=>$supplier]; } $supplier = isset($post['supplierNo'])&&$post['supplierNo']!="" ? trim($post['supplierNo']) :""; if($supplier!=""){ $condition[]=["supplierNo"=>$supplier]; } $wsm_code = isset($post['wsm_code'])&&$post['wsm_code']!="" ? trim($post['wsm_code']) :""; if($wsm_code!=""){ $condition[]=["wsm_code"=>$wsm_code]; } $start = isset($post['start'])&&$post['start']!="" ? $post['start'] :""; if($start!=""){ $condition[]=["addtime"=>[">=",$start]]; } $end = isset($post['end'])&&$post['end']!="" ? $post['end'] :""; if($start!=""){ $condition[]=["addtime"=>[">=",$end]]; } $mobile = isset($post['mobile'])&&$post['mobile']!="" ? trim($post['mobile']) :""; if($mobile!=""){ $condition[]=["mobile"=>["like","%{$mobile}%"]]; } $contactor = isset($post['contactor'])&&$post['contactor']!="" ? trim($post['contactor']) :""; if($contactor!=""){ $condition[]=["contactor"=>["like","%{$contactor}%"]]; } $page = isset($post['page']) &&$post['page']!=='' ?intval($post['page']) :1; $size = isset($post['size']) &&$post['size']!=='' ?intval($post['size']) :10; $count = Db::name("warehouse_info")->where($condition)->count(); $page>=ceil($count/$size) ? $page = ceil($count/$size): ''; $list = Db::name("warehouse_info")->where($condition)->page($page,$size)->order("addtime desc")->select(); return app_show(0,"获取成功",['list'=>$list,"count"=>$count]); } public function info(){ $post =$this->request->post(); } }