update code

This commit is contained in:
全栈小学生 2023-09-19 18:00:55 +08:00
parent bbb1214775
commit 594f8287f2
19 changed files with 200 additions and 176 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

View File

@ -35,5 +35,8 @@
"toBind": "绑定授权",
"toNiucloud": "去niucloud官网",
"failReason": "失败原因:",
"toSetting": "去配置"
"toSetting": "去配置",
"cloudRelease": "一键云端发布",
"localRelease": "本地发布",
"localInsertTips": "请先将uni-app编译成微信小程序然后使用微信开发者工具进行上传"
}

View File

@ -33,5 +33,6 @@
"safeModeTips": "安全模式下,消息包为纯密文,需要开发者加密和解密,安全系数高",
"weappUpload": "小程序代码上传",
"uploadKey": "上传密钥",
"uploadKeyTips": "配置之后可实现在线上传小程序版本"
"uploadKeyTips": "配置之后可实现在线上传小程序版本",
"uploadIpTips": "如果小程序代码上传开启了ip白名单设置在ip白名单中添加ip"
}

View File

@ -1,128 +1,75 @@
<template>
<div
class="main main-container min-w-[1000px] min-h-[650px]"
v-loading="loading"
>
<div class="main main-container min-w-[1000px] min-h-[650px]" v-loading="loading">
<el-card class="box-card !border-none" shadow="never" v-if="!loading">
<div class="flex">
<div class="left bg-gray-100 mr-[14px] w-[402px] h-[188px]">
<div class="flex">
<span class="ml-[32px] mt-[34px] text-[20px] text-[#333333]">版本信息</span>
<el-button class="ml-[166px] mt-[34px] text-[#DDDDDD]" plain
>检测更新</el-button
>
<div class="bg-[#F3F6FF] mr-[14px] w-[402px] pt-[30px] pl-[32px] pr-[46px] pb-[60px]">
<div class="flex items-center justify-between">
<span class="text-[20px] text-[#333333]">版本信息</span>
<el-button class="text-[#4C4C4C] w-[78px] h-[32px] !bg-transparent">检测更新</el-button>
</div>
<div>
<p class="ml-[32px] mt-[34px] text-[14px] text-[#797979]">
当前版本 <span class="text-[26px]">1.0.35</span
><em class="text-[12px] text-[#797979]">(当前已是最新版本)</em>
</p>
<div class="mt-[30px] flex items-center text-[14px] text-[#797979]">
<span>当前版本</span>
<span class="text-[26px] ml-[15px] mr-[10px] text-[#656668]">1.0.35</span>
<em class="text-[12px]">(当前已是最新版本)</em>
</div>
</div>
<div class="right flex bg-gray-100 w-[1188px] h-[188px]">
<div class="left w-[730px]">
<div class="flex w-[100%]">
<p class="ml-[30px] mt-[34px] text-[20px] text-[#333333]">授权信息</p>
<span class="ml-[30px] mt-[40px] text-[14px] text-[#666666]"
>杭州数字运动科技有限公司</span
>
<div class="flex-1 flex justify-between items-center bg-[#F3F6FF] pt-[34px] pl-[30px] pr-[60px] pb-[62px]">
<div class="flex flex-col">
<div class="flex flex-wrap items-center">
<p class="text-[20px] text-[#333] mr-[20px]">授权信息</p>
<span class="text-[14px] text-[#666]">{{authinfo.company_name || '--'}}</span>
</div>
<div class="ml-[70px] mt-[44px] w-[100%]">
<span class="text-[14px] text-[#797979]"
>授权域名<em class="ml-[12px] text-[12px] text-[#222222]">sseeee</em></span
>
<span class="text-[14px] ml-[84px] text-[#797979]"
>授权码 <em class="ml-[12px] text-[12px] text-[#222222]">94302</em><el-icon class="text-[12px] ml-[20px]"><View />
</el-icon><el-icon class="text-[12px] ml-[2px]"><Hide /></el-icon></span
>
<div class="mt-[46px] ml-[40px] flex flex-wrap">
<span class="text-[14px] text-[#797979] mr-[84px]">授权域名<em class="ml-[12px] text-[12px] text-[#222222]">{{authinfo.site_address || '--'}}</em></span>
<span class="text-[14px] flex items-center text-[#797979]">
<span>授权码</span>
<em class="ml-[12px] mr-[10px] text-[12px] text-[#222222]">{{ authinfo.auth_code ? (isCheck ? authinfo.auth_code : hideAuthCode(authinfo.auth_code)) : '--' }}</em>
<el-icon v-if="isCheck" @click="isCheck = !isCheck" class="text-[12px] cursor-pointer"><View/></el-icon>
<el-icon v-else @click="isCheck = !isCheck" class="text-[12px] cursor-pointer"><Hide /></el-icon>
</span>
</div>
</div>
<div class="right flex w-[458px] ml-[200px] mt-[70px]" >
<el-button class="btn1" type="primary" >授权码认证</el-button>
<el-popover :visible="visible" placement="bottom" :width="478" popper-class="popper1">
<p class="leading-[32px] w-[418px] h-[96px] text-[18px] mx-[auto] mt-[40px]">您在官方应用市场购买任意一款应用即可获得授权码输入正确授权码认证通过后即可支持在线升级和其它相关服务</p>
<div style="text-align: right; margin: 0">
<el-button class="btn3 mt-[36px]" size="default" type="plain" @click="visible = false"
>去应用市场逛逛</el-button
>
<el-button class=" btn4 mt-[36px]" size="default" type="plain" text @click="visible = false"
>关闭</el-button
>
<div class="flex flex-1 flex-wrap justify-end relative" >
<el-button class="w-[154px] !h-[48px] mt-[8px]" type="primary" @click="authCodeApproveFn">授权码认证</el-button>
<el-popover ref="getAuthCodeDialog" placement="bottom" :width="478" trigger="click" class="mt-[8px]">
<div class="px-[18px] py-[8px]">
<p class="leading-[32px] text-[18px]">您在官方应用市场购买任意一款应用即可获得授权码输入正确授权码认证通过后即可支持在线升级和其它相关服务</p>
<div class="flex justify-end mt-[36px]">
<el-button class="w-[182px] !h-[48px]" plain @click="market">去应用市场逛逛</el-button>
<el-button class="w-[100px] !h-[48px]" plain @click="getAuthCodeDialog.hide()">关闭</el-button>
</div>
</div>
<template #reference>
<el-button class="btn2" @click="visible = true">如何获取授权码?</el-button>
<el-button class="w-[154px] !h-[48px] mt-[8px] !text-[var(--el-color-primary)] hover:!text-[var(--el-color-primary)] !bg-transparent" plain type="primary">如何获取授权码?</el-button>
</template>
</el-popover>
</div>
<el-dialog v-model="authCodeApproveDialog" title="授权码认证" width="400px" :before-close="closeAuthCodeApproveDialogFn">
<el-form :model="formData" label-width="0" ref="formRef" :rules="formRules" class="page-form">
<el-card class="box-card !border-none" shadow="never">
<el-form-item prop="auth_code">
<el-input v-model="formData.auth_code" :placeholder="t('authCodePlaceholder')" class="input-width" clearable size="large" />
</el-form-item>
<div class="mt-[20px]">
<el-form-item prop="auth_secret">
<el-input v-model="formData.auth_secret" clearable :placeholder="t('authSecretPlaceholder')" class="input-width" size="large" />
</el-form-item>
</div>
<div class="text-sm mt-[10px] text-info">{{ t('authInfoTips') }}</div>
<div class="mt-[20px]">
<el-button type="primary" class="w-full" size="large" :loading="saveLoading" @click="save(formRef)">{{ t('confirm') }}</el-button>
</div>
<div class="mt-[10px] text-right">
<el-button type="primary" link @click="market">{{ t('notHaveAuth') }}</el-button>
</div>
</el-card>
</el-form>
</el-dialog>
</div>
</div>
<!-- <div class="flex items-center">
<span class="text-[20px]">{{ pageName }}</span>
<span v-if="authinfo" class="text-[14px] ml-[20px] block"> {{ t('authCode') }} {{ authinfo.auth_code }}
<span class="cursor-pointer text-primary" @click="authEvent">{{ t('updateCode') }}</span> </span>
</div> -->
<!-- <div v-if="authinfo" class="mt-[50px]">
<el-row>
<el-col :span="8" class="mb-[20px]">
<div class="flex mt-[15px]">
<span class="text-[14px] w-[130px] text-right mr-[20px]">{{ t('companyName') }}</span>
<span class="text-[14px] text-[#666666]">{{ authinfo.company_name }}</span>
</div>
</el-col>
<el-col :span="8" class="mb-[20px]">
<div class="mt-[15px]">
<div class="flex">
<span class="text-[14px] w-[130px] text-right mr-[20px]">{{ t('siteAddress') }}</span>
<span class="text-[14px] text-[#666666]">{{ authinfo.site_address }}</span>
</div>
<div class="flex" v-if="!authinfo.address_type">
<span class="text-[14px] min-w-[130px] text-right mr-[20px]"></span>
<span class="text-[14px] text-[#f10b0b] cursor-pointer" @click="authEvent">{{ t('siteAddressTips') }}</span>
</div>
</div>
</el-col>
<el-col :span="8" class="mb-[20px]">
<div class="flex mt-[15px]">
<span class="text-[14px] w-[130px] text-right mr-[20px]">{{ t('contactName') }}</span>
<span class="text-[14px] text-[#666666]">{{ authinfo.contact_name }}</span>
</div>
</el-col>
<el-col :span="8" class="mb-[20px]">
<div class="flex mt-[15px]">
<span class="text-[14px] w-[130px] text-right mr-[20px]">{{ t('authCode') }}</span>
<span class="text-[14px] text-[#666666]">{{ authinfo.auth_code }}</span>
</div>
</el-col>
</el-row>
</div>
<div v-else>
<el-form :model="formData" label-width="0" ref="formRef" :rules="formRules"
class="page-form mx-auto w-[340px] mt-[100px]" v-loading="loading">
<el-card class="box-card !border-none" shadow="never">
<el-form-item prop="auth_code">
<el-input v-model="formData.auth_code" :placeholder="t('authCodePlaceholder')" class="input-width" clearable size="large" />
</el-form-item>
<div class="mt-[20px]">
<el-form-item prop="auth_secret">
<el-input v-model="formData.auth_secret" clearable :placeholder="t('authSecretPlaceholder')" class="input-width" size="large" />
</el-form-item>
</div>
<div class="text-sm mt-[10px] text-info">{{ t('authInfoTips') }}</div>
<div class="mt-[20px]">
<el-button type="primary" class="w-full" size="large" :loading="saveLoading" @click="save(formRef)">{{ t('confirm') }}</el-button>
</div>
<div class="mt-[10px] text-right">
<el-button type="primary" link @click="market">{{ t('notHaveAuth') }}</el-button>
</div>
</el-card>
</el-form>
</div> -->
</el-card>
</div>
</template>
@ -137,6 +84,26 @@ import { useRoute } from "vue-router";
const route = useRoute();
const pageName = route.meta.title;
let getAuthCodeDialog = ref(null);
let authCodeApproveDialog = ref(false);
let isCheck = ref(false);
const hideAuthCode = (res)=>{
let authCode = JSON.parse(JSON.stringify(res));
let data = authCode.slice(0, authCode.length/2) + authCode.slice(authCode.length/2, authCode.length-1).replace(/./g, '*')
return data
}
const authCodeApproveFn = ()=>{
authCodeApproveDialog.value = true;
authinfo.value = "";
}
const closeAuthCodeApproveDialogFn = ()=>{
loading.value = true;
checkAppMange();
}
const authinfo = ref("");
const loading = ref(true);
const saveLoading = ref(false);
@ -146,10 +113,12 @@ const checkAppMange = () => {
loading.value = false;
if (res.data.data && res.data.data.length != 0) {
authinfo.value = res.data.data;
authCodeApproveDialog.value = false;
}
})
.catch(() => {
loading.value = false;
authCodeApproveDialog.value = false;
});
};
checkAppMange();
@ -192,20 +161,15 @@ const save = async (formEl: FormInstance | undefined) => {
})
.catch(() => {
saveLoading.value = false;
authCodeApproveDialog.value = false;
});
}
});
};
const authEvent = () => {
authinfo.value = "";
};
const market = () => {
window.open("https://www.niucloud.com/product");
};
const visible = ref(false)
</script>
<style lang="scss" scoped>
@ -215,42 +179,21 @@ const visible = ref(false)
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
}
.main {
background-color: var(--el-bg-color-overlay);
}
.app-item {
// box-shadow: 0px 6px 18px 0px rgba(82,129,187,0.1);
}
em{
font-style:normal
}
:deep(.btn1){
width: 154px;
height: 48px;
border: 1px solid #2454FF;
border-radius: 4px;
font-size: 18px;
}
:deep(.btn2){
width: 154px;
height: 48px;
border: 1px solid #2454FF;
border-radius: 4px;
font-size: 18px;
color: #2454FF;
}
:deep(.btn3){
border: 1px solid #2454FF;
border-radius: 4px;
font-size: 18px;
color: #2454FF;
}
:deep(.btn4){
border: 1px solid #2454FF;
border-radius: 4px;
font-size: 18px;
color: #2454FF;
}
</style>
<style>
.auth-code-dialog .el-overlay{
background-color: transparent;
}
.auth-code-dialog .el-dialog__header{
padding: 0;
}
.auth-code-dialog .el-dialog__body{
padding: 20px 30px;
}
</style>

View File

@ -306,11 +306,11 @@
:show-log-time="true" />
</div>
<div v-show="installStep == 3" class="h-[50vh] mt-[20px] flex flex-col">
<el-result icon="success" :title="t('addonInstallSuccess')"></el-result>
<!-- 提示信息 -->
<div v-for="item in installWarning" class="mb-[10px]">
<div v-for="item in installAfterTips" class="mb-[10px]">
<el-alert :title="item" type="warning" :closable="false" />
</div>
<el-result icon="success" :title="t('addonInstallSuccess')"></el-result>
</div>
</el-dialog>
</div>
@ -331,6 +331,7 @@ const activeName = ref('installed')
const loading = ref<Boolean>(false)
const showType = ref('large')
const downloading = ref('')
const installAfterTips = ref<string[]>([])
const downEvent = (param: Record<string, any>) => {
if (downloading.value) return
@ -422,8 +423,6 @@ const installShowDialog = ref(false)
const installStep = ref(1)
//
const installCheckResult = ref({})
//
const installWarning = ref<string[]>([])
/**
* 安装
@ -431,9 +430,9 @@ const installWarning = ref<string[]>([])
*/
const installAddonFn = (key: string) => {
currAddon.value = key
installStep.value = 1
installWarning.value = []
installStep.value = 3
installShowDialog.value = true
installAfterTips.value = []
preInstallCheck(key).then(res => {
installCheckResult.value = res.data
@ -500,6 +499,7 @@ const handleInstall = () => {
installStep.value = 3
localListFn()
localInstalling.value = false
if (res.data.length) installAfterTips.value = res.data
}).catch((res) => {
localInstalling.value = false
})

View File

@ -18,7 +18,8 @@
</el-collapse>
<div class="mt-[50px]">
<el-button type="primary" @click="insert" :loading="uploading">{{ t('codeDownTwoDesc') }}</el-button>
<el-button type="primary" @click="insert" :loading="uploading">{{ t('cloudRelease') }}</el-button>
<el-button @click="localInsert">{{ t('localRelease') }}</el-button>
</div>
<el-table class="mt-[15px]" :data="weappTableData.data" v-loading="weappTableData.loading" size="default">
<template #empty>
@ -175,12 +176,18 @@ const insert = () => {
})
}
const localInsert = () => {
ElMessageBox.alert(t('localInsertTips'), t('warning'), {
confirmButtonText: t('confirm')
})
}
const previewContent = ref('')
const getWeappPreviewImage = () => {
if (!authCode.value) return
getWeappPreview()
.then(res => {
if (res.data) previewContent.value = `<img src="${res.data}" class="w-[150px]">`
})
.catch()
}
@ -196,6 +203,7 @@ const getWeappUploadLogFn = (key: string) => {
}
if (last.code == 1 && last.percent == 100) {
getWeappVersionListFn()
getWeappPreviewImage()
return
}
setTimeout(() => {

View File

@ -55,6 +55,7 @@
<upload-file v-model="formData.upload_private_key" api="sys/document/wechat" />
</div>
<div class="form-tip">{{ t('uploadKeyTips') }}</div>
<div class="form-tip">{{ t('uploadIpTips') }}{{ formData.upload_ip }}</div>
</el-form-item>
</el-card>

View File

@ -42,7 +42,7 @@ import { useRouter } from 'vue-router'
const router = useRouter()
import useUserStore from '@/stores/modules/user'
const userStore = useUserStore()
const loading = ref(false)
const loading = ref(true)
const detail = reactive({
appList: []
})

View File

@ -52,7 +52,7 @@
<el-table :data="formData.table_column" size="large" ref="tableRef" :key="toggleIndex">
<el-table-column align="center" label="操作" width="80">
<template #default>
<i class="iconfont iconfenlei vab-rank cursor-pointer"></i>
<i class="iconfont iconfenlei vues-rank cursor-pointer"></i>
</template>
</el-table-column>
<el-table-column :label="t('columnName')" prop="column_name" min-width="130px" />
@ -255,7 +255,7 @@
<el-button type="primary" class="w-[100px]" @click="addEvent(null, 0)">{{ t('insertAssociated')
}}</el-button>
</div>
<el-table :data="formData.relations" size="large" ref="tableRef" :key="toggleIndex">
<el-table :data="formData.relations" size="large">
<el-table-column :label="t('associatedType')" prop="type" min-width="130px" />
<el-table-column :label="t('associatedName')" prop="name" min-width="130px" />
<el-table-column :label="t('addons')" prop="addon" min-width="130px" />
@ -404,6 +404,9 @@ const addonList = ref<Array<any>>([])
const getAddonDevelopFn = (search: string) => {
getAddonDevelop({ search }).then(res => {
addonList.value = res.data
nextTick(() => {
rowDrop()
})
})
}
//
@ -412,7 +415,7 @@ const rowDrop = () => {
'.el-table__body-wrapper tbody'
)
Sortable.create(tbody, {
handle: '.vab-rank',
handle: '.vues-rank',
animation: 300,
onEnd({ newIndex, oldIndex }) {
const tableData = formData.table_column
@ -426,7 +429,6 @@ const rowDrop = () => {
})
}
onMounted(() => {
rowDrop()
getAddonDevelopFn('')
})
//change

View File

@ -30,18 +30,24 @@
</el-aside>
</div>
<!-- 浮动样式的应用菜单 -->
<div v-if="!floatMenuStyle && floatActive && applyList.filter(el => { return el.type === 'app' }).length"
class="flex absolute bg-[#fff] w-[640px] px-[28px] py-[20px] flex-wrap left-0 top-[65px] z-50 box-border shadow-lg">
<template v-for="(item, index) in applyList" :key="index">
<div v-if="item.type == 'app'" @click="toLink(item)" class="flex items-center cursor-pointer text-[#6d7278] hover:bg-[#f1f2f6] whitespace-nowrap py-[10px] px-[15px] box-border w-[165px]">
<img :src="img(item.icon)" class="w-[44px] h-[44px] rounded-full mr-[5px]" alt="" :title="item.title">
<span>{{ item.title }}</span>
<div class="one-menus-float-style">
<el-dialog v-model="floatActive" :show-close="false">
<div v-if="!floatMenuStyle && applyList.filter(el => { return el.type === 'app' }).length"
class="flex bg-[#fff] w-[640px] px-[28px] py-[20px] flex-wrap box-border shadow-lg one-menus-wrap">
<template v-for="(item, index) in applyList" :key="index">
<div v-if="item.type == 'app'" @click="toLink(item)" class="flex items-center cursor-pointer text-[#6d7278] hover:bg-[#f1f2f6] whitespace-nowrap py-[10px] px-[15px] box-border w-[165px]">
<img :src="img(item.icon)" class="w-[44px] h-[44px] rounded-full mr-[5px]" alt="" :title="item.title">
<span>{{ item.title }}</span>
</div>
</template>
<div v-if="!applyList.length" class="flex-1 text-center">暂无安装应用</div>
</div>
</template>
</el-dialog>
</div>
<!-- 二级菜单 -->
<template v-for="(item, index) in menus" :key="index">
<div v-if="isTwoMenuFn(item)" class="w-[189px] box-border border-r-[1px] border-solid second-menu">
<div v-if="isTwoMenuFn(item)" :class="[(floatMenuStyle ? 'w-[210px]' : 'w-[189px]'),'box-border border-r-[1px] border-solid second-menu']">
<div
class="group flex flex-col items-center justify-center h-[64px] border-b-[1px] border-solid second-head cursor-pointer relative">
<div class="flex items-center">
@ -64,6 +70,7 @@
<span>{{ item.title }}</span>
</div>
</template>
<div v-if="!applyList.length" class="flex-1 text-center">暂无安装应用</div>
</div>
</div>
@ -723,4 +730,19 @@ const isTwoMenuFn = (item) => {
.menus-wrap {
height: calc(100vh - 64px);
}</style>
}
</style>
<style>
.one-menus-float-style .el-overlay{
background-color: transparent;
}
.one-menus-float-style .el-dialog__header, .one-menus-float-style .el-dialog__body{
padding: 0;
}
.one-menus-float-style .one-menus-wrap{
position: fixed;
left: 0;
top: 65px;
z-index: 5555;
}
</style>

View File

@ -4347,6 +4347,7 @@ CREATE TABLE `weapp_version` (
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态',
`update_time` int(11) NOT NULL DEFAULT '0',
`fail_reason` VARCHAR(2000) NOT NULL DEFAULT '',
`task_key` varchar(20) NOT NULL DEFAULT '' COMMENT '上传任务key',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

View File

@ -252,6 +252,12 @@ return [
'type_app' => '应用',
'type_addon' => '插件',
'install_after_admin_update' => '该插件admin端引用了新的依赖需在项目根目录下admin目录执行 npm install 更新依赖',
'install_after_composer_update' => '该插件引用了新的composer依赖需在项目根目录下niucloud目录执行 composer update 更新依赖',
'install_after_wap_update' => '该插件wap端引用了新的依赖需在项目根目录下uni-app目录执行 npm install 更新依赖',
'install_after_web_update' => '该插件web端引用了新的依赖需在项目根目录下web目录执行 npm install 更新依赖',
'install_after_update' => '安装完成更新完依赖后需还手动编译admin web wap 端的源码',
],
// 退款支付状态
'dict_pay_refund' => [

View File

@ -195,6 +195,7 @@ class Generate
foreach ($this->getGenerator() as $item) {
$generator = app()->make($item);
$generator->init($table);
$file_info = $generator->fileInfo();
if(!empty($file_info))
{

View File

@ -355,6 +355,8 @@ class WebEditGenerator extends BaseGenerator
$content = '{ validator: (rule: any, value: string, callback: any) => { '.
' if (value && !/^\d{'.$between.'}$/.test(value)) {'. " callback(new Error(t('".'generateBetween'."')))".'} else { callback() }}},';
}
}else{
$content = '';
}
}else{
$content = '';

View File

@ -276,6 +276,7 @@ class WebEditPageGenerator extends BaseGenerator
/**
* 表单验证内容
*
* @return string
*/
public function getFormValidate()
@ -283,7 +284,9 @@ class WebEditPageGenerator extends BaseGenerator
$content = '';
$isExist = [];
$specDictType = ['input', 'textarea', 'editor'];
unset($this->tableColumn[1]);
unset($this->tableColumn[2]);
unset($this->tableColumn[3]);
foreach ($this->tableColumn as $column) {
if (!$column['is_insert'] || !$column['is_update'] ) {
continue;
@ -315,8 +318,7 @@ class WebEditPageGenerator extends BaseGenerator
continue;
}
$content .= $this->replaceFileText($old, $new, $vmPath) . ',' . PHP_EOL;
$content.= $this->replaceFileText($old, $new, $vmPath) . ',' . PHP_EOL;
$isExist[] = $column['column_name'];
}
return substr($content, 0, -2);
@ -353,6 +355,8 @@ class WebEditPageGenerator extends BaseGenerator
$content = '{ validator: (rule: any, value: string, callback: any) => { '.
' if (value && !/^\d{'.$between.'}$/.test(value)) {'. " callback(new Error(t('".'generateBetween'."')))".'} else { callback() }}},';
}
}else{
$content = '';
}
}else{
$content = '';

View File

@ -55,6 +55,7 @@ class WeappConfigService extends BaseAdminService
'socket_url' => "wss://".request()->host(),
'upload_url' => $domain,
'download_url' => $domain,
'upload_ip' => '8.140.96.55'
];
}
}

View File

@ -205,7 +205,24 @@ class CoreAddonInstallService extends CoreAddonBaseService
$this->install_task['step'][] = $step;
$this->$step();
}
if ($mode == 'cloud') Cache::set('install_task', $this->install_task);
if ($mode == 'cloud') {
Cache::set('install_task', $this->install_task);
} else {
// 配置文件
$package_path = $this->install_addon_path . 'package' . DIRECTORY_SEPARATOR;
$package_file = [];
search_dir($package_path, $package_file);
$package_file = array_map(function ($file) use ($package_path) {
return str_replace($package_path . DIRECTORY_SEPARATOR, '', $file);
}, $package_file);
$tips = [get_lang('dict_addon.install_after_update')];
if (in_array('admin-package.json', $package_file)) $tips[] = get_lang('dict_addon.install_after_admin_update');
if (in_array('composer.json', $package_file)) $tips[] = get_lang('dict_addon.install_after_composer_update');
if (in_array('uni-app-package.json', $package_file)) $tips[] = get_lang('dict_addon.install_after_wap_update');
if (in_array('web-package.json', $package_file)) $tips[] = get_lang('dict_addon.install_after_web_update');
return $tips;
}
return true;
} catch (\Exception $e) {
Cache::set('install_task', null);

View File

@ -128,7 +128,15 @@ class CoreWeappCloudService extends CoreCloudBaseService
$query = [
'authorize_code' => $this->auth_code,
];
return (new CloudService())->httpGet('cloud/get_weapp_preview?' . http_build_query($query));
$preview_url = (new CloudService())->getUrl('cloud/get_weapp_preview?' . http_build_query($query));
try {
$path = runtime_path() . uniqid() . '.jpg';
file_put_contents($path, file_get_contents($preview_url));
return image_to_base64($path, true);
} catch (\Exception $e) {
return '';
}
}
/**

View File

@ -26,4 +26,8 @@ class CloudService
public function request(string $method, string $url, array $options = []) {
return (new Client(['base_uri' => $this->baseUri ]))->request($method, $url, $options);
}
public function getUrl(string $url) {
return $this->baseUri . $url;
}
}