基础数据库等配置文件修改

This commit is contained in:
lixin 2025-01-09 16:40:20 +08:00
parent a1293723eb
commit a49c9e31ab
17 changed files with 257 additions and 7 deletions

1
lock/db/app.db.lock Normal file
View File

@ -0,0 +1 @@
time consuming1172ms

1
lock/db/base.db.lock Normal file
View File

@ -0,0 +1 @@
time consuming1035ms

1
lock/db/dict.db.lock Normal file
View File

@ -0,0 +1 @@
time consuming3188ms

1
lock/db/task.db.lock Normal file
View File

@ -0,0 +1 @@
time consuming156ms

1
lock/menu/app.menu.lock Normal file
View File

@ -0,0 +1 @@
success

1
lock/menu/base.menu.lock Normal file
View File

@ -0,0 +1 @@
success

1
lock/menu/cs.menu.lock Normal file
View File

@ -0,0 +1 @@
success

View File

@ -0,0 +1 @@
success

View File

@ -54,8 +54,8 @@ export default {
// },
cool: {
redis: {
host: '127.0.0.1',
password: '',
host: '120.48.5.80',
password: 'redis_b3YetY',
port: 6379,
db: 10,
},

View File

@ -9,11 +9,11 @@ export default {
dataSource: {
default: {
type: 'mysql',
host: '127.0.0.1',
host: '120.48.5.80',
port: 3306,
username: 'root',
password: '123456',
database: 'mall',
password: 'mysql_PjAFkh',
database: 'automated_test',
// 自动建表 注意:线上部署的时候不要使用,有可能导致数据丢失
synchronize: true,
// 打印日志

View File

@ -5,9 +5,9 @@ import { createAdapter } from '@socket.io/redis-adapter';
import Redis from 'ioredis';
const redis = {
host: '127.0.0.1',
host: '120.48.5.80',
port: 6379,
password: '',
password: 'redis_b3YetY',
db: 0,
};
const pubClient = new Redis(redis);

View File

@ -0,0 +1,19 @@
import { ModuleConfig } from '@cool-midway/core';
/**
*
*/
export default () => {
return {
// 模块名称
name: '页面装修模块',
// 模块描述
description: '装修管理',
// 中间件,只对本模块有效
middlewares: [],
// 中间件,全局有效
globalMiddlewares: [],
// 模块加载顺序默认为0值越大越优先加载
order: 0,
} as ModuleConfig;
};

View 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());
}
}

View 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));
}
}

View 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;
}

View 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":[]}]}]

View 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
}
}