|
@@ -12,6 +12,7 @@ use App\Http\Logic\Bside\User\UserLoginLogic; |
|
@@ -12,6 +12,7 @@ use App\Http\Logic\Bside\User\UserLoginLogic; |
|
12
|
use App\Models\Domain\DomainInfo;
|
12
|
use App\Models\Domain\DomainInfo;
|
|
13
|
use App\Models\Product\Category;
|
13
|
use App\Models\Product\Category;
|
|
14
|
use App\Models\Product\CategoryRelated;
|
14
|
use App\Models\Product\CategoryRelated;
|
|
|
|
15
|
+use App\Models\Product\Keyword;
|
|
15
|
use App\Models\Product\Product;
|
16
|
use App\Models\Product\Product;
|
|
16
|
use App\Models\Project\OnlineCheck;
|
17
|
use App\Models\Project\OnlineCheck;
|
|
17
|
use App\Models\Project\Project;
|
18
|
use App\Models\Project\Project;
|
|
@@ -151,11 +152,7 @@ class PrivateController extends BaseController |
|
@@ -151,11 +152,7 @@ class PrivateController extends BaseController |
|
151
|
}
|
152
|
}
|
|
152
|
|
153
|
|
|
153
|
/**
|
154
|
/**
|
|
154
|
- * @remark :模拟登录返回token
|
|
|
|
155
|
- * @name :getToken
|
|
|
|
156
|
- * @author :lyh
|
|
|
|
157
|
- * @method :post
|
|
|
|
158
|
- * @time :2024/3/29 16:19
|
155
|
+ * 模拟登录返回token
|
|
159
|
*/
|
156
|
*/
|
|
160
|
public function getAutoToken(){
|
157
|
public function getAutoToken(){
|
|
161
|
$this->request->validate([
|
158
|
$this->request->validate([
|
|
@@ -201,4 +198,96 @@ class PrivateController extends BaseController |
|
@@ -201,4 +198,96 @@ class PrivateController extends BaseController |
|
201
|
$product_route = Product::where(['status' => Product::STATUS_ON])->whereNotIn('id', $feature_product)->pluck('route')->toArray();
|
198
|
$product_route = Product::where(['status' => Product::STATUS_ON])->whereNotIn('id', $feature_product)->pluck('route')->toArray();
|
|
202
|
return $this->success($product_route);
|
199
|
return $this->success($product_route);
|
|
203
|
}
|
200
|
}
|
|
|
|
201
|
+
|
|
|
|
202
|
+ /**
|
|
|
|
203
|
+ * 获取项目信息---站群服务
|
|
|
|
204
|
+ * @param Request $request
|
|
|
|
205
|
+ * @return false|string
|
|
|
|
206
|
+ */
|
|
|
|
207
|
+ public function getProjectByDomain(Request $request)
|
|
|
|
208
|
+ {
|
|
|
|
209
|
+ $domain = trim($request->input('domain'));
|
|
|
|
210
|
+ if (empty($domain)) {
|
|
|
|
211
|
+ return $this->error('非法参数!');
|
|
|
|
212
|
+ }
|
|
|
|
213
|
+
|
|
|
|
214
|
+ $project = Project::getProjectByDomain($domain);
|
|
|
|
215
|
+ if (empty($project)) {
|
|
|
|
216
|
+ return $this->error('未找到当前域名对应的项目!');
|
|
|
|
217
|
+ }
|
|
|
|
218
|
+ $optimize = $project->optimize;
|
|
|
|
219
|
+ $keyword = $project->project_keyword;
|
|
|
|
220
|
+ $keywords = explode("\r\n", $keyword ? $keyword->main_keyword : []);
|
|
|
|
221
|
+ $result = [
|
|
|
|
222
|
+ 'company' => $project->company,
|
|
|
|
223
|
+ 'company_en_name' => $optimize ? $optimize->company_en_name : '',
|
|
|
|
224
|
+ 'company_en_description' => $optimize ? $optimize->company_en_description : '',
|
|
|
|
225
|
+ 'keywords' => $keywords
|
|
|
|
226
|
+ ];
|
|
|
|
227
|
+ return $this->success($result);
|
|
|
|
228
|
+ }
|
|
|
|
229
|
+
|
|
|
|
230
|
+ /**
|
|
|
|
231
|
+ * 获取产品信息---站群服务
|
|
|
|
232
|
+ * @param Request $request
|
|
|
|
233
|
+ * @return false|string
|
|
|
|
234
|
+ */
|
|
|
|
235
|
+ public function getProjectProduct(Request $request)
|
|
|
|
236
|
+ {
|
|
|
|
237
|
+ $domain = trim($request->input('domain'));
|
|
|
|
238
|
+ $page_size = intval($request->input('page_size', 20));
|
|
|
|
239
|
+ if (empty($domain)) {
|
|
|
|
240
|
+ return $this->error('非法参数!');
|
|
|
|
241
|
+ }
|
|
|
|
242
|
+
|
|
|
|
243
|
+ $project = Project::getProjectByDomain($domain);
|
|
|
|
244
|
+ if (empty($project)) {
|
|
|
|
245
|
+ return $this->error('未找到当前域名对应的项目!');
|
|
|
|
246
|
+ }
|
|
|
|
247
|
+ ProjectServer::useProject($project->id);
|
|
|
|
248
|
+ $products = Product::with('category')->where(['status' => Product::STATUS_ON])->paginate($page_size);
|
|
|
|
249
|
+
|
|
|
|
250
|
+// $products_ids = $products->pluck('id')->toArray();
|
|
|
|
251
|
+// $category_ids = CategoryRelated::whereIn('product_id', $products_ids)->pluck('cate_id')->toArray();
|
|
|
|
252
|
+// $category = Category::whereIn('id', $category_ids)->pluck('title', 'id')->toArray();
|
|
|
|
253
|
+
|
|
|
|
254
|
+ $keyword_id = $products->pluck('keyword_id')->toArray();
|
|
|
|
255
|
+ $keyword_ids = array_reduce($keyword_id, 'array_merge', array());
|
|
|
|
256
|
+ $keyword = Keyword::whereIn('id', $keyword_ids)->pluck('title', 'id')->toArray();
|
|
|
|
257
|
+
|
|
|
|
258
|
+ $result = [];
|
|
|
|
259
|
+ foreach ($products as $product) {
|
|
|
|
260
|
+ $product_keyword = [];
|
|
|
|
261
|
+ foreach ($product->keyword_id as $k_id) {
|
|
|
|
262
|
+ array_push($product_keyword, $keyword[$k_id]);
|
|
|
|
263
|
+ }
|
|
|
|
264
|
+ $product_category = $product->category->pluck('title')->toArray();
|
|
|
|
265
|
+ $result[] = [
|
|
|
|
266
|
+ 'title' => $product->title,
|
|
|
|
267
|
+ 'thumb' => $product->thumb,
|
|
|
|
268
|
+ 'gallery' => $product->gallery,
|
|
|
|
269
|
+ 'intro' => $product->intro,
|
|
|
|
270
|
+ 'content' => $product->content,
|
|
|
|
271
|
+ 'category' => $product_category,
|
|
|
|
272
|
+ 'keyword' => $product_keyword,
|
|
|
|
273
|
+ 'route' => $product->route
|
|
|
|
274
|
+ ];
|
|
|
|
275
|
+ }
|
|
|
|
276
|
+ return $this->success($result);
|
|
|
|
277
|
+ }
|
|
|
|
278
|
+
|
|
|
|
279
|
+ /**
|
|
|
|
280
|
+ * 获取上线项目 --- 监控服务
|
|
|
|
281
|
+ * @param Request $request
|
|
|
|
282
|
+ * @return false|string
|
|
|
|
283
|
+ */
|
|
|
|
284
|
+ public function getProjectOnline(Request $request)
|
|
|
|
285
|
+ {
|
|
|
|
286
|
+ $page_size = intval($request->input('page_size', 20));
|
|
|
|
287
|
+ $projects = Project::select(['id', 'title', 'company', 'type', 'finish_remain_day', 'remain_day'])->whereIn('type', [2, 3, 4, 6])->where('delete_status', 0)->paginate($page_size);
|
|
|
|
288
|
+ foreach ($projects as $project) {
|
|
|
|
289
|
+ $project->domain = $project->domainInfo ? $project->domainInfo->domain : '';
|
|
|
|
290
|
+ }
|
|
|
|
291
|
+ return $this->success($projects);
|
|
|
|
292
|
+ }
|
|
204
|
} |
293
|
} |