|
@@ -14,12 +14,7 @@
|
14
|
14
|
// +----------------------------------------------------------------------
|
15
|
15
|
namespace app\api\controller;
|
16
|
16
|
|
17
|
|
-use app\common\controller\Api;
|
18
|
|
-use app\common\library\Ems as Emslib;
|
19
|
17
|
use app\member\controller\MemberApi;
|
20
|
|
-use app\member\model\Member;
|
21
|
|
-use think\facade\Hook;
|
22
|
|
-use think\facade\Validate;
|
23
|
18
|
use think\Db;
|
24
|
19
|
|
25
|
20
|
/**
|
|
@@ -30,7 +25,7 @@ use think\Db;
|
30
|
25
|
class Cms extends MemberApi
|
31
|
26
|
{
|
32
|
27
|
|
33
|
|
- protected $noNeedLogin = ['login', 'register','getProduct','getProductSmall','createTask','tagHandle','taskHandle','getAreaJson'];
|
|
28
|
+ protected $noNeedLogin = ['login', 'register','getProduct','getProductSmall','createTask','tagHandle','taskHandle','getAreaJson','getTagListHandle'];
|
34
|
29
|
protected $noNeedRight = [];
|
35
|
30
|
|
36
|
31
|
//初始化
|
|
@@ -345,6 +340,11 @@ class Cms extends MemberApi
|
345
|
340
|
->order('add_time asc')->paginate(1);
|
346
|
341
|
$list = $list->toArray();
|
347
|
342
|
$data = $list['data'];
|
|
343
|
+
|
|
344
|
+ if(empty($data)){
|
|
345
|
+ $this->error('fail',['ko'=>'不存在数据']);
|
|
346
|
+ }
|
|
347
|
+
|
348
|
348
|
foreach ($data as $index => $row) {
|
349
|
349
|
|
350
|
350
|
//获取标签
|
|
@@ -385,7 +385,7 @@ class Cms extends MemberApi
|
385
|
385
|
'run_time' => time(),
|
386
|
386
|
'status' => 1,
|
387
|
387
|
]);
|
388
|
|
- $this->error('fail');
|
|
388
|
+ $this->error('fail',['is_run'=>4]);
|
389
|
389
|
}
|
390
|
390
|
|
391
|
391
|
//是否只有一个页面 (远程)
|
|
@@ -408,7 +408,7 @@ class Cms extends MemberApi
|
408
|
408
|
'run_time' => time(),
|
409
|
409
|
'status' => 1,
|
410
|
410
|
]);
|
411
|
|
- $this->error('fail');
|
|
411
|
+ $this->error('fail',['is_run'=>3]);
|
412
|
412
|
}
|
413
|
413
|
|
414
|
414
|
//创建标签
|
|
@@ -519,6 +519,9 @@ class Cms extends MemberApi
|
519
|
519
|
$data = $list['data'];
|
520
|
520
|
//dump($data);die;
|
521
|
521
|
|
|
522
|
+ if(empty($data)){
|
|
523
|
+ $this->error('fail',['ko'=>'不存在数据']);
|
|
524
|
+ }
|
522
|
525
|
/*
|
523
|
526
|
* 跨库 无法保证远程和本地的事务一致性
|
524
|
527
|
* 这种机制 类似 支付
|
|
@@ -786,7 +789,7 @@ class Cms extends MemberApi
|
786
|
789
|
$one = Db::connect('db1')->table('ey_seo_number')->where([
|
787
|
790
|
'type' => 1,
|
788
|
791
|
'aid' => $row['aid'],
|
789
|
|
- ])->where('parentid','!=',38)->find();
|
|
792
|
+ ])->where('parentid','<>',38)->find();
|
790
|
793
|
$number = Db::connect('db1')->table('ey_seo_number')->where([
|
791
|
794
|
'type' => 1,
|
792
|
795
|
'aid' => $one['parentid'],
|
|
@@ -860,5 +863,48 @@ class Cms extends MemberApi
|
860
|
863
|
|
861
|
864
|
}
|
862
|
865
|
|
|
866
|
+ /*
|
|
867
|
+ * 批量执行标签处理
|
|
868
|
+ * 加入队列 http://console.zx2049.com/api/cms/getTagListHandle
|
|
869
|
+ * 启动队列 php think queue:listen --queue tagHandle
|
|
870
|
+ * 监听队列 进程守护管理器 (附加参数参考: https://www.kancloud.cn/ken678/yzncms/2383907)
|
|
871
|
+ * redis查看数据器 默认重置次数1
|
|
872
|
+ * workman实时推送消息
|
|
873
|
+ * 添加自定义命令的方式来执行队列
|
|
874
|
+ */
|
|
875
|
+ public function getTagListHandle()
|
|
876
|
+ {
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+/* $a = new \app\api\queue\jobs\TagHandle();
|
|
880
|
+ var_dump($a);
|
|
881
|
+ return json([]);*/
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+ $area = Db::connect('db1')
|
|
886
|
+ ->table('ey_citysite')
|
|
887
|
+ ->where(['level'=>1,'is_open'=>1,'status'=>1])
|
|
888
|
+ ->select();
|
|
889
|
+ //dump($area);
|
|
890
|
+ $area[] = [
|
|
891
|
+ 'id' => 10000,
|
|
892
|
+ 'name' => '主站',
|
|
893
|
+ ];
|
|
894
|
+
|
|
895
|
+ foreach ($area as $k=>$v){
|
|
896
|
+ //http://console.zx2049.com/api/cms/tagHandle?taskid=10&diqu=1
|
|
897
|
+ $jobData = ['ts' => time(),'url'=>'http://console.zx2049.com/api/cms/tagHandle','taskid'=>10, 'area_id' => $v['id'], 'area_name' => $v['name']];//当前任务所需的业务数据
|
|
898
|
+ $isPushed = \think\Queue::push('app\common\jobs\TagHandle', $jobData,'tagHandle');//没有@使用默认方法fire,此方法为立即执行
|
|
899
|
+ if ($isPushed !== false) {
|
|
900
|
+ echo "ok";
|
|
901
|
+ } else {
|
|
902
|
+ echo 'warn';
|
|
903
|
+ }
|
|
904
|
+ echo "<br/>";
|
|
905
|
+ }
|
|
906
|
+
|
|
907
|
+ }
|
|
908
|
+
|
863
|
909
|
|
864
|
910
|
}
|