$code, 'message' => $message, 'data' => $data]); } } function made($var,$data=[]){ $str = Db::name('cat')->where(['id'=>$var])->find(); if($str==false){ return []; } $vmn =[]; $vmn['id'] =$str['id']; $vmn['name'] =$str['cat_name']; array_unshift($data,$vmn); // $var['id']=made(); if($str['pid']==0){ // krsort($data); return $data; }else{ return made($str['pid'],$data); } } //获取有赞分类信息 function made_youzan(int $yz_cat_id=0,$data=[]){ $rs = get_yz_cat_info($yz_cat_id); if(empty($rs)) return []; $vmn =[]; $vmn['yz_cat_id'] =$rs['id']; $vmn['yz_cat_name'] =$rs['yz_cat_name']; array_unshift($data,$vmn); if($rs['parent_cid']==0) return $data; else return made_youzan($rs['parent_cid'],$data); } function makeExcluse($var,$data=[]){ $str = Db::name('exclusive')->where(['id'=>$var])->find(); if($str==false){ return []; } $vmn =[]; $vmn['id'] =$str['id']; $vmn['name'] =$str['name']; array_unshift($data,$vmn); // $var['id']=made(); if($str['pid']==0){ // krsort($data); return $data; }else{ return makeExcluse($str['pid'],$data); } } function makeNo($str){ $date=date("mdHis"); $year = date("Y")-2000; $msec=rand(1000,9999); return $str.$year.$date.$msec; } function randomkeys($length) { $returnStr=''; $pattern = '1234567890abcdefghijklmnopqrstuvwxyz';//ABCDEFGHIJKLOMNOPQRSTUVWXYZ for($i = 0; $i < $length; $i ++) { $returnStr .= $pattern[mt_rand ( 0, strlen($pattern)-1 )]; //生成php随机数 } return $returnStr; }