控制台应用,yzncms本身基于tp5.1框架,里面的队列用不了,bug,坑
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Cms.php 27KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Yzncms [ 御宅男工作室 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2018 http://yzncms.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | fastadmin: https://www.fastadmin.net/
  10. // +----------------------------------------------------------------------
  11. // +----------------------------------------------------------------------
  12. // | 邮箱验证码接口
  13. // +----------------------------------------------------------------------
  14. namespace app\api\controller;
  15. use app\common\controller\Api;
  16. use app\common\library\Ems as Emslib;
  17. use app\member\controller\MemberApi;
  18. use app\member\model\Member;
  19. use think\facade\Hook;
  20. use think\facade\Validate;
  21. use think\Db;
  22. /**
  23. * @title 邮箱验证码接口
  24. * @controller api\controller\Ems
  25. * @group base
  26. */
  27. class Cms extends MemberApi
  28. {
  29. protected $noNeedLogin = ['login', 'register','getProduct','getProductSmall','createTask','tagHandle','taskHandle'];
  30. protected $noNeedRight = [];
  31. //初始化
  32. protected function initialize()
  33. {
  34. parent::initialize();
  35. }
  36. /**
  37. * @title 发送验证码
  38. * @desc 最基础的接口注释写法
  39. * @author 御宅男
  40. * @url /api/Ems/send
  41. * @method GET
  42. * @tag 邮箱 验证码
  43. * @param name:email type:string require:1 desc:邮箱
  44. * @param name:event type:string require:1 desc:事件名称
  45. * @return name:data type:array ref:definitions\dictionary
  46. */
  47. public function send()
  48. {
  49. }
  50. /**
  51. * @title 检测验证码
  52. * @desc 最基础的接口注释写法
  53. * @author 御宅男
  54. * @url /api/Ems/check
  55. * @method GET
  56. * @tag 邮箱 验证码
  57. * @param name:email type:string require:1 desc:邮箱
  58. * @param name:event type:string require:1 desc:事件名称
  59. * @param name:captcha type:string require:1 desc:验证码
  60. * @return name:data type:array ref:definitions\dictionary
  61. */
  62. public function check()
  63. {
  64. }
  65. /*
  66. *
  67. * 同步产品接口 - 大类
  68. * 每天同步一次
  69. * 防止产品未发布级别就同步过来 执行了
  70. * http://console.zx2049.com/api/cms/getProduct
  71. */
  72. public function getProduct()
  73. {
  74. //查找区域
  75. $area = Db::connect('db1')
  76. ->table('ey_citysite')
  77. ->where(['level'=>1,'is_open'=>1,'status'=>1])
  78. ->select();
  79. //dump($area);
  80. $area[] = [
  81. 'id' => 10000,
  82. ];
  83. foreach ($area as $index => $item) {
  84. //查找最后创建时间create_time
  85. $add_time = Db::name('cms_product')
  86. ->where(['catid'=>2,'diqu'=>$item['id']]) //产品大类
  87. ->order('add_time desc')
  88. ->value('add_time');
  89. //dump($create_time);
  90. if(empty($add_time)){
  91. $add_time = 0;
  92. }
  93. //不考虑分批次
  94. $list = Db::connect('db1')
  95. ->table('ey_arctype')
  96. ->where(['topid'=>38,'area_id'=>$item['id'],'is_del'=>0])
  97. ->where('add_time','>',$add_time)
  98. ->select();
  99. //dump($list);
  100. foreach ($list as $key=>$row){
  101. $one = Db::name('cms_product')->where([
  102. 'catid' => 2,
  103. 'aid' => $row['id'],
  104. 'diqu' => $item['id'],
  105. 'pid' => 0,
  106. ])->find();
  107. if(empty($one)){
  108. //插入数据库
  109. $insert_data = [
  110. 'catid' => 2,
  111. 'title' => $row['typename'],
  112. 'add_time' => $row['add_time'],
  113. 'create_time' => time(),
  114. 'update_time' => time(),
  115. 'status' => 1,
  116. 'diqu' => $item['id'],
  117. 'pid' => 0,
  118. 'aid' => $row['id'],
  119. 'site_id' => 1,
  120. 'link' => ''
  121. ];
  122. $run = Db::name('cms_product')->insert($insert_data);
  123. echo '插入'.$run.'条,产品id: '.$row['id'].'<br/>';
  124. }else{
  125. echo '插入0条,产品id: '.$row['id'].'已存在<br/>';
  126. }
  127. }
  128. }
  129. }
  130. /*
  131. * 同步产品接口 - 小类
  132. * http://console.zx2049.com/api/cms/getProductSmall
  133. */
  134. public function getProductSmall()
  135. {
  136. //查找最后创建时间create_time
  137. $add_time = Db::name('cms_product')
  138. ->where(['catid'=>3]) //产品小类
  139. ->order('add_time desc')
  140. ->value('add_time');
  141. //dump($create_time);
  142. if(empty($add_time)){
  143. $add_time = 0;
  144. }
  145. //不考虑分批次
  146. $list = Db::connect('db1')
  147. ->table('ey_arctype_cat')
  148. ->where(['is_del'=>0])
  149. ->where('add_time','>',$add_time)
  150. ->select();
  151. //dump($list);
  152. foreach ($list as $key=>$row){
  153. //查找上级所属区域id
  154. $area_id = Db::connect('db1')->table('ey_arctype')->where(['id'=>$row['parent_id']])->value('area_id');
  155. if(empty($area_id)){
  156. $area_id = 0;
  157. }
  158. $one = Db::name('cms_product')->where([
  159. 'catid' => 3,
  160. 'aid' => $row['id'],
  161. 'diqu' => $area_id,
  162. 'pid' => 0,
  163. ])->find();
  164. if(empty($one)){
  165. //插入数据库
  166. $insert_data = [
  167. 'catid' => 3,
  168. 'title' => $row['typename'],
  169. 'add_time' => $row['add_time'],
  170. 'create_time' => time(),
  171. 'update_time' => time(),
  172. 'status' => 1,
  173. 'diqu' => $area_id,
  174. 'pid' => $row['parent_id'],
  175. 'aid' => $row['id'],
  176. 'site_id' => 1,
  177. 'link' => ''
  178. ];
  179. $run = Db::name('cms_product')->insert($insert_data);
  180. echo '插入'.$run.'条,产品id: '.$row['id'].'<br/>';
  181. }else{
  182. echo '插入0条,产品id: '.$row['id'].'已存在<br/>';
  183. }
  184. }
  185. }
  186. /*
  187. * 同步删除操作
  188. * 增加字段 is_del 和 delete_time
  189. * 同步删除时间和是否删除
  190. * 目前先在发文的时候判断是否已删除就行
  191. */
  192. public function delHandle()
  193. {
  194. }
  195. /*
  196. * 存在小类就不创建发文任务,因为只有概述
  197. * 小类肯定都发文
  198. * 一个产品发一篇 不按级别 级别作为轮询为发文内容
  199. * 标签为 产品名+申报 (这个固定不变) 另 产品名与标签名 发生修改 不做统一校验
  200. * 同时判断产品是否正常(非删除状态)
  201. * 每一轮为一个定时任务 因为产品是不断增加的 同时任务也是不断增加的
  202. * 每一轮的任务分组不一样 会持续不断发文 对应发文模板也不一样
  203. * 参数 任务分组id
  204. * http://console.zx2049.com/api/cms/createTask?taskid=10
  205. */
  206. public function createTask()
  207. {
  208. $taskid = $this->request->get('taskid',0);
  209. if((int)$taskid === 0){
  210. $this->error('fail');
  211. }
  212. //查询
  213. $add_time = Db::table('yzn_task')
  214. ->where(['catid'=>$taskid])
  215. ->order('add_time desc')
  216. ->value('add_time');
  217. if(empty($add_time)){
  218. $add_time = 0;
  219. }
  220. //不做分批次处理
  221. //新赠的产品 大类
  222. $list = Db::table('yzn_cms_product')
  223. ->where(['status'=>1]) //,'catid'=>2 不管是大类还是小类
  224. ->where('add_time','>',$add_time)
  225. ->select();
  226. foreach ($list as $key=>$row){
  227. $one = Db::name('task')->where([
  228. 'catid' => $taskid,
  229. 'aid' => $row['aid'],
  230. 'diqu' => $row['diqu'],
  231. 'yid' => $row['catid'],
  232. 'cid' => 111,
  233. ])->find();
  234. if(empty($one)){
  235. //插入数据库
  236. $insert_data = [
  237. 'catid' => $taskid, //任务分组id
  238. 'title' => $row['title'],
  239. 'add_time' => $row['add_time'],
  240. 'create_time' => time(),
  241. 'update_time' => time(),
  242. 'status' => 0, //初始状态为0 未执行
  243. 'diqu' => $row['diqu'],
  244. 'yid' => $row['catid'], //产品大类还是小类
  245. 'aid' => $row['aid'], //产品id
  246. 'site_id' => 1,
  247. 'link' => '', //文章链接
  248. 'tagid' => 0, //标签id 初始为0
  249. 'cid' => 111, //常见问题
  250. 'run_time' => time(),
  251. 'is_run' => 0
  252. ];
  253. $run = Db::name('task')->insert($insert_data);
  254. echo '插入'.$run.'条,产品id: '.$row['aid'].'-'.$row['title'].'<br/>';
  255. }else{
  256. echo '插入0条,产品id: '.$row['aid'].'-'.$row['title'].'已存在<br/>';
  257. }
  258. }
  259. }
  260. /*
  261. * http://console.zx2049.com/api/cms/tagHandle?taskid=10
  262. */
  263. public function tagHandle()
  264. {
  265. $taskid = $this->request->get('taskid',0);
  266. if((int)$taskid === 0){
  267. $this->error('fail');
  268. }
  269. $page = 1;
  270. $list = Db::name('task')->where([
  271. 'catid' => $taskid, //任务分组id
  272. 'tagid' => 0,
  273. 'status' => 0,
  274. ])
  275. ->order('add_time asc')->paginate(1);
  276. $list = $list->toArray();
  277. $data = $list['data'];
  278. foreach ($data as $index => $row) {
  279. //获取标签
  280. $tagname = $this->getName($row['title']);
  281. $tagname = $tagname.'申报';
  282. if((int)$row['diqu'] === 10000){
  283. $diqu = 0; //山东地区变为主页 区域为0
  284. }else{
  285. $diqu = $row['diqu'];
  286. }
  287. $one = Db::connect('db1')->table('ey_archives')
  288. ->where(['typeid' => 523,'province_id'=>$diqu,'is_del'=>0])
  289. ->where('title',$tagname)
  290. ->find();
  291. if(empty($one)){
  292. //不存在
  293. //判断是否需要增加标签
  294. //远程判断产品状态
  295. if((int)$row['yid'] === 2) {
  296. //大类
  297. $one = Db::connect('db1')->table('ey_arctype')->where(['id' => $row['aid']])->find();
  298. }else if((int)$row['yid'] === 3) {
  299. //小类
  300. $one = Db::connect('db1')->table('ey_arctype_cat')->where(['id' => $row['aid']])->find();
  301. }else{
  302. //任务异常 退出
  303. $this->error('fail');
  304. }
  305. if((int)$one['is_del'] === 1 || (int)$one['status'] === 0){
  306. //已删除
  307. Db::name('task')->where(['id'=>$row['id']])->update([
  308. 'is_run' => 4, //执行异常
  309. 'run_time' => time(),
  310. 'status' => 1,
  311. ]);
  312. $this->error('fail');
  313. }
  314. //是否只有一个页面 (远程)
  315. if((int)$row['yid'] === 2) {
  316. //大类
  317. $count = Db::connect('db1')->table('ey_archives')->where(['typeid' => $row['aid'],'product_id'=>0,'is_del'=>0])->count();
  318. }else if((int)$row['yid'] === 3) {
  319. //小类
  320. $count = Db::connect('db1')->table('ey_archives')->where(['product_id' => $row['aid'],'is_del'=>0])->count();
  321. }else{
  322. //任务异常 退出
  323. $this->error('fail');
  324. }
  325. //dump($count);
  326. if($count <= 1) {
  327. //只有一个主页 概述
  328. Db::name('task')->where(['id' => $row['id']])->update([
  329. 'is_run' => 3, //执行忽略
  330. 'run_time' => time(),
  331. 'status' => 1,
  332. ]);
  333. $this->error('fail');
  334. }
  335. //创建标签
  336. $insert_data = [
  337. 'typeid' => 523,
  338. 'status' => 1,
  339. 'is_del' => 0,
  340. 'channel' => 101,
  341. 'click' => rand(500,5000),
  342. 'arcrank' => 0,
  343. 'add_time' => time(),
  344. 'update_time' => time(),
  345. 'province_id' => (int)$diqu,
  346. 'product_tag_id' => 0, //由其他任务处理
  347. 'title' => $tagname,
  348. ];
  349. //执行插入
  350. $aid = Db::connect('db1')->table('ey_archives')->insertGetId($insert_data);
  351. if((int)$aid > 0) {
  352. //增加详情
  353. $insert_data_content = [
  354. 'aid' => $aid,
  355. 'add_time' => time(),
  356. 'update_time' => time()
  357. ];
  358. Db::connect('db1')->table('ey_suipian_content')->insert($insert_data_content);
  359. }
  360. //更新任务 标签id
  361. Db::name('task')->where(['id' => $row['id']])->update([
  362. 'tagid' => $aid,
  363. ]);
  364. $this->success('成功');
  365. }else{
  366. //写入标签id 到 任务记录
  367. Db::name('task')->where(['id' => $row['id']])->update([
  368. 'tagid' => $one['aid'],
  369. ]);
  370. $this->success('成功');
  371. }
  372. }
  373. }
  374. /*
  375. * 执行
  376. * 增加字段 is_run 未执行0 执行成功1 执行失败2(远程响应错误) 执行忽略3(存在小类或无级别-只有一个主页) 产品异常4(删除或未审核或屏蔽)
  377. * run_time 执行时间
  378. * is_run = 0 每次处理10条
  379. * http://console.zx2049.com/api/cms/taskHandle?taskid=10
  380. */
  381. public function taskHandle()
  382. {
  383. $taskid = $this->request->get('taskid',0);
  384. if((int)$taskid === 0){
  385. $this->error('fail');
  386. }
  387. //查询未执行的任务
  388. $page = 1;
  389. $list = Db::name('task')->where([
  390. 'catid' => $taskid, //任务分组id
  391. 'is_run' => 0,
  392. 'status' => 0,
  393. ])
  394. ->where('tagid','>',0) //标签id需要已经获取到的
  395. ->order('add_time asc')->paginate(1);
  396. $list = $list->toArray();
  397. $data = $list['data'];
  398. //dump($data);die;
  399. /*
  400. * 跨库 无法保证远程和本地的事务一致性
  401. * 这种机制 类似 支付
  402. * 先简单处理
  403. */
  404. foreach ($data as $index => $row) {
  405. //远程判断产品状态
  406. /*if((int)$row['yid'] === 2) {
  407. //大类
  408. $one = Db::connect('db1')->table('ey_arctype')->where(['id' => $row['aid']])->find();
  409. }else if((int)$row['yid'] === 3) {
  410. //小类
  411. $one = Db::connect('db1')->table('ey_arctype_cat')->where(['id' => $row['aid']])->find();
  412. }else{
  413. //任务异常 退出
  414. return false;
  415. }
  416. if((int)$one['is_del'] === 1 || (int)$one['status'] === 0){
  417. //已删除
  418. Db::name('task')->where(['id'=>$row['id']])->update([
  419. 'is_run' => 4, //执行异常
  420. 'run_time' => time(),
  421. 'status' => 1,
  422. ]);
  423. return false;
  424. }*/
  425. /*
  426. *
  427. *
  428. //不管有没有小类 只有一个主页 就执行忽略
  429. if((int)$row['yid'] === 2) {
  430. //该任务记录 为 大类 产品
  431. //是否存在小类(控制台产品不保证是最新数据 采用远程判断)
  432. Db::connect('db1')->table('ey_arctype_cat')->where(['parent_id' => $row['aid']])->find();
  433. }*/
  434. //是否只有一个页面 (远程)
  435. /*if((int)$row['yid'] === 2) {
  436. //大类
  437. $count = Db::connect('db1')->table('ey_archives')->where(['typeid' => $row['aid'],'product_id'=>0,'is_del'=>0])->count();
  438. }else if((int)$row['yid'] === 3) {
  439. //小类
  440. $count = Db::connect('db1')->table('ey_archives')->where(['product_id' => $row['aid'],'is_del'=>0])->count();
  441. }else{
  442. //任务异常 退出
  443. return false;
  444. }
  445. //dump($count);
  446. if($count <= 1) {
  447. //只有一个主页 概述
  448. Db::name('task')->where(['id' => $row['id']])->update([
  449. 'is_run' => 3, //执行忽略
  450. 'run_time' => time(),
  451. 'status' => 1,
  452. ]);
  453. return false;
  454. }*/
  455. //构建参数
  456. if((int)$row['diqu'] === 10000){
  457. $diqu = 0; //山东地区变为主页 区域为0
  458. }else{
  459. $diqu = $row['diqu'];
  460. }
  461. $insert_data = [
  462. 'typeid' => 111,
  463. 'status' => 1,
  464. 'is_del' => 0,
  465. 'channel' => 103,
  466. 'click' => rand(500,5000),
  467. 'arcrank' => 0,
  468. 'add_time' => time(),
  469. 'update_time' => time(),
  470. 'province_id' => (int)$diqu,
  471. 'product_tag_id' => $row['tagid'], //由其他任务处理
  472. 'title' => $this->getTitle($row,$diqu),
  473. 'seo_title' => $this->getSeoTitle($row,$diqu),
  474. 'seo_keywords' => $this->getKeywords($row,$diqu),
  475. 'seo_description' => $this->getDesc($row,$diqu),
  476. ];
  477. //执行插入
  478. $aid = Db::connect('db1')->table('ey_archives')->insertGetId($insert_data);
  479. //$aid=1;
  480. //dump($insert_data);die;
  481. if((int)$aid > 0) {
  482. //增加详情
  483. $content = $this->getContent($row,$diqu);
  484. //echo htmlspecialchars_decode($content);die;
  485. $insert_data_content = [
  486. 'aid' => $aid,
  487. 'add_time' => time(),
  488. 'update_time' => time(),
  489. 'content_5' => $content
  490. ];
  491. Db::connect('db1')->table('ey_zczygz_content')->insert($insert_data_content);
  492. //增加序列号
  493. $where6 = [
  494. "type" => 2,
  495. "tid" => 111,
  496. 'topid' => 0,
  497. 'parentid' => 0,
  498. 'area_id' => (int)$diqu, //如果是0的话 后续也不能改
  499. 'city_id' => 0, //如果是0的话 后续也不能改
  500. ];
  501. $last = Db::connect('db1')->name('seo_number')
  502. ->where($where6)->order('number desc')->find();
  503. if (empty($last['number'])) {
  504. $num = 1;
  505. } else {
  506. $num = (int)$last['number'] + 1;
  507. }
  508. $insert_data_seo = [
  509. "type" => 2, //产品类型
  510. "aid" => $aid, //实际的ID
  511. "tid" => 111, //属于哪个栏目的
  512. 'is_del' => 0,
  513. 'is_kan' => 0, // 0正常 1审核
  514. 'status' => 1,
  515. 'area_id' => (int)$diqu,
  516. 'city_id' => 0,
  517. 'topid' => 0,
  518. 'parentid' => 0,
  519. 'number' => $num
  520. ];
  521. Db::connect('db1')->table('ey_seo_number')->insert($insert_data_seo);
  522. //更新状态
  523. if ((int)$diqu === 0) {
  524. $link = 'https://www.gdzcfw.com/wthz' . $num;
  525. } else {
  526. $domain = Db::connect('db1')->name('citysite')->where('id', '=', $diqu)->value('domain');
  527. $link = 'https://' . $domain . '.gdzcfw.com/wthz' . $num;
  528. }
  529. Db::name('task')->where(['id' => $row['id']])->update([
  530. 'is_run' => 1, //执行成功
  531. 'run_time' => time(),
  532. 'status' => 1,
  533. 'link' => $link,
  534. ]);
  535. $this->success('成功');
  536. }
  537. }
  538. }
  539. /*
  540. * 产品名称处理
  541. */
  542. public function getName($str){
  543. $str = str_replace('职称', "", $str);
  544. $str = $str.'职称';
  545. return $str;
  546. }
  547. /*
  548. * 模板1
  549. */
  550. public function getTitle($row,$diqu)
  551. {
  552. $area_name = '';
  553. if((int)$diqu > 0){
  554. $area_name = Db::connect('db1')->name('citysite')->where('id', '=', $diqu)->value('name');
  555. }
  556. $title = $this->getName($row['title']);
  557. $str = $area_name.$title.'评定【2024年最新学历要求】';
  558. return $str;
  559. }
  560. public function getSeoTitle($row,$diqu)
  561. {
  562. $area_name = '';
  563. if((int)$diqu > 0){
  564. $area_name = Db::connect('db1')->name('citysite')->where('id', '=', $diqu)->value('name');
  565. }
  566. $title = $this->getName($row['title']);
  567. $str = $area_name.$title.'评定【2024年最新要求解读】';
  568. return $str;
  569. }
  570. public function getKeywords($row,$diqu){
  571. $area_name = '';
  572. if((int)$diqu > 0){
  573. $area_name = Db::connect('db1')->name('citysite')->where('id', '=', $diqu)->value('name');
  574. }
  575. $title = $this->getName($row['title']);
  576. $str = $area_name.$title.'评定';
  577. return $str;
  578. }
  579. public function getDesc($row,$diqu){
  580. $area_name = '';
  581. if((int)$diqu > 0){
  582. $area_name = Db::connect('db1')->name('citysite')->where('id', '=', $diqu)->value('name');
  583. }
  584. $title = $this->getName($row['title']);
  585. $str = $area_name.$title.'评定上【职称网】工程师职称破格评审绿色通道,专注工程师职称评审,专注工程师职称评审,提供职称材料撰写、职称申报、职称论文专利一站式服务。';
  586. return $str;
  587. }
  588. /*
  589. * 模板1
  590. */
  591. public function getContent($row,$diqu)
  592. {
  593. $area_name = '';
  594. $domain = 'www';
  595. if((int)$diqu > 0){
  596. $area = Db::connect('db1')->name('citysite')->where('id', '=', $diqu)->find();
  597. $area_name = $area['name'];
  598. $domain = $area['domain'];
  599. }
  600. $title = $this->getTitle($row,$diqu);
  601. //图片地址
  602. $op = rand(1,9);
  603. $imgurl = 'https://oss.gdzcfw.com/static/article/'.$op.'.png';
  604. $html = '';
  605. $html .= '<p style="text-align: center;">
  606. <img src="'.$imgurl.'" style="max-width:100%;" /><br/>
  607. <span>'.$title.'</span>
  608. </p>';
  609. //调用其他级别的学历要求
  610. if((int)$row['yid'] === 2) {
  611. //大类
  612. $aids = Db::connect('db1')->table('ey_archives')->field('aid,title')->where(['typeid' => $row['aid'],'product_id'=>0,'is_del'=>0])->select();
  613. }else if((int)$row['yid'] === 3) {
  614. //小类
  615. $aids = Db::connect('db1')->table('ey_archives')->field('aid,title')->where(['product_id' => $row['aid'],'is_del'=>0])->order('level asc')->select();
  616. }
  617. $h = ['一)','二)','三)','四)','五)','六)','七)','八)','九)','十)','十一)'];
  618. foreach ($aids as $k=>$v){
  619. $data = Db::connect('db1')->table('ey_zczygz_content')
  620. ->field('aid,content_6')->where('aid','=',$v['aid'])->find();
  621. if(!empty($data['content_6'])){
  622. $pro_title = $this->getName($row['title']);
  623. $html .= '<p style="text-align: left;font-weight: bold;">
  624. '.$h[$k].$area_name.$pro_title.'评定'.$v['title'].'学历要求:</p>';
  625. $html .= '<p style="text-align: left;">
  626. '.$data['content_6'].'</p>';
  627. }
  628. }
  629. //拼装产品
  630. if((int)$row['yid'] === 2) {
  631. //大类
  632. $number = Db::connect('db1')->table('ey_seo_number')->where([
  633. 'type' => 1,
  634. 'aid' => $row['aid'],
  635. 'parentid' => 38
  636. ])->value('number');
  637. $link = 'https://'.$domain.'.gdzcfw.com/id'.$number;
  638. }else if((int)$row['yid'] === 3) {
  639. //小类
  640. $one = Db::connect('db1')->table('ey_seo_number')->where([
  641. 'type' => 1,
  642. 'aid' => $row['aid'],
  643. ])->where('parentid','!=',38)->find();
  644. $number = Db::connect('db1')->table('ey_seo_number')->where([
  645. 'type' => 1,
  646. 'aid' => $one['parentid'],
  647. 'parentid' => 38
  648. ])->value('number');
  649. $link = 'https://'.$domain.'.gdzcfw.com/id'.$number.'/sid'.$one['number'];
  650. }
  651. $html .= '<p style="text-align: left;">
  652. 最新'.$area_name.$pro_title.'评定政策详情请点击:<a href="'.$link.'" targey="_blank">'.$area_name.$pro_title.'评审</a></p>';
  653. //其他链接
  654. $html .= '<p style="text-align: left;">
  655. <a href="https://'.$domain.'.gdzcfw.com">职称网</a>更多<a href="https://'.$domain.'.gdzcfw.com">职称评审</a>相关请点击:<br/>
  656. '.$area_name.'职称政策文件下载: <a href="https://'.$domain.'.gdzcfw.com/zccl">https://'.$domain.'.gdzcfw.com/zccl</a><br/>
  657. 职称答辩相关指引请点击: <a href="https://www.gdzcfw.com/zcdb">https://www.gdzcfw.com/zcdb</a><br/>
  658. 职称评审绿色破格通道: <a href="https://zczl.gdzcfw.com">https://zczl.gdzcfw.com</a><br/></p>';
  659. return $html;
  660. }
  661. /*
  662. * 执行忽略 重新校验
  663. * 产品后面增加了级别 一开始没有级别 也没有小类
  664. * 产品后面增加了级别 一开始没有级别 有小类
  665. * 产品后面增加了小类 一开始没有级别 也没有小类
  666. * 产品后面增加了小类 一开始有级别 没有小类
  667. *
  668. * 不管有没有小类 是大类还是小类 只要没有级别 就不发文 就对了
  669. * 就算有小类 有级别 就发文
  670. * 正常情况 不会存在既有级别又有小类
  671. * 这里把执行忽略的 校验后 改为未执行
  672. */
  673. /*
  674. * 校验产品如果正常了 任务改为未执行
  675. */
  676. }