|
@@ -12,10 +12,23 @@ namespace App\Http\Controllers\Aside\Com; |
|
@@ -12,10 +12,23 @@ namespace App\Http\Controllers\Aside\Com; |
|
12
|
|
12
|
|
|
13
|
use App\Enums\Common\Code;
|
13
|
use App\Enums\Common\Code;
|
|
14
|
use App\Http\Controllers\Aside\BaseController;
|
14
|
use App\Http\Controllers\Aside\BaseController;
|
|
|
|
15
|
+use App\Models\Blog\Blog;
|
|
|
|
16
|
+use App\Models\Blog\BlogCategory;
|
|
|
|
17
|
+use App\Models\CustomModule\CustomModuleCategory;
|
|
|
|
18
|
+use App\Models\CustomModule\CustomModuleContent;
|
|
15
|
use App\Models\Domain\DomainInfo;
|
19
|
use App\Models\Domain\DomainInfo;
|
|
|
|
20
|
+use App\Models\News\News;
|
|
|
|
21
|
+use App\Models\News\NewsCategory;
|
|
|
|
22
|
+use App\Models\Product\Category;
|
|
|
|
23
|
+use App\Models\Product\CategoryRelated;
|
|
|
|
24
|
+use App\Models\Product\Keyword;
|
|
|
|
25
|
+use App\Models\Product\Product;
|
|
16
|
use App\Models\Project\Country as CountryModel;
|
26
|
use App\Models\Project\Country as CountryModel;
|
|
17
|
use App\Models\Project\DeployBuild;
|
27
|
use App\Models\Project\DeployBuild;
|
|
|
|
28
|
+use App\Models\WebSetting\SettingNum;
|
|
|
|
29
|
+use App\Models\WebSetting\TranslateBigProject;
|
|
18
|
use App\Models\WebSetting\WebLanguage;
|
30
|
use App\Models\WebSetting\WebLanguage;
|
|
|
|
31
|
+use App\Services\ProjectServer;
|
|
19
|
use Illuminate\Http\Request;
|
32
|
use Illuminate\Http\Request;
|
|
20
|
use Illuminate\Support\Facades\DB;
|
33
|
use Illuminate\Support\Facades\DB;
|
|
21
|
|
34
|
|
|
@@ -30,6 +43,69 @@ use Illuminate\Support\Facades\DB; |
|
@@ -30,6 +43,69 @@ use Illuminate\Support\Facades\DB; |
|
30
|
class CNoticeController extends BaseController
|
43
|
class CNoticeController extends BaseController
|
|
31
|
{
|
44
|
{
|
|
32
|
/**
|
45
|
/**
|
|
|
|
46
|
+ * @remark :计算页面数量
|
|
|
|
47
|
+ * @name :countLanguagePage
|
|
|
|
48
|
+ * @author :lyh
|
|
|
|
49
|
+ * @method :post
|
|
|
|
50
|
+ * @time :2025/6/19 17:14
|
|
|
|
51
|
+ */
|
|
|
|
52
|
+ public function countLanguagePage(){
|
|
|
|
53
|
+ $this->request->validate([
|
|
|
|
54
|
+ 'language'=>'required',
|
|
|
|
55
|
+ 'project_id'=>'required',
|
|
|
|
56
|
+ ],[
|
|
|
|
57
|
+ 'language.required' => 'language不能为空',
|
|
|
|
58
|
+ 'project_id.required' => 'project_id不能为空',
|
|
|
|
59
|
+ ]);
|
|
|
|
60
|
+ $bigProjectModel = new TranslateBigProject();
|
|
|
|
61
|
+ $project_id_arr = $bigProjectModel->selectField(['status'=>1],'project_id') ?? [];
|
|
|
|
62
|
+ if(in_array($this->param['project_id'],$project_id_arr)){
|
|
|
|
63
|
+ $this->response('success');
|
|
|
|
64
|
+ }
|
|
|
|
65
|
+ $lang_num = count($this->param['language']);
|
|
|
|
66
|
+ ProjectServer::useProject($this->param['project_id']);
|
|
|
|
67
|
+ $keyword_num = (new Keyword())->counts(['route'=>['!=',null]]);
|
|
|
|
68
|
+ $data_num = $this->productNum() + $this->customNum() + $this->newsNum() + $this->blogNum();
|
|
|
|
69
|
+ DB::disconnect('custom_mysql');
|
|
|
|
70
|
+ $number = $keyword_num * 18 + $lang_num * $data_num;
|
|
|
|
71
|
+ if($number >= 450000){
|
|
|
|
72
|
+ $this->response('success',Code::SUCCESS,['msg'=>'翻译数量过多, 大概页面数量:'.$number.', 磁盘空间占用可能会超过40G,请联系管理员操作!']);
|
|
|
|
73
|
+ }
|
|
|
|
74
|
+ $this->response('success');
|
|
|
|
75
|
+ }
|
|
|
|
76
|
+
|
|
|
|
77
|
+ /**
|
|
|
|
78
|
+ * @remark :产品分类页面数量
|
|
|
|
79
|
+ * @name :productCateNum
|
|
|
|
80
|
+ * @author :lyh
|
|
|
|
81
|
+ * @method :post
|
|
|
|
82
|
+ * @time :2025/1/4 10:43
|
|
|
|
83
|
+ */
|
|
|
|
84
|
+ public function productNum(){
|
|
|
|
85
|
+ $number = (new Product())->counts(['status'=>1]);
|
|
|
|
86
|
+ $settingModel = new SettingNum();
|
|
|
|
87
|
+ $info = $settingModel->read(['type'=>1]);
|
|
|
|
88
|
+ if($info === false){
|
|
|
|
89
|
+ $product_page_number = 15;
|
|
|
|
90
|
+ }else{
|
|
|
|
91
|
+ $product_page_number = $info['num'];
|
|
|
|
92
|
+ }
|
|
|
|
93
|
+ $productCateModel = new Category();
|
|
|
|
94
|
+ $productCateList = $productCateModel->list(['status'=>1]);
|
|
|
|
95
|
+ if(!empty($productCateList)){
|
|
|
|
96
|
+ $cateReModel = new CategoryRelated();
|
|
|
|
97
|
+ foreach ($productCateList as $v){
|
|
|
|
98
|
+ $cate_num = $cateReModel->counts(['cate_id'=>$v['id']]);
|
|
|
|
99
|
+ if($cate_num == 0){
|
|
|
|
100
|
+ $number += 1;
|
|
|
|
101
|
+ }else{
|
|
|
|
102
|
+ $number += ceil($cate_num / $product_page_number);
|
|
|
|
103
|
+ }
|
|
|
|
104
|
+ }
|
|
|
|
105
|
+ }
|
|
|
|
106
|
+ return $number;
|
|
|
|
107
|
+ }
|
|
|
|
108
|
+ /**
|
|
33
|
* 更新通知C端
|
109
|
* 更新通知C端
|
|
34
|
* @param Request $request
|
110
|
* @param Request $request
|
|
35
|
* @return \Illuminate\Http\JsonResponse
|
111
|
* @return \Illuminate\Http\JsonResponse
|
|
@@ -58,8 +134,102 @@ class CNoticeController extends BaseController |
|
@@ -58,8 +134,102 @@ class CNoticeController extends BaseController |
|
58
|
http_post($url, json_encode($param));
|
134
|
http_post($url, json_encode($param));
|
|
59
|
$this->response('更新中请稍后, 更新完成将会发送站内信通知更新结果!');
|
135
|
$this->response('更新中请稍后, 更新完成将会发送站内信通知更新结果!');
|
|
60
|
}
|
136
|
}
|
|
|
|
137
|
+ /**
|
|
|
|
138
|
+ * @remark :新闻数量
|
|
|
|
139
|
+ * @name :newsNum
|
|
|
|
140
|
+ * @author :lyh
|
|
|
|
141
|
+ * @method :post
|
|
|
|
142
|
+ * @time :2025/1/4 11:21
|
|
|
|
143
|
+ */
|
|
|
|
144
|
+ public function newsNum(){
|
|
|
|
145
|
+ $newsModel = new News();
|
|
|
|
146
|
+ $number = $newsModel->counts(['status'=>1]);
|
|
|
|
147
|
+ $settingModel = new SettingNum();
|
|
|
|
148
|
+ $info = $settingModel->read(['type'=>2]);
|
|
|
|
149
|
+ if($info === false){
|
|
|
|
150
|
+ $news_page_number = 10;
|
|
|
|
151
|
+ }else{
|
|
|
|
152
|
+ $news_page_number = $info['num'];
|
|
|
|
153
|
+ }
|
|
|
|
154
|
+ $newsCateModel = new NewsCategory();
|
|
|
|
155
|
+ $newsCateList = $newsCateModel->list(['status'=>0]);
|
|
|
|
156
|
+ if(!empty($newsCateList)){
|
|
|
|
157
|
+ foreach ($newsCateList as $v){
|
|
|
|
158
|
+ $cate_num = $newsModel->counts(['category_id'=>['like',','.$v['id'].',']]);
|
|
|
|
159
|
+ if($cate_num == 0){
|
|
|
|
160
|
+ $number += 1;
|
|
|
|
161
|
+ }else{
|
|
|
|
162
|
+ $number += ceil($cate_num / $news_page_number);
|
|
|
|
163
|
+ }
|
|
|
|
164
|
+ }
|
|
|
|
165
|
+ }
|
|
|
|
166
|
+ return $number;
|
|
|
|
167
|
+ }
|
|
|
|
168
|
+
|
|
|
|
169
|
+ /**
|
|
|
|
170
|
+ * @remark :博客数量
|
|
|
|
171
|
+ * @name :blogNum
|
|
|
|
172
|
+ * @author :lyh
|
|
|
|
173
|
+ * @method :post
|
|
|
|
174
|
+ * @time :2025/1/4 11:21
|
|
|
|
175
|
+ */
|
|
|
|
176
|
+ public function blogNum(){
|
|
|
|
177
|
+ $blogModel = new Blog();
|
|
|
|
178
|
+ $number = $blogModel->counts(['status'=>1]);
|
|
|
|
179
|
+ $settingModel = new SettingNum();
|
|
|
|
180
|
+ $info = $settingModel->read(['type'=>3]);
|
|
|
|
181
|
+ if($info === false){
|
|
|
|
182
|
+ $news_page_number = 10;
|
|
|
|
183
|
+ }else{
|
|
|
|
184
|
+ $news_page_number = $info['num'];
|
|
|
|
185
|
+ }
|
|
|
|
186
|
+ $blogCateModel = new BlogCategory();
|
|
|
|
187
|
+ $blogCateList = $blogCateModel->list(['status'=>0]);
|
|
|
|
188
|
+ if(!empty($blogCateList)){
|
|
|
|
189
|
+ foreach ($blogCateList as $v){
|
|
|
|
190
|
+ $cate_num = $blogModel->counts(['category_id'=>['like',','.$v['id'].',']]);
|
|
|
|
191
|
+ if($cate_num == 0){
|
|
|
|
192
|
+ $number += 1;
|
|
|
|
193
|
+ }else{
|
|
|
|
194
|
+ $number += ceil($cate_num / $news_page_number);
|
|
|
|
195
|
+ }
|
|
|
|
196
|
+ }
|
|
|
|
197
|
+ }
|
|
|
|
198
|
+ return $number;
|
|
|
|
199
|
+ }
|
|
61
|
|
200
|
|
|
62
|
/**
|
201
|
/**
|
|
|
|
202
|
+ * @remark :扩展模块数量
|
|
|
|
203
|
+ * @name :blogNum
|
|
|
|
204
|
+ * @author :lyh
|
|
|
|
205
|
+ * @method :post
|
|
|
|
206
|
+ * @time :2025/1/4 11:21
|
|
|
|
207
|
+ */
|
|
|
|
208
|
+ public function customNum(){
|
|
|
|
209
|
+ $contentModel = new CustomModuleContent();
|
|
|
|
210
|
+ $number = $contentModel->counts(['status'=>0]);
|
|
|
|
211
|
+ $settingModel = new SettingNum();
|
|
|
|
212
|
+ $info = $settingModel->read(['type'=>2]);
|
|
|
|
213
|
+ if($info === false){
|
|
|
|
214
|
+ $news_page_number = 10;
|
|
|
|
215
|
+ }else{
|
|
|
|
216
|
+ $news_page_number = $info['num'];
|
|
|
|
217
|
+ }
|
|
|
|
218
|
+ $cateModel = new CustomModuleCategory();
|
|
|
|
219
|
+ $cateList = $cateModel->list(['status'=>0]);
|
|
|
|
220
|
+ if(!empty($cateList)){
|
|
|
|
221
|
+ foreach ($cateList as $v){
|
|
|
|
222
|
+ $cate_num = $contentModel->counts(['category_id'=>['like',','.$v['id'].',']]);
|
|
|
|
223
|
+ if($cate_num == 0){
|
|
|
|
224
|
+ $number += 1;
|
|
|
|
225
|
+ }else{
|
|
|
|
226
|
+ $number += ceil($cate_num / $news_page_number);
|
|
|
|
227
|
+ }
|
|
|
|
228
|
+ }
|
|
|
|
229
|
+ }
|
|
|
|
230
|
+ return $number;
|
|
|
|
231
|
+ }
|
|
|
|
232
|
+ /**
|
|
63
|
* @remark :获取当前项目选中的语种
|
233
|
* @remark :获取当前项目选中的语种
|
|
64
|
* @name :getCountry
|
234
|
* @name :getCountry
|
|
65
|
* @author :lyh
|
235
|
* @author :lyh
|