|
@@ -5,6 +5,8 @@ namespace App\Http\Logic\Bside\Setting; |
|
@@ -5,6 +5,8 @@ namespace App\Http\Logic\Bside\Setting; |
|
5
|
use App\Helper\Common as CommonHelper;
|
5
|
use App\Helper\Common as CommonHelper;
|
|
6
|
use App\Http\Logic\Bside\BaseLogic;
|
6
|
use App\Http\Logic\Bside\BaseLogic;
|
|
7
|
use App\Models\Com\UpdateNotify;
|
7
|
use App\Models\Com\UpdateNotify;
|
|
|
|
8
|
+use App\Models\Com\UpdateProgress;
|
|
|
|
9
|
+use App\Models\RouteMap\RouteMap;
|
|
8
|
use App\Models\WebSetting\WebSetting;
|
10
|
use App\Models\WebSetting\WebSetting;
|
|
9
|
|
11
|
|
|
10
|
class WebSettingLogic extends BaseLogic
|
12
|
class WebSettingLogic extends BaseLogic
|
|
@@ -62,24 +64,59 @@ class WebSettingLogic extends BaseLogic |
|
@@ -62,24 +64,59 @@ class WebSettingLogic extends BaseLogic |
|
62
|
* @param string $type
|
64
|
* @param string $type
|
|
63
|
* @return array
|
65
|
* @return array
|
|
64
|
*/
|
66
|
*/
|
|
65
|
- public function sendNotifyMessage($type = ''){
|
|
|
|
66
|
- //获取当前项目所有未处理的更新并更换为1:处理中 2:处理完成
|
67
|
+ public function sendNotifyMessage($type,$page){
|
|
|
|
68
|
+ $updateProgressModel = new UpdateProgress();
|
|
|
|
69
|
+ $progressInfo = $updateProgressModel->formatQuery(['project_id'=>$this->user['project_id'],'type'=>$type])->orderBy('id','desc')->first()->toArray();
|
|
|
|
70
|
+ if((!empty($progressInfo)) && ($progressInfo['total_num'] > $progressInfo['current_num'])){
|
|
|
|
71
|
+ return $this->success($progressInfo);
|
|
|
|
72
|
+ }
|
|
67
|
$updateNotifyModel = new UpdateNotify();
|
73
|
$updateNotifyModel = new UpdateNotify();
|
|
68
|
-// $list = $updateNotifyModel->list(['project_id'=>$this->user['project_id'],'status'=>1]);
|
|
|
|
69
|
-// if(!empty($list)){
|
|
|
|
70
|
-// return $this->success($list);
|
|
|
|
71
|
-// }
|
|
|
|
72
|
- $field = $type == UpdateNotify::TYPE_MINOR ? 'minor_languages_status' : 'status';
|
74
|
+ $field = ($type == UpdateNotify::TYPE_MINOR) ? 'minor_languages_status' : 'status';
|
|
|
|
75
|
+ $count = $updateNotifyModel->formatQuery(['project_id' => $this->user['project_id'], $field => 0])->count();
|
|
|
|
76
|
+ if($page == UpdateNotify::PAGE_ALL){
|
|
|
|
77
|
+ //如果是更新所有
|
|
|
|
78
|
+ $routeMapModel = new RouteMap();
|
|
|
|
79
|
+ $count = $routeMapModel->formatQuery(['project_id'=>$this->user['project_id'],'source'=>['!=','product_keyword']])->count();
|
|
|
|
80
|
+ }
|
|
|
|
81
|
+ $this->addProgress($count);
|
|
73
|
$updateNotifyModel->edit([$field => 1], ['project_id' => $this->user['project_id'], $field => 0]);
|
82
|
$updateNotifyModel->edit([$field => 1], ['project_id' => $this->user['project_id'], $field => 0]);
|
|
|
|
83
|
+ $urlStr = $this->getString();
|
|
|
|
84
|
+ http_get($urlStr,["charset = UTF-8"]);
|
|
|
|
85
|
+ return $this->success();
|
|
|
|
86
|
+ }
|
|
|
|
87
|
+
|
|
|
|
88
|
+ /**
|
|
|
|
89
|
+ * @remark :生成一条更新记录
|
|
|
|
90
|
+ * @name :addProgress
|
|
|
|
91
|
+ * @author :lyh
|
|
|
|
92
|
+ * @method :post
|
|
|
|
93
|
+ * @time :2023/9/6 17:01
|
|
|
|
94
|
+ */
|
|
|
|
95
|
+ public function addProgress($count,$type){
|
|
|
|
96
|
+ $data = [
|
|
|
|
97
|
+ 'total_num'=>$count,
|
|
|
|
98
|
+ 'current_num'=>0,
|
|
|
|
99
|
+ 'type'=>$type,
|
|
|
|
100
|
+ 'created_at'=>date('Y-m-d H;i:s')
|
|
|
|
101
|
+ ];
|
|
|
|
102
|
+ $updateProgressModel = new UpdateProgress();
|
|
|
|
103
|
+ return $updateProgressModel->insert($data);
|
|
|
|
104
|
+ }
|
|
|
|
105
|
+
|
|
|
|
106
|
+ /**
|
|
|
|
107
|
+ * @remark :通知参数处理
|
|
|
|
108
|
+ * @name :getString
|
|
|
|
109
|
+ * @author :lyh
|
|
|
|
110
|
+ * @method :post
|
|
|
|
111
|
+ * @time :2023/9/6 17:03
|
|
|
|
112
|
+ */
|
|
|
|
113
|
+ public function getString($type,$page){
|
|
74
|
$param = [
|
114
|
$param = [
|
|
75
|
'project_id' => $this->user['project_id'],
|
115
|
'project_id' => $this->user['project_id'],
|
|
76
|
'type' => $type,
|
116
|
'type' => $type,
|
|
77
|
- 'route' => 'all'
|
117
|
+ 'route' => $page
|
|
78
|
];
|
118
|
];
|
|
79
|
$string = http_build_query($param);
|
119
|
$string = http_build_query($param);
|
|
80
|
- $urlStr = $this->user['domain'].'api/updateHtmlNotify/?' . $string;
|
|
|
|
81
|
- http_get($urlStr,["charset = UTF-8"]);
|
|
|
|
82
|
- return $this->success();
|
120
|
+ return $this->user['domain'].'api/updateHtmlNotify/?' . $string;
|
|
83
|
}
|
121
|
}
|
|
84
|
-
|
|
|
|
85
|
} |
122
|
} |