mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 05:50:50 +00:00
【程序目录】优化程序
This commit is contained in:
parent
eee9cee2e3
commit
0d480368f9
@ -221,7 +221,7 @@ class RoutineTemplate extends AuthController
|
||||
$qrcode = app()->make(QrcodeServices::class);
|
||||
$resForever = $qrcode->qrCodeForever(0, 'code');
|
||||
if ($resForever) {
|
||||
$resCode = MiniProgramService::qrcodeService()->appCodeUnlimit($resForever->id, '', 280);
|
||||
$resCode = MiniProgramService::appCodeUnlimitService($resForever->id, '', 280);
|
||||
$res = ['res' => $resCode, 'id' => $resForever->id];
|
||||
} else {
|
||||
$res = false;
|
||||
|
||||
@ -71,6 +71,7 @@ class LangCode extends AuthController
|
||||
['is_admin', 0],
|
||||
['code', ''],
|
||||
['remarks', ''],
|
||||
['edit', 0],
|
||||
['list', []]
|
||||
]);
|
||||
$this->services->langCodeSave($data);
|
||||
|
||||
@ -84,7 +84,7 @@ class SystemFile extends AuthController
|
||||
{
|
||||
$comment = $this->request->param('comment');
|
||||
$filepath = $this->request->param('filepath');
|
||||
if (empty($comment) || empty($filepath)) {
|
||||
if (empty($filepath)) {
|
||||
return app('json')->fail(410087);
|
||||
}
|
||||
$res = $this->services->savefile($filepath, $comment);
|
||||
@ -104,15 +104,34 @@ class SystemFile extends AuthController
|
||||
*/
|
||||
public function createFolder()
|
||||
{
|
||||
[$path] = $this->request->postMore([
|
||||
['path', '']
|
||||
[$path,$name] = $this->request->postMore([
|
||||
['path', ''],
|
||||
['name', '']
|
||||
], true);
|
||||
if (empty($path) || empty($name)) {
|
||||
return app('json')->fail(410087);
|
||||
}
|
||||
$data = [];
|
||||
try {
|
||||
$this->services->createFolder($path);
|
||||
$res = $this->services->createFolder($path,$name);
|
||||
if($res)
|
||||
{
|
||||
$data = [
|
||||
'children' => [],
|
||||
'contextmenu'=> true,
|
||||
'isDir'=> true,
|
||||
'loading'=> false,
|
||||
'path'=> $path,
|
||||
'pathname'=> $path . DS . $name,
|
||||
'title'=> $name,
|
||||
];
|
||||
}else{
|
||||
return app('json')->fail(100005);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return app('json')->fail($e->getMessage());
|
||||
}
|
||||
return app('json')->success(100010);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -124,15 +143,34 @@ class SystemFile extends AuthController
|
||||
*/
|
||||
public function createFile()
|
||||
{
|
||||
[$path] = $this->request->postMore([
|
||||
['path', '']
|
||||
[$path,$name] = $this->request->postMore([
|
||||
['path', ''],
|
||||
['name', '']
|
||||
], true);
|
||||
if (empty($path) || empty($name)) {
|
||||
return app('json')->fail(410087);
|
||||
}
|
||||
$data = [];
|
||||
try {
|
||||
$this->services->createFile($path);
|
||||
$res = $this->services->createFile($path,$name);
|
||||
if($res)
|
||||
{
|
||||
$data = [
|
||||
'children' => [],
|
||||
'contextmenu'=> true,
|
||||
'isDir'=> false,
|
||||
'loading'=> false,
|
||||
'path'=> $path,
|
||||
'pathname'=> $path . DS . $name,
|
||||
'title'=> $name,
|
||||
];
|
||||
}else{
|
||||
return app('json')->fail(100005);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return app('json')->fail($e->getMessage());
|
||||
}
|
||||
return app('json')->success(100010);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,6 +185,9 @@ class SystemFile extends AuthController
|
||||
[$path] = $this->request->postMore([
|
||||
['path', '']
|
||||
], true);
|
||||
if (empty($path)) {
|
||||
return app('json')->fail(410087);
|
||||
}
|
||||
try {
|
||||
$this->services->delFolder($path);
|
||||
} catch (\Exception $e) {
|
||||
@ -155,6 +196,24 @@ class SystemFile extends AuthController
|
||||
return app('json')->success(100010);
|
||||
}
|
||||
|
||||
public function rename()
|
||||
{
|
||||
[$newname,$oldname] = $this->request->postMore([
|
||||
['newname', ''],
|
||||
['oldname', '']
|
||||
], true);
|
||||
if (empty($newname) || empty($oldname)) {
|
||||
return app('json')->fail(410087);
|
||||
}
|
||||
try {
|
||||
$this->services->rename($newname,$oldname);
|
||||
} catch (\Exception $e) {
|
||||
return app('json')->fail($e->getMessage());
|
||||
}
|
||||
return app('json')->success(100010);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function copyFolder()
|
||||
{
|
||||
@ -162,6 +221,9 @@ class SystemFile extends AuthController
|
||||
['surDir', ''],
|
||||
['toDir', '']
|
||||
], true);
|
||||
if (empty($surDir) || empty($toDir)) {
|
||||
return app('json')->fail(410087);
|
||||
}
|
||||
try {
|
||||
return app('json')->success($this->services->copyFolder($surDir, $toDir));
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@ -114,6 +114,7 @@ Route::group('system', function () {
|
||||
Route::get('file/createFolder', 'v1.system.SystemFile/createFolder')->option(['real_name' => '创建文件夹']);
|
||||
Route::get('file/createFile', 'v1.system.SystemFile/createFile')->option(['real_name' => '创建文件']);
|
||||
Route::get('file/delFolder', 'v1.system.SystemFile/delFolder')->option(['real_name' => '删除文件夹']);
|
||||
Route::get('file/rename', 'v1.system.SystemFile/rename')->option(['real_name' => '重命名文件夹']);
|
||||
})->middleware([
|
||||
\app\http\middleware\AllowOriginMiddleware::class,
|
||||
\app\adminapi\middleware\AdminEditorTokenMiddleware::class,
|
||||
|
||||
@ -638,4 +638,13 @@ class PublicController
|
||||
}, 3600);
|
||||
return app('json')->success([$range => $lang]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取版本号
|
||||
* @return mixed
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return app('json')->success(['version' => get_crmeb_version()]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ class UserBillController
|
||||
}
|
||||
if (!$imageInfo) {
|
||||
$resForever = $qrCode->qrCodeForever($user['uid'], 'spread', '', '');
|
||||
$resCode = MiniProgramService::qrcodeService()->appCodeUnlimit($resForever->id, '', 280);
|
||||
$resCode = MiniProgramService::appCodeUnlimitService($resForever->id, '', 280);
|
||||
if ($resCode) {
|
||||
$res = ['res' => $resCode, 'id' => $resForever->id];
|
||||
} else {
|
||||
@ -363,7 +363,7 @@ class UserBillController
|
||||
$qrCode = app()->make(QrcodeServices::class);
|
||||
if (!$imageInfo) {
|
||||
$resForever = $qrCode->qrCodeForever($user['uid'], 'spread', '', '');
|
||||
$resCode = MiniProgramService::qrcodeService()->appCodeUnlimit($resForever->id, '', 280);
|
||||
$resCode = MiniProgramService::appCodeUnlimitService($resForever->id, '', 280);
|
||||
if ($resCode) {
|
||||
$res = ['res' => $resCode, 'id' => $resForever->id];
|
||||
} else {
|
||||
|
||||
@ -18,6 +18,7 @@ Route::any('wechat/notify', 'v1.wechat.WechatController/notify');//公众号支
|
||||
Route::any('routine/notify', 'v1.wechat.AuthController/notify');//小程序支付回调
|
||||
Route::any('pay/notify/:type', 'v1.PayController/notify');//支付回调
|
||||
Route::get('get_script', 'v1.PublicController/getScript');//获取统计代码
|
||||
Route::get('version', 'v1.PublicController/getVersion');//获取统计代码
|
||||
|
||||
Route::group(function () {
|
||||
//apple快捷登陆
|
||||
|
||||
@ -493,4 +493,26 @@ abstract class BaseDao
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取条件数据中的某个值的最大值
|
||||
* @param array $where
|
||||
* @param string $field
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMax(array $where = [], string $field = '')
|
||||
{
|
||||
return $this->getModel()->where($where)->max($field);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取条件数据中的某个值的最小值
|
||||
* @param array $where
|
||||
* @param string $field
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMin(array $where = [], string $field = '')
|
||||
{
|
||||
return $this->getModel()->where($where)->min($field);
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ class PosterJob extends BaseJobs
|
||||
}
|
||||
if (!$imageInfo_routine) {
|
||||
$resForever = $qrcodeService->getForeverQrcode('spread', $user['uid']);
|
||||
$resCode = MiniProgramService::qrcodeService()->appCodeUnlimit($resForever->id, '', 280);
|
||||
$resCode = MiniProgramService::appCodeUnlimitService($resForever->id, '', 280);
|
||||
if ($resCode) {
|
||||
$res = ['res' => $resCode, 'id' => $resForever->id];
|
||||
} else {
|
||||
|
||||
@ -81,7 +81,9 @@ class Login extends BaseController
|
||||
return app('json')->success([
|
||||
'appid' => sys_config('wechat_open_app_id', 'wxc736972a4ca1e2a1'),
|
||||
'version' => get_crmeb_version(),
|
||||
'site_name' => sys_config('site_name')
|
||||
'site_name' => sys_config('site_name'),
|
||||
'copyright' => sys_config('nncnL_crmeb_copyright'),
|
||||
'copyrightImg' => sys_config('nncnL_crmeb_copyright_image'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@ -805,7 +805,7 @@ class StoreBargainServices extends BaseServices
|
||||
if ($userServices->checkUserPromoter((int)$user['uid'], $user)) {
|
||||
$valueData .= '&spread=' . $user['uid'];
|
||||
}
|
||||
$res = MiniProgramService::qrcodeService()->appCodeUnlimit($valueData, 'pages/activity/goods_bargain_details/index', 280);
|
||||
$res = MiniProgramService::appCodeUnlimitService($valueData, 'pages/activity/goods_bargain_details/index', 280);
|
||||
if (!$res) throw new ApiException(400237);
|
||||
$uploadType = (int)sys_config('upload_type', 1);
|
||||
$upload = UploadService::init();
|
||||
@ -902,7 +902,7 @@ class StoreBargainServices extends BaseServices
|
||||
if ($userServices->checkUserPromoter((int)$user['uid'], $user)) {
|
||||
$valueData .= '&spread=' . $user['uid'];
|
||||
}
|
||||
$res = MiniProgramService::qrcodeService()->appCodeUnlimit($valueData, 'pages/activity/goods_bargain_details/index', 280);
|
||||
$res = MiniProgramService::appCodeUnlimitService($valueData, 'pages/activity/goods_bargain_details/index', 280);
|
||||
if (!$res) throw new ApiException(410167);
|
||||
$uploadType = (int)sys_config('upload_type', 1);
|
||||
$upload = UploadService::init();
|
||||
|
||||
@ -589,7 +589,7 @@ class StorePinkServices extends BaseServices
|
||||
if ($userServices->checkUserPromoter((int)$user['uid'], $user)) {
|
||||
$valueData .= '&pid=' . $user['uid'];
|
||||
}
|
||||
$res = MiniProgramService::qrcodeService()->appCodeUnlimit($valueData, 'pages/activity/goods_combination_status/index', 280);
|
||||
$res = MiniProgramService::appCodeUnlimitService($valueData, 'pages/activity/goods_combination_status/index', 280);
|
||||
if (!$res) throw new ApiException(410167);
|
||||
$uploadType = (int)sys_config('upload_type', 1);
|
||||
$upload = UploadService::init();
|
||||
@ -853,7 +853,7 @@ class StorePinkServices extends BaseServices
|
||||
if ($userServices->checkUserPromoter((int)$user['uid'], $user)) {
|
||||
$valueData .= '&pid=' . $user['uid'];
|
||||
}
|
||||
$res = MiniProgramService::qrcodeService()->appCodeUnlimit($valueData, 'pages/activity/goods_combination_status/index', 280);
|
||||
$res = MiniProgramService::appCodeUnlimitService($valueData, 'pages/activity/goods_combination_status/index', 280);
|
||||
if (!$res) throw new ApiException(410167);
|
||||
$uploadType = (int)sys_config('upload_type', 1);
|
||||
$upload = UploadService::init();
|
||||
|
||||
@ -300,7 +300,7 @@ class AgentManageServices extends BaseServices
|
||||
$qrcode = app()->make(QrcodeServices::class);
|
||||
$resForever = $qrcode->qrCodeForever($uid, 'spread_routine');
|
||||
if ($resForever) {
|
||||
$resCode = MiniProgramService::qrcodeService()->appCodeUnlimit($resForever->id, '', 280);
|
||||
$resCode = MiniProgramService::appCodeUnlimitService($resForever->id, '', 280);
|
||||
$res = ['res' => $resCode, 'id' => $resForever->id];
|
||||
} else {
|
||||
$res = false;
|
||||
|
||||
@ -278,7 +278,7 @@ class QrcodeServices extends BaseServices
|
||||
}
|
||||
$siteUrl = sys_config('site_url');
|
||||
if (!$imageInfo) {
|
||||
$res = MiniProgramService::qrcodeService()->appCodeUnlimit($data, $page, 280);
|
||||
$res = MiniProgramService::appCodeUnlimitService($data, $page, 280);
|
||||
if (!$res) return false;
|
||||
if ($res->getSize() < 100) return 'unpublished';
|
||||
$uploadType = (int)sys_config('upload_type', 1);
|
||||
|
||||
@ -68,7 +68,7 @@ class ProductServices extends BaseServices
|
||||
$imageInfo = $systemAttachmentService->getOne(['name' => $namePath]);
|
||||
$siteUrl = sys_config('site_url');
|
||||
if (!$imageInfo) {
|
||||
$res = MiniProgramService::qrcodeService()->appCodeUnlimit($data, 'pages/goods_details/index', 280);
|
||||
$res = MiniProgramService::appCodeUnlimitService($data, 'pages/goods_details/index', 280);
|
||||
if (!$res) return false;
|
||||
$uploadType = (int)sys_config('upload_type', 1);
|
||||
$upload = UploadService::init();
|
||||
|
||||
@ -45,7 +45,7 @@ class CapitalFlowServices extends BaseServices
|
||||
case 'refund':
|
||||
$data['order_id'] = $orderInfo['order_id'];
|
||||
$data['uid'] = $orderInfo['uid'];
|
||||
$data['price'] = bcmul('-1', $orderInfo['pay_price'], 2);
|
||||
$data['price'] = bcmul('-1', $orderInfo['refund_price'] ?? $orderInfo['pay_price'], 2);
|
||||
$data['trading_type'] = 2;
|
||||
$data['pay_type'] = $orderInfo['pay_type'];
|
||||
break;
|
||||
|
||||
@ -163,6 +163,7 @@ class SystemAdminServices extends BaseServices
|
||||
'login_logo' => sys_config('login_logo'),//登陆
|
||||
'site_name' => sys_config('site_name'),
|
||||
'copyright' => sys_config('nncnL_crmeb_copyright'),
|
||||
'version' => get_crmeb_version(),
|
||||
'key' => $key
|
||||
];
|
||||
}
|
||||
|
||||
@ -78,10 +78,24 @@ class LangCodeServices extends BaseServices
|
||||
*/
|
||||
public function langCodeSave($data)
|
||||
{
|
||||
if ($data['edit'] == 0) {
|
||||
if ($data['is_admin'] == 1) {
|
||||
$code = $this->dao->getMax(['is_admin' => 1], 'code');
|
||||
if ($code < 500000) {
|
||||
$code = 500000;
|
||||
} else {
|
||||
$code = $code + 1;
|
||||
}
|
||||
} else {
|
||||
$code = $data['remarks'];
|
||||
}
|
||||
} else {
|
||||
$code = $data['code'];
|
||||
}
|
||||
$saveData = [];
|
||||
foreach ($data['list'] as $key => $item) {
|
||||
$saveData[$key] = [
|
||||
'code' => $data['code'],
|
||||
'code' => $code,
|
||||
'remarks' => $data['remarks'],
|
||||
'lang_explain' => $item['lang_explain'],
|
||||
'type_id' => $item['type_id'],
|
||||
|
||||
@ -18,6 +18,7 @@ use app\services\system\admin\SystemAdminServices;
|
||||
use crmeb\exceptions\AdminException;
|
||||
use crmeb\services\CacheService;
|
||||
use crmeb\services\FileService as FileClass;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* 文件校验
|
||||
@ -180,7 +181,7 @@ class SystemFileServices extends BaseServices
|
||||
{
|
||||
$fileAll = array('dir' => [], 'file' => []);
|
||||
//根目录
|
||||
$rootdir = app()->getRootPath();
|
||||
$rootdir = $this->formatPath(app()->getRootPath());
|
||||
// return $rootdir;
|
||||
//当前目录
|
||||
$request_dir = app('request')->param('dir');
|
||||
@ -200,6 +201,7 @@ class SystemFileServices extends BaseServices
|
||||
$dir = !empty($request_dir) ? $request_dir : $rootdir;
|
||||
$dir = rtrim($dir, DS) . DS . app('request')->param('filedir');
|
||||
}
|
||||
Log::error(['dir'=>$dir]);
|
||||
$list = scandir($dir);
|
||||
foreach ($list as $key => $v) {
|
||||
if ($v != '.' && $v != '..') {
|
||||
@ -229,6 +231,7 @@ class SystemFileServices extends BaseServices
|
||||
$navList[$key]['path'] = $value['path'];
|
||||
$navList[$key]['isDir'] = $value['isDir'];
|
||||
$navList[$key]['pathname'] = $value['pathname'];
|
||||
$navList[$key]['contextmenu'] = true;
|
||||
}
|
||||
return compact('dir', 'list','navList');
|
||||
}
|
||||
@ -236,42 +239,67 @@ class SystemFileServices extends BaseServices
|
||||
//读取文件
|
||||
public function openfile($filepath)
|
||||
{
|
||||
$filepath = $this->formatPath($filepath);
|
||||
$content = FileClass::readFile($filepath);//防止页面内嵌textarea标签
|
||||
$ext = FileClass::getExt($filepath);
|
||||
$encoding = mb_detect_encoding($content, mb_detect_order());
|
||||
//前端组件支持的语言类型
|
||||
//['plaintext', 'json', 'abap', 'apex', 'azcli', 'bat', 'cameligo', 'clojure', 'coffeescript', 'c', 'cpp', 'csharp', 'csp', 'css', 'dart', 'dockerfile', 'fsharp', 'go', 'graphql', 'handlebars', 'hcl', 'html', 'ini', 'java', 'javascript', 'julia', 'kotlin', 'less', 'lexon', 'lua', 'markdown', 'mips', 'msdax', 'mysql', 'objective-c', 'pascal', 'pascaligo', 'perl', 'pgsql', 'php', 'postiats', 'powerquery', 'powershell', 'pug', 'python', 'r', 'razor', 'redis', 'redshift', 'restructuredtext', 'ruby', 'rust', 'sb', 'scala', 'scheme', 'scss', 'shell', 'sol', 'aes', 'sql', 'st', 'swift', 'systemverilog', 'verilog', 'tcl', 'twig', 'typescript', 'vb', 'xml', 'yaml']
|
||||
|
||||
$extarray = [
|
||||
'js' => 'text/javascript'
|
||||
, 'htm' => 'text/html'
|
||||
, 'shtml' => 'text/html'
|
||||
, 'xml' => 'text/xml'
|
||||
, 'php' => 'text/x-php'
|
||||
, 'html' => 'text/html'
|
||||
, 'sql' => 'text/x-mysql'
|
||||
, 'css' => 'text/x-scss'
|
||||
, 'txt'=>'text/plain'
|
||||
'js' => 'javascript'
|
||||
, 'htm' => 'html'
|
||||
, 'shtml' => 'html'
|
||||
, 'html' => 'html'
|
||||
, 'xml' => 'xml'
|
||||
, 'php' => 'php'
|
||||
, 'sql' => 'mysql'
|
||||
, 'css' => 'css'
|
||||
, 'txt'=>'plaintext'
|
||||
, 'vue' => 'html'
|
||||
, 'json' => 'json'
|
||||
, 'lock' => 'json'
|
||||
, 'md' => 'markdown'
|
||||
, 'bat' => 'bat'
|
||||
, 'ini' => 'ini'
|
||||
|
||||
|
||||
];
|
||||
$mode = empty($extarray[$ext]) ? 'text/plain' : $extarray[$ext];
|
||||
return compact('content', 'mode', 'filepath');
|
||||
$mode = empty($extarray[$ext]) ? 'php' : $extarray[$ext];
|
||||
return compact('content', 'mode', 'filepath','encoding');
|
||||
}
|
||||
|
||||
//保存文件
|
||||
public function savefile($filepath,$comment)
|
||||
{
|
||||
//兼容windows
|
||||
$uname = php_uname('s');
|
||||
if (strstr($uname, 'Windows') !== false)
|
||||
$filepath = ltrim(str_replace('/', DS, $filepath), '.');
|
||||
$filepath = $this->formatPath($filepath);
|
||||
if (!FileClass::isWritable($filepath)) {
|
||||
throw new AdminException(400611);
|
||||
}
|
||||
return FileClass::writeFile($filepath, $comment);
|
||||
}
|
||||
|
||||
// 文件重命名
|
||||
public function rename($newname,$oldname)
|
||||
{
|
||||
if (($newname != $oldname) && is_writable($oldname)) {
|
||||
return rename($oldname, $newname);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除文件或文件夹
|
||||
* @param string $path
|
||||
* @return bool
|
||||
*
|
||||
* @date 2022/09/20
|
||||
* @author yyw
|
||||
*/
|
||||
public function delFolder(string $path)
|
||||
{
|
||||
if (!file_exists($path)) {
|
||||
return false;
|
||||
}
|
||||
$path = $this->formatPath($path);
|
||||
if(is_file($path))
|
||||
{
|
||||
return unlink($path);
|
||||
@ -281,7 +309,7 @@ class SystemFileServices extends BaseServices
|
||||
$file = $path . '/' . $fileName;
|
||||
if ($fileName != '.' && $fileName != '..') {
|
||||
if (is_dir($file)) {
|
||||
self::delDir($file);
|
||||
self::delFolder($file);
|
||||
} else {
|
||||
unlink($file);
|
||||
}
|
||||
@ -291,15 +319,36 @@ class SystemFileServices extends BaseServices
|
||||
return rmdir($path);
|
||||
}
|
||||
|
||||
public function createFolder(string $path, int $permissions = 0755)
|
||||
/**
|
||||
* 新建文件夹
|
||||
* @param string $path
|
||||
* @param string $name
|
||||
* @param int $permissions
|
||||
* @return bool
|
||||
*
|
||||
* @date 2022/09/20
|
||||
* @author yyw
|
||||
*/
|
||||
public function createFolder(string $path, string $name, int $permissions = 0755)
|
||||
{
|
||||
$path = $this->formatPath($path,$name);
|
||||
/** @var FileClass $fileClass */
|
||||
$fileClass = app()->make(FileClass::class);
|
||||
return $fileClass->createDir($path,$permissions);
|
||||
}
|
||||
|
||||
public function createFile(string $path)
|
||||
/**
|
||||
* 新建文件
|
||||
* @param string $path
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*
|
||||
* @date 2022/09/20
|
||||
* @author yyw
|
||||
*/
|
||||
public function createFile(string $path, string $name)
|
||||
{
|
||||
$path = $this->formatPath($path,$name);
|
||||
/** @var FileClass $fileClass */
|
||||
$fileClass = app()->make(FileClass::class);
|
||||
return $fileClass->createFile($path);
|
||||
@ -308,4 +357,28 @@ class SystemFileServices extends BaseServices
|
||||
{
|
||||
return FileClass::copyDir($surDir,$toDir);
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化路径
|
||||
* @param string $path
|
||||
* @param string $name
|
||||
* @return string
|
||||
*
|
||||
* @date 2022/09/20
|
||||
* @author yyw
|
||||
*/
|
||||
public function formatPath(string $path = '',string $name = ''):string
|
||||
{
|
||||
if($path)
|
||||
{
|
||||
$path = rtrim($path,DS);
|
||||
if($name) $path = $path . DS . $name;
|
||||
$uname = php_uname('s');
|
||||
// $search = '/';
|
||||
if (strstr($uname, 'Windows') !== false)
|
||||
$path = ltrim(str_replace('\\', '\\\\', $path), '.');
|
||||
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ class AliPay extends BasePay implements PayInterface
|
||||
* 支付异步回调
|
||||
* @return mixed|string
|
||||
*/
|
||||
public static function handleNotify()
|
||||
public function handleNotify()
|
||||
{
|
||||
return AliPayService::handleNotify();
|
||||
}
|
||||
|
||||
@ -166,11 +166,11 @@ class Cos extends BaseUpload
|
||||
|
||||
/**
|
||||
* 文件流上传
|
||||
* @param string $fileContent
|
||||
* @param $fileContent
|
||||
* @param string|null $key
|
||||
* @return array|bool|mixed|\StdClass
|
||||
*/
|
||||
public function stream(string $fileContent, string $key = null)
|
||||
public function stream($fileContent, string $key = null)
|
||||
{
|
||||
if (!$key) {
|
||||
$key = $this->saveFileName();
|
||||
|
||||
@ -151,11 +151,11 @@ class Local extends BaseUpload
|
||||
|
||||
/**
|
||||
* 文件流上传
|
||||
* @param string $fileContent
|
||||
* @param $fileContent
|
||||
* @param string|null $key
|
||||
* @return array|bool|mixed|\StdClass
|
||||
*/
|
||||
public function stream(string $fileContent, string $key = null)
|
||||
public function stream($fileContent, string $key = null)
|
||||
{
|
||||
if (!$key) {
|
||||
$key = $this->saveFileName();
|
||||
|
||||
@ -156,11 +156,12 @@ class Oss extends BaseUpload
|
||||
|
||||
/**
|
||||
* 文件流上传
|
||||
* @param string $fileContent
|
||||
* @param $fileContent
|
||||
* @param string|null $key
|
||||
* @return bool|mixed
|
||||
* @return array|bool|mixed
|
||||
* @throws OssException
|
||||
*/
|
||||
public function stream(string $fileContent, string $key = null)
|
||||
public function stream($fileContent, string $key = null)
|
||||
{
|
||||
try {
|
||||
if (!$key) {
|
||||
|
||||
@ -154,11 +154,11 @@ class Qiniu extends BaseUpload
|
||||
|
||||
/**
|
||||
* 文件流上传
|
||||
* @param string $fileContent
|
||||
* @param $fileContent
|
||||
* @param string|null $key
|
||||
* @return array|bool|mixed|\StdClass
|
||||
*/
|
||||
public function stream(string $fileContent, string $key = null)
|
||||
public function stream($fileContent, string $key = null)
|
||||
{
|
||||
if (!$key) {
|
||||
$key = $this->saveFileName();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user