123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577 |
- <?php
-
-
- namespace app\api\logic;
-
- use think\Model;
- use think\Db;
-
-
- class Sqldata extends Model
- {
- public function index(){
- return "4444";
- }
-
-
-
-
-
-
- public function unsetHandle($list=[],$group_id=0,$type='xml'){
- if($type == 'txt') {
- $temp = [];
- foreach ($list as $k => $value) {
- $data = [];
- $update_data = [];
- if (strpos($value, 'is_del') !== false) {
- $data['is_del'] = 1;
- $update_data['is_del'] = 1;
- } else {
- $data['is_del'] = 0;
- $update_data['is_del'] = 0;
- }
- if (strpos($value, 'is_arcrank') !== false) {
- $data['is_arcrank'] = 1;
- $update_data['is_arcrank'] = 1;
- } else {
- $data['is_arcrank'] = 0;
- $update_data['is_arcrank'] = 0;
- }
-
- if (strpos($value, 'is_status') !== false) {
- $data['is_status'] = 1;
- $update_data['is_status'] = 1;
- } else {
- $data['is_status'] = 0;
- $update_data['is_status'] = 0;
- }
- if (strpos($value, 'list_is_null') !== false) {
- $data['is_null'] = 1;
- $update_data['is_null'] = 1;
-
- $new_url = explode('---', $value);
- $new_url = $new_url[0];
- $temp[] = $new_url;
- } else {
- $data['is_null'] = 0;
- $update_data['is_null'] = 0;
- }
-
- if (strpos($value, '---') !== false) {
- $new_url = explode('---', $value);
- $new_url = $new_url[0];
- } else {
- $new_url = $value;
-
- $temp[] = $value;
- }
- $one = Db::name('all_url')->where(['url' => $new_url])->find();
- if (empty($one)) {
- $data['group_id'] = $group_id;
- $data['url'] = $new_url;
- $data['update_time'] = time();
- $data['add_time'] = time();
- Db::name('all_url')->insert($data);
- } else {
- $update_data['update_time'] = time();
- $update_data['group_id'] = $group_id;
- Db::name('all_url')->where(['url' => $new_url])->update($update_data);
- }
- }
- return $temp;
- }else{
- return $list;
- }
- }
-
-
-
-
- public function buildXml($xmlWriter,$value,$time,$mod="hourly",$level="1.0")
- {
-
-
-
- $xmlWriter->startElement('url');
- $xmlWriter->writeElement('loc', $value);
- $xmlWriter->writeElement('lastmod', $time);
- $xmlWriter->writeElement('changefreq', $mod);
-
- $xmlWriter->writeElement('priority', $level);
-
- $xmlWriter->startElement('mobile:mobile');
- $xmlWriter->writeAttribute('type', 'htmladapt');
-
-
-
-
- $xmlWriter->endElement();
- $xmlWriter->endElement();
-
-
- return $xmlWriter;
- }
-
- public function gethtml(){
-
- return '
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
- <meta name="renderer" content="webkit">
- <meta name="force-rendering" content="webkit">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1">
- <meta name="applicable-device" content="pc,mobile">
- <meta name="author" content="order by ">
- <title>职称E家_网站地图</title>
- </head>
- <style>
- * {
- margin: 0px;
- padding: 0px;
- }
- a {
- color: grey;
- text-decoration: none;
- }
- h1 a {
- color: Black;
- }
- h1 {
- font-size: 15px;
- display: block;
- max-width: 1200px;
- margin: 0 auto;
- border: 1px solid #eee;
- padding: 10px;
- color: Black;
- }
- h2 {
- color: Black;
- font-size: 16px;
- margin-bottom: 10px;
- }
- a:hover {
- color: Black;
- text-decoration: underline;
- }
- .content {
- max-width: 1200px;
- border: 1px solid #eee;
- margin: 0 auto;
- padding: 10px;
- margin-top: 10px;
- color: #999;
- overflow: hidden;
- }
- li {
- text-indent: 20px;
- list-style: disc;
- }
- .content li {
- width: 285px;
- text-indent: 5px;
- float: left;
- list-style: none;
- height: 30px;
- }
- .content li a {
- display: block;
- height: 25px;
- overflow: hidden;
- }
- </style>
- <body>
- <h1>
- <a href="https://www.zc10000.com/">职称E家</a>
- </h1>
-
- <div class="content">
- <h2>分类</h2>
- <ul>';
-
- }
-
- public function gethtmlend(){
-
- $taglist = Db::name('archives')->where(['typeid'=>371,'status'=>1,'is_del'=>0])->select();
- $html = '';
- foreach($taglist as $k=>$v){
- $html .= '<li><a target="_blank" href="https://www.zc10000.com/tag'.$v['number'].'">'.$v['title'].'</a></li>';
- }
- return '
- <div class="content">
- <h2>最新tags</h2>
- <ul>
- '.$html.'
- </ul>
- </div>
-
- </body>
- </html>';
- }
-
- public function add_1($type,$data){
-
- $list = [
- 'https://www.zc10000.com',
- 'https://www.zc10000.com/zx',
- 'https://www.zc10000.com/zc',
- 'https://www.zc10000.com/cl',
- 'https://www.zc10000.com/cp',
-
- 'https://www.zc10000.com/taglist',
- ];
- $html_a = ['职称E家','申报资讯','评审政策','业绩材料','一键测评','标签列表'];
- $list = $this->unsetHandle($list,0,$type);
-
-
- switch ($type) {
- case 'xml':
- foreach ($list as $k=>$value){
- $data = $this->buildXml($data,$value,date('Y-m-d',time()));
- }
-
- break;
- case 'txt':
- foreach ($list as $k=>$value){
- $data .= $value."\r\n";
- }
-
- break;
- case 'html':
- foreach ($list as $k=>$value){
- $data .= '<li><a target="_blank" href="'.$value.'">'.$html_a[$k].'</a></li>';
- }
- $data .= "</ul></div>";
- break;
- default:
-
- }
-
- return $data;
- }
-
- public function add_2($type,$data,$list,$groupid,$is_html,$hourly,$level,$htmldata){
- $list_1 = $this->unsetHandle($list,$groupid,$type);
-
- switch ($type) {
- case 'xml':
- foreach ($list_1 as $k=>$value){
- $data = $this->buildXml($data,$value,date('Y-m-d',time()),$hourly,$level);
- }
- break;
- case 'txt':
- foreach ($list_1 as $k=>$value){
- $data .= $value."\r\n";
- }
- break;
- case 'html':
-
-
- if((int)$is_html === 1){
-
- if((int)$htmldata === 1){
- $one_data = $this->gethtml_1($data,$list);
- $data = $data.$one_data;
- }
-
- }
- break;
- default:
-
- }
- return $data;
- }
-
- public function gethtml_1($data,$list){
- $data = '<div class="content"><h2>评审政策区域分类</h2><ul>';
-
- foreach ($list as $k=>$value){
- $value1 = explode('/',$value);
- $value2 = end($value1);
- $name = Db::name('citysite')->where('domain','=',$value2)->value('name');
- $data .= '<li><a target="_blank" href="'.$value.'">'.$name.'职称</a></li>';
- }
- $data .= '</ul></div>';
- return $data;
- }
-
-
-
-
-
-
- public function get_url_list($str="zx",$typeid=1231,$pasize=12)
- {
- $list = Db::name('archives')->where(['typeid'=>$typeid,'status'=>1,'is_del'=>0,'arcrank'=>0])->count();
-
- $desc = '';
- if((int)$list === 0){
- $list = 1;
- $desc = '---(list_is_null)';
- }
-
- $page = ceil($list/$pasize);
- $url = [];
- for ($i=2;$i<=$page;$i++){
- $url[] = 'https://www.zc10000.com/'.$str.'-'.$i.$desc;
- }
- return $url;
- }
-
-
-
- public function get_url_detail($str="zclw/lunwen",$typeid=116,$ty=4)
- {
- $list_1 = Db::name('seo_number')->where(['type'=>$ty,'tid'=>$typeid,'is_del'=>0,'area_id'=>0])->select();
- foreach ($list_1 as $key=>$item) {
-
- $op = Db::name('archives')->where(['aid'=>$item['aid']])->find();
- $desc = '';
- if((int)$op['is_del'] === 1){
- $desc .= '---ID: '.$item['aid']."(is_del)";
- }
- if((int)$op['arcrank'] === 1){
- $desc .= '---ID: '.$item['aid']."(is_arcrank)";
- }
- if((int)$op['status'] === 0){
- $desc .= '---ID: '.$item['aid']."(is_status)";
- }
- $url[] = 'https://www.zc10000.com/'.$str.$item['number'].$desc;
- }
- return $url;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public function get_cat_area_list($str="zhengce",$typeid=115,$pasize=10)
- {
- $area = Db::name('citysite')->where(['is_open'=>1,'status'=>1,'level'=>1])->select();
- $url = [];
- foreach ($area as $index=>$row){
-
-
-
- $url[] = 'https://www.zc10000.com/'.$str.'/'.$row['domain'];
- }
- return $url;
- }
-
-
-
-
- public function get_cat_area_list_page($str="zhengce",$typeid=115,$pasize=10)
- {
- $area = Db::name('citysite')->where(['is_open'=>1,'status'=>1,'level'=>1])->select();
- $url = [];
- foreach ($area as $index=>$row){
-
-
-
- $list = Db::name('archives')->where([
- 'typeid'=>$typeid,'status'=>1,'is_del'=>0,'arcrank'=>0,'area_tag_id'=>$row['id']
- ])->count();
-
- $desc = '';
- if((int)$list === 0){
- $list = 1;
- $desc = '---list_is_null)';
- }
- $page = ceil($list/$pasize);
- for ($i=2;$i<=$page;$i++){
- $url[] = 'https://www.zc10000.com/'.$str.'/'.$row['domain'].'-'.$i.$desc;
- }
-
- }
- return $url;
- }
-
-
-
-
-
-
-
-
- public function get_tag_list(){
- $taglist = Db::name('archives')->where(['typeid'=>371,'status'=>1,'is_del'=>0])->select();
- $url = [];
- foreach ($taglist as $index=>$row){
-
-
-
- $url[] = 'https://www.zc10000.com/tag'.$row['number'];
- }
- return $url;
- }
-
-
-
-
- public function get_tag_list_page($str,$pasize){
- $taglist = Db::name('archives')->where(['typeid'=>371,'status'=>1,'is_del'=>0])->select();
- $url = [];
- foreach ($taglist as $index=>$row){
-
-
-
- $list = Db::name('archives')->where([
- 'status'=>1,'is_del'=>0,'arcrank'=>0,'area_tag_id'=>$row['aid']
- ])->where('typeid','in','1231,1232,1233')->count();
-
- $desc = '';
- if((int)$list === 0){
- $list = 1;
- $desc = '---list_is_null)';
- }
- $page = ceil($list/$pasize);
- for ($i=2;$i<=$page;$i++){
- $url[] = 'https://www.zc10000.com/'.$str.$row['number'].'-'.$i.$desc;
- }
-
- }
- return $url;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public function get_url_area_detail($str="zhengce/cms",$typeid=115,$ty=2,$area_id=0,$city_id=0)
- {
- $area = Db::name('citysite')->where(['is_open'=>1,'status'=>1,'level'=>1])->select();
- $url = [];
- foreach ($area as $index=>$row){
- $list_1 = Db::name('seo_number')->where([
- 'type'=>$ty,'tid'=>$typeid,'is_del'=>0,"area_id"=>$row['id'],"city_id"=>$city_id
- ])->select();
- foreach ($list_1 as $key=>$item) {
-
- $op = Db::name('archives')->where(['aid'=>$item['aid']])->find();
- $desc = '';
- if((int)$op['is_del'] === 1){
- $desc .= '---ID: '.$item['aid']."(is_del)";
- }
- if((int)$op['arcrank'] === 1){
- $desc .= '---ID: '.$item['aid']."(is_arcrank)";
- }
- if((int)$op['status'] === 0){
- $desc .= '---ID: '.$item['aid']."(is_status)";
- }
- $url[] = 'https://www.zc10000.com/'.$str.'/'.$row['domain'].'/'.$item['number'].$desc;
- }
- }
- return $url;
- }
-
- }
|