新增env获取环境变量函数,新增普通授权账号和代开发小程序菜单

master
李春波 2 years ago
parent c0f2a2de07
commit 08ab5e024a
  1. 9
      .env.example
  2. 10
      config/database.php
  3. 8
      config/redis.php
  4. 21
      front/src/config/router.config.js
  5. 203
      front/src/views/authorizedAccountManage/authorizerList.vue
  6. 205
      front/src/views/authorizedAccountManage/devWebappList.vue
  7. 2
      front/src/views/platform/account.vue
  8. 1
      front/src/views/user/Login.vue
  9. 26
      support/helpers.php

@ -1,5 +1,12 @@
# mysql
DB_HOST = 127.0.0.1
DB_PORT = 3306
DB_NAME =
DB_USER =
DB_PASSWORD =
DB_PASSWORD =
# redis
REDIS_HOST = 127.0.0.1
REDIS_PORT = 6379
REDIS_DB = 0
REDIS_PASSWORD =

@ -19,11 +19,11 @@ return [
'connections' => [
'mysql' => [
'driver' => 'mysql',
'host' => getenv('DB_HOST'),
'port' => getenv('DB_PORT'),
'database' => getenv('DB_NAME'),
'username' => getenv('DB_USER'),
'password' => getenv('DB_PASSWORD'),
'host' => env('DB_HOST'),
'port' => env('DB_PORT'),
'database' => env('DB_NAME'),
'username' => env('DB_USER'),
'password' => env('DB_PASSWORD'),
'unix_socket' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',

@ -14,9 +14,9 @@
return [
'default' => [
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'database' => 0,
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', ''),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DB', 0),
],
];

@ -126,6 +126,27 @@ export const asyncRouterMap = [
}
]
},
// authorizer
{
name: 'authorizer',
path: '/authorizedAccountManage',
component: RouteView,
meta: {title: '授权管理', keepAlive: true, icon: bxAnaalyse},
children: [
{
name: 'authorizer-list',
path: '/authorizedAccountManage/authorizerList',
component: () => import('@/views/authorizedAccountManage/authorizerList'),
meta: {title: '普通授权账号', keepAlive: true, icon: bxAnaalyse}
},
{
name: 'dev-webapp-list',
path: '/authorizedAccountManage/devWebappList',
component: () => import('@/views/authorizedAccountManage/devWebappList'),
meta: {title: '代开发小程序', keepAlive: true, icon: bxAnaalyse}
}
]
},
// platform
{
name: 'platform',

@ -0,0 +1,203 @@
<template>
<page-header-wrapper :title="false">
<template v-slot:content>
<div class="normal_flex">
<div class="blue_circle"></div>
<div>授权帐号指的是获得公众号或者小程序管理员授权的帐号服务商可为授权帐号提供代开发代运营等服务</div>
</div>
</template>
<a-card :bordered="false">
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="48">
<a-col :md="8" :sm="24">
<a-form-item label="名称">
<a-input v-model="queryParam.name" placeholder=""/>
</a-form-item>
</a-col>
<a-col :md="8" :sm="24">
<a-form-item label="app_id">
<a-input v-model="queryParam.app_id" placeholder=""/>
</a-form-item>
</a-col>
<span :style="advanced && { float: 'right', overflow: 'hidden' } || {} "
class="table-page-search-submitButtons">
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
<a-button style="margin-left: 8px" @click="() => this.queryParam = {}">重置</a-button>
</span>
</a-row>
</a-form>
</div>
<div class="table-operator">
<a-button icon="plus" type="primary" @click="handleAdd">新建</a-button>
</div>
<s-table
ref="table"
:columns="columns"
:data="loadData"
rowKey="id"
showPagination="auto"
size="default"
>
<span slot="action" slot-scope="text, record">
<template>
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical"/>
<a-popconfirm title="确定删除该记录吗?" @confirm="handleDel(record.id)">
<a>删除</a>
</a-popconfirm>
</template>
</span>
</s-table>
</a-card>
</page-header-wrapper>
</template>
<script>
import {Ellipsis, STable} from '@/components'
import {addPlatform, deletePlatform, editPlatform, getPlatform} from '@/api/platform'
const columns = [
{
title: '名称',
dataIndex: 'name'
},
{
title: 'app_id',
dataIndex: 'app_id'
},
{
title: 'secret',
dataIndex: 'secret'
},
{
title: 'token',
dataIndex: 'token'
},
{
title: 'aes_key',
dataIndex: 'aes_key'
},
{
title: '更新时间',
dataIndex: 'update_time',
sorter: true
},
{
title: '操作',
dataIndex: 'action',
width: '150px',
scopedSlots: {customRender: 'action'}
}
]
export default {
name: 'account',
components: {
STable,
Ellipsis
},
data() {
this.columns = columns
return {
// create model
visible: false,
confirmLoading: false,
mdl: null,
// /
advanced: false,
//
queryParam: {},
// Promise
loadData: parameter => {
const requestParameters = Object.assign({}, parameter, this.queryParam)
return getPlatform(requestParameters)
.then(res => {
return res.data
})
},
selectedRowKeys: [],
selectedRows: []
}
},
created() {
// getRoleList({ t: new Date() })
},
computed: {},
methods: {
handleAdd() {
this.mdl = null
this.visible = true
},
handleEdit(record) {
this.visible = true
this.mdl = {...record}
},
handleOk() {
const form = this.$refs.createModal.form
this.confirmLoading = true
form.validateFields((errors, values) => {
if (!errors) {
if (values.id > 0) {
editPlatform(values).then(res => {
this.visible = false
form.resetFields()
this.$refs.table.refresh()
this.$message.success(res['msg'])
}).catch(e => {
console.log(e)
}).finally(() => {
this.confirmLoading = false
})
} else {
addPlatform(values).then(res => {
this.visible = false
form.resetFields()
this.$refs.table.refresh()
this.$message.success(res['msg'])
}).catch(e => {
console.log(e)
}).finally(() => {
this.confirmLoading = false
})
}
} else {
this.confirmLoading = false
}
})
},
handleCancel() {
this.visible = false
const form = this.$refs.createModal.form
form.resetFields() //
},
handleDel(id) {
deletePlatform({id}).then(res => {
//
this.$refs.table.refresh()
this.$message.success(res['msg'])
}).catch(e => {
console.log(e)
})
}
}
}
</script>
<style lang="less" scoped>
.normal_flex {
display: flex;
align-items: center;
flex-wrap: wrap;
.blue_circle {
min-width: 10px;
width: 10px;
height: 10px;
border-radius: 50%;
background-color: #1890ff;
margin-right: 10px;
}
}
</style>

@ -0,0 +1,205 @@
<template>
<page-header-wrapper :title="false">
<template v-slot:content>
<div class="normal_flex">
<div class="blue_circle"></div>
<div>
代开发小程序指的是小程序管理员将权限集id为18的"小程序开发与数据分析"权限授权给该第三方服务商可代小程序提交代码发布上线等
</div>
</div>
</template>
<a-card :bordered="false">
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="48">
<a-col :md="8" :sm="24">
<a-form-item label="名称">
<a-input v-model="queryParam.name" placeholder=""/>
</a-form-item>
</a-col>
<a-col :md="8" :sm="24">
<a-form-item label="app_id">
<a-input v-model="queryParam.app_id" placeholder=""/>
</a-form-item>
</a-col>
<span :style="advanced && { float: 'right', overflow: 'hidden' } || {} "
class="table-page-search-submitButtons">
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
<a-button style="margin-left: 8px" @click="() => this.queryParam = {}">重置</a-button>
</span>
</a-row>
</a-form>
</div>
<div class="table-operator">
<a-button icon="plus" type="primary" @click="handleAdd">新建</a-button>
</div>
<s-table
ref="table"
:columns="columns"
:data="loadData"
rowKey="id"
showPagination="auto"
size="default"
>
<span slot="action" slot-scope="text, record">
<template>
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical"/>
<a-popconfirm title="确定删除该记录吗?" @confirm="handleDel(record.id)">
<a>删除</a>
</a-popconfirm>
</template>
</span>
</s-table>
</a-card>
</page-header-wrapper>
</template>
<script>
import {Ellipsis, STable} from '@/components'
import {addPlatform, deletePlatform, editPlatform, getPlatform} from '@/api/platform'
const columns = [
{
title: '名称',
dataIndex: 'name'
},
{
title: 'app_id',
dataIndex: 'app_id'
},
{
title: 'secret',
dataIndex: 'secret'
},
{
title: 'token',
dataIndex: 'token'
},
{
title: 'aes_key',
dataIndex: 'aes_key'
},
{
title: '更新时间',
dataIndex: 'update_time',
sorter: true
},
{
title: '操作',
dataIndex: 'action',
width: '150px',
scopedSlots: {customRender: 'action'}
}
]
export default {
name: 'account',
components: {
STable,
Ellipsis
},
data() {
this.columns = columns
return {
// create model
visible: false,
confirmLoading: false,
mdl: null,
// /
advanced: false,
//
queryParam: {},
// Promise
loadData: parameter => {
const requestParameters = Object.assign({}, parameter, this.queryParam)
return getPlatform(requestParameters)
.then(res => {
return res.data
})
},
selectedRowKeys: [],
selectedRows: []
}
},
created() {
// getRoleList({ t: new Date() })
},
computed: {},
methods: {
handleAdd() {
this.mdl = null
this.visible = true
},
handleEdit(record) {
this.visible = true
this.mdl = {...record}
},
handleOk() {
const form = this.$refs.createModal.form
this.confirmLoading = true
form.validateFields((errors, values) => {
if (!errors) {
if (values.id > 0) {
editPlatform(values).then(res => {
this.visible = false
form.resetFields()
this.$refs.table.refresh()
this.$message.success(res['msg'])
}).catch(e => {
console.log(e)
}).finally(() => {
this.confirmLoading = false
})
} else {
addPlatform(values).then(res => {
this.visible = false
form.resetFields()
this.$refs.table.refresh()
this.$message.success(res['msg'])
}).catch(e => {
console.log(e)
}).finally(() => {
this.confirmLoading = false
})
}
} else {
this.confirmLoading = false
}
})
},
handleCancel() {
this.visible = false
const form = this.$refs.createModal.form
form.resetFields() //
},
handleDel(id) {
deletePlatform({id}).then(res => {
//
this.$refs.table.refresh()
this.$message.success(res['msg'])
}).catch(e => {
console.log(e)
})
}
}
}
</script>
<style lang="less" scoped>
.normal_flex {
display: flex;
align-items: center;
flex-wrap: wrap;
.blue_circle {
min-width: 10px;
width: 10px;
height: 10px;
border-radius: 50%;
background-color: #1890ff;
margin-right: 10px;
}
}
</style>

@ -1,5 +1,5 @@
<template>
<page-header-wrapper :title="false" content="开放平台参数配置">
<page-header-wrapper title="开放平台参数配置">
<a-card :bordered="false">
<div class="table-page-search-wrapper">
<a-form layout="inline">

@ -185,7 +185,6 @@ export default {
validateFields(validateFieldsKey, { force: true }, (err, values) => {
if (!err) {
console.log('login form', values)
const loginParams = { ...values }
delete loginParams.username
loginParams[!state.loginType ? 'email' : 'username'] = values.username

@ -515,3 +515,29 @@ function cpu_count(): int
}
return $count > 0 ? $count : 4;
}
function env(string $key, $default = null)
{
$value = getenv($key);
if ($value === false) {
return value($default);
}
switch (strtolower($value)) {
case 'true':
case '(true)':
return true;
case 'false':
case '(false)':
return false;
case 'empty':
case '(empty)':
return '';
case 'null':
case '(null)':
return null;
}
if (($valueLength = strlen($value)) > 1 && $value[0] === '"' && $value[$valueLength - 1] === '"') {
return substr($value, 1, -1);
}
return $value;
}
Loading…
Cancel
Save