This commit is contained in:
全栈小学生 2023-10-24 14:28:30 +08:00
parent d38c0f062d
commit 7382267d13
13 changed files with 66 additions and 65 deletions

View File

@ -1,8 +1,8 @@
{
"app": "应用管理",
"descriptionLeft": "暂无安装任何应用,马上去",
"descriptionLeft": "暂未安装任何应用,请到",
"link": "插件管理",
"descriptionRight": "逛逛",
"descriptionRight": "进行安装使用",
"niucloud": "Niucloud官网",
"appStore": "插件管理"
}

View File

@ -48,7 +48,7 @@
"descriptionLeft": "暂无任何应用,马上去",
"link": "官方应用市场",
"descriptionRight": "逛逛",
"installed-empty": "暂安装任何应用,请先安装",
"installed-empty": "暂安装任何应用,请先安装",
"siteAddressTips": "授权域名不匹配",
"authCodePlaceholder": "请输入授权码",

View File

@ -574,6 +574,7 @@ const installAddonFn = (key: string) => {
preInstallCheck(key).then(res => {
installCheckResult.value = res.data
userStore.clearRouters()
}).catch(() => { })
}
@ -612,6 +613,7 @@ const getInstallTask = (first: boolean = true) => {
} else {
if (!first) {
installStep.value = 3
userStore.clearRouters()
localListFn()
userStore.getAppList()
notificationEl.close()
@ -822,11 +824,12 @@ const save = async (formEl: FormInstance | undefined) => {
setAuthinfo(formData)
.then(() => {
saveLoading.value = false
checkAppMange()
setTimeout(() => {
location.reload();
}, 1000);
})
.catch(() => {
saveLoading.value = false
authCodeApproveDialog.value = false
})
}
})

View File

@ -8,7 +8,7 @@
<span class="cursor-pointer" @click="goDeveloperCenter">{{ t('developerCenter') }}</span>
</template>
</div>
<div class="flex items-center mr-[20px] min-w-[200px] text-[14px]">
<div class="flex items-center min-w-[180px] text-[14px]">
<span class="cursor-pointer mr-[15px]" @click="goNiucloud">{{ t('niucloud') }}</span>
<el-dropdown>
<div class="userinfo flex h-full items-center">
@ -18,14 +18,13 @@
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="usercenter"><router-link to="/user/center">账号设置</router-link></el-dropdown-item>
<el-dropdown-item command="usercenter"><router-link to="/tools/authorize">授权信息</router-link></el-dropdown-item>
<el-dropdown-item command="usercenter" @click="changePasswordDialog=true">修改密码</el-dropdown-item>
<el-dropdown-item><router-link to="/user/center">账号设置</router-link></el-dropdown-item>
<el-dropdown-item><router-link to="/tools/authorize">授权信息</router-link></el-dropdown-item>
<el-dropdown-item @click="changePasswordDialog=true">修改密码</el-dropdown-item>
<el-dropdown-item @click="logout">退出登录</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<span class="mx-2 text-[#4F5563]">|</span>
<span class="cursor-pointer" @click="logout">{{t('exit')}}</span>
</div>
<el-dialog v-model="changePasswordDialog" width="450px" title="修改密码" :before-close="handleClose">

View File

@ -8,7 +8,7 @@
<span class="cursor-pointer" @click="goDeveloperCenter">{{ t('developerCenter') }}</span>
</template>
</div>
<div class="flex items-center mr-[20px] min-w-[200px] text-[14px]">
<div class="flex items-center min-w-[180px] text-[14px]">
<span class="cursor-pointer mr-[15px]" @click="goNiucloud">{{ t('niucloud') }}</span>
<el-dropdown>
<div class="userinfo flex h-full items-center">
@ -18,14 +18,13 @@
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="usercenter"><router-link to="/user/center">账号设置</router-link></el-dropdown-item>
<el-dropdown-item command="usercenter"><router-link to="/tools/authorize">授权信息</router-link></el-dropdown-item>
<el-dropdown-item command="usercenter" @click="changePasswordDialog=true">修改密码</el-dropdown-item>
<el-dropdown-item><router-link to="/user/center">账号设置</router-link></el-dropdown-item>
<el-dropdown-item><router-link to="/tools/authorize">授权信息</router-link></el-dropdown-item>
<el-dropdown-item @click="changePasswordDialog=true">修改密码</el-dropdown-item>
<el-dropdown-item @click="logout">退出登录</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<span class="mx-2 text-[#4F5563]">|</span>
<span class="cursor-pointer" @click="logout">{{t('exit')}}</span>
</div>
<el-dialog v-model="changePasswordDialog" title="修改密码" :before-close="handleClose">
<div>

View File

@ -22,7 +22,7 @@ const useSystemStore = defineStore('system', {
dark: theme.dark ?? false,
theme: theme.theme ?? '#273de3',
sidebar: theme.sidebar ?? 'oneType',
sidebarStyle: theme.sidebarStyle ?? 'oneType',
sidebarStyle: theme.sidebarStyle ?? 'threeType',
lang: storage.get('lang') ?? 'zh-cn'
}
},

View File

@ -44,6 +44,9 @@ const useUserStore = defineStore('user', {
})
})
},
clearRouters() {
this.routers = []
},
logout() {
this.token = ''
this.userInfo = {}

View File

@ -1518,19 +1518,6 @@ return [
],
],
],
[
'menu_name' => '插件管理',
'menu_key' => 'app_store',
'menu_type' => 1,
'icon' => 'iconfont-iconchajian1',
'api_url' => 'addon/local',
'router_path' => 'app_store',
'view_path' => 'app/store',
'methods' => 'get',
'sort' => 20,
'status' => 1,
'is_show' => 0,
],
[
'menu_name' => '授权信息',
'menu_key' => 'app_auth',

View File

@ -37,7 +37,7 @@ class Index extends BaseInstall
$host = ( empty($_SERVER[ 'REMOTE_ADDR' ]) ? $_SERVER[ 'REMOTE_HOST' ] : $_SERVER[ 'REMOTE_ADDR' ] );
$name = $_SERVER[ 'SERVER_NAME' ];
$verison = !(version_compare(PHP_VERSION, '8.0.0') == -1);
$verison = !( version_compare(PHP_VERSION, '8.0.0') == -1 );
//pdo
$pdo = extension_loaded('pdo') && extension_loaded('pdo_mysql');
$system_variables[] = [ "name" => "pdo", "need" => "开启", "status" => $pdo ];
@ -60,9 +60,9 @@ class Index extends BaseInstall
[ "path" => $root_path . DIRECTORY_SEPARATOR, "path_name" => "niucloud/", "name" => "网站目录" ],
[ "path" => $root_path . DIRECTORY_SEPARATOR . ".env", "path_name" => "niucloud/.env", "name" => "env" ],
[ "path" => $root_path . DIRECTORY_SEPARATOR . ".example.env", "path_name" => "niucloud/.example_env", "name" => "env" ],
[ "path" => $root_path . DIRECTORY_SEPARATOR . 'runtime'.DIRECTORY_SEPARATOR, "path_name" => "niucloud/runtime", "name" => "runtime" ],
[ "path" => $root_path . DIRECTORY_SEPARATOR . 'public'.DIRECTORY_SEPARATOR.'upload'.DIRECTORY_SEPARATOR, "path_name" => "niucloud/public/upload", "name" => "upload" ],
[ "path" => $root_path . DIRECTORY_SEPARATOR . 'app'.DIRECTORY_SEPARATOR.'install'.DIRECTORY_SEPARATOR, "path_name" => "niucloud/app/install", "name" => "安装目录" ]
[ "path" => $root_path . DIRECTORY_SEPARATOR . 'runtime' . DIRECTORY_SEPARATOR, "path_name" => "niucloud/runtime", "name" => "runtime" ],
[ "path" => $root_path . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR, "path_name" => "niucloud/public/upload", "name" => "upload" ],
[ "path" => $root_path . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR, "path_name" => "niucloud/app/install", "name" => "安装目录" ]
];
//目录 可读 可写检测
$is_dir = true;
@ -169,7 +169,7 @@ class Index extends BaseInstall
}
return success($result);
} catch ( Exception $e) {
} catch (Exception $e) {
$result = [
"status" => -1,
"message" => $e->getMessage()
@ -197,7 +197,7 @@ class Index extends BaseInstall
$sqls = explode("\n", trim($sql));
$sqls = array_filter($sqls);
foreach ($sqls as $query) {
$str1 = $query[0] ?? '';
$str1 = $query[ 0 ] ?? '';
if ($str1 != '#' && $str1 != '-')
$sql_query[ $num ] .= $query;
}
@ -251,7 +251,7 @@ class Index extends BaseInstall
Cache::set('install_status', 1);//成功
return success();
} catch ( Exception $e) {
} catch (Exception $e) {
$this->setSuccessLog([ '安装失败' . $e->getMessage(), 'error' ]);
return fail('安装失败' . $e->getMessage());
}
@ -281,7 +281,7 @@ class Index extends BaseInstall
return fail('菜单初始化失败');
}
//初始化计划任务
$res = ( new CoreScheduleInstallService())->installSystemSchedule();
$res = ( new CoreScheduleInstallService() )->installSystemSchedule();
if (!$res) {
$this->setSuccessLog([ '计划任务初始化失败', 'error' ]);
return fail('计划任务初始化失败');
@ -293,7 +293,7 @@ class Index extends BaseInstall
$user->save([
'username' => $username,
'password' => create_password($password),
'is_admin'=>1
'is_admin' => 1
]);
}
@ -328,7 +328,7 @@ class Index extends BaseInstall
Cache::set('install_status', 2);//成功
// Cache::tag(MenuService::$cache_tag_name)->clear();
return success();
} catch ( Exception $e) {
} catch (Exception $e) {
$this->setSuccessLog([ '安装失败' . $e->getMessage(), 'error' ]);
return fail('安装失败' . $e->getMessage());
}
@ -402,11 +402,14 @@ class Index extends BaseInstall
if ($match_item > 0) {
try {
$table_name = $match_data[ 1 ];
if (substr($dbprefix, -1) !== "_") {
$dbprefix .= '_';
}
$new_table_name = $dbprefix . $table_name;
$sql_item = $this->str_replace_first($table_name, $new_table_name, $sql);
@mysqli_query($conn, $sql_item);
if ($is_write) $this->setSuccessLog([ '创建表' . $table_name, 'success' ]);
} catch ( Exception $e) {
if ($is_write) $this->setSuccessLog([ '创建表' . $new_table_name, 'success' ]);
} catch (Exception $e) {
$this->setSuccessLog([ $e->getMessage(), 'error' ]);
return fail('数据库解析失败' . $e->getMessage());
}
@ -435,6 +438,9 @@ class Index extends BaseInstall
$dbpwd = $data[ 'dbpwd' ] ?? '';
$dbname = $data[ 'dbname' ] ?? '';
$dbprefix = $data[ 'dbprefix' ] ?? '';
if (substr($dbprefix, -1) !== "_") {
$dbprefix .= '_';
}
$replace_key = [
'{dbhost}',
@ -467,7 +473,8 @@ class Index extends BaseInstall
* 安装插件
* @return void
*/
public function installAddon() {
public function installAddon()
{
$addon_path = root_path() . 'addon' . DIRECTORY_SEPARATOR;
$addon_files = [];
@ -484,7 +491,7 @@ class Index extends BaseInstall
if (!empty($addon_files)) {
foreach ($addon_files as $addon) {
$service = (new CoreAddonInstallService($addon));
$service = ( new CoreAddonInstallService($addon) );
$service->installCheck();
$service->install();
}
@ -506,7 +513,7 @@ class Index extends BaseInstall
if ($data[ 1 ] == 'error') {
Cache::set('install_status', -1);
}
$time = @(int)microtime(true);
$time = @(int) microtime(true);
$data[] = date('Y-m-d H:i:s', $time);
$install_data = Cache::get('install_data') ?? [];
$install_data[] = $data;

View File

@ -354,6 +354,10 @@ class CoreAddonDevelopService extends CoreAddonBaseService
return true;
}
$file = $dir . $name;
if (!is_dir($dir) && !mkdir($dir, 0777, true) && !is_dir($dir)) {
throw new AddonException(sprintf('Directory "%s" was not created', $dir));
}
if (strpos($name, 'png') || strpos($name, 'jpg')) {
$file_name = explode('.', $name)[0] ?? '';
if (empty($file_name)) return true;
@ -361,14 +365,12 @@ class CoreAddonDevelopService extends CoreAddonBaseService
if (empty($image)) return true;
if (check_file_is_remote($image)) {
try {
(new CoreFetchService())->setRootPath($dir)->setRename($name)->image($image, '', FileDict::LOCAL);
} catch ( UploadFileException $e ) {
return true;
}
} else {
copy($image, $file);
@copy($image, $file);
}
} else {
//创建路由文件

View File

@ -64,20 +64,22 @@ class CoreAddonService extends CoreAddonBaseService
} catch ( Throwable $e ) {
$error = $e->getMessage();
}
$files = get_files_by_dir($this->addon_path);
if (!empty($files)) {
foreach ($files as $path) {
$data = $this->getAddonConfig($path);
if (isset($data['key'])) {
$data['icon'] = is_file($data['icon']) ? image_to_base64($data['icon']) : '';
$data['cover'] = is_file($data['cover']) ? image_to_base64($data['cover']) : '';
$key = $data['key'];
$data['install_info'] = $install_addon_list[$key] ?? [];
$data['is_download'] = true;
$data['is_local'] = in_array($data['key'], $online_app_list) ? false : true;
$list[$key] = $data;
}
if(is_dir($this->addon_path)){
$files = get_files_by_dir($this->addon_path);
if (!empty($files)) {
foreach ($files as $path) {
$data = $this->getAddonConfig($path);
if (isset($data['key'])) {
$data['icon'] = is_file($data['icon']) ? image_to_base64($data['icon']) : '';
$data['cover'] = is_file($data['cover']) ? image_to_base64($data['cover']) : '';
$key = $data['key'];
$data['install_info'] = $install_addon_list[$key] ?? [];
$data['is_download'] = true;
$data['is_local'] = in_array($data['key'], $online_app_list) ? false : true;
$list[$key] = $data;
}
}
}
}
return ['list' => $list, 'error' => $error ?? ''];

View File

@ -308,7 +308,6 @@ class CorePayService extends BaseCoreService
{
$pay = $this->findPayInfoByOutTradeNo($out_trade_no);
if ($pay->isEmpty()) throw new PayException('PAY_TRANSACTION_NO_NOT_EXIST');
// if (empty($pay->type)) throw new PayException('TREAT_PAYMENT_IS_OPEN');
if($pay['status'] == PayDict::STATUS_CALCLE) return true;
if (!in_array($pay['status'], [

View File

@ -138,8 +138,8 @@ abstract class BasePay extends Storage
'enable' => true,
'file' => root_path('runtime') . 'paylog' . DIRECTORY_SEPARATOR . date('Ym') . DIRECTORY_SEPARATOR . date('d') . '.log',
'level' => env('app_debug') ? 'debug' : 'info', // 建议生产环境等级调整为 info开发环境为 debug
'type' => 'single', // optional, 可选 daily.
'max_file' => 30, // optional, 当 type 为 daily 时有效,默认 30 天
'type' => 'single', // type, 可选 daily.
'max_file' => 30, // max_file, 当 type 为 daily 时有效,默认 30 天
],
'http' => [ // optional
'timeout' => 5.0,