Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projecttwo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangtao
projecttwo
Commits
dd416904
Commit
dd416904
authored
May 27, 2025
by
wangtao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
业务板块api接口
parent
a23d313f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
100 additions
and
12 deletions
+100
-12
Upload.php
app/admin/controller/system/Upload.php
+9
-1
Wecaht.php
app/api/controller/Wecaht.php
+69
-0
Advert.php
app/model/project/Advert.php
+1
-1
SystemUploadFile.php
app/model/system/SystemUploadFile.php
+4
-1
Driver.php
vendor/veitool/admin/src/veitool/storage/Driver.php
+1
-0
Aliyun.php
vendor/veitool/admin/src/veitool/storage/engine/Aliyun.php
+5
-3
Local.php
vendor/veitool/admin/src/veitool/storage/engine/Local.php
+3
-3
Server.php
vendor/veitool/admin/src/veitool/storage/engine/Server.php
+8
-3
No files found.
app/admin/controller/system/Upload.php
View file @
dd416904
...
...
@@ -75,6 +75,7 @@ class Upload extends BaseController
'file'
=>
array
(
'ext'
=>
$this
->
CF
[
'upload_file_type'
],
'size'
=>
$this
->
CF
[
'upload_file_size'
]),
'video'
=>
array
(
'ext'
=>
$this
->
CF
[
'upload_video_type'
],
'size'
=>
$this
->
CF
[
'upload_video_size'
]),
'audio'
=>
array
(
'ext'
=>
$this
->
CF
[
'upload_audio_type'
],
'size'
=>
$this
->
CF
[
'upload_audio_size'
]),
'upfile'
=>
''
),
'qiniu'
=>
array
(
'bucket'
=>
$this
->
CF
[
'qiniu_bucket'
],
...
...
@@ -86,7 +87,8 @@ class Upload extends BaseController
'bucket'
=>
$this
->
CF
[
'aliyun_bucket'
],
'access_key_id'
=>
$this
->
CF
[
'access_key_id'
],
'access_key_secret'
=>
$this
->
CF
[
'access_key_secret'
],
'domain'
=>
$this
->
CF
[
'aliyun_domain'
]
'domain'
=>
$this
->
CF
[
'aliyun_domain'
],
'upfile'
=>
'public/'
,
),
'qcloud'
=>
array
(
'bucket'
=>
$this
->
CF
[
'qcloud_bucket'
],
...
...
@@ -110,6 +112,7 @@ class Upload extends BaseController
*/
public
function
upfile
(
string
$file
=
'file'
,
int
$groupid
=
0
,
string
$action
=
''
,
string
$thum
=
''
)
{
$action
=
$action
?
$action
:
input
(
'action'
);
if
(
!
$action
)
return
$this
->
returnMsg
(
'参数错误'
);
$this
->
init
();
...
...
@@ -118,6 +121,7 @@ class Upload extends BaseController
$this
->
config
[
'engine'
][
$engine
][
'thum'
]
=
$thum
;
$domain
=
$this
->
config
[
'engine'
][
$engine
][
'domain'
];
//实例化存储驱动
$StorageDriver
=
new
StorageDriver
(
$this
->
config
);
try
{
//设置上传文件的信息
...
...
@@ -125,6 +129,10 @@ class Upload extends BaseController
}
catch
(
\think\Exception
$e
){
return
$this
->
returnMsg
(
'上传失败!'
.
$e
->
getMessage
());
}
if
(
$engine
==
'aliyun'
){
$_FILES
[
'file'
][
'name'
]
=
'public/'
.
$_FILES
[
'file'
][
'name'
];
}
//上传图片
if
(
!
$StorageDriver
->
upload
())
return
$this
->
returnMsg
(
'上传失败!'
.
$StorageDriver
->
getError
());
//图片上传路径
...
...
app/api/controller/Wecaht.php
0 → 100644
View file @
dd416904
<?php
namespace
app\api\controller
;
use
think\Request
;
use
app\api\validate\ArticleValidate
;
use
app\BaseController
;
use
app\model\ArticleModel
;
class
Wecaht
extends
BaseController
{
public
function
index
()
{
$get
=
input
();
exit
(
$get
[
'echostr'
]);
// // 配置 Token(需与微信公众号后台设置一致)
// define("WX_TOKEN", "YOUR_TOKEN_HERE");
// // 处理微信服务器发送的 GET 验证请求
// if ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['echostr'])) {
// $signature = $_GET['signature'] ?? '';
// $timestamp = $_GET['timestamp'] ?? '';
// $nonce = $_GET['nonce'] ?? '';
// $echostr = $_GET['echostr'] ?? '';
//
// // 参数缺失检测
// if (empty($signature) || empty($timestamp) || empty($nonce) || empty($echostr)) {
// exit('Invalid Request: Missing Parameters');
// }
//
// // 1. 生成本地签名
// $tmpArr = [WX_TOKEN, $timestamp, $nonce];
// sort($tmpArr, SORT_STRING); // 字典序排序
// $tmpStr = implode('', $tmpArr); // 拼接字符串
// $localSign = sha1($tmpStr); // SHA1 加密
//
// // 2. 验证签名并返回 echostr
// if ($localSign == $signature) {
// header('Content-Type: text/plain; charset=utf-8');
// exit($echostr);
// } else {
// exit('Signature Verification Failed');
// }
// return true;
// }
}
private
function
checkSignature
()
{
$signature
=
$_GET
[
"signature"
];
$timestamp
=
$_GET
[
"timestamp"
];
$nonce
=
$_GET
[
"nonce"
];
$token
=
'VtUEf2MvC0dMMaDGwMT8'
;
$tmpArr
=
array
(
$token
,
$timestamp
,
$nonce
);
sort
(
$tmpArr
,
SORT_STRING
);
$tmpStr
=
implode
(
$tmpArr
);
$tmpStr
=
sha1
(
$tmpStr
);
if
(
$tmpStr
==
$signature
)
{
return
true
;
}
else
{
return
false
;
}
}
}
\ No newline at end of file
app/model/project/Advert.php
View file @
dd416904
...
...
@@ -18,7 +18,7 @@ class Advert extends Model
{
return
$this
->
hasOne
(
SystemUploadFile
::
class
,
'fileid'
,
'cover_img_id'
)
->
where
(
'isdel'
,
0
)
->
field
(
'fileid, filename, filesize, fileurl, filetype'
);
->
field
(
'fileid, filename, filesize, fileurl, filetype
,storage
'
);
}
public
function
getAdvcatenameAttr
(
$value
,
$data
){
...
...
app/model/system/SystemUploadFile.php
View file @
dd416904
...
...
@@ -40,7 +40,10 @@ class SystemUploadFile extends Base
public
function
getFileurlAttr
(
$value
,
$data
)
{
return
config
(
'app.file_http_url'
)
.
$value
;
if
(
isset
(
$data
[
'storage'
])
&&
$data
[
'storage'
]
==
'local'
)
{
return
config
(
'app.file_http_url'
)
.
$value
;
}
return
$value
;
}
}
\ No newline at end of file
vendor/veitool/admin/src/veitool/storage/Driver.php
View file @
dd416904
...
...
@@ -104,6 +104,7 @@ class Driver
if
(
!
class_exists
(
$classSpace
))
{
throw
new
Exception
(
'未找到存储引擎类: '
.
$engineName
);
}
return
new
$classSpace
(
$this
->
config
[
'engine'
][
$engineName
]);
}
...
...
vendor/veitool/admin/src/veitool/storage/engine/Aliyun.php
View file @
dd416904
...
...
@@ -7,6 +7,7 @@
* Licensed: 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
* ---------------------------------------------------------------------------
*/
namespace
veitool\storage\engine
;
use
OSS\OssClient
;
...
...
@@ -19,7 +20,7 @@ use OSS\Core\OssException;
*/
class
Aliyun
extends
Server
{
private
$config
;
//
private $config;
/**
* 构造方法
...
...
@@ -28,8 +29,8 @@ class Aliyun extends Server
*/
public
function
__construct
(
$config
)
{
parent
::
__construct
();
$this
->
config
=
$config
;
parent
::
__construct
(
$config
);
//
$this->config = $config;
}
/**
...
...
@@ -45,6 +46,7 @@ class Aliyun extends Server
$this
->
config
[
'domain'
],
true
);
$result
=
$ossClient
->
uploadFile
(
$this
->
config
[
'bucket'
],
$this
->
fileName
,
...
...
vendor/veitool/admin/src/veitool/storage/engine/Local.php
View file @
dd416904
...
...
@@ -17,7 +17,7 @@ use think\facade\Filesystem;
*/
class
Local
extends
Server
{
private
$config
;
//
private $config;
/**
* 构造方法
...
...
@@ -25,8 +25,8 @@ class Local extends Server
*/
public
function
__construct
(
$config
)
{
parent
::
__construct
();
$this
->
config
=
$config
;
parent
::
__construct
(
$config
);
//
$this->config = $config;
}
/**
...
...
vendor/veitool/admin/src/veitool/storage/engine/Server.php
View file @
dd416904
...
...
@@ -7,6 +7,7 @@
* Licensed: 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
* ---------------------------------------------------------------------------
*/
namespace
veitool\storage\engine
;
use
think\Exception
;
...
...
@@ -23,12 +24,16 @@ abstract class Server
protected
$error
;
protected
$fileName
;
protected
$fileInfo
;
protected
$config
;
/**
* 构造函数
* Server constructor.
*/
protected
function
__construct
(){}
protected
function
__construct
(
$config
)
{
$this
->
config
=
$config
;
}
/**
* 设置上传的文件信息
...
...
@@ -45,7 +50,7 @@ abstract class Server
// 生成保存文件名
$this
->
fileName
=
$this
->
buildSaveName
();
// 文件信息
$this
->
fileInfo
=
[
'name'
=>
$this
->
file
->
getFilename
(),
'oname'
=>
$this
->
file
->
getOriginalName
(),
'size'
=>
$this
->
file
->
getSize
(),
'type'
=>
$this
->
file
->
getMime
(),
'ext'
=>
$this
->
file
->
getOriginalExtension
()];
$this
->
fileInfo
=
[
'name'
=>
$this
->
file
->
getFilename
(),
'oname'
=>
$this
->
file
->
getOriginalName
(),
'size'
=>
$this
->
file
->
getSize
(),
'type'
=>
$this
->
file
->
getMime
(),
'ext'
=>
$this
->
file
->
getOriginalExtension
()];
}
/**
...
...
@@ -95,7 +100,7 @@ abstract class Server
// 扩展名
$ext
=
$this
->
file
->
getOriginalExtension
();
// 自动生成文件名
return
date
(
'YmdHis'
)
.
substr
(
md5
(
$realPath
),
0
,
5
)
.
str_pad
(
rand
(
0
,
9999
),
4
,
'0'
,
STR_PAD_LEFT
)
.
'.'
.
$ext
;
return
$this
->
config
[
'upfile'
]
.
date
(
'YmdHis'
)
.
substr
(
md5
(
$realPath
),
0
,
5
)
.
str_pad
(
rand
(
0
,
9999
),
4
,
'0'
,
STR_PAD_LEFT
)
.
'.'
.
$ext
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment