基础数据库等配置文件修改
This commit is contained in:
parent
a1293723eb
commit
a49c9e31ab
1
lock/db/app.db.lock
Normal file
1
lock/db/app.db.lock
Normal file
@ -0,0 +1 @@
|
|||||||
|
time consuming:1172ms
|
1
lock/db/base.db.lock
Normal file
1
lock/db/base.db.lock
Normal file
@ -0,0 +1 @@
|
|||||||
|
time consuming:1035ms
|
1
lock/db/dict.db.lock
Normal file
1
lock/db/dict.db.lock
Normal file
@ -0,0 +1 @@
|
|||||||
|
time consuming:3188ms
|
1
lock/db/task.db.lock
Normal file
1
lock/db/task.db.lock
Normal file
@ -0,0 +1 @@
|
|||||||
|
time consuming:156ms
|
1
lock/menu/app.menu.lock
Normal file
1
lock/menu/app.menu.lock
Normal file
@ -0,0 +1 @@
|
|||||||
|
success
|
1
lock/menu/base.menu.lock
Normal file
1
lock/menu/base.menu.lock
Normal file
@ -0,0 +1 @@
|
|||||||
|
success
|
1
lock/menu/cs.menu.lock
Normal file
1
lock/menu/cs.menu.lock
Normal file
@ -0,0 +1 @@
|
|||||||
|
success
|
1
lock/menu/fixtures.menu.lock
Normal file
1
lock/menu/fixtures.menu.lock
Normal file
@ -0,0 +1 @@
|
|||||||
|
success
|
@ -54,8 +54,8 @@ export default {
|
|||||||
// },
|
// },
|
||||||
cool: {
|
cool: {
|
||||||
redis: {
|
redis: {
|
||||||
host: '127.0.0.1',
|
host: '120.48.5.80',
|
||||||
password: '',
|
password: 'redis_b3YetY',
|
||||||
port: 6379,
|
port: 6379,
|
||||||
db: 10,
|
db: 10,
|
||||||
},
|
},
|
||||||
|
@ -9,11 +9,11 @@ export default {
|
|||||||
dataSource: {
|
dataSource: {
|
||||||
default: {
|
default: {
|
||||||
type: 'mysql',
|
type: 'mysql',
|
||||||
host: '127.0.0.1',
|
host: '120.48.5.80',
|
||||||
port: 3306,
|
port: 3306,
|
||||||
username: 'root',
|
username: 'root',
|
||||||
password: '123456',
|
password: 'mysql_PjAFkh',
|
||||||
database: 'mall',
|
database: 'automated_test',
|
||||||
// 自动建表 注意:线上部署的时候不要使用,有可能导致数据丢失
|
// 自动建表 注意:线上部署的时候不要使用,有可能导致数据丢失
|
||||||
synchronize: true,
|
synchronize: true,
|
||||||
// 打印日志
|
// 打印日志
|
||||||
|
@ -5,9 +5,9 @@ import { createAdapter } from '@socket.io/redis-adapter';
|
|||||||
import Redis from 'ioredis';
|
import Redis from 'ioredis';
|
||||||
|
|
||||||
const redis = {
|
const redis = {
|
||||||
host: '127.0.0.1',
|
host: '120.48.5.80',
|
||||||
port: 6379,
|
port: 6379,
|
||||||
password: '',
|
password: 'redis_b3YetY',
|
||||||
db: 0,
|
db: 0,
|
||||||
};
|
};
|
||||||
const pubClient = new Redis(redis);
|
const pubClient = new Redis(redis);
|
||||||
|
19
src/modules/fixtures/config.ts
Normal file
19
src/modules/fixtures/config.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { ModuleConfig } from '@cool-midway/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块配置
|
||||||
|
*/
|
||||||
|
export default () => {
|
||||||
|
return {
|
||||||
|
// 模块名称
|
||||||
|
name: '页面装修模块',
|
||||||
|
// 模块描述
|
||||||
|
description: '装修管理',
|
||||||
|
// 中间件,只对本模块有效
|
||||||
|
middlewares: [],
|
||||||
|
// 中间件,全局有效
|
||||||
|
globalMiddlewares: [],
|
||||||
|
// 模块加载顺序,默认为0,值越大越优先加载
|
||||||
|
order: 0,
|
||||||
|
} as ModuleConfig;
|
||||||
|
};
|
30
src/modules/fixtures/controller/admin/mould.ts
Normal file
30
src/modules/fixtures/controller/admin/mould.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { CoolController, BaseController } from '@cool-midway/core';
|
||||||
|
import { Body, Inject, Post,Get } from '@midwayjs/core';
|
||||||
|
import { FixturesMouldEntity } from '../../entity/mould';
|
||||||
|
import { FixturesMouldService } from '../../service/mould';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面装修
|
||||||
|
*/
|
||||||
|
@CoolController({
|
||||||
|
api: ['add', 'delete', 'update', 'info', 'list', 'page'],
|
||||||
|
entity: FixturesMouldEntity,
|
||||||
|
service: FixturesMouldService,
|
||||||
|
pageQueryOp: {
|
||||||
|
keyWordLikeFields: ['name']
|
||||||
|
}
|
||||||
|
})
|
||||||
|
export class AdminFixturesMouldController extends BaseController {
|
||||||
|
@Inject()
|
||||||
|
fixturesMouldService: FixturesMouldService;
|
||||||
|
|
||||||
|
@Post('/getFixturesPreviewCode', { summary: '保存配置' })
|
||||||
|
async getFixturesPreviewCode(@Body() body) {
|
||||||
|
return this.ok(await this.fixturesMouldService.getFixturesPreviewCode(body));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('/getPlatformPages', { summary: '获取平台页面' })
|
||||||
|
async getPlatformPages() {
|
||||||
|
return this.ok(await this.fixturesMouldService.getPlatformPages());
|
||||||
|
}
|
||||||
|
}
|
30
src/modules/fixtures/controller/app/mould.ts
Normal file
30
src/modules/fixtures/controller/app/mould.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { CoolController, BaseController, CoolUrlTag, CoolTag, TagTypes } from '@cool-midway/core';
|
||||||
|
import { Get, Inject, Query } from '@midwayjs/core';
|
||||||
|
import { FixturesMouldEntity } from '../../entity/mould';
|
||||||
|
import { FixturesMouldService } from '../../service/mould';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装修页面
|
||||||
|
*/
|
||||||
|
@CoolController({
|
||||||
|
api: [],
|
||||||
|
entity: FixturesMouldEntity,
|
||||||
|
})
|
||||||
|
@CoolUrlTag()
|
||||||
|
export class AppFixturesMouldController extends BaseController {
|
||||||
|
@Inject()
|
||||||
|
fixturesMouldService: FixturesMouldService;
|
||||||
|
|
||||||
|
@CoolTag(TagTypes.IGNORE_TOKEN)
|
||||||
|
@Get('/getHomePage', { summary: '获取首页' })
|
||||||
|
async getHomePage() {
|
||||||
|
return this.ok(await this.fixturesMouldService.getHomePage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@CoolTag(TagTypes.IGNORE_TOKEN)
|
||||||
|
@Get('/getPage', { summary: '获取指定页面' })
|
||||||
|
async getPage(@Query('id') id: string) {
|
||||||
|
return this.ok(await this.fixturesMouldService.getPage(id));
|
||||||
|
}
|
||||||
|
}
|
37
src/modules/fixtures/entity/mould.ts
Normal file
37
src/modules/fixtures/entity/mould.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import { BaseEntity } from '@cool-midway/core';
|
||||||
|
import { Column, Entity, Index } from 'typeorm';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义页面
|
||||||
|
*/
|
||||||
|
@Entity('fixtures_mould')
|
||||||
|
export class FixturesMouldEntity extends BaseEntity {
|
||||||
|
|
||||||
|
@Column({ comment: '页面名称' })
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column({ comment: '页面背景色', default: '#f6f7f8' })
|
||||||
|
background: string;
|
||||||
|
|
||||||
|
@Column({ comment: '页面背景图', default: '', nullable: true })
|
||||||
|
backgroundImage: string;
|
||||||
|
|
||||||
|
@Index()
|
||||||
|
@Column({ comment: '是否首页 0-否 1-是', type: 'tinyint', default: 0 })
|
||||||
|
isHome: number;
|
||||||
|
|
||||||
|
@Column({ comment: '状态 0-关闭 1-正常', type: 'tinyint', default: 1 })
|
||||||
|
status: number;
|
||||||
|
|
||||||
|
@Column({ comment: '状态栏占位 0-隐藏 1-显示', type: 'tinyint', default: 1 })
|
||||||
|
statusBar: number;
|
||||||
|
|
||||||
|
@Column({ comment: '状态栏占位颜色', type: 'varchar', default: '#fff' })
|
||||||
|
statusBarColor: string;
|
||||||
|
|
||||||
|
@Column({ comment: '组件数据', type: 'json', nullable: true })
|
||||||
|
data: string;
|
||||||
|
|
||||||
|
@Column({ comment: '组件数据-未发布', type: 'json', nullable: true })
|
||||||
|
form: string;
|
||||||
|
}
|
1
src/modules/fixtures/menu.json
Normal file
1
src/modules/fixtures/menu.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"name":"页面装修","router":null,"perms":null,"type":0,"icon":"icon-design","orderNum":14,"viewPath":null,"keepAlive":true,"isShow":true,"childMenus":[{"name":"自定义页面","router":"/fixtures/mould","perms":null,"type":1,"icon":"icon-device","orderNum":2,"viewPath":"modules/fixtures/views/mould.vue","keepAlive":true,"isShow":true,"childMenus":[{"name":"权限","router":null,"perms":"fixtures:mould:delete,fixtures:mould:update,fixtures:mould:info,fixtures:mould:list,fixtures:mould:page,fixtures:mould:add","type":2,"icon":null,"orderNum":0,"viewPath":null,"keepAlive":true,"isShow":true,"childMenus":[]}]},{"name":"页面组装","router":"/fixtures/mould/edit","perms":null,"type":1,"icon":"icon-iot","orderNum":0,"viewPath":"modules/fixtures/views/edit.vue","keepAlive":true,"isShow":false,"childMenus":[]}]}]
|
125
src/modules/fixtures/service/mould.ts
Normal file
125
src/modules/fixtures/service/mould.ts
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
import { Init, Inject, Provide } from '@midwayjs/decorator';
|
||||||
|
import { BaseService, CoolCommException } from '@cool-midway/core';
|
||||||
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||||
|
import { Repository } from 'typeorm';
|
||||||
|
import { FixturesMouldEntity } from '../entity/mould';
|
||||||
|
import { PluginService } from '../../plugin/service/info';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面
|
||||||
|
*/
|
||||||
|
@Provide()
|
||||||
|
export class FixturesMouldService extends BaseService {
|
||||||
|
@InjectEntityModel(FixturesMouldEntity)
|
||||||
|
fixturesMouldEntity: Repository<FixturesMouldEntity>;
|
||||||
|
@Inject()
|
||||||
|
pluginService: PluginService;
|
||||||
|
@Init()
|
||||||
|
async init() {
|
||||||
|
await super.init();
|
||||||
|
this.setEntity(this.fixturesMouldEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新页面
|
||||||
|
*/
|
||||||
|
async update(param: FixturesMouldEntity) {
|
||||||
|
if (param.isHome) {
|
||||||
|
await this.fixturesMouldEntity.update({ isHome: 1 }, { isHome: 0 })
|
||||||
|
}
|
||||||
|
await this.fixturesMouldEntity.save(param)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取首页
|
||||||
|
*/
|
||||||
|
async getHomePage() {
|
||||||
|
const data = await this.fixturesMouldEntity.findOne({ where: { isHome: 1 } })
|
||||||
|
if (!data || !data.status) throw new CoolCommException('该页面已丢失~');
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定页面
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
async getPage(id: string) {
|
||||||
|
if (!Number(id)) throw new CoolCommException('该页面已丢失~');
|
||||||
|
const data = await this.fixturesMouldEntity.findOne({ where: { id: Number(id) } })
|
||||||
|
if (!data || !data.status) throw new CoolCommException('该页面已丢失~');
|
||||||
|
|
||||||
|
if (!data.data) throw new CoolCommException('该页面未发布~');
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取页面预览小程序码
|
||||||
|
* 需要调用 wx 插件 https://www.cool-admin.com/plugin/70
|
||||||
|
*因为不注释掉,连 npm run dev 都过不了。。。
|
||||||
|
*/
|
||||||
|
async getFixturesPreviewCode(body: any) {
|
||||||
|
throw new CoolCommException('请手动修改关闭代码注释 在 fixtures-service-mould-getFixturesPreviewCode')
|
||||||
|
// const { id, form } = body
|
||||||
|
// const info = await this.fixturesMouldEntity.findOne({ where: { id: id } })
|
||||||
|
// if (!info) throw new CoolCommException('数据不存在~');
|
||||||
|
// await this.fixturesMouldEntity.update({ id: info.id }, { form: form })
|
||||||
|
// // 获取插件实例
|
||||||
|
// const instance = await this.pluginService.getInstance('wx');
|
||||||
|
// // 获得小程序实例
|
||||||
|
// const MiniApp = await instance.MiniApp();
|
||||||
|
// const miniToken = await MiniApp.getAccessToken().getToken();
|
||||||
|
// let miniUrl = `https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=${miniToken}`
|
||||||
|
// // 获取 api 调用客户端
|
||||||
|
// let client = MiniApp.getClient();
|
||||||
|
// const data = {
|
||||||
|
// page: "uni_modules/cool-fixtures/pages/preview",
|
||||||
|
// scene: `id=${info.id}`,
|
||||||
|
// width: 200,
|
||||||
|
// check_path: false,
|
||||||
|
// }
|
||||||
|
// const result = await client.post(miniUrl, { data, responseType: 'arraybuffer' });
|
||||||
|
// const buffer = Buffer.from(result.response.data, 'base64');
|
||||||
|
// return 'data:image/png;base64,' + buffer.toString('base64');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取平台页面
|
||||||
|
*/
|
||||||
|
async getPlatformPages() {
|
||||||
|
const data = [
|
||||||
|
{
|
||||||
|
name: '基础页面',
|
||||||
|
children: [{ name: '平台首页', page: '/pages/index/home' },
|
||||||
|
{ name: '轻松赚钱', page: '/pages/index/introduce' },
|
||||||
|
{ name: '购物车', page: '/pages/index/shopping-cart' },
|
||||||
|
{ name: '商品分类', page: '/pages/index/category' },
|
||||||
|
{ name: '会员中心', page: '/pages/index/my' },
|
||||||
|
{ name: '订单列表', page: '/pages/order/list' },
|
||||||
|
{ name: '我的收益', page: '/pages/user/balance/purse' },
|
||||||
|
{ name: '在线客服', page: '/uni_modules/cool-cs/pages/chat' },
|
||||||
|
{ name: '附近终端店', page: '/pages/partnership/sample/vicinity' },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '我的店铺',
|
||||||
|
children: [{ name: '店铺首页', page: '/pages/partnership/index' },
|
||||||
|
{ name: '店铺订单', page: '/pages/partnership/order' },
|
||||||
|
{ name: '店铺码', page: '/pages/partnership/code' },
|
||||||
|
{ name: '店铺代金券', page: '/pages/partnership/voucher/index' },
|
||||||
|
{ name: '店铺拉客工具', page: '/pages/partnership/activity/index' },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '抽奖活动',
|
||||||
|
children: [{ name: '期数集奖', page: '/pages/activity/index' },
|
||||||
|
{ name: '九宫格抽奖', page: '/pages/partnership/activity/lottery/detail' },
|
||||||
|
{ name: '邀请赢红包', page: '/pages/partnership/activity/laxin/detail' },
|
||||||
|
{ name: '邀请赢代金券', page: '/pages/partnership/activity/lake/detail' },
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user