From 0ea78440cb53b7ecf0ef715e3f51d88918c5821d Mon Sep 17 00:00:00 2001
From: chengkun <chengkun@ishangstudy.com>
Date: Thu, 04 Sep 2025 18:21:14 +0800
Subject: [PATCH] 提交
---
app/admin/controller/Common.php | 65 +++++++++++++++++---------------
1 files changed, 35 insertions(+), 30 deletions(-)
diff --git a/app/admin/controller/Common.php b/app/admin/controller/Common.php
index 4d682e4..3f22ee1 100644
--- a/app/admin/controller/Common.php
+++ b/app/admin/controller/Common.php
@@ -2,6 +2,7 @@
namespace app\admin\controller;
+use app\admin\util\Opadmin;
use think\facade\View;
use think\facade\Request;
@@ -13,33 +14,31 @@
use think\facade\Log;
use think\facade\Session;
-class Common extends BaseController
-{
-
- public $Opadmin = null;
- public $admin_id = null;
- public $cinfo = null;
-
- public function __construct()
- {
+class Common extends BaseController {
+
+ public ?Opadmin $Opadmin = NULL;
+ public mixed $admin_id = NULL;
+ public mixed $cinfo = NULL;
+
+ public function __construct() {
Log::record(getcurrurl());
header('Content-Type:text/html;charset=utf-8');
- $this->Opadmin = new \app\admin\util\Opadmin();
+ $this->Opadmin = new Opadmin();
if (!$this->Opadmin->islogin()) {
$this->redirect(url('/admin/login/index')->build());
}
-
- $this->cinfo = $this->Opadmin->info;
+
+ $this->cinfo = $this->Opadmin->info;
$this->admin_id = $this->Opadmin->info['id'];
- $menulist = $this->Opadmin->menu();
+ $menulist = $this->Opadmin->menu();
View::assign('menulist', $menulist);
View::assign('cinfo', $this->Opadmin->info);
- View::assign('menuitem', Request()->controller(true) . '-' . Request()->action(true));
+ View::assign('menuitem', Request()->controller(TRUE) . '-' . Request()->action(TRUE));
}
- protected function getCountrychildrenids($id)
- {
+
+ protected function getCountrychildrenids($id): array {
$where['father_id'] = $id;
- $result = Db::name('country_code')->field('id as value,cate_name as label')->where($where)->cacheAlways(TRUE, 0, 'country_codes')->order('order_id asc,id asc')->select()->toArray();
+ $result = Db::name('country_code')->field('id as value,cate_name as label')->where($where)->cacheAlways(TRUE, 0, 'country_codes')->order('order_id asc,id asc')->select()->toArray();
if ($result) {
foreach ($result as &$val) {
$val['children'] = $this->getCountrychildrenids($val['value']); ////
@@ -49,26 +48,32 @@
return [];
}
}
- //////上传文件到cos/////////////////
- protected function uploadFileToCos($file = '')
- {
+
+ /**
+ * 上传文件到cos
+ * @param string $file
+ * @return object|string|void
+ */
+ protected function uploadFileToCos(string $file = '') {
if ($file && Config::get('qcloud.isopencos') == 1) {
- $key = getCosName($file);
+ $key = getCosName($file);
$localPath = '.' . $file;
- $cos = new \common\Uploadcos();
- $result = $cos->cosUpload($key, $localPath);
- return $result;
+ $cos = new \common\Uploadcos();
+ return $cos->cosUpload($key, $localPath);
}
}
-
- //////删除cos中的文件/////////////////
- protected function deleteFileFromCos($file = '', $versionId = '')
- {
+
+ /**
+ * 删除cos中的文件
+ * @param string $file
+ * @param string $versionId
+ * @return object|string|void
+ */
+ protected function deleteFileFromCos(string $file = '', string $versionId = '') {
if ($file && Config::get('qcloud.isopencos') == 1) {
$key = getCosName($file);
$cos = new \common\Uploadcos();
- $result = $cos->cosDelete($key, $versionId);
- return $result;
+ return $cos->cosDelete($key, $versionId);
}
}
}
--
Gitblit v1.9.0