|
...
|
...
|
@@ -5,6 +5,8 @@ namespace App\Http\Logic\Bside\Setting; |
|
|
|
use App\Helper\Common as CommonHelper;
|
|
|
|
use App\Http\Logic\Bside\BaseLogic;
|
|
|
|
use App\Models\Com\UpdateNotify;
|
|
|
|
use App\Models\Com\UpdateProgress;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Models\WebSetting\WebSetting;
|
|
|
|
|
|
|
|
class WebSettingLogic extends BaseLogic
|
|
...
|
...
|
@@ -62,24 +64,59 @@ class WebSettingLogic extends BaseLogic |
|
|
|
* @param string $type
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function sendNotifyMessage($type = ''){
|
|
|
|
//获取当前项目所有未处理的更新并更换为1:处理中 2:处理完成
|
|
|
|
public function sendNotifyMessage($type,$page){
|
|
|
|
$updateProgressModel = new UpdateProgress();
|
|
|
|
$progressInfo = $updateProgressModel->formatQuery(['project_id'=>$this->user['project_id'],'type'=>$type])->orderBy('id','desc')->first()->toArray();
|
|
|
|
if((!empty($progressInfo)) && ($progressInfo['total_num'] > $progressInfo['current_num'])){
|
|
|
|
return $this->success($progressInfo);
|
|
|
|
}
|
|
|
|
$updateNotifyModel = new UpdateNotify();
|
|
|
|
// $list = $updateNotifyModel->list(['project_id'=>$this->user['project_id'],'status'=>1]);
|
|
|
|
// if(!empty($list)){
|
|
|
|
// return $this->success($list);
|
|
|
|
// }
|
|
|
|
$field = $type == UpdateNotify::TYPE_MINOR ? 'minor_languages_status' : 'status';
|
|
|
|
$field = ($type == UpdateNotify::TYPE_MINOR) ? 'minor_languages_status' : 'status';
|
|
|
|
$count = $updateNotifyModel->formatQuery(['project_id' => $this->user['project_id'], $field => 0])->count();
|
|
|
|
if($page == UpdateNotify::PAGE_ALL){
|
|
|
|
//如果是更新所有
|
|
|
|
$routeMapModel = new RouteMap();
|
|
|
|
$count = $routeMapModel->formatQuery(['project_id'=>$this->user['project_id'],'source'=>['!=','product_keyword']])->count();
|
|
|
|
}
|
|
|
|
$this->addProgress($count);
|
|
|
|
$updateNotifyModel->edit([$field => 1], ['project_id' => $this->user['project_id'], $field => 0]);
|
|
|
|
$urlStr = $this->getString();
|
|
|
|
http_get($urlStr,["charset = UTF-8"]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :生成一条更新记录
|
|
|
|
* @name :addProgress
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/9/6 17:01
|
|
|
|
*/
|
|
|
|
public function addProgress($count,$type){
|
|
|
|
$data = [
|
|
|
|
'total_num'=>$count,
|
|
|
|
'current_num'=>0,
|
|
|
|
'type'=>$type,
|
|
|
|
'created_at'=>date('Y-m-d H;i:s')
|
|
|
|
];
|
|
|
|
$updateProgressModel = new UpdateProgress();
|
|
|
|
return $updateProgressModel->insert($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :通知参数处理
|
|
|
|
* @name :getString
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/9/6 17:03
|
|
|
|
*/
|
|
|
|
public function getString($type,$page){
|
|
|
|
$param = [
|
|
|
|
'project_id' => $this->user['project_id'],
|
|
|
|
'type' => $type,
|
|
|
|
'route' => 'all'
|
|
|
|
'route' => $page
|
|
|
|
];
|
|
|
|
$string = http_build_query($param);
|
|
|
|
$urlStr = $this->user['domain'].'api/updateHtmlNotify/?' . $string;
|
|
|
|
http_get($urlStr,["charset = UTF-8"]);
|
|
|
|
return $this->success();
|
|
|
|
return $this->user['domain'].'api/updateHtmlNotify/?' . $string;
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
...
|
...
|
|