* Date: 2018-4-3
*/
namespace app\api\controller;
use \think\Db;
use Overtrue\Pinyin\Pinyin;
class Other extends Base
{
/*
* 初始化操作
*/
public function _initialize() {
parent::_initialize();
session('user'); // 哪里用到 session_id() , 哪个文件就加上这行代码
}
/**
* 广告位js
*/
public function other_show()
{
$pid = input('pid/d',1);
$row = input('row/d',1);
$where = array(
'pid'=>$pid,
'status'=>1,
// 'start_time'=>array('lt', getTime()),
);
$ad = M("ad")->where($where)
// ->where('end_time', ['>', getTime()], ['=', 0], 'or')
->order("sort_order asc")
->limit($row)
->cache(true,EYOUCMS_CACHE_TIME, 'ad') // 如果查询条件有时间字段,一定要去掉这行,避免产生一堆缓存文件
->select();
foreach ($ad as &$value) {
$value['intro'] = htmlspecialchars_decode($value['intro']);
$value['intro'] = str_replace("\r\n", "", $value['intro']);
$value['intro'] = str_replace("'", "\'", $value['intro']);
}
$this->assign('ad', $ad);
return $this->fetch();
}
/*
* 复制省级分类
*/
public function index(){
return false;
$pro_list = Db::table('ey_citysite')->where([
"level" => 1,
"parent_id" => 0,
"topid" => 0,
"status" => 1,
])->select();
//dump($pro_list);
//循环省份
//1,30,6872,6791,6645,6344,6303,6003,5879,5742,5625,5448,5290,5179,5056,4833,4813,4667,4589,4474,4228,4042,4023,4003,6547,4359,4004,6990,7092,7144,7171
/*foreach ($pro_list as $index=>$item){
echo $item['id'].',';
}*/
//查询所有分类
$cat_list = Db::table('ey_arctype')->where([
'topid'=>38,
'parent_id'=>38,
'type'=>'默认',
'status' => 1,
'is_del' => 0,
'area_id' => 1
])->select();
$pid = '6344,6303,6003,5879,5742,5625,5448,5290,5179,5056,4833,4813,4667,4589,4474,4228,4042,4023,4003,6547,4359,4004,6990,7092,7144,7171';
$pid = explode(',',$pid);
//var_dump($pid);die;
foreach ($pid as $index=>$item) {
foreach ($cat_list as $key => $row) {
//echo $row['id'].$row['typename'].'-';
unset($row['id']);
$row['area_id'] = $item;
$row['dirname'] = $row['dirname'] . rand(1, 99999) . 'a' . rand(1, 99999);
//插入表
$res = Db::name('arctype')->insert($row);
echo $res;
}
echo '
';
}
exit;
}
/*
* 复制产品分类
*/
public function index2(){
return false;
/*$pro_list = Db::table('ey_citysite')->where([
"level" => 1,
"parent_id" => 0,
"topid" => 0,
"status" => 1,
])->select();*/
//dump($pro_list);
//循环省份
//1,30,6872,6791,6645,6344,6303,6003,5879,5742,5625,5448,5290,5179,5056,4833,4813,4667,4589,4474,4228,4042,4023,4003,6547,4359,4004,6990,7092,7144,7171
/*foreach ($pro_list as $index=>$item){
echo $item['id'].',';
}*/
//$pid = '6872,6791,6645,6344,6303,6003,5879,5742,5625,5448,5290,5179,5056,4833,4813,4667';
$pid = '4589,4474,4228,4042,4023,4003,6547,4359,4004,6990,7092,7144,7171';
$pid = explode(',',$pid);
//var_dump($pid);die;
foreach ($pid as $in=>$id) {
$area_id = $id;
//查询某区域所有分类
$cat_list = Db::table('ey_arctype')->where([
'topid' => 38,
'parent_id' => 38,
'type' => '默认',
'status' => 1,
'is_del' => 0,
'area_id' => $area_id
])->order('id asc')->select();
//dump($cat_list);die;
$i = 1;
foreach ($cat_list as $index => $item) {
//查询对应广东地区的哪个分类
$cat = Db::table('ey_arctype')->where([
'topid' => 38,
'parent_id' => 38,
'type' => '默认',
'status' => 1,
'is_del' => 0,
'area_id' => 1,
'typename' => $item['typename']
])->find();
//echo $cat['typename'];
//查询广东地区对应所有产品
$pro_list = Db::table('ey_arctype')->where([
'topid' => 38,
'parent_id' => $cat['id'],
'type' => '产品',
'status' => 1,
'is_del' => 0,
'area_id' => 1 //广东
])->select();
foreach ($pro_list as $key => $row) {
//echo $row['id'].$row['typename'].'-';
unset($row['id']);
$row['area_id'] = $area_id; //区域id
$row['parent_id'] = (int)$item['id']; //更改上级id
$row['dirname'] = $row['dirname'] . rand(1, 99999) . 'a' . rand(1, 99999);
//插入表
$res = Db::name('arctype')->insert($row);
$i = $i + $res;
echo $i;
}
echo '
';
}
}
exit;
}
/*
* 处理员网站
* https://www.zc10000.com/api/other/index3?page=1
*/
public function index3(){
return false;
$page = $_GET['page']?$_GET['page']:1;
$pagesize = 50; //每次处理50条
//查询文章
$list = Db::table('ey_web_ur')
->where('to_tid','=',0)
->order('id asc')
->paginate($pagesize)->toArray();
//dump($list);die;
foreach($list['data'] as $index=>$row){
//构建新数据
//启动事务
// 启动事务
Db::startTrans();
try {
/*业务*/
$run = 0;
$one = Db::table('ey_archives_before')
->where(['aid'=>$row['aid']])->find();
//dump($row);die;
if(!empty($one)){
unset($one['aid']);
//1,2,4 对应 115/68,69,70,80,92 对应 111 / 8对应118 /其他对应 117
$tid = (int)$one['typeid'];
if($tid === 1 || $tid === 2 || $tid === 4){
$typeid = 115;
$url = '/zhengce/cms';
}else if($tid === 68 || $tid === 69 || $tid === 70 || $tid === 80 || $tid === 92){
$typeid = 111;
$url = '/wthz';
}else if($tid === 8){
$typeid = 118;
$url = '/zcsb';
}else{
$typeid = 117;
$url = '/gonglve';
}
$one['typeid'] = $typeid;
$one['channel'] = 103;
//把one新插入栏目
$new_aid = Db::name('archives')->insertGetId($one);
//处理附表
$two = Db::table('ey_article_content_b')
->where('aid','=',$row['aid'])
->find();
if(!empty($two)){
unset($two['id']);
unset($two['aid']);
$two['aid'] = $new_aid; //新的aid
$two['content_5'] = $two['content'];
$two['content_ey_m'] = $two['content_ey_m'];
unset($two['content']);
unset($two['content_ey_m']);
$two['downname'] = $two['filename'];
$two['down'] = $two['file'];
unset($two['file']);
unset($two['filename']);
$res = Db::name('zczygz_content')->insertGetId($two);
if($res > 0){
//插入ey_web_ur
$data = [
'to_tid' => $typeid,
'to_aid' => $new_aid,
'to_url' => $url.$new_aid,
];
//var_dump($data);
$res_c = Db::name('web_ur')
->where('id','=',$row['id'])->update($data);
//var_dump($res_c);die;
if($res_c === 0){
//必须更新成功
Db::rollback();
$run = 1;
}
}else{
//必须更新成功
Db::rollback();
$run = 1;
}
}else{
//
Db::rollback();
$run = 1;
}
}
if($run === 0){
// 提交事务
Db::commit();
}
} catch (\Exception $e) {
// 回滚事务
Db::rollback();
}
echo $row['id'];
if($run === 0){
echo "-ok";
}else{
echo "-fail";
}
echo '
';
}
}
/*
* 处理所有城市 有些省份 数据库没了 不管了
* https://www.zc10000.com/api/other/index4
*/
public function index4(){
$list = Db::name('citysite')
->where(['level'=>1])
->order('id asc')
->select();
//var_dump($list);
foreach ($list as $index => $item){
echo 'https://www.zc10000.com/api/other/index6?aid='.$item['id'].'
';
/*$one = Db::name('seo_number')->where([
"type" => 3,
"aid" => $item['id'],
'is_del' => 0,
])->find();
if(!empty($one)) {
if((int)$one['is_del'] === 0){
$desc = '正常';
}else{
$desc = '原记录已删除';
}
echo $item['name'].'-已存在-'.$desc.'-序号为:'.$one['number'].'
';
}else{
$data = [
'type' => 3,
'tid' => 0,
'aid' => $item['id'],
'number' => $index + 1,
'is_del' => 0,
'area_id' => 0,
'topid' => 0,
'parentid' => 0
];
$res = Db::name('seo_number')->insert($data);
echo $item['name'].'-新增成功'.$res.'
';
}*/
}
}
/*
* 处理产品大类 其实就是栏目 二级
* 后台禁用掉 编辑时 重选区域 这样 会造成 排序混乱 对应的序列号不对
* https://www.zc10000.com/api/other/index5
* https://www.zc10000.com/id2
*/
public function index5(){
$list = Db::name('arctype')
//'is_del'=>0
->where([
'topid'=>38,'parent_id'=>38,
])
->order('area_id asc,add_time asc') //按新增时间排序 按id asc 不准确
->select();
//var_dump($list);
$temp_id = 0;
foreach ($list as $index => $item){
//计算
if($temp_id !== (int)$item['area_id']){
$temp_id = (int)$item['area_id'];
$num = 1; //重置为1
echo "
";
}
/*echo '区域id:'.$item['area_id'].'-'.$item['typename'].'-序号:'.$num.'
';
$num++;*/
echo '区域id:'.$item['area_id'].'-';
$one = Db::name('seo_number')->where([
"type" => 1, //产品类型
"aid" => $item['id'], //实际的ID
"tid" => $item['parent_id'], //属于哪个栏目的
//'is_del' => 0,
'area_id' => $item['area_id'],
'topid' => $item['topid'],
'parentid' => $item['parent_id']
])->find();
if(!empty($one)) {
if((int)$one['number'] === $num){
$desc = '-序列号正常';
}else{
$desc = '-序列号不正常';
}
if($item['is_del'] === 1){
echo '序号:'.$num.'-'.$item['typename'].'-已存在序列表-原记录已删除-'.$desc.'
';
}else{
echo '序号:'.$num.'-'.$item['typename'].'-已存在序列表-原记录正常'.$desc.'
';
}
//不管是更新还是新增 存在记录就加1
$num++;
}else{
//判断是否已删除,已删除不加入
if((int)$item['is_del'] === 0){
$data = [
"type" => 1, //产品类型
"aid" => $item['id'], //实际的ID
"tid" => $item['parent_id'], //属于哪个栏目的
'is_del' => 0,
'area_id' => $item['area_id'],
'topid' => $item['topid'],
'parentid' => $item['parent_id'],
'number' => $num
];
$res = Db::name('seo_number')->insert($data);
echo '序号:'.$num.'-'.$item['typename'].'-不存在序列表且原记录正常,新增成功'.$res.'
';
//不管是更新还是新增 增加记录就加1
$num++;
}else{
echo ''.$item['typename'].'-不存在序列表且原记录已删除,不新增
';
}
}
}
}
/*
* 处理产品三类id
* 后台没有移动功能(以后也不能移动) 还好 只能在三级下面 进行 增加删除 不影响排序
* 不过缺少 add_time 字段写入 需要修改原先的curd
* https://www.zc10000.com/id2/sid1
*
* https://www.zc10000.com/api/other/index6?aid=1
https://www.zc10000.com/api/other/index6?aid=30
https://www.zc10000.com/api/other/index6?aid=4003
https://www.zc10000.com/api/other/index6?aid=4004
https://www.zc10000.com/api/other/index6?aid=4023
https://www.zc10000.com/api/other/index6?aid=4042
https://www.zc10000.com/api/other/index6?aid=4228
https://www.zc10000.com/api/other/index6?aid=4359
https://www.zc10000.com/api/other/index6?aid=4474
https://www.zc10000.com/api/other/index6?aid=4589
https://www.zc10000.com/api/other/index6?aid=4667
https://www.zc10000.com/api/other/index6?aid=4813
https://www.zc10000.com/api/other/index6?aid=4833
https://www.zc10000.com/api/other/index6?aid=5056
https://www.zc10000.com/api/other/index6?aid=5179
https://www.zc10000.com/api/other/index6?aid=5290
https://www.zc10000.com/api/other/index6?aid=5448
https://www.zc10000.com/api/other/index6?aid=5625
https://www.zc10000.com/api/other/index6?aid=5742
https://www.zc10000.com/api/other/index6?aid=5879
https://www.zc10000.com/api/other/index6?aid=6003
https://www.zc10000.com/api/other/index6?aid=6303
https://www.zc10000.com/api/other/index6?aid=6344
https://www.zc10000.com/api/other/index6?aid=6547
https://www.zc10000.com/api/other/index6?aid=6645
https://www.zc10000.com/api/other/index6?aid=6791
https://www.zc10000.com/api/other/index6?aid=6872
https://www.zc10000.com/api/other/index6?aid=6990
https://www.zc10000.com/api/other/index6?aid=7092
https://www.zc10000.com/api/other/index6?aid=7144
https://www.zc10000.com/api/other/index6?aid=7171
*/
/*
* 级别 不参与序列号 那是等级
*/
public function index6(){
$area_id = request()->get('aid',1);
//按区域调用
$catList = Db::name('arctype')
//'is_del'=>0
->where([
'topid'=>38,'parent_id'=>38,'area_id'=> $area_id
])
->order('area_id asc,add_time asc') //按新增时间排序 按id asc 不准确
->select();
//循环二级大类
foreach ($catList as $key => $row) {
//查询三级小类
$list = Db::name('arctype_cat')->where([
"parent_id" => $row['id'],
"topid" => 38,
//"is_del" => 0
])->select();
//var_dump($list);
$num = 1; //重置为1
echo "
";
foreach ($list as $index => $item){
/*if((int)$item['is_del'] === 1){
$desc = '原文档记录已删除';
}else{
$desc = '原文档记录正常';
}
echo '区域id:'.$row['area_id'].'-上级ID:'.$item['parent_id'].'-名称:'.$item['typename'].'-序号:'.$num.'-'.$desc.'
';
$num++;*/
echo '区域id:'.$row['area_id'].'-';
$one = Db::name('seo_number')->where([
"type" => 1, //产品类型
"aid" => $item['id'], //实际的ID
"tid" => $item['parent_id'], //属于哪个栏目的
//'is_del' => 0,
//'area_id' => $row['area_id'], //没有这个条件
'topid' => $item['topid'],
'parentid' => $item['parent_id']
])->find();
if(!empty($one)) {
if((int)$one['number'] === $num){
$desc = '-序列号正常';
}else{
$desc = '-序列号不正常';
}
if($item['is_del'] === 1){
echo '序号:'.$num.'-'.'-上级ID:'.$item['parent_id'].'-名称:'.$item['typename'].'-已存在序列表-原记录已删除-'.$desc.'
';
}else{
echo '序号:'.$num.'-'.'-上级ID:'.$item['parent_id'].'-名称:'.$item['typename'].'-已存在序列表-原记录正常'.$desc.'
';
}
//不管是更新还是新增 存在记录就加1
$num++;
}else{
//判断是否已删除,已删除不加入
if((int)$item['is_del'] === 0){
$data = [
"type" => 1, //产品类型
"aid" => $item['id'], //实际的ID
"tid" => $item['parent_id'], //属于哪个栏目的 非38
'is_del' => 0,
//'area_id' => $item['area_id'],
'topid' => $item['topid'], //还是38
'parentid' => $item['parent_id'],
'number' => $num
];
$res = Db::name('seo_number')->insert($data);
echo '序号:'.$num.'-'.'-上级ID:'.$item['parent_id'].'-名称:'.$item['typename'].'-不存在序列表且原记录正常,新增成功'.$res.'
';
//不管是更新还是新增 增加记录就加1
$num++;
}else{
echo ''.$item['typename'].'-不存在序列表且原记录已删除,不新增
';
}
}
}
}
}
/*
* 处理期刊 或者 是以后的其他文章栏目 都可以
* 主要前提是 没有区域 只按发布时间排序就可以
* https://www.zc10000.com/api/other/index7
*/
public function index7(){
//查询所有期刊
$list = Db::name('archives')
->where('typeid','in',[116,123])
->order('add_time asc')
->select();
//var_dump($list);
$num = 1;
foreach ($list as $index => $item){
$one = Db::name('seo_number')->where([
"type" => 4,
"aid" => $item['aid'], //实际的文档aid
//'is_del' => 0, //目前都是未删除
])->find();
if(!empty($one)) {
if((int)$one['number'] === $num){
$ks = '序号正常';
}else{
$ks = '序号不正常';
}
if((int)$item['is_del'] === 0){
$desc = '(原记录正常)';
}else{
$desc = '(原记录已删除)';
}
echo '文档ID:'.$item['aid'].'-'.$item['title'].'-已存在-'.$desc.'-序号为:'.$one['number'].'-'.$ks.'
';
$num++;
}else{
if((int)$item['is_del'] === 0){
$data = [
'type' => 4,
'tid' => $item['typeid'],
'aid' => $item['aid'],
'number' => $num,
'is_del' => 0,
//'area_id' => 0, //非栏目
//'topid' => 0, //非栏目
//'parentid' => 0 //非栏目
];
$res = Db::name('seo_number')->insert($data);
echo $item['title'].'-新增成功'.$res.'-序号为:'.$num.'
';
$num++;
}else {
echo '文档ID:'.$item['aid'].'-'.$item['title'].'-原记录已删除-不新增-且不存在序号记录表
';
}
}
}
}
/*
* 论文参考
* https://www.zc10000.com/api/other/index8
* 主要前提是 没有区域 只按发布时间排序就可以
*/
public function index8(){
//查询所有期刊 参考
$list = Db::name('archives')
->where('typeid','in',[127,128])
->order('add_time asc')
->select();
//var_dump($list);
$num = 1;
foreach ($list as $index => $item){
$one = Db::name('seo_number')->where([
"type" => 4,
"aid" => $item['aid'], //实际的文档aid
//'is_del' => 0, //目前都是未删除
])->find();
if(!empty($one)) {
if((int)$one['number'] === $num){
$ks = '序号正常';
}else{
$ks = '序号不正常';
}
if((int)$item['is_del'] === 0){
$desc = '(原记录正常)';
}else{
$desc = '(原记录已删除)';
}
echo '文档ID:'.$item['aid'].'-'.$item['title'].'-已存在-'.$desc.'-序号为:'.$one['number'].'-'.$ks.'
';
$num++;
}else{
if((int)$item['is_del'] === 0){
$data = [
'type' => 4,
'tid' => $item['typeid'],
'aid' => $item['aid'],
'number' => $num,
'is_del' => 0,
//'area_id' => 0, //非栏目
//'topid' => 0, //非栏目
//'parentid' => 0 //非栏目
];
$res = Db::name('seo_number')->insert($data);
echo $item['title'].'-新增成功'.$res.'-序号为:'.$num.'
';
$num++;
}else {
echo '文档ID:'.$item['aid'].'-'.$item['title'].'-原记录已删除-不新增-且不存在序号记录表
';
}
}
}
}
/*
* 标签
* https://www.zc10000.com/api/other/index10000
* 主要前提是 没有区域 只按发布时间排序就可以
*/
public function index10000(){
//查询所有期刊 参考
$list = Db::name('archives')
->where('typeid','in',[371])
->order('add_time asc')
->select();
//var_dump($list);
$num = 1;
foreach ($list as $index => $item){
$one = Db::name('seo_number')->where([
"type" => 10,
"aid" => $item['aid'], //实际的文档aid
//'is_del' => 0, //目前都是未删除
])->find();
if(!empty($one)) {
if((int)$one['number'] === $num){
$ks = '序号正常';
}else{
$ks = '序号不正常';
}
if((int)$item['is_del'] === 0){
$desc = '(原记录正常)';
}else{
$desc = '(原记录已删除)';
}
echo '文档ID:'.$item['aid'].'-'.$item['title'].'-已存在-'.$desc.'-序号为:'.$one['number'].'-'.$ks.'
';
$num++;
//更新主记录
Db::name('archives')
->where(['aid'=>$item['aid']])
->update(['number'=>(int)$one['number']]);
}else{
if((int)$item['is_del'] === 0){
$data = [
'type' => 10,
'tid' => $item['typeid'],
'aid' => $item['aid'],
'number' => $num,
'is_del' => 0,
//'area_id' => 0, //非栏目
//'topid' => 0, //非栏目
//'parentid' => 0 //非栏目
];
$res = Db::name('seo_number')->insert($data);
echo $item['title'].'-新增成功'.$res.'-序号为:'.$num.'
';
//更新主记录
Db::name('archives')
->where(['aid'=>$item['aid']])
->update(['number'=>$num]);
$num++;
}else {
echo '文档ID:'.$item['aid'].'-'.$item['title'].'-原记录已删除-不新增-且不存在序号记录表
';
}
}
}
}
/*
* 处理文档 注意有省级区分
* 发布时候可以不选 区域
* 但是编辑时,不能重选区域,会造成序号混乱
* https://www.zc10000.com/api/other/index9?tid=126 政策指引
* https://www.zc10000.com/api/other/index9?tid=825 政策文件
* https://www.zc10000.com/api/other/index9?tid=826 参考文件
*/
public function index9(){
$tid = request()->get('tid',0);
if((int)$tid === 0){
echo "不存在文档栏目id";
return false;
}
//查询所有指定 栏目id 的文档
$list = Db::name('archives')
->where('typeid','=',$tid)
->order('province_id asc,add_time asc') //按照省份进行排序
->select();
//var_dump($list);
$temp_id = 0;
foreach ($list as $index => $item){
if((int)$item['province_id'] > 0) {
if ($temp_id !== (int)$item['province_id']) {
$temp_id = (int)$item['province_id'];
$num = 1; //重置为1
echo "
";
}
}else{
//只输出一次
if($index === 0){
$num = 1; //重置为1
echo "
";
}
}
echo '区域ID:'.$item['province_id'].'-';
$one = Db::name('seo_number')->where([
"type" => 5,
"aid" => $item['aid'], //实际的文档aid
//'is_del' => 0, //目前都是未删除
])->find();
if(!empty($one)) {
if((int)$one['number'] === $num){
$ks = '序号正常';
}else{
$ks = '序号不正常';
}
if((int)$item['is_del'] === 0){
$desc = '(原记录正常)';
}else{
$desc = '(原记录已删除)';
}
echo '文档ID:'.$item['aid'].'-'.$item['title'].'-已存在-'.$desc.'-序号为:'.$one['number'].'-'.$ks.'
';
$num++;
}else{
if((int)$item['is_del'] === 0){
$data = [
'type' => 5,
'tid' => $item['typeid'], //写入栏目id
'aid' => $item['aid'],
'number' => $num,
'is_del' => 0,
'area_id' => (int)$item['province_id'], //按区域
//'topid' => 0, //非栏目
//'parentid' => 0 //非栏目
];
$res = Db::name('seo_number')->insert($data); //假设都会成功
echo $item['title'].'-新增成功'.$res.'-序号为:'.$num.'
';
$num++;
}else {
echo '文档ID:'.$item['aid'].'-'.$item['title'].'-原记录已删除-不新增-且不存在序号记录表
';
}
}
}
}
/*
* 处理文章 复制期刊 修改type 大体一致 比如案例 常见问题
* 如果有区域性的文章 又得特殊处理 比如评审攻略 -- 目前先忽略这些
* 后续再说
* https://www.zc10000.com/api/other/index10?tid=120 案例
* https://www.zc10000.com/api/other/index10?tid=118 申报
* https://www.zc10000.com/api/other/index10?tid=122 职称相关问题
* https://www.zc10000.com/api/other/index10?tid=111 常见问题汇总 -- 已改为有区域
* https://www.zc10000.com/api/other/index10?tid=133 历年真题题库
* https://www.zc10000.com/api/other/index10?tid=132 答辩问题汇总
* https://www.zc10000.com/api/other/index10?tid=131 防骗指南
* https://www.zc10000.com/api/other/index10?tid=306 职称补贴
* https://www.zc10000.com/api/other/index10?tid=1231 新增 新闻资讯
* https://www.zc10000.com/api/other/index10?tid=1233 新增 业绩材料
* https://www.zc10000.com/api/other/index10?tid=1234 新增 一键测评
*/
public function index10(){
$tid = request()->get('tid',0);
if((int)$tid === 0){
echo "不存在文档栏目id";
exit;
}
$tids = ["120","118","122","111","133","132","131","306","1231","1233","1234"];
if(!in_array($tid,$tids)){
echo "不存在允许栏目内";
exit;
}
//查询所有文档 包含已删除的
$list = Db::name('archives')
->where('typeid','in',[$tid])
->order('add_time asc')
->select();
//var_dump($list);
$num = 1;
foreach ($list as $index => $item){
$one = Db::name('seo_number')->where([
"type" => 2,
"aid" => $item['aid'], //实际的文档aid
//'is_del' => 0, //目前都是未删除
])->find();
if(!empty($one)) {
if((int)$one['number'] === $num){
$ks = '序号正常';
}else{
$ks = '序号不正常';
}
if((int)$item['is_del'] === 0){
$desc = '(原记录正常)';
}else{
$desc = '(原记录已删除)';
}
echo '文档ID:'.$item['aid'].'-'.$item['title'].'-已存在-'.$desc.'-序号为:'.$one['number'].'-'.$ks.'
';
$num++;
}else{
if((int)$item['is_del'] === 0){
$data = [
'type' => 2,
'tid' => $item['typeid'], //文档本身的tid
'aid' => $item['aid'],
'number' => $num, //根据add_time 顺序
'is_del' => 0,
//'area_id' => 0, //非栏目
//'topid' => 0, //非栏目
//'parentid' => 0 //非栏目
];
$res = Db::name('seo_number')->insert($data);
echo $item['title'].'-新增成功'.$res.'-序号为:'.$num.'
';
$num++;
}else {
echo '文档ID:'.$item['aid'].'-'.$item['title'].'-原记录已删除-不新增-且不存在序号记录表
';
}
}
}
}
/*
* area_tag_id
* https://www.zc10000.com/api/other/index10_1?tid=1232 //评审政策
*/
public function index10_1(){
$tid = request()->get('tid',0);
if((int)$tid === 0){
echo "不存在文档栏目id";
exit;
}
$tids = ["1232"];
if(!in_array($tid,$tids)){
echo "不存在允许栏目内";
exit;
}
//查询所有指定 栏目id 的文档
$list = Db::name('archives')
->where('typeid','=',$tid)
//->where('area_tag_id','>',0)
->order('area_tag_id asc,add_time asc') //按照省份进行排序
->select();
//var_dump($list);
$temp_id = 0;
$temp_id2 = 0;
foreach ($list as $index => $item){
if((int)$item['area_tag_id'] > 0 && (int)$item['city_id'] === 0) {
//只属于省
if ($temp_id !== (int)$item['area_tag_id']) {
$temp_id = (int)$item['area_tag_id'];
$num = 1; //重置为1
echo "
";
}
}else if((int)$item['city_id'] > 0){
if ($temp_id2 !== (int)$item['city_id']) {
$temp_id2 = (int)$item['city_id'];
$num = 1; //重置为1
echo "
";
}
}else{
//只输出一次
if($index === 0){
$num = 1; //重置为1
echo "
";
}
}
echo '区域省ID:'.$item['area_tag_id'].'-';
if((int)$item['city_id'] > 0){
echo '区域市ID:'.$item['city_id'].'-';
}
//测试排序
//echo '文档ID:'.$item['aid'].'-序号为:'.$num.'
';
//$num++;
$one = Db::name('seo_number')->where([
"type" => 2, //文章
"aid" => $item['aid'], //实际的文档aid 全站唯一的
//'is_del' => 0, //目前都是未删除
])->find();
if(!empty($one)) {
if((int)$one['number'] === $num){
$ks = '序号正常';
}else{
$ks = '序号不正常-'.$one['number'];
}
if((int)$item['is_del'] === 0){
$desc = '(原记录正常)';
}else{
$desc = '(原记录已删除)';
}
echo '文档ID:'.$item['aid'].'-'.$item['title'].'-已存在-'.$desc.'-序号为:'.$one['number'].'-'.$ks.'
';
$num++;
}else{
if((int)$item['is_del'] === 0){
if((int)$tid === 1232){
//评审政策
$area_id = (int)$item['area_tag_id'];
$city_id = 0;
}else{
$area_id = (int)$item['province_id'];
$city_id = (int)$item['city_id'];
}
$data = [
'type' => 2,
'tid' => $item['typeid'], //写入栏目id 攻略或者政策资讯
'aid' => $item['aid'], //实际文档id
'number' => $num,
'is_del' => 0,
'area_id' => $area_id, //按区域
'city_id' => $city_id, //按城市
//'topid' => 0, //非栏目
//'parentid' => 0 //非栏目
];
$res = Db::name('seo_number')->insert($data); //假设都会成功
echo $item['title'].'-新增成功'.$res.'-序号为:'.$num.'
';
$num++;
}else {
echo '文档ID:'.$item['aid'].'-'.$item['title'].'-原记录已删除-不新增-且不存在序号记录表
';
}
}
}
}
/*
* 评审攻略
* https://www.zc10000.com/api/other/index11?tid=117 评审攻略
* https://www.zc10000.com/api/other/index11?tid=115 政策资讯
* https://www.zc10000.com/api/other/index11?tid=111 常见问题解答
*
* 后台编辑 禁用 区域重选
*/
public function index11(){
$tid = request()->get('tid',0);
if((int)$tid === 0){
echo "不存在文档栏目id";
exit;
}
$tids = ["117","115","111"];
if(!in_array($tid,$tids)){
echo "不存在允许栏目内";
exit;
}
//查询所有指定 栏目id 的文档
$list = Db::name('archives')
->where('typeid','=',$tid)
->order('province_id asc,city_id asc,add_time asc') //按照省份进行排序
->select();
//var_dump($list);
$temp_id = 0;
$temp_id2 = 0;
foreach ($list as $index => $item){
if((int)$item['province_id'] > 0 && (int)$item['city_id'] === 0) {
//只属于省
if ($temp_id !== (int)$item['province_id']) {
$temp_id = (int)$item['province_id'];
$num = 1; //重置为1
echo "
";
}
}else if((int)$item['city_id'] > 0){
if ($temp_id2 !== (int)$item['city_id']) {
$temp_id2 = (int)$item['city_id'];
$num = 1; //重置为1
echo "
";
}
}else{
//只输出一次
if($index === 0){
$num = 1; //重置为1
echo "
";
}
}
echo '区域省ID:'.$item['province_id'].'-';
if((int)$item['city_id'] > 0){
echo '区域市ID:'.$item['city_id'].'-';
}
//测试排序
//echo '文档ID:'.$item['aid'].'-序号为:'.$num.'
';
//$num++;
$one = Db::name('seo_number')->where([
"type" => 2, //文章
"aid" => $item['aid'], //实际的文档aid 全站唯一的
//'is_del' => 0, //目前都是未删除
])->find();
if(!empty($one)) {
if((int)$one['number'] === $num){
$ks = '序号正常';
}else{
$ks = '序号不正常-'.$one['number'];
}
if((int)$item['is_del'] === 0){
$desc = '(原记录正常)';
}else{
$desc = '(原记录已删除)';
}
echo '文档ID:'.$item['aid'].'-'.$item['title'].'-已存在-'.$desc.'-序号为:'.$one['number'].'-'.$ks.'
';
$num++;
}else{
if((int)$item['is_del'] === 0){
if((int)$tid === 1232){
//评审政策
$area_id = (int)$item['product_tag_id'];
$city_id = 0;
}else{
$area_id = (int)$item['province_id'];
$city_id = (int)$item['city_id'];
}
$data = [
'type' => 2,
'tid' => $item['typeid'], //写入栏目id 攻略或者政策资讯
'aid' => $item['aid'], //实际文档id
'number' => $num,
'is_del' => 0,
'area_id' => $area_id, //按区域
'city_id' => $city_id, //按城市
//'topid' => 0, //非栏目
//'parentid' => 0 //非栏目
];
$res = Db::name('seo_number')->insert($data); //假设都会成功
echo $item['title'].'-新增成功'.$res.'-序号为:'.$num.'
';
$num++;
}else {
echo '文档ID:'.$item['aid'].'-'.$item['title'].'-原记录已删除-不新增-且不存在序号记录表
';
}
}
}
}
/*
* 批量修改图片地址
* https://www.zc10000.com/api/other/index89
*/
public function index89(){
$list = Db::name('ad')->select();
foreach ($list as $index=>$item){
if(!empty($item['litpic'])){
if (strpos($item['litpic'], 'zc10000.com') !== false) {
//包含
} else {
if (strpos($item['litpic'], '/uploads/') !== false) {
//包含
$item['litpic'] = 'https://oss.zc10000.com'.$item['litpic'];
$res = Db::name('ad')->update($item);
echo $res.'
';
}else{
}
}
}
}
}
public function index90(){
$list = Db::name('archives')->select();
foreach ($list as $index=>$item){
if(!empty($item['litpic'])){
if (strpos($item['litpic'], 'zc10000.com') !== false) {
//包含
} else {
if (strpos($item['litpic'], '/uploads/') !== false) {
//包含
$item['litpic'] = 'https://oss.zc10000.com'.$item['litpic'];
$res = Db::name('archives')->update($item);
echo $res.'
';
}else{
}
}
}
}
}
public function index91(){
$list = Db::name('arctype')->select();
foreach ($list as $index=>$item){
if(!empty($item['litpic'])){
if (strpos($item['litpic'], 'zc10000.com') !== false) {
//包含
} else {
if (strpos($item['litpic'], '/uploads/') !== false) {
//包含
$item['litpic'] = 'https://oss.zc10000.com'.$item['litpic'];
$res = Db::name('arctype')->update($item);
echo $res.'
';
}else{
}
}
}
}
}
public function index92(){
$list = Db::name('links')->select();
foreach ($list as $index=>$item){
if(!empty($item['logo'])){
if (strpos($item['logo'], 'zc10000.com') !== false) {
//包含
} else {
if (strpos($item['logo'], '/uploads/') !== false) {
//包含
$item['logo'] = 'https://oss.zc10000.com'.$item['logo'];
$res = Db::name('links')->update($item);
echo $res.'
';
}else{
}
}
}
}
}
public function index93(){
$list = Db::name('nav_list')->select();
foreach ($list as $index=>$item){
if(!empty($item['nav_pic'])){
if (strpos($item['nav_pic'], 'zc10000.com') !== false) {
//包含
} else {
if (strpos($item['nav_pic'], '/uploads/') !== false) {
//包含
$item['nav_pic'] = 'https://oss.zc10000.com'.$item['nav_pic'];
$res = Db::name('nav_list')->update($item);
echo $res.'
';
}else{
}
}
}
}
}
public function index94(){
$list = Db::name('uploads')->select();
foreach ($list as $index=>$item){
if(!empty($item['image_url'])){
if (strpos($item['image_url'], 'zc10000.com') !== false) {
//包含
} else {
if (strpos($item['image_url'], '/uploads/') !== false) {
//包含
$item['image_url'] = 'https://oss.zc10000.com'.$item['image_url'];
$res = Db::name('uploads')->update($item);
echo $res.'
';
}else{
}
}
}
}
}
public function index95(){
$list = Db::name('zczygz_content')->select();
foreach ($list as $index=>$item){
if(!empty($item['content_5'])){
////oss.zc10000.com/uploads/allimg/20240308/1-24030Q95602A4.jpg
$newStr = str_replace("/uploads/", '//oss.zc10000.com/uploads/', $item['content_5']);
$newStr = str_replace("//oss.zc10000.com//oss.zc10000.com/uploads/", '//oss.zc10000.com/uploads/', $newStr);
$item['content_5'] = $newStr;
$res = Db::name('zczygz_content')->update($item);
echo $res.'
';
}
}
}
public function index96(){
$list = Db::name('zczygz_content')->select();
foreach ($list as $index=>$item){
if(!empty($item['down'])){
if (strpos($item['down'], 'zc10000.com') !== false) {
//包含
} else {
if (strpos($item['down'], '/uploads/') !== false) {
//包含
$item['down'] = 'https://oss.zc10000.com'.$item['down'];
$res = Db::name('zczygz_content')->update($item);
echo $res.'
';
}else{
}
}
}
}
}
/*
* 生成百度地图
* https://www.zc10000.com/api/other/index100?type=xml
*
*/
public function index100(){
/* if (extension_loaded('xml')) {
echo "xml extension is loaded";
} else {
echo "xml extension is not loaded";
}*/
/*// 创建XML根节点
$xml = new SimpleXMLElement('');
// 添加子节点
$item = $xml->addChild('item');
$item->addChild('id', 1);
$item->addChild('name', 'Item Name');
$item->addChild('price', '$99.99');
// 保存XML到文件或输出
$xml->asXML();
// 输出到浏览器
header('Content-Type: text/xml');
echo $xml->asXML();
// 保存到文件
$xml->asXML('output.xml');*/
//ini_set('memory_limit', '1024M'); //无用
/*
* 可对比系统的xml生成
*/
$type = request()->get('type','xml');
switch ($type) {
case 'xml':
header('Content-type: text/xml');
$xmlWriter = new \XMLWriter();
$xmlWriter->openMemory();
$xmlWriter->startDocument('1.0', 'UTF-8');
$xmlWriter->startElement('urlset');
$xmlWriter->writeAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
$xmlWriter->writeAttribute('xmlns:mobile', 'http://www.google.com/schemas/sitemap-mobile/1.0');
break;
case 'txt':
$txt = '';
break;
case 'html':
$html = '
职称网_网站地图
分类
';
break;
default:
// 如果没有匹配的值
}
/*
* 方法1 获取主页
*/
$list = [
'https://www.zc10000.com', //省级主页 + 城市主页
'https://www.zc10000.com/zczl', //产品分页 + 产品详情
'https://www.zc10000.com/zclw',
'https://www.zc10000.com/zccl',
'https://www.zc10000.com/zlwd',
'https://www.zc10000.com/zcwj',
'https://www.zc10000.com/zcdb',
'https://www.zc10000.com/zhengce',
'https://www.zc10000.com/gonglve',
'https://www.zc10000.com/lwck',
'https://www.zc10000.com/wthz',
'https://www.zc10000.com/anli',
'https://www.zc10000.com/zcbt',
'https://zczl.zc10000.com',
];
$html_a = ['职称网','职称工种','职称论文','职称材料','通用文件','政策指引','职称答辩','政策资讯','评审攻略','论文参考','常见问题','案例分析','职称补贴','快速评审'];
$list = $this->unsetHandle($list,0,$type);
switch ($type) {
case 'xml':
foreach ($list as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()));
}
break;
case 'txt':
foreach ($list as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
foreach ($list as $k=>$value){
$html .= '- '.$html_a[$k].'
';
}
$html .= "
";
break;
default:
// 如果没有匹配的值
}
/*
* 省级主页
*/
$list_1 = $this->getIndex();
$list_1 = $this->unsetHandle($list_1,1,$type);
//$list = array_merge($list,$list_1);
switch ($type) {
case 'xml':
foreach ($list_1 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()));
}
break;
case 'txt':
foreach ($list_1 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
$html .= '省级站点
';
//dump($list_1);die;
foreach ($list_1 as $k=>$value){
$value1 = explode('.',$value);
$value2 = explode('//',$value1[0]);
$name = Db::name('citysite')->where('domain','=',$value2[1])->value('name');
if(empty($name)){
if($value == 'https://www.zc10000.com/shandong'){
$name = '山东';
$html .= '- '.$name.'站
';
}
}else{
$html .= '- '.$name.'站
';
}
}
$html .= '
';
break;
default:
// 如果没有匹配的值
}
/*
* 城市主页
*/
$list_2 = $this->getIndex2();
//$list = array_merge($list,$list_2);
$list_2 = $this->unsetHandle($list_2,2,$type);
switch ($type) {
case 'xml':
foreach ($list_2 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()));
}
break;
case 'txt':
foreach ($list_2 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 产品 无区域 主页 已有
* 产品 无区域 分页
*/
$list_3 = $this->getIndex3(); //产品分页
//$list = array_merge($list,$list_3);
$list_3 = $this->unsetHandle($list_3,3,$type);
switch ($type) {
case 'xml':
foreach ($list_3 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_3 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 产品按省级 主页
*/
$list_4 = $this->getIndex4(); //产品分页
//$list = array_merge($list,$list_4);
$list_4 = $this->unsetHandle($list_4,4,$type);
switch ($type) {
case 'xml':
foreach ($list_4 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_4 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
$html .= '职称工种
';
foreach ($list_4 as $k=>$value){
$value1 = explode('zczl/jzzc',$value);
$aid = Db::name('seo_number')->where('number','=',$value1[1])
->where('type','=',3)
->value('aid');
$name = Db::name('citysite')->where('id','=',$aid)->value('name');
if(empty($name)){
$name = '山东';
}
$html .= '- '.$name.'地区
';
}
$html .= '
';
break;
default:
// 如果没有匹配的值
}
/*
* 产品按省级 分页
*/
$list_5 = $this->getIndex5(); //产品分页
$list_5 = $this->unsetHandle($list_5,5,$type);
//$list = array_merge($list,$list_5);
switch ($type) {
case 'xml':
foreach ($list_5 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_5 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 产品url
* 按照 /id /idh /id/sid /id/sidh
*/
$list_6 = $this->getIndex6(); //产品分页
$list_6 = $this->unsetHandle($list_6,6,$type);
//$list = array_merge($list,$list_6);
switch ($type) {
case 'xml':
foreach ($list_6 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_6 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 论文主页 已有
* 论文列表 - 分页
*/
$list_7 = $this->getIndex7();
$list_7 = $this->unsetHandle($list_7,7,$type);
//$list = array_merge($list,$list_7);
switch ($type) {
case 'xml':
foreach ($list_7 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_7 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 论文详情
*/
$list_8 = $this->getIndex8();
$list_8 = $this->unsetHandle($list_8,8,$type);
//$list = array_merge($list,$list_8);
switch ($type) {
case 'xml':
foreach ($list_8 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_8 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 主页在最上面
* 职称材料 无区域 无标签 分页
*/
/*
* 职称材料 栏目1
*/
$list_9 = $this->getIndex9("zccl",126,20);
$list_9 = $this->unsetHandle($list_9,9,$type);
//$list = array_merge($list,$list_9);
switch ($type) {
case 'xml':
foreach ($list_9 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_9 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 职称材料 只有区域
* 包含 区域主页 + 分页
* 包含 伪区域主页 + 分页
*/
$list_10 = $this->getIndex10("zccl",126,20);
$list_10 = $this->unsetHandle($list_10,10,$type);
//$list = array_merge($list,$list_10);
switch ($type) {
case 'xml':
foreach ($list_10 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_10 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
$html .= '职称材料
';
//dump($list_10);die;
foreach ($list_10 as $k=>$value){
$value = str_replace('---list_is_null)','',$value);
$pos = strpos($value, '-');
if ($pos !== false) {
}else{
$value1 = explode('.',$value);
$value2 = explode('//',$value1[0]);
//echo $value2;
$name = Db::name('citysite')->where('domain','=',$value2[1])->value('name');
if(empty($name)){
$name = '山东';
}
$html .= '- '.$name.'地区
';
}
}
$html .= '
';
break;
default:
// 如果没有匹配的值
}
/*
* 职称材料 只有标签
* 包含 标签主页 + 分页
*/
$list_11 = $this->getIndex11("zccl",126,20);
$list_11 = $this->unsetHandle($list_11,11,$type);
//$list = array_merge($list,$list_11);
switch ($type) {
case 'xml':
foreach ($list_11 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_11 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 职称材料 同时有 区域+标签
* 包含主页 + 分页
*/
$list_12 = $this->getIndex12("zccl",126,20);
$list_12 = $this->unsetHandle($list_12,12,$type);
//$list = array_merge($list,$list_12);
switch ($type) {
case 'xml':
foreach ($list_12 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_12 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 职称材料 栏目2
*/
$list_9_1 = $this->getIndex9("zlwd",126,20);
$list_9_1 = $this->unsetHandle($list_9_1,13,$type);
//$list = array_merge($list,$list_9_1);
switch ($type) {
case 'xml':
foreach ($list_9_1 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_9_1 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_10_1 = $this->getIndex10("zlwd",126,20);
$list_10_1 = $this->unsetHandle($list_10_1,14,$type);
//$list = array_merge($list,$list_10_1);
switch ($type) {
case 'xml':
foreach ($list_10_1 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_10_1 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_11_1 = $this->getIndex11("zlwd",126,20);
$list_11_1 = $this->unsetHandle($list_11_1,15,$type);
//$list = array_merge($list,$list_11_1);
switch ($type) {
case 'xml':
foreach ($list_11_1 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_11_1 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_12_1 = $this->getIndex12("zlwd",126,20);
$list_12_1 = $this->unsetHandle($list_12_1,16,$type);
//$list = array_merge($list,$list_12_1);
switch ($type) {
case 'xml':
foreach ($list_12_1 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_12_1 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 职称材料 栏目3
*/
$list_9_2 = $this->getIndex9("zcwj",825,20);
$list_9_2 = $this->unsetHandle($list_9_2,17,$type);
//$list = array_merge($list,$list_9_2);
switch ($type) {
case 'xml':
foreach ($list_9_2 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_9_2 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_10_2 = $this->getIndex10("zcwj",825,20);
$list_10_2 = $this->unsetHandle($list_10_2,18,$type);
//$list = array_merge($list,$list_10_2);
switch ($type) {
case 'xml':
foreach ($list_10_2 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_10_2 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_11_2 = $this->getIndex11("zcwj",825,20);
$list_11_2 = $this->unsetHandle($list_11_2,19,$type);
//$list = array_merge($list,$list_11_2);
switch ($type) {
case 'xml':
foreach ($list_11_2 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_11_2 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_12_2 = $this->getIndex12("zcwj",825,20);
$list_12_2 = $this->unsetHandle($list_12_2,20,$type);
//$list = array_merge($list,$list_12_2);
switch ($type) {
case 'xml':
foreach ($list_12_2 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_12_2 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 补充伪区域 url 加入标签
*/
$list_11_3 = $this->getIndex11("shandong_zccl",126,20);
$list_11_3 = $this->unsetHandle($list_11_3,58,$type);
//$list = array_merge($list,$list_11);
switch ($type) {
case 'xml':
foreach ($list_11_3 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_11_3 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_11_4 = $this->getIndex11("shandong_zlwd",126,20);
$list_11_4 = $this->unsetHandle($list_11_4,59,$type);
//$list = array_merge($list,$list_11);
switch ($type) {
case 'xml':
foreach ($list_11_4 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_11_4 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_11_5 = $this->getIndex11("shandong_zcwj",825,20);
$list_11_5 = $this->unsetHandle($list_11_5,60,$type);
//$list = array_merge($list,$list_11);
switch ($type) {
case 'xml':
foreach ($list_11_5 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_11_5 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 职称材料 详情页
*/
$list_13 = $this->getIndex13('zlwd',126);
$list_13 = $this->unsetHandle($list_13,21,$type);
//$list = array_merge($list,$list_13);
switch ($type) {
case 'xml':
foreach ($list_13 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_13 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_13_1 = $this->getIndex13('zcwj',825);
$list_13_1 = $this->unsetHandle($list_13_1,22,$type);
//$list = array_merge($list,$list_13_1);
switch ($type) {
case 'xml':
foreach ($list_13_1 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_13_1 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 主页在最上面
* 职称答辩 - 分页
*/
$list_14 = $this->getIndex7("zcdb",132,12); //列表页
$list_14 = $this->unsetHandle($list_14,23,$type);
//$list = array_merge($list,$list_14);
switch ($type) {
case 'xml':
foreach ($list_14 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_14 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_15 = $this->getIndex8("zcdb1",132,2); //职称答辩 - 详情页
$list_15 = $this->unsetHandle($list_15,24,$type);
//$list = array_merge($list,$list_15);
switch ($type) {
case 'xml':
foreach ($list_15 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_15 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
*
*/
$list_14_1 = $this->getIndex11_1("zcdb",132,12); //列表页
$list_14_1 = $this->unsetHandle($list_14_1,49,$type);
switch ($type) {
case 'xml':
foreach ($list_14_1 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_14_1 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 调用政策资讯 主页 最上面
*
*/
$list_16_1 = $this->getIndex9("zhengce",115,12); //生成主站域名 分页
//$list = array_merge($list,$list_16_1);
$list_16_1 = $this->unsetHandle($list_16_1,25,$type);
switch ($type) {
case 'xml':
foreach ($list_16_1 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_16_1 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_16 = $this->getIndex15("zhengce"); //生成二级域名主页(这里 是 所有省级主页)
//$list = array_merge($list,$list_16);
$list_16 = $this->unsetHandle($list_16,26,$type);
switch ($type) {
case 'xml':
foreach ($list_16 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_16 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
$html .= '政策资讯
';
foreach ($list_16 as $k=>$value){
$pos = strpos($value, '-');
if ($pos !== false) {
}else{
$value1 = explode('.',$value);
$value2 = explode('//',$value1[0]);
//echo $value2;
$name = Db::name('citysite')->where('domain','=',$value2[1])->value('name');
$html .= '- '.$name.'地区
';
}
}
$html .= '
';
break;
default:
// 如果没有匹配的值
}
$list_16_2 = $this->getIndex10("zhengce",115,12); //生成二级域名 分页
//$list = array_merge($list,$list_16_2);
$list_16_2 = $this->unsetHandle($list_16_2,27,$type);
switch ($type) {
case 'xml':
foreach ($list_16_2 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_16_2 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_16_4 = $this->getIndex16("zhengce"); //生成二级域名 城市二级目录 主页
//$list = array_merge($list,$list_16_4);
$list_16_4 = $this->unsetHandle($list_16_4,28,$type);
switch ($type) {
case 'xml':
foreach ($list_16_4 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_16_4 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_16_3 = $this->getIndex14("zhengce",115,12); //生成二级域名城市二级目录 分页
//$list = array_merge($list,$list_16_3);
$list_16_3 = $this->unsetHandle($list_16_3,29,$type);
switch ($type) {
case 'xml':
foreach ($list_16_3 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_16_3 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_16_5 = $this->getIndex17("zhengce/cms",115,2,0,0); //主站域名 详情
//$list = array_merge($list,$list_16_5);
$list_16_5 = $this->unsetHandle($list_16_5,30,$type);
switch ($type) {
case 'xml':
foreach ($list_16_5 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_16_5 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_16_6 = $this->getIndex18("zhengce/cms",115,2,0,0); //省站域名 详情
//$list = array_merge($list,$list_16_6);
$list_16_6 = $this->unsetHandle($list_16_6,31,$type);
switch ($type) {
case 'xml':
foreach ($list_16_6 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_16_6 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_16_7 = $this->getIndex19("zhengce/cms",115,2,0,0); //省站域名二级城市目录 详情
//$list = array_merge($list,$list_16_7);
$list_16_7 = $this->unsetHandle($list_16_7,32,$type);
switch ($type) {
case 'xml':
foreach ($list_16_7 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_16_7 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 政策资讯 标签 功能 无区域
*/
$list_16_8 = $this->getIndex11_1("zhengce",115,12); //列表页
$list_16_8 = $this->unsetHandle($list_16_8,50,$type);
switch ($type) {
case 'xml':
foreach ($list_16_8 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_16_8 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 政策资讯 标签 功能 加上区域
*/
$list_16_9 = $this->getIndex12_1("zhengce",115,12); //列表页
$list_16_9 = $this->unsetHandle($list_16_9,51,$type);
switch ($type) {
case 'xml':
foreach ($list_16_9 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_16_9 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 攻略主页 在最上面
*/
$list_17_1 = $this->getIndex9("gonglve",117,12); //生成主站域名 分页
//$list = array_merge($list,$list_17_1);
$list_17_1 = $this->unsetHandle($list_17_1,33,$type);
switch ($type) {
case 'xml':
foreach ($list_17_1 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_17_1 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_17 = $this->getIndex15("gonglve"); //生成二级域名主页
//$list = array_merge($list,$list_17);
$list_17 = $this->unsetHandle($list_17,34,$type);
switch ($type) {
case 'xml':
foreach ($list_17 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_17 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
$html .= '评审攻略
';
foreach ($list_17 as $k=>$value){
$pos = strpos($value, '-');
if ($pos !== false) {
}else{
$value1 = explode('.',$value);
$value2 = explode('//',$value1[0]);
//echo $value2;
$name = Db::name('citysite')->where('domain','=',$value2[1])->value('name');
$html .= '- '.$name.'地区
';
}
}
$html .= '
';
break;
default:
// 如果没有匹配的值
}
$list_17_2 = $this->getIndex10("gonglve",117,12); //生成二级域名 分页
//$list = array_merge($list,$list_17_2);
$list_17_2 = $this->unsetHandle($list_17_2,35,$type);
switch ($type) {
case 'xml':
foreach ($list_17_2 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_17_2 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_17_4 = $this->getIndex16("gonglve"); //生成二级域名 城市二级目录 主页
//$list = array_merge($list,$list_17_4);
$list_17_4 = $this->unsetHandle($list_17_4,36,$type);
switch ($type) {
case 'xml':
foreach ($list_17_4 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_17_4 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_17_3 =$this->getIndex14("gonglve",117,12); //生成二级域名城市二级目录 分页
//$list = array_merge($list,$list_17_3);
$list_17_3 = $this->unsetHandle($list_17_3,37,$type);
switch ($type) {
case 'xml':
foreach ($list_17_3 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_17_3 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_17_5 = $this->getIndex17("gonglve1-",117,2,0,0); //主站域名 详情
//$list = array_merge($list,$list_17_5);
$list_17_5 = $this->unsetHandle($list_17_5,38,$type);
switch ($type) {
case 'xml':
foreach ($list_17_5 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_17_5 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_17_6 = $this->getIndex18("gonglve1-",117,2,0,0); //省站域名 详情
//$list = array_merge($list,$list_17_6);
$list_17_6 = $this->unsetHandle($list_17_6,39,$type);
switch ($type) {
case 'xml':
foreach ($list_17_6 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_17_6 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_17_7 = $this->getIndex19("gonglve1-",117,2,0,0); //省站域名 城市二级目录 详情
//$list = array_merge($list,$list_17_7);
$list_17_7 = $this->unsetHandle($list_17_7,40,$type);
switch ($type) {
case 'xml':
foreach ($list_17_7 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_17_7 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 评审攻略 标签 功能 无区域
*/
$list_17_8 = $this->getIndex11_1("gonglve",117,12); //列表页
$list_17_8 = $this->unsetHandle($list_17_8,52,$type);
switch ($type) {
case 'xml':
foreach ($list_17_8 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_17_8 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 政策资讯 标签 功能 加上区域
*/
$list_17_9 = $this->getIndex12_1("gonglve",117,12); //列表页
$list_17_9 = $this->unsetHandle($list_17_9,53,$type);
switch ($type) {
case 'xml':
foreach ($list_17_9 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_17_9 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 主页在最上面
* 论文参考 分页
*/
$list_18 = $this->getIndex7("lwck",127,12); //列表页
//$list = array_merge($list,$list_18);
$list_18 = $this->unsetHandle($list_18,41,$type);
switch ($type) {
case 'xml':
foreach ($list_18 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_18 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_18_1 = $this->getIndex8("lwck/cankao",127,2); //论文参考 详情页
//$list = array_merge($list,$list_18_1);
$list_18_1 = $this->unsetHandle($list_18_1,42,$type);
switch ($type) {
case 'xml':
foreach ($list_18_1 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_18_1 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 论文参考 标签 功能 无区域
*/
$list_18_2 = $this->getIndex11_1("lwck",127,12); //列表页
$list_18_2 = $this->unsetHandle($list_18_2,54,$type);
switch ($type) {
case 'xml':
foreach ($list_18_2 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_18_2 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 主页在最上面
* 常见问题 - 分页
*/
$list_19 = $this->getIndex7("wthz",111,12); //列表页
//$list = array_merge($list,$list_19);
$list_19 = $this->unsetHandle($list_19,43,$type);
switch ($type) {
case 'xml':
foreach ($list_19 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_19 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
//$list_19_1 = $this->getIndex8("wthz",111,2); //常见问题 - 详情页 添加区域后 改为方法getIndex17
$list_19_1 = $this->getIndex17("wthz",111,2,0,0); //主站域名 详情
//$list = array_merge($list,$list_19_1);
$list_19_1 = $this->unsetHandle($list_19_1,44,$type);
switch ($type) {
case 'xml':
foreach ($list_19_1 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_19_1 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 文章新增 区域 增加部分
* !+++++++++++++++++++++++++++++++++++++++++
*/
$list_16_a = $this->getIndex15("wthz"); //生成二级域名主页(这里 是 所有省级主页)
//$list = array_merge($list,$list_16);
$list_16_a = $this->unsetHandle($list_16_a,61,$type);
switch ($type) {
case 'xml':
foreach ($list_16_a as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_16_a as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
$html .= '常见问题
';
foreach ($list_16_a as $k=>$value){
$pos = strpos($value, '-');
if ($pos !== false) {
}else{
$value1 = explode('.',$value);
$value2 = explode('//',$value1[0]);
//echo $value2;
$name = Db::name('citysite')->where('domain','=',$value2[1])->value('name');
$html .= '- '.$name.'地区
';
}
}
$html .= '
';
break;
default:
// 如果没有匹配的值
}
$list_16_2_a = $this->getIndex10("wthz",111,12); //生成二级域名 分页
//$list = array_merge($list,$list_16_2);
$list_16_2_a = $this->unsetHandle($list_16_2_a,62,$type);
switch ($type) {
case 'xml':
foreach ($list_16_2_a as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_16_2_a as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_16_4_a = $this->getIndex16("wthz"); //生成二级域名 城市二级目录 主页
//$list = array_merge($list,$list_16_4);
$list_16_4_a = $this->unsetHandle($list_16_4_a,63,$type);
switch ($type) {
case 'xml':
foreach ($list_16_4_a as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_16_4_a as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_16_3_a = $this->getIndex14("wthz",111,12); //生成二级域名城市二级目录 分页
//$list = array_merge($list,$list_16_3);
$list_16_3_a = $this->unsetHandle($list_16_3_a,64,$type);
switch ($type) {
case 'xml':
foreach ($list_16_3_a as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_16_3_a as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_16_6_a = $this->getIndex18("wthz",111,2,0,0); //省站域名 详情
//$list = array_merge($list,$list_16_6);
$list_16_6_a = $this->unsetHandle($list_16_6_a,65,$type);
switch ($type) {
case 'xml':
foreach ($list_16_6_a as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_16_6_a as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_16_7_a = $this->getIndex19("wthz",111,2,0,0); //省站域名二级城市目录 详情
//$list = array_merge($list,$list_16_7);
$list_16_7_a = $this->unsetHandle($list_16_7_a,66,$type);
switch ($type) {
case 'xml':
foreach ($list_16_7_a as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_16_7_a as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 常见问题 标签 功能 无区域
*/
$list_19_2 = $this->getIndex11_1("wthz",111,12); //列表页
$list_19_2 = $this->unsetHandle($list_19_2,55,$type);
switch ($type) {
case 'xml':
foreach ($list_19_2 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_19_2 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/**
* 文章类型 常见问题 标签功能 增加 区域
*/
/*
* 政策资讯 标签 功能 加上区域
*/
$list_16_9_a = $this->getIndex12_1("wthz",111,12); //列表页
$list_16_9_a = $this->unsetHandle($list_16_9_a,67,$type);
switch ($type) {
case 'xml':
foreach ($list_16_9_a as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_16_9_a as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 主页在最上面
* 案例 - 分页
*/
$list_20 = $this->getIndex7("anli",120,12); //列表页
//$list = array_merge($list,$list_20);
$list_20 = $this->unsetHandle($list_20,45,$type);
switch ($type) {
case 'xml':
foreach ($list_20 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_20 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_20_1 = $this->getIndex8("anli",120,2); //案例 - 详情页
//$list = array_merge($list,$list_20_1);
$list_20_1 = $this->unsetHandle($list_20_1,46,$type);
switch ($type) {
case 'xml':
foreach ($list_20_1 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_20_1 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 案例 标签 功能 无区域
*/
$list_20_2 = $this->getIndex11_1("anli",120,12); //列表页
$list_20_2 = $this->unsetHandle($list_20_2,56,$type);
switch ($type) {
case 'xml':
foreach ($list_20_2 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_20_2 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 主页 在最上面
* 职称补贴 - 分页
*/
$list_21 = $this->getIndex7("zcbt",306,12); //列表页
//$list = array_merge($list,$list_21);
$list_21 = $this->unsetHandle($list_21,47,$type);
switch ($type) {
case 'xml':
foreach ($list_21 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_21 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
$list_21_1 = $this->getIndex8("zcbt",306,2); //职称补贴 - 详情页
//$list = array_merge($list,$list_21_1);
$list_21_1 = $this->unsetHandle($list_21_1,48,$type);
switch ($type) {
case 'xml':
foreach ($list_21_1 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.8');
}
break;
case 'txt':
foreach ($list_21_1 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*
* 职称补贴 标签 功能 无区域
*/
$list_21_2 = $this->getIndex11_1("zcbt",306,12); //列表页
$list_21_2 = $this->unsetHandle($list_21_2,57,$type);
switch ($type) {
case 'xml':
foreach ($list_21_2 as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()),'hourly','0.9');
}
break;
case 'txt':
foreach ($list_21_2 as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
break;
default:
// 如果没有匹配的值
}
/*echo "";
var_dump($list);
echo "
";*/
switch ($type) {
case 'xml':
// ... 添加其他页面的URL
$xmlWriter->endElement();
$xmlWriter->endDocument();
//var_dump($xmlWriter->outputMemory(true));
file_put_contents('./sitemaps/sitemap.xml', $xmlWriter->outputMemory(true));
break;
case 'txt':
file_put_contents('./sitemaps/sitemap.txt',$txt);
break;
case 'html':
$html .= '
';
//./sitemaps/sitemap.html
file_put_contents('./sitemap.html',$html);
break;
default:
// 如果没有匹配的值
}
}
public function getIndex()
{
$list = Db::name('citysite')->where(['is_open'=>1,'status'=>1,'level'=>1])->select();
$url = [];
$list[] = [
'id' => 10000,
'domain' => 'www'
];
foreach ($list as $index=>$row){
$url[] = 'https://'.$row['domain'].'.zc10000.com';
}
$url[] = 'https://www.zc10000.com/shandong';
return $url;
}
public function getIndex2()
{
$list = Db::name('citysite')->where(['is_open'=>1,'status'=>1,'level'=>1])->select();
$url = [];
$list[] = [
'id' => 10000,
'domain' => 'www'
];
foreach ($list as $index=>$row){
if((int)$row['id'] === 10000){
$collect = Db::name('citysite')->where(['parent_id'=>5290])->select();
foreach ($collect as $key=>$item){
$url[] = 'https://'.$row['domain'].'.zc10000.com/'.$item['domain'];
}
}else{
$collect = Db::name('citysite')->where(['parent_id'=>$row['id']])->select();
foreach ($collect as $key=>$item){
$url[] = 'https://'.$row['domain'].'.zc10000.com/'.$item['domain'];
}
}
}
return $url;
}
public function getIndex3()
{
$list = Db::name('arctype')->where(['parent_id'=>38,'status'=>1,'is_del'=>0])->count();
$page = ceil($list/12);
$url = [];
for ($i=2;$i<=$page;$i++){
$url[] = 'https://www.zc10000.com/zczl-'.$i;
}
return $url;
}
public function getIndex4()
{
$list = Db::name('citysite')->where(['is_open'=>1,'status'=>1,'level'=>1])->select();
$url = [];
$list[] = [
'id' => 10000
];
foreach ($list as $index=>$row){
if((int)$row['id'] === 10000){
$number = 32;
}else{
//查找序列号
$number = Db::name('seo_number')->where(['type'=>3,'aid'=>$row['id'],'is_del'=>0])->value('number');
}
$url[] = 'https://www.zc10000.com/zczl/jzzc'.$number;
}
return $url;
}
public function getIndex5()
{
$list = Db::name('citysite')->where(['is_open'=>1,'status'=>1,'level'=>1])->select();
$url = [];
$list[] = [
'id' => 10000
];
foreach ($list as $index=>$row){
//查找序列号
if((int)$row['id'] === 10000){
$number = 32;
}else{
$number = Db::name('seo_number')->where(['type'=>3,'aid'=>$row['id'],'is_del'=>0])->value('number');
}
//查找分页
$list2 = Db::name('arctype')->where(['parent_id'=>38,'status'=>1,'is_del'=>0,'area_id'=>$row['id']])->count();
if((int)$list2 === 0){
$list2 = 1; //假设有一条数据
}
$page = ceil($list2/12);
for ($i=2;$i<=$page;$i++){
$url[] = 'https://www.zc10000.com/zczl/jzzc'.$number.'-'.$i;
}
}
return $url;
}
public function getIndex6()
{
$list = Db::name('citysite')->where(['is_open'=>1,'status'=>1,'level'=>1])->select();
$url = [];
$list[] = [
'id' => 10000,
'domain' => 'www',
];
foreach ($list as $index=>$row){
//查找序列号
$list_1 = Db::name('seo_number')->where(['type'=>1,'area_id'=>$row['id'],'is_del'=>0,'parentid'=>38])->select();
foreach ($list_1 as $key=>$item) {
//判断是否已删除 栏目只有删除 与 未删除
$op = Db::name('arctype')->where(['id'=>$item['aid']])->find();
if((int)$op['is_del'] === 1){
$url[] = 'https://' . $row['domain'] . '.zc10000.com/id' . $item['number'].'---ID:'.$item['aid'].'(is_del)';
}else{
$url[] = 'https://' . $row['domain'] . '.zc10000.com/id' . $item['number'];
}
if((int)$op['is_del'] === 0) {
//查询有多少级别
$level_group_id = Db::name('archives')->where(['typeid' => $item['aid'], 'product_id' => 0])->value('level_group_id');
//echo $level_group_id.'
';
$level_count = 0;
if ((int)$level_group_id > 0) {
///只调用存在的链接
$level_count = Db::name('archives')->where(['typeid' => $level_group_id, 'is_del' => 0, 'arcrank' => 0, 'status' => 1])->count();
}
for ($i = 1; $i < $level_count; $i++) {
//去掉主页
$url[] = 'https://' . $row['domain'] . '.zc10000.com/id' . $item['number'] . 'h' . $i;
}
//查询子类
$list_2 = Db::name('seo_number')->where(['type' => 1, 'is_del' => 0, 'parentid' => $item['aid']])->select();
foreach ($list_2 as $key2 => $item2) {
//判断是否已删除
$op2 = Db::name('arctype_cat')->where(['id' => $item2['aid']])->find();
if ((int)$op2['is_del'] === 1) {
$url[] = 'https://' . $row['domain'] . '.zc10000.com/id' . $item['number'] . '/sid' . $item2['number'] . '---ID:' . $item2['aid'] . '(is_del)';
} else {
$url[] = 'https://' . $row['domain'] . '.zc10000.com/id' . $item['number'] . '/sid' . $item2['number'];
}
if ((int)$op2['is_del'] === 0) {
//查询子类级别
$level_group_id2 = Db::name('archives')->where(['typeid' => $item['aid'], 'product_id' => $item2['aid']])->value('level_group_id');
$level_count2 = 0;
if ((int)$level_group_id2 > 0) {
//只调用存在的链接
$level_count2 = Db::name('archives')->where(['typeid' => $level_group_id2, 'is_del' => 0, 'arcrank' => 0, 'status' => 1])->count();
}
for ($i2 = 1; $i2 < $level_count2; $i2++) {
//去掉主页
$url[] = 'https://' . $row['domain'] . '.zc10000.com/id' . $item['number'] . '/sid' . $item2['number'] . 'h' . $i2;
}
}
}
}
}
}
return $url;
}
public function getIndex7($str="zclw",$typeid=116,$pasize=25)
{
$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 getIndex8($str="zclw/lunwen",$typeid=116,$ty=4)
{
$list_1 = Db::name('seo_number')->where(['type'=>$ty,'tid'=>$typeid,'is_del'=>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 getIndex9($str="zccl",$typeid=126,$pasize=20)
{
$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 getIndex10($str="zccl",$typeid=126,$pasize=20)
{
$area = Db::name('citysite')->where(['is_open'=>1,'status'=>1,'level'=>1])->select();
$url = [];
//https://www.zc10000.com/shandong_zccl
$area[] = [
'id' => 10000,
'domain' => 'www'
];
foreach ($area as $index=>$row){
//seo_number 并没有这个字段 arcrank 假设没有 先不管了
$is_www = 0;
if((int)$row['id'] === 10000 && (int)$pasize === 20){
//伪区域内容 (职称材料调用)
$list = Db::name('archives')->where(['typeid'=>$typeid,'status'=>1,'is_del'=>0,'arcrank'=>0,'area_tag_id'=>$row['id']])->count();
$str = 'shandong_'.$str;
$is_www = 1;
}else{
$list = Db::name('archives')->where(['typeid'=>$typeid,'status'=>1,'is_del'=>0,'arcrank'=>0,'province_id'=>$row['id']])->count();
}
$desc = '';
if((int)$list === 0){
$list = 1; //假设有一条数据
$desc = '---list_is_null)';
}
$page = ceil($list/$pasize);
for ($i=1;$i<=$page;$i++){
if($i === 1 && $str === 'zccl' || $i === 1 && $str === 'zlwd' || $i === 1 && $str === 'zcwj' || $i === 1 && $is_www === 1){
$url[] = 'https://'.$row['domain'].'.zc10000.com/'.$str.$desc;
}else{
if($i > 1) {
$url[] = 'https://' . $row['domain'] . '.zc10000.com/' . $str . '-' . $i.$desc;
}
}
}
}
return $url;
}
/*
* 加入 标签
*/
public function getIndex11($str="zccl",$typeid=126,$pasize=20)
{
$tagList = Db::name('archives')->where(['typeid'=>58,'status'=>1,'is_del'=>0])->select();
$url = [];
foreach ($tagList as $index=>$row){
//seo_number 并没有这个字段 arcrank 假设没有 先不管了
$list = Db::name('archives')->where(['typeid'=>$typeid,'status'=>1,'is_del'=>0,'arcrank'=>0,'product_tag_id'=>$row['aid']])->count();
$desc = '';
if((int)$list === 0){
$list = 1; //假设有一条数据
$desc = '---list_is_null)';
}
$page = ceil($list/$pasize);
for ($i=1;$i<=$page;$i++){
if($i === 1 && $str === 'zccl' || $i === 1 && $str === 'zlwd' || $i === 1 && $str === 'zcwj' || $i === 1 && $str === 'shandong_zccl' || $i === 1 && $str === 'shandong_zlwd' || $i === 1 && $str === 'shandong_zcwj'){
$url[] = 'https://www.zc10000.com/'.$str.'/tag'.$row['aid'].$desc;
}else{
if($i > 1) {
$url[] = 'https://www.zc10000.com/' . $str . '/tag' . $row['aid'] . '-' . $i.$desc;
}
}
}
}
return $url;
}
/*
* 加入区域和标签
*/
public function getIndex12($str="zccl",$typeid=126,$pasize=20)
{
$tagList = Db::name('archives')->where(['typeid'=>58,'status'=>1,'is_del'=>0])->select();
$url = [];
foreach ($tagList as $index=>$row){
$area = Db::name('citysite')->where(['is_open'=>1,'status'=>1,'level'=>1])->select();
foreach ($area as $key=>$item){
//seo_number 并没有这个字段 arcrank 假设没有 先不管了
$list = Db::name('archives')->where(['typeid'=>$typeid,'status'=>1,'is_del'=>0,'arcrank'=>0,'province_id'=>$item['id'],'product_tag_id'=>$row['aid']])->count();
$desc = '';
if((int)$list === 0){
$list = 1; //假设有一条数据
$desc = '---list_is_null)';
}
$page = ceil($list/$pasize);
for ($i=1;$i<=$page;$i++){
if($i === 1 && $str === 'zccl' || $i === 1 && $str === 'zlwd' || $i === 1 && $str === 'zcwj'){
$url[] = 'https://'.$item['domain'].'.zc10000.com/'.$str.'/tag'.$row['aid'].$desc;
}else{
if($i > 1) {
$url[] = 'https://' . $item['domain'] . '.zc10000.com/' . $str . '/tag' . $row['aid'] . '-' . $i.$desc;
}
}
}
}
}
return $url;
}
public function getIndex13($str='zlwd',$tid='126')
{
$list = Db::name('citysite')->where(['is_open'=>1,'status'=>1,'level'=>1])->select();
$url = [];
$list[] = [
'id' => 0,
'domain' => 'www'
];
foreach ($list as $index=>$row){
//查找序列号
$data = Db::name('seo_number')->where(['type'=>5,'area_id'=>$row['id'],'is_del'=>0,'tid'=>$tid])->select();
foreach ($data 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)";
}
if((int)$row['id'] === 0){
$url[] = 'https://'.$row['domain'].'.zc10000.com/'.$str.'/cms'.$item['number'].$desc;
}else{
$url[] = 'https://'.$row['domain'].'.zc10000.com/'.$str.'/cms'.$item['number'].$desc;
}
}
}
return $url;
}
public function getIndex14($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){
$collect = Db::name('citysite')->where(['parent_id'=>$row['id']])->select();
foreach ($collect as $key=>$item){
//seo_number 并没有这个字段 arcrank 假设没有 先不管了
$list = Db::name('archives')->where(['typeid'=>$typeid,'status'=>1,'is_del'=>0,'arcrank'=>0,'city_id'=>$item['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://'.$row['domain'].'.zc10000.com/'.$item['domain'].'/'.$str.'-'.$i.$desc;
}
}
}
return $url;
}
public function getIndex15($str="zhengce")
{
$area = Db::name('citysite')->where(['is_open'=>1,'status'=>1,'level'=>1])->select();
$url = [];
foreach ($area as $index=>$row){
$url[] = 'https://'.$row['domain'].'.zc10000.com/'.$str;
}
return $url;
}
public function getIndex16($str="zhengce")
{
$area = Db::name('citysite')->where(['is_open'=>1,'status'=>1,'level'=>1])->select();
$url = [];
foreach ($area as $index=>$row){
$collect = Db::name('citysite')->where(['parent_id'=>$row['id']])->select();
foreach ($collect as $key=>$item){
$url[] = 'https://'.$row['domain'].'.zc10000.com/'.$item['domain'].'/'.$str;
}
}
return $url;
}
public function getIndex17($str="zhengce/cms",$typeid=115,$ty=2,$area_id=0,$city_id=0)
{
$list_1 = Db::name('seo_number')->where(['type'=>$ty,'tid'=>$typeid,'is_del'=>0,"area_id"=>$area_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.$item['number'].$desc;
}
return $url;
}
public function getIndex18($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://'.$row['domain'].'.zc10000.com/'.$str.$item['number'].$desc;
}
}
return $url;
}
public function getIndex19($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){
$collect = Db::name('citysite')->where(['parent_id'=>$row['id']])->select();
foreach ($collect as $key=>$item){
$list_1 = Db::name('seo_number')->where(['type'=>$ty,'tid'=>$typeid,'is_del'=>0,"area_id"=>$row['id'],"city_id"=>$item['id']])->select();
foreach ($list_1 as $key2=>$item2) {
//判断文档是否已删除
$op = Db::name('archives')->where(['aid'=>$item2['aid']])->find();
$desc = '';
if((int)$op['is_del'] === 1){
$desc .= '---ID: '.$item2['aid']."(is_del)";
}
if((int)$op['arcrank'] === 1){
$desc .= '---ID: '.$item2['aid']."(is_arcrank)";
}
if((int)$op['status'] === 0){
$desc .= '---ID: '.$item2['aid']."(is_status)";
}
$url[] = 'https://'.$row['domain'].'.zc10000.com/'.$item['domain'].'/'.$str.$item2['number'].$desc;
}
}
}
return $url;
}
public function buildXml($xmlWriter,$value,$time,$mod="hourly",$level="1.0")
{
/*
* 循环 start
*/
// 添加你网站的URL
$xmlWriter->startElement('url');
$xmlWriter->writeElement('loc', $value);
$xmlWriter->writeElement('lastmod', $time);
$xmlWriter->writeElement('changefreq', $mod);
//always hourly daily weekly monthly yearly never
$xmlWriter->writeElement('priority', $level); //优先级 0.0到1.0之间
$xmlWriter->startElement('mobile:mobile');
$xmlWriter->writeAttribute('type', 'htmladapt');
//
// :移动网页
// :移动网页
//:代码适配
$xmlWriter->endElement();
$xmlWriter->endElement();
/*
* 循环 end
*/
return $xmlWriter;
}
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;
//其他url加入地图
$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 catIndex()
{
$data = [
'获取主页和专题页',
'省级主页',
'城市主页',
'产品 无区域 分页',
'产品按省级 主页',
'产品按省级 分页',
'产品url',
'论文列表 - 分页',
'论文详情',
'职称材料 zccl 无区域 无标签 分页',
'职称材料 zccl 只有区域 包含 区域主页 + 分页',
'职称材料 zccl 只有标签 包含 标签主页 + 分页',
'职称材料 zccl 同时有 区域+标签 包含主页 + 分页',
'职称材料 zlwd 无区域 无标签 分页',
'职称材料 zlwd 只有区域 包含 区域主页 + 分页',
'职称材料 zlwd 只有标签 包含 标签主页 + 分页',
'职称材料 zlwd 同时有 区域+标签 包含主页 + 分页',
'职称材料 zcwj 无区域 无标签 分页',
'职称材料 zcwj 只有区域 包含 区域主页 + 分页',
'职称材料 zcwj 只有标签 包含 标签主页 + 分页',
'职称材料 zcwj 同时有 区域+标签 包含主页 + 分页',
'职称材料 详情页 zlwd',
'职称材料 详情页 zcwj',
'职称答辩 - 分页',
'职称答辩 - 分页',
'政策资讯生成主站域名 分页',
'政策资讯生成二级域名主页',
'政策资讯生成二级域名 分页',
'政策资讯生成二级域名 城市二级目录 主页',
'政策资讯生成二级域名城市二级目录 分页',
'政策资讯主站域名 详情',
'政策资讯省站域名 详情',
'政策资讯省站域名 城市二级目录 详情',
'评审攻略生成主站域名 分页',
'评审攻略生成二级域名主页',
'评审攻略生成二级域名 分页',
'评审攻略生成二级域名 城市二级目录 主页',
'评审攻略生成二级域名城市二级目录 分页',
'评审攻略主站域名 详情',
'评审攻略省站域名 详情',
'评审攻略省站域名 城市二级目录 详情',
'论文参考 分页',
'论文参考 详情页',
'常见问题 - 分页',
'常见问题 - 详情页',
'案例 - 分页',
'案例 - 详情页',
'职称补贴 - 分页',
'职称补贴 - 详情页',
'职称答辩 标签 功能', //49
'政策资讯 标签 功能 无区域', //50
'政策资讯 标签 功能 加上区域',
'评审攻略 标签 功能 无区域', //52
'评审攻略 标签 功能 加上区域',
'论文参考 标签 功能 无区域',
'常见问题 标签 功能 无区域',
'案例 标签 功能 无区域',
'职称补贴 标签 功能 无区域',
'伪山东 - 职称材料',
'伪山东 - 通用文件',
'伪山东 - 政策指引', //60
'常见问题生成二级域名主页', //61
'常见问题生成二级域名 分页', //62
'常见问题生成二级域名 城市二级目录 主页',
'常见问题生成二级域名城市二级目录 分页',
'常见问题省站域名 详情', //65
'常见问题省站域名 城市二级目录 详情',
'常见问题 标签 功能 加上区域', //67
];
foreach ($data as $key => $row){
$insert['gid'] = $key;
$insert['name'] = $row;
$one = Db::name('all_name')->where('gid','=',$key)->find();
if(!empty($one)){
Db::name('all_name')->where('gid','=',$key)->update($insert);
}else{
Db::name('all_name')->insert($insert);
}
}
/*
* 查询sql
*
*/
$sql = "select a.group_id,(SELECT b.name FROM ey_all_name b WHERE b.gid = a.group_id) AS group_name,a.url, date_format(a.update_time,'%Y-%m-%d %H:%i:%s') AS 更新时间, CASE
WHEN a.is_del = 0 THEN ''
ELSE '文档已删除'
END AS 是否删除,CASE
WHEN a.is_null = 0 THEN ''
ELSE '列表数据为空'
END AS 列表是否为空,CASE
WHEN a.is_arcrank = 0 THEN ''
ELSE '文档审核中'
END AS 文档是否审核,CASE
WHEN a.is_status = 0 THEN ''
ELSE '屏蔽中'
END AS 正常或者屏蔽 from ey_all_url a order by a.group_id asc";
}
/*
* 文章 加入 标签
*/
public function getIndex11_1($str="wthz",$typeid=111,$pasize=12)
{
//根据tid 查询
$cat = Db::name('arctype')->where(['parent_id'=>369,'article_id'=>$typeid])->find();
if(empty($cat)){
$cat_id = 371;
}else{
$cat_id = $cat['id'];
}
//加入区域 只调用主站的标签
$tagList = Db::name('archives')->where([
'typeid'=>$cat_id,'status'=>1,'is_del'=>0,
'province_id' => 0
])->select();
$url = [];
foreach ($tagList as $index=>$row){
//seo_number 并没有这个字段 arcrank 假设没有 先不管了
//主站是没有区域 加入区域0
$list = Db::name('archives')->where(['typeid'=>$typeid,'status'=>1,'is_del'=>0,'arcrank'=>0,'product_tag_id'=>$row['aid'],'province_id' => 0])->count();
$desc = '';
if((int)$list === 0){
$list = 1; //假设有一条数据
$desc = '---list_is_null)';
}
$page = ceil($list/$pasize);
for ($i=1;$i<=$page;$i++){
if($i === 1){
$url[] = 'https://www.zc10000.com/'.$str.'/tag'.$row['aid'].$desc;
}else{
$url[] = 'https://www.zc10000.com/' . $str . '/tag' . $row['aid'] . '-' . $i.$desc;
}
}
}
return $url;
}
/*
* 文章 加入区域和标签
*/
public function getIndex12_1($str="wthz",$typeid=111,$pasize=12)
{
//根据tid 查询
$cat = Db::name('arctype')->where(['parent_id'=>369,'article_id'=>$typeid])->find();
if(empty($cat)){
$cat_id = 371;
}else{
$cat_id = $cat['id'];
}
/*
* 原先是一个标签拥有多个省份
* 现在改为 每个省 对应 有哪些标签
*/
$url = [];
$area = Db::name('citysite')->where(['is_open'=>1,'status'=>1,'level'=>1])->select();
foreach ($area as $key=>$item){
$tagList = Db::name('archives')->where([
'typeid'=>$cat_id,'status'=>1,'is_del'=>0,
'province_id' => $item['id']
])->select();
foreach ($tagList as $index=>$row){
//seo_number 并没有这个字段 arcrank 假设没有 先不管了
$list = Db::name('archives')->where(['typeid'=>$typeid,'status'=>1,'is_del'=>0,'arcrank'=>0,'province_id'=>$item['id'],'product_tag_id'=>$row['aid']])->count();
$desc = '';
if((int)$list === 0){
$list = 1; //假设有一条数据
$desc = '---list_is_null)';
}
$page = ceil($list/$pasize);
for ($i=1;$i<=$page;$i++){
if($i === 1){
$url[] = 'https://'.$item['domain'].'.zc10000.com/'.$str.'/tag'.$row['aid'].$desc;
}else{
$url[] = 'https://' . $item['domain'] . '.zc10000.com/' . $str . '/tag' . $row['aid'] . '-' . $i.$desc;
}
}
//查询城市
$collect = Db::name('citysite')->where(['parent_id'=>$item['id']])->select();
foreach ($collect as $key2=>$item2){
//查询
$list = Db::name('archives')->where(['typeid'=>$typeid,'status'=>1,'is_del'=>0,'arcrank'=>0,'province_id'=>$item['id'],'city_id'=>$item2['id'],'product_tag_id'=>$row['aid']])->count();
$desc = '';
if((int)$list === 0){
$list = 1; //假设有一条数据
$desc = '---list_is_null)';
}
$page = ceil($list/$pasize);
for ($i=1;$i<=$page;$i++){
if($i === 1){
$url[] = 'https://'.$item['domain'].'.zc10000.com/'.$item2['domain'].'/'.$str.'/tag'.$row['aid'].$desc;
}else{
$url[] = 'https://' . $item['domain'] . '.zc10000.com/'.$item2['domain'].'/' . $str . '/tag' . $row['aid'] . '-' . $i.$desc;
}
}
}
}
}
return $url;
}
/*
* 按字母输出所有城市
* https://www.zc10000.com/api/other/getAllCity
*/
public function getAllCity(){
$list = Db::name('region')->where(['level'=>2])->order('initial asc,parent_id asc')
//->limit(2)
->select();
//dump($list);
//'北京|beijing|bj'
$data = [];
$pinyin = new Pinyin();
//dump($pinyin);
foreach ($list as $key=>$row){
$chinese = str_replace('市','',$row['name']);
$a = $pinyin->convert($chinese);
$str = '';
foreach ($a as $index => $item){
$str = $str.$item;
}
$b = $pinyin->abbr($chinese);
$h = $row['name'].'|'.$str.'|'.$b;
$data[] = $h;
echo '\''.$h.'\',';
}
}
/*
* 校验文章和序列号记录 状态
* aid是唯一的 就不需要 分类查询了
* 以后按定时任务 分页处理
* https://www.zc10000.com/api/other/rtArticleIsdel
*/
public function rtArticleIsdel(){
//针对 文章 论文 文档
$list = Db::name('seo_number')
->where('type',in,[2,4,5])
->where(['is_del'=>0])
->select();
foreach ($list as $key=>$item){
//查询对应的有没有被删除 更新序列号记录
$one = Db::name('archives')->where(['aid'=>$item['aid']])->find();
$data = [
'is_del' => (int)$one['is_del'],
'is_kan' => (int)$one['arcrank'], // 0正常 1审核
'status' => (int)$one['status'],
];
$res = Db::name('seo_number')->where(['id'=>$item['id']])->update($data);
echo '文档ID: '.$item['id'].'-类型:'.$item['type'].'-'.$res.'
';
}
}
/*
* https://www.zc10000.com/api/other/rtArticleIsdelCount
*/
public function rtArticleIsdelCount(){
//针对 文章 论文 文档
$list = Db::name('seo_number')
->where('type',in,[2,4,5])
->where(['is_del'=>1])
->select();
foreach ($list as $key=>$item){
//查询对应的有没有被删除 更新序列号记录
$one = Db::name('archives')->where(['aid'=>$item['aid']])->find();
echo '文档ID: '.$item['id'].'-类型:'.$item['type'].'-已删除:'.$one['is_del'].'
';
}
}
/*
* 处理产品
* https://www.zc10000.com/api/other/rtArticleIsdelPro
*/
public function rtArticleIsdelPro(){
//针对 文章 论文 文档
$list = Db::name('seo_number')
->where('type','=',1)
->where(['tid'=>38,'is_del'=>0])
->select();
foreach ($list as $key=>$item){
//查询对应的有没有被删除 更新序列号记录
$one = Db::name('arctype')->where(['id'=>$item['aid']])->find();
$data = [
'is_del' => $one['is_del'],
'status' => $one['status'],
];
$res = Db::name('seo_number')->where(['id'=>$item['id']])->update($data);
echo '文档ID: '.$item['id'].'-类型:'.$item['type'].'-'.$res.'
';
}
}
/*
* https://www.zc10000.com/api/other/rtArticleIsdelProSon
*/
public function rtArticleIsdelProSon(){
//针对 文章 论文 文档
$list = Db::name('seo_number')
->where('type','=',1)
->where('tid','<>',38)
->where(['is_del'=>0])
->select();
foreach ($list as $key=>$item){
//查询对应的有没有被删除 更新序列号记录
$one = Db::name('arctype_cat')->where(['id'=>$item['aid']])->find();
$data = [
'is_del' => $one['is_del'],
'status' => $one['status'],
];
$res = Db::name('seo_number')->where(['id'=>$item['id']])->update($data);
echo '文档ID: '.$item['id'].'-类型:'.$item['type'].'-'.$res.'
';
}
}
/*
* 删除没有内容的文章
* https://www.zc10000.com/api/other/delArticle
*/
public function delArticle(){
//文章 论文 文档等
$list = Db::name('archives')->where('typeid','in',[115,126,825,826,126,127,111,117,118,120,122,131,132,133,306])->where(['is_del'=>0])->select();
foreach ($list as $key=>$item){
//查询对应的有没有被删除 更新序列号记录
$one = Db::name('zczygz_content')->where(['aid'=>$item['aid']])->find();
if(empty($one['content_5'])){
//删除文章
Db::name('archives')->where(['aid'=>$item['aid']])->update(['is_del'=>1]);
//序列号
$res = Db::name('seo_number')
->where('type','in',[2,4,5])
->where(['aid'=>$item['aid']])->update(['is_del'=>1]);
echo '文档ID: '.$item['aid'].'-'.$res.'
';
}
}
}
/*
* 生成地图文件后 再次按域名 生成新的文件
* https://www.zc10000.com/api/other/urlMapHandle?type=xml
*/
public function urlMapHandle(){
/*
* all_url 表 已经 更新地图文件的时候 写入链接状态
*/
//读取数据库
$list = Db::name('all_url')->where('is_del','=',0)->order('group_id asc')->select();
$file = [];
foreach ($list as $key=>$item){
$url = explode('.',$item['url']);
$domain = str_replace('https://','',$url[0]);
$file[$domain][] = $item['url'];
}
//dump($file);
$type = request()->get('type','xml');
foreach ($file as $index => $row){
//创建文件
$this->jk($row,$index,$type);
}
}
public function jk($list,$name,$type){
switch ($type) {
case 'xml':
header('Content-type: text/xml');
$xmlWriter = new \XMLWriter();
$xmlWriter->openMemory();
$xmlWriter->startDocument('1.0', 'UTF-8');
$xmlWriter->startElement('urlset');
$xmlWriter->writeAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
$xmlWriter->writeAttribute('xmlns:mobile', 'http://www.google.com/schemas/sitemap-mobile/1.0');
break;
case 'txt':
$txt = '';
break;
case 'html':
$html = '
职称网_网站地图
分类
';
break;
default:
// 如果没有匹配的值
}
//写入文件
switch ($type) {
case 'xml':
foreach ($list as $k=>$value){
$xmlWriter = $this->buildXml($xmlWriter,$value,date('Y-m-d',time()));
}
break;
case 'txt':
foreach ($list as $k=>$value){
$txt .= $value."\r\n";
}
break;
case 'html':
foreach ($list as $k=>$value){
//$html .= '- '.$html_a[$k].'
';
}
$html .= "
";
break;
default:
// 如果没有匹配的值
}
//创建目录
$dir = './sitemaps/'.$name;
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
//创建文件
switch ($type) {
case 'xml':
// ... 添加其他页面的URL
$xmlWriter->endElement();
$xmlWriter->endDocument();
//var_dump($xmlWriter->outputMemory(true));
file_put_contents($dir.'/sitemap.xml', $xmlWriter->outputMemory(true));
break;
case 'txt':
file_put_contents($dir.'/sitemap.txt',$txt);
break;
case 'html':
$html .= '
';
file_put_contents($dir.'/sitemap.html',$html);
break;
default:
// 如果没有匹配的值
}
}
/*
* https://www.zc10000.com/api/other/iop
*/
public function iop()
{
$list = Db::name('zczygz_content')
//->where(['typeid'=>1232])
->select();
foreach ($list as $key=>$item){
if(!empty($item['down'])){
$file = explode('.',$item['down']);
$ext = end($file);
Db::name('archives')
->where(['aid'=>$item['aid']])
->update(['ext'=>$ext]);
}
}
}
}