first commit
1
康唯唯私活/Vr项目/code/src/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
d7003c62-8b86-49a2-af15-a3772fb0fd7e
|
||||
1
康唯唯私活/Vr项目/code/src/config/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
1f9fca33-582d-4f4a-bb93-79d237adb020
|
||||
99
康唯唯私活/Vr项目/code/src/config/dev.ts
Executable file
@@ -0,0 +1,99 @@
|
||||
import path from "path";
|
||||
/**
|
||||
* 开发阶段环境配置
|
||||
*/
|
||||
export const dev = {
|
||||
// 程序默认运行端口
|
||||
port: 80,
|
||||
// 绑定的域名
|
||||
host: "www.geekhelp.cn",
|
||||
// api接口基地址,如果改这个了,请改管理后台的axios基地址配置
|
||||
apiurl: '/bmy/api',
|
||||
// 初始化 koa2 插件需要的一些配置
|
||||
initPlugins: {
|
||||
SessionKey: '4WM7mSy5S5kkxcE1I3', // SessionKey: koa-session 秘钥
|
||||
staticPath: '../resources/static', // 静态资源目录
|
||||
viewsPath: '../resources/view' // 页面视图存放路径
|
||||
},
|
||||
// 终端的欢迎信息
|
||||
banner: {
|
||||
welcome: () => {
|
||||
return `
|
||||
👏 VR 产品介绍网站 👏
|
||||
|
||||
👉 1:PC官网: http://${dev.host}:${dev.port}/
|
||||
👉 2:Admin后台: http://${dev.host}:3030/#/course/all
|
||||
`
|
||||
}
|
||||
},
|
||||
logConfig: {
|
||||
appenders: {
|
||||
//系统日志
|
||||
access: {
|
||||
type: 'dateFile',
|
||||
pattern: '_yyyy-MM-dd.log',
|
||||
alwaysIncludePattern: true,
|
||||
encoding:"utf-8",
|
||||
category: "access",
|
||||
filename: path.join(__dirname, '../../logs/access')
|
||||
},
|
||||
// 应用日志
|
||||
application: {
|
||||
type: 'dateFile',
|
||||
pattern: '_yyyy-MM-dd.log',
|
||||
alwaysIncludePattern: true,
|
||||
encoding:"utf-8",
|
||||
category: "application",
|
||||
filename: path.join(__dirname, '../../logs/application')
|
||||
},
|
||||
out: {
|
||||
type: 'console'
|
||||
}
|
||||
},
|
||||
categories: {
|
||||
default: { appenders: [ 'out' ], level: 'info' },
|
||||
access: { appenders: [ 'access' ], level: 'info' },
|
||||
application: { appenders: [ 'application' ], level: 'WARN'}
|
||||
}
|
||||
},
|
||||
// 七牛的核心配置,不熟悉七牛请勿修改
|
||||
qiniu: {
|
||||
// 七牛秘钥,七牛云管理后台获得,可以改成自己的
|
||||
accessKey: '0MGmT_rkMiaOeXY09B4EhBnXuDcIYyKlGumQ-zUt',
|
||||
secretKey: '59dfmEi9Q50rMlz9sxTBCvYDhM7biERAjflBXALb',
|
||||
// 视频切片的配置
|
||||
HLSconfig: {
|
||||
// 被切片后视频存放的基路径,如果需要修改域名,请到域名管理后台 CNAME 泛解析域到七牛云
|
||||
// 然后再到七牛配置 泛子域名 将二级域名绑定到指定空间,这里 video.* 被绑定到 m3u8video 空间
|
||||
VideoBaseUrl: 'http://vsassets.geekhelp.cn/',
|
||||
// 需要被切片的源视频所在七牛云的空间名
|
||||
FromBucket: 'vrcource',
|
||||
// 视频被切片后存放的空间名
|
||||
ToBucket: 'm3u8video',
|
||||
// 视频切片规则,参考七牛云官网文档来配置,或者在 多媒体队列 中复制切片参数
|
||||
VideoHlsParams: 'avthumb/m3u8/segtime/10/ab/128k/ar/44100/acodec/libfaac/r/30/vb/1000k/vcodec/libx264/stripmeta/0/noDomain/1|saveas/'
|
||||
}
|
||||
},
|
||||
// 网站浏览器标签卡的基础标题
|
||||
title: ' | 怪客课堂',
|
||||
// 本地Mysql数据库配置
|
||||
typeorm: {
|
||||
type: 'mysql',
|
||||
host: "localhost",
|
||||
charset: "utf8_general_ci",
|
||||
port: 3306,
|
||||
username: "root",
|
||||
password: "lb714500",
|
||||
database: "shop",
|
||||
logging: "all",
|
||||
synchronize: false,
|
||||
logger: "advanced-console",
|
||||
cache: {
|
||||
duration: 30000
|
||||
},
|
||||
maxQueryExecutionTime: 1000,
|
||||
entities: [
|
||||
`${path.join(__dirname,'../entity/*{.js,.ts}')}`
|
||||
]
|
||||
}
|
||||
};
|
||||
6
康唯唯私活/Vr项目/code/src/config/index.ts
Executable file
@@ -0,0 +1,6 @@
|
||||
// 开发环境配置
|
||||
import { dev } from "./dev";
|
||||
// 上线环境配置
|
||||
import { prod } from "./prod";
|
||||
|
||||
export const config = process.env.NODE_ENV == "dev" ? dev : prod;
|
||||
83
康唯唯私活/Vr项目/code/src/config/prod.ts
Executable file
@@ -0,0 +1,83 @@
|
||||
import path from "path";
|
||||
|
||||
/**
|
||||
* 上线阶段的环境配置
|
||||
*/
|
||||
export const prod = {
|
||||
port: 9090,
|
||||
host: "127.0.0.1",
|
||||
apiurl: '/bmy/api',
|
||||
uploadPath: '../resources/static/upload/',
|
||||
initPlugins: {
|
||||
SessionKey: '4WM7mSy5S5kkxcE1I3',
|
||||
staticPath: '../resources/static',
|
||||
viewsPath: '../resources/view'
|
||||
},
|
||||
banner: {
|
||||
welcome: () => {
|
||||
return `
|
||||
👏 VR 产品介绍网站 👏
|
||||
|
||||
👉 1:PC官网: http://${prod.host}:${prod.port}/
|
||||
👉 2:Admin后台: http://${prod.host}:3030/#/course/all
|
||||
`
|
||||
}
|
||||
},
|
||||
logConfig: {
|
||||
appenders: {
|
||||
access: {
|
||||
type: 'console',
|
||||
pattern: '-yyyy-MM-dd.log', //通过日期来生成文件
|
||||
alwaysIncludePattern: true, //文件名始终以日期区分
|
||||
encoding:"utf-8",
|
||||
filename: path.join(__dirname, '../../logs/access.log') //生成文件路径和文件名
|
||||
},
|
||||
//系统日志
|
||||
application: {
|
||||
type: 'console',
|
||||
pattern: '-yyyy-MM-dd.log', //通过日期来生成文件
|
||||
alwaysIncludePattern: true, //文件名始终以日期区分
|
||||
encoding:"utf-8",
|
||||
filename: path.join(__dirname, '../../logs/application.log') //生成文件路径和文件名
|
||||
},
|
||||
out: {
|
||||
type: 'console'
|
||||
}
|
||||
},
|
||||
categories: {
|
||||
default: { appenders: [ 'out' ], level: 'info' },
|
||||
access: { appenders: [ 'access' ], level: 'info' },
|
||||
application: { appenders: [ 'application' ], level: 'WARN'}
|
||||
}
|
||||
},
|
||||
qiniu: {
|
||||
accessKey: '0MGmT_rkMiaOeXY09B4EhBnXuDcIYyKlGumQ-zUt',
|
||||
secretKey: '59dfmEi9Q50rMlz9sxTBCvYDhM7biERAjflBXALb',
|
||||
HLSconfig: {
|
||||
VideoBaseUrl: 'http://video.geekhelp.cn/',
|
||||
FromBucket: 'guaikevideo',
|
||||
ToBucket: 'm3u8video',
|
||||
VideoHlsParams: 'avthumb/m3u8/segtime/10/ab/128k/ar/44100/acodec/libfaac/r/30/vb/640k/vcodec/libx264/stripmeta/0/noDomain/1|saveas/'
|
||||
}
|
||||
},
|
||||
title: ' | 怪客课堂',
|
||||
typeorm: {
|
||||
type: 'mysql',
|
||||
host: "localhost",
|
||||
charset: "utf8_general_ci",
|
||||
port: 3306,
|
||||
username: "root",
|
||||
password: "lb714500",
|
||||
database: "shop",
|
||||
logging: "error",
|
||||
logger: "file",
|
||||
synchronize: false,
|
||||
maxQueryExecutionTime: 1000,
|
||||
cache: {
|
||||
duration: 30000
|
||||
},
|
||||
entities: [
|
||||
`${path.join(__dirname,'../entity/*{.js,.ts}')}`
|
||||
]
|
||||
}
|
||||
};
|
||||
1
康唯唯私活/Vr项目/code/src/controller/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
99f93a39-40e7-4882-b31e-4f49a3fb2dfe
|
||||
1
康唯唯私活/Vr项目/code/src/controller/admin/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
100fff94-5a22-46b1-bdc7-8c6f078bdcab
|
||||
30
康唯唯私活/Vr项目/code/src/controller/admin/AdminController.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { JsonController, Body, Post, UploadedFile,UseInterceptor, Req, Res, Get } from "routing-controllers";
|
||||
import { JsonResponseInterceptor } from "../../middleware/JsonResponseMiddlewares";
|
||||
import { Service, Inject } from "typedi";
|
||||
import { config } from "../../config";
|
||||
import { utils } from "../../utils/utils";
|
||||
import { QiNiu } from "../../plugins/qiniu"
|
||||
|
||||
@Service()
|
||||
@JsonController(`${config.apiurl}/admin`)
|
||||
@UseInterceptor(JsonResponseInterceptor)
|
||||
|
||||
export class AdminController {
|
||||
|
||||
@Inject()
|
||||
private utils: utils;
|
||||
@Inject()
|
||||
private qiniu:QiNiu;
|
||||
|
||||
/**
|
||||
* 获取上传token,服务于图片,视频的上传
|
||||
* http://www.geekhelp.cn/bmy/api/admin/token
|
||||
* @param params
|
||||
* @constructor
|
||||
*/
|
||||
@Post("/token")
|
||||
public async Token (): Promise<Object> {
|
||||
return { qn_token: this.qiniu.GenerateToken() };
|
||||
}
|
||||
|
||||
}
|
||||
1
康唯唯私活/Vr项目/code/src/controller/api/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
8c5eb4f3-426d-4c22-864c-f2b649a48d45
|
||||
72
康唯唯私活/Vr项目/code/src/controller/api/UserControllerApi.ts
Executable file
@@ -0,0 +1,72 @@
|
||||
import { JsonController, Get, UseBefore, QueryParams, Body, UseInterceptor, Post } from "routing-controllers";
|
||||
import { config } from "../../config";
|
||||
import { JsonResponseInterceptor } from "../../middleware/JsonResponseMiddlewares";
|
||||
import { Service, Inject } from "typedi";
|
||||
import { UserServiceImpl } from "../../service/impl/UserServiceImpl";
|
||||
import { UserModel } from "../../model/UserModel";
|
||||
import { LogsMiddlewares } from "../../middleware/LogsMiddlewares";
|
||||
|
||||
@Service()
|
||||
@JsonController(`${config.apiurl}/user`)
|
||||
@UseInterceptor(JsonResponseInterceptor)
|
||||
export class UserControllerApi {
|
||||
|
||||
@Inject()
|
||||
private userServiceImpl: UserServiceImpl;
|
||||
|
||||
/**
|
||||
* @api {get} /user/oneUser oneUser
|
||||
* @apiVersion 1.1.0
|
||||
* @apiDescription 获取一条用户记录
|
||||
* @apiName oneUser
|
||||
* @apiGroup user
|
||||
* @apiParam {string} id 用户id
|
||||
* @apiSuccessExample {json} 请求成功的返回:
|
||||
* {
|
||||
* "status" : 200,
|
||||
* "result" : {
|
||||
* }
|
||||
* }
|
||||
* @apiErrorExample {json} 请求失败的返回
|
||||
* {
|
||||
* "status":200,
|
||||
* "result":{
|
||||
* }
|
||||
* }
|
||||
* @apiSampleRequest http://www.geekhelp.cn/bmy/api/user/oneUser
|
||||
* @apiVersion 1.0.0
|
||||
*/
|
||||
@Get("/oneUser")
|
||||
@UseBefore(LogsMiddlewares)
|
||||
public async oneUser (@QueryParams() query: UserModel): Promise<void> {
|
||||
return await this.userServiceImpl.getOneUserService(query.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /user/allUser allUser
|
||||
* @apiVersion 1.1.0
|
||||
* @apiDescription 获取所有用户信息
|
||||
* @apiName allUser
|
||||
* @apiGroup user
|
||||
* @apiSuccessExample {json} 请求成功的返回:
|
||||
* {
|
||||
* "status" : 200,
|
||||
* "result" : {
|
||||
* }
|
||||
* }
|
||||
* @apiErrorExample {json} 请求失败的返回
|
||||
* {
|
||||
* "status":200,
|
||||
* "result":{
|
||||
* }
|
||||
* }
|
||||
* @apiSampleRequest http://www.geekhelp.cn/bmy/api/user/allUser
|
||||
* @apiVersion 1.0.0
|
||||
*/
|
||||
@Get("/allUser")
|
||||
@UseBefore(LogsMiddlewares)
|
||||
public async allUser (): Promise<Object> {
|
||||
return await this.userServiceImpl.getAllUserService();
|
||||
}
|
||||
|
||||
}
|
||||
1
康唯唯私活/Vr项目/code/src/controller/home/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
9981d332-c264-45bb-9fea-7c4ab00a9082
|
||||
22
康唯唯私活/Vr项目/code/src/controller/home/AboutControllerHome.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import {Controller, Render, Get, UseBefore, Session} from "routing-controllers";
|
||||
import { utils } from "../../utils/utils";
|
||||
|
||||
@Controller()
|
||||
export class AboutControllerHome {
|
||||
@Get("/about")
|
||||
@Render("home/page/about")
|
||||
About(@Session() session) {
|
||||
return {
|
||||
title: utils.titleName("关于"),
|
||||
isShowAction: {
|
||||
header: true,
|
||||
footer: true
|
||||
},
|
||||
banner: {
|
||||
bannerTitle: '关于怪客',
|
||||
bannerUrl: '/img/banner_5.jpg',
|
||||
},
|
||||
login: session.user ? session.user : false
|
||||
}
|
||||
}
|
||||
}
|
||||
17
康唯唯私活/Vr项目/code/src/controller/home/ErrorControllerHome.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import {Controller, Render, Get, UseBefore, Session} from "routing-controllers";
|
||||
import { utils } from "../../utils/utils";
|
||||
|
||||
@Controller()
|
||||
export class ErrorControllerHome {
|
||||
@Get("/error")
|
||||
@Render("home/page/error")
|
||||
public Error() {
|
||||
return {
|
||||
title: utils.titleName("404..."),
|
||||
isShowAction: {
|
||||
header: false,
|
||||
footer: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
康唯唯私活/Vr项目/code/src/controller/home/IndexControllerHome.ts
Executable file
@@ -0,0 +1,21 @@
|
||||
import {Controller, Render, Get, UseBefore, Session} from "routing-controllers";
|
||||
import { utils } from "../../utils/utils";
|
||||
import { Service, Inject } from "typedi";
|
||||
|
||||
@Service()
|
||||
@Controller()
|
||||
export class IndexControllerHome {
|
||||
|
||||
@Get("/")
|
||||
@Render("home/page/index")
|
||||
public async Index(@Session() session,) {
|
||||
return {
|
||||
title: utils.titleName("首页"),
|
||||
isShowAction: {
|
||||
header: true,
|
||||
footer: true
|
||||
},
|
||||
login: session.user ? session.user : false
|
||||
}
|
||||
}
|
||||
}
|
||||
1
康唯唯私活/Vr项目/code/src/dao/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
eca0134b-30d7-4dfc-aca8-e9f949c29e00
|
||||
22
康唯唯私活/Vr项目/code/src/dao/UserDao.ts
Executable file
@@ -0,0 +1,22 @@
|
||||
import { Service , Inject } from "typedi";
|
||||
import { UserEntity } from "../entity/UserEntity";
|
||||
import { getRepository } from "typeorm";
|
||||
|
||||
@Service()
|
||||
export class UserDao {
|
||||
|
||||
/**
|
||||
* 查询用户具体信息
|
||||
* @param id
|
||||
*/
|
||||
public async getOneUserDao(id: string): Promise<any> {
|
||||
return await getRepository(UserEntity)
|
||||
.findOne({ where: { user_id: id} });
|
||||
}
|
||||
|
||||
public async AllUser(): Promise<any> {
|
||||
return await getRepository(UserEntity)
|
||||
.find();
|
||||
}
|
||||
|
||||
}
|
||||
1
康唯唯私活/Vr项目/code/src/entity/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
ec5fc0ad-3358-441d-9467-9dbb6e513197
|
||||
30
康唯唯私活/Vr项目/code/src/entity/UserEntity.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import {Entity, PrimaryGeneratedColumn, Column} from "typeorm";
|
||||
|
||||
@Entity("user")
|
||||
export class UserEntity {
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
user_id: number;
|
||||
|
||||
@Column()
|
||||
user_name: string;
|
||||
|
||||
@Column()
|
||||
user_pwd: string;
|
||||
|
||||
@Column()
|
||||
user_time: string;
|
||||
|
||||
@Column()
|
||||
user_money: string;
|
||||
|
||||
@Column()
|
||||
user_pic: string;
|
||||
|
||||
@Column()
|
||||
user_address: string;
|
||||
|
||||
@Column()
|
||||
user_phone: string;
|
||||
|
||||
}
|
||||
5
康唯唯私活/Vr项目/code/src/index.ts
Executable file
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* 启动文件入口
|
||||
*/
|
||||
import { App } from "./run/app";
|
||||
new App();
|
||||
1
康唯唯私活/Vr项目/code/src/middleware/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
ff0b6be2-e764-4370-91ee-c45e73b0740b
|
||||
14
康唯唯私活/Vr项目/code/src/middleware/CheckLoginMiddleware.ts
Executable file
@@ -0,0 +1,14 @@
|
||||
import { KoaMiddlewareInterface } from "routing-controllers";
|
||||
|
||||
/**
|
||||
* 判断用户是否登录,如果登录则继续访问,没有去登录
|
||||
*/
|
||||
export class CheckLoginMiddleware implements KoaMiddlewareInterface {
|
||||
use(context: any, next: (err?: any) => Promise<any>): Promise<any> {
|
||||
if (!context.session || !context.session.user) {
|
||||
context.redirect(`/reg?from=${context.request.url}`);
|
||||
}else {
|
||||
return next();
|
||||
}
|
||||
}
|
||||
}
|
||||
21
康唯唯私活/Vr项目/code/src/middleware/JsonResponseMiddlewares.ts
Executable file
@@ -0,0 +1,21 @@
|
||||
import { Interceptor, InterceptorInterface, Action } from "routing-controllers";
|
||||
import { ResultDataMiddlewares } from "./ResultDataMiddlewares";
|
||||
import { Service,Inject } from "typedi";
|
||||
import { Logs } from "../utils/logs";
|
||||
|
||||
// 拦截controller在数据响应给前端,按照标准格式输出数据,同时session存储用户
|
||||
@Service()
|
||||
export class JsonResponseInterceptor implements InterceptorInterface {
|
||||
|
||||
@Inject()
|
||||
private resultDataMiddlewares: ResultDataMiddlewares;
|
||||
|
||||
intercept(action: Action, content: any) {
|
||||
if (content == undefined || content.length == 0) {
|
||||
Logs.ApplicationLogger().error(action);
|
||||
return this.resultDataMiddlewares.error(action,"没有数据");
|
||||
} else if (content.length != 0 ) {
|
||||
return this.resultDataMiddlewares.success(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
20
康唯唯私活/Vr项目/code/src/middleware/LogsMiddlewares.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { KoaMiddlewareInterface, Action } from "routing-controllers";
|
||||
import { Service,Inject } from "typedi";
|
||||
import { Logs } from "../utils/logs";
|
||||
import moment from "moment";
|
||||
|
||||
/**
|
||||
* controller 拦截器
|
||||
* 拦截 controller 被访问前,进行访问的日志记录
|
||||
*/
|
||||
@Service()
|
||||
export class LogsMiddlewares implements KoaMiddlewareInterface {
|
||||
use(context: any, next: (err?: any) => Promise<any>): Promise<any> {
|
||||
if (context.request.method == "GET") {
|
||||
Logs.ApplicationLogger().warn(`${moment().format('YYYY-MM-DD HH:mm:ss')} ${context.request.ip} ${context.request.method} ${context.request.url} ${JSON.stringify(context.request.querystring)} ${JSON.stringify(context.request.header)} \n`);
|
||||
} else {
|
||||
Logs.ApplicationLogger().warn(`${moment().format('YYYY-MM-DD HH:mm:ss')} ${context.request.ip} ${context.request.method} ${context.request.url} ${JSON.stringify(context.request.body)} ${JSON.stringify(context.request.header)} \n`);
|
||||
}
|
||||
return next()
|
||||
}
|
||||
}
|
||||
72
康唯唯私活/Vr项目/code/src/middleware/ResultDataMiddlewares.ts
Executable file
@@ -0,0 +1,72 @@
|
||||
import {Action} from "routing-controllers";
|
||||
import { Service } from "typedi";
|
||||
|
||||
@Service()
|
||||
export class ResultDataMiddlewares {
|
||||
private _status : number;
|
||||
private _data: Object;
|
||||
private _methods;
|
||||
private _url;
|
||||
|
||||
get status(): number {
|
||||
return this._status;
|
||||
}
|
||||
|
||||
set status(value: number) {
|
||||
this._status = value;
|
||||
}
|
||||
|
||||
get data(): Object {
|
||||
return this._data;
|
||||
}
|
||||
|
||||
set data(value: Object) {
|
||||
this._data = value;
|
||||
}
|
||||
get methods() {
|
||||
return this._methods;
|
||||
}
|
||||
|
||||
set methods(value) {
|
||||
this._methods = value;
|
||||
}
|
||||
|
||||
get url() {
|
||||
return this._url;
|
||||
}
|
||||
|
||||
set url(value) {
|
||||
this._url = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据请求成功
|
||||
* @param _data 需要返回给前端的数据
|
||||
*/
|
||||
public success (_data:Object): string {
|
||||
this.status = 200;
|
||||
this.data = _data;
|
||||
return JSON.stringify({
|
||||
status: this.status,
|
||||
time: new Date(),
|
||||
result: this.data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据请求失败
|
||||
* @param action 请求对象
|
||||
*/
|
||||
public error (action: Action,message: string): string {
|
||||
this.status = action.response.status; // 状态码
|
||||
this.data = message; // 错误信息
|
||||
this.methods = action.request.method; // 请求方式
|
||||
this.url = action.request.url; // 请求地址
|
||||
return JSON.stringify({
|
||||
methods: this.methods,
|
||||
status: this.status,
|
||||
result: this.data,
|
||||
url: this.url
|
||||
})
|
||||
}
|
||||
}
|
||||
1
康唯唯私活/Vr项目/code/src/model/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
d31cb2c6-6d5c-4237-989d-08c3fda78a0b
|
||||
8
康唯唯私活/Vr项目/code/src/model/UserModel.ts
Executable file
@@ -0,0 +1,8 @@
|
||||
import { MinLength,IsInt, MaxLength,Allow,Validate } from 'class-validator';
|
||||
|
||||
export class UserModel {
|
||||
@MinLength(1,{
|
||||
message: 'id参数必须有'
|
||||
})
|
||||
id: string;
|
||||
}
|
||||
1
康唯唯私活/Vr项目/code/src/plugins/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
69cb9fb3-ee9b-458b-bef3-daf2bc2d2145
|
||||
63
康唯唯私活/Vr项目/code/src/plugins/qiniu.ts
Executable file
@@ -0,0 +1,63 @@
|
||||
import qiniu from "qiniu";
|
||||
import { Service } from "typedi";
|
||||
import { config } from "../config/index";
|
||||
|
||||
@Service()
|
||||
export class QiNiu {
|
||||
public FromBucket:string = config.qiniu.HLSconfig.FromBucket;
|
||||
public ToBucket:string = config.qiniu.HLSconfig.ToBucket;
|
||||
public VideoHlsParams:string = config.qiniu.HLSconfig.VideoHlsParams;
|
||||
|
||||
public accessKey:string = config.qiniu.accessKey;
|
||||
public secretKey:string = config.qiniu.secretKey;
|
||||
// 鉴权对象mac
|
||||
public mac:any;
|
||||
|
||||
constructor () {
|
||||
this.mac = new qiniu.auth.digest.Mac(this.accessKey, this.secretKey)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param BucketName
|
||||
* @constructor
|
||||
*/
|
||||
public GenerateToken (BucketName:string = "vrcource"): string {
|
||||
|
||||
let putPolicy = new qiniu.rs.PutPolicy({
|
||||
scope: BucketName,
|
||||
expires: 7200
|
||||
});
|
||||
|
||||
return putPolicy.uploadToken(this.mac);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据前端传递的 filename 文件名,对需要的视频进行切片配置,
|
||||
* 返回给前端 token,前端拿到 token 后通过form data将视频和
|
||||
* token 传递给七牛,七牛会根据token开始切片任务。这里不需要
|
||||
* 配置七牛切片成功后的回调通知,因为已经可以通过基地址+m3u8文件名拿到
|
||||
* 切片后的地址
|
||||
* @param params
|
||||
* @constructor
|
||||
*/
|
||||
public GenerateHlsToken (params:Object): Object {
|
||||
|
||||
let M3u8FileName = new Date().getTime();
|
||||
let saveHlsEntry = qiniu.util.urlsafeBase64Encode(`${this.ToBucket}:${M3u8FileName}`);
|
||||
|
||||
|
||||
const options = {
|
||||
scope: `${this.FromBucket}:${params['filename']}`,
|
||||
persistentOps: `${this.VideoHlsParams}${saveHlsEntry}`,
|
||||
persistentPipeline: 'guaikem3u8', // 多媒体处理队列名称,必填
|
||||
};
|
||||
|
||||
let putPolicy = new qiniu.rs.PutPolicy(options);
|
||||
return {
|
||||
filePath: `${config.qiniu.HLSconfig.VideoBaseUrl}${M3u8FileName}`,
|
||||
token: putPolicy.uploadToken(this.mac)
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
1
康唯唯私活/Vr项目/code/src/resources/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
5c218c69-2699-41a3-93d1-925b51669fb1
|
||||
1
康唯唯私活/Vr项目/code/src/resources/static/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
c5b28913-3a3b-484e-b9f2-a28a1c6d4989
|
||||
1
康唯唯私活/Vr项目/code/src/resources/static/css/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
bda32304-4a22-4b30-9e93-01d6aca51246
|
||||
1
康唯唯私活/Vr项目/code/src/resources/static/css/admin/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
c32e48ff-80dc-4886-b707-970ae76cce20
|
||||
8
康唯唯私活/Vr项目/code/src/resources/static/css/admin/index.css
Executable file
@@ -0,0 +1,8 @@
|
||||
.index h1 {
|
||||
color: red;
|
||||
}
|
||||
.index h2 {
|
||||
font-size-adjust: 19px;
|
||||
color: blue;
|
||||
font-weight: bold;
|
||||
}
|
||||
0
康唯唯私活/Vr项目/code/src/resources/static/css/base.css
Executable file
1
康唯唯私活/Vr项目/code/src/resources/static/css/home/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
c522ad26-81df-45fa-b710-8586ca7ac3b7
|
||||
3
康唯唯私活/Vr项目/code/src/resources/static/css/home/about.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.about {
|
||||
color: red;
|
||||
}
|
||||
38
康唯唯私活/Vr项目/code/src/resources/static/css/home/error.css
Normal file
@@ -0,0 +1,38 @@
|
||||
.error {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: row;
|
||||
}
|
||||
.error img {
|
||||
width: 270px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.error .i-message {
|
||||
margin-left: 19px;
|
||||
}
|
||||
.error .i-message .action {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.error .i-message .action a[href="/"] {
|
||||
margin-right: 15px;
|
||||
}
|
||||
.error .i-message ul {
|
||||
padding-left: 20px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.error .i-message h3 {
|
||||
font-size: 17px;
|
||||
margin-bottom: 10px;
|
||||
line-height: 27px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
.error .i-message a {
|
||||
color: #8d8d8d;
|
||||
}
|
||||
body,
|
||||
html,
|
||||
.error {
|
||||
height: 100%;
|
||||
}
|
||||
0
康唯唯私活/Vr项目/code/src/resources/static/css/home/index.css
Executable file
@@ -0,0 +1,4 @@
|
||||
.register {
|
||||
font-size: 30px;
|
||||
color: green;
|
||||
}
|
||||
3
康唯唯私活/Vr项目/code/src/resources/static/css/home/test.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.Test {
|
||||
color: red;
|
||||
}
|
||||
1
康唯唯私活/Vr项目/code/src/resources/static/css/tpl/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
299e7316-530d-447b-9f85-c3330e38a7dd
|
||||
0
康唯唯私活/Vr项目/code/src/resources/static/css/tpl/colors.css
Executable file
0
康唯唯私活/Vr项目/code/src/resources/static/css/tpl/mixins.css
Executable file
1
康唯唯私活/Vr项目/code/src/resources/static/fonts/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
822d216e-92f7-4793-9f16-03b1bd4fa43d
|
||||
1
康唯唯私活/Vr项目/code/src/resources/static/img/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
8760d284-82aa-4273-8786-4869ef514e61
|
||||
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/banner.png
Executable file
|
After Width: | Height: | Size: 340 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/banner_1.png
Executable file
|
After Width: | Height: | Size: 232 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/banner_2.png
Executable file
|
After Width: | Height: | Size: 492 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/banner_3.png
Executable file
|
After Width: | Height: | Size: 492 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/banner_4.jpg
Executable file
|
After Width: | Height: | Size: 142 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/banner_5.jpg
Executable file
|
After Width: | Height: | Size: 200 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/banner_6.jpg
Executable file
|
After Width: | Height: | Size: 123 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/banner_7.png
Executable file
|
After Width: | Height: | Size: 96 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/bgError.png
Executable file
|
After Width: | Height: | Size: 40 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/discountbanner.png
Executable file
|
After Width: | Height: | Size: 108 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/favicon.ico
Executable file
|
After Width: | Height: | Size: 40 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/getbg.png
Executable file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/spjcdet_img1.png
Executable file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/spjcdet_img2.jpg
Executable file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/spjcdet_img3.png
Executable file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/spjcdet_img4.png
Executable file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/wx.png
Executable file
|
After Width: | Height: | Size: 114 KiB |
BIN
康唯唯私活/Vr项目/code/src/resources/static/img/youh.png
Executable file
|
After Width: | Height: | Size: 3.9 KiB |
1
康唯唯私活/Vr项目/code/src/resources/static/js/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
e890eb7d-4259-4e87-91d0-d15946c21144
|
||||
32
康唯唯私活/Vr项目/code/src/resources/static/js/app.js
Executable file
@@ -0,0 +1,32 @@
|
||||
requirejs.config({
|
||||
baseUrl: '/js',
|
||||
waitSeconds: 0,
|
||||
paths: {
|
||||
app: 'app',
|
||||
jquery: 'lib/jquery.min',
|
||||
swiper: 'lib/swiper/swiper.min',
|
||||
zui: 'lib/zui/js/zui.min',
|
||||
utils: 'utils/index',
|
||||
config: 'config/index'
|
||||
},
|
||||
map: {
|
||||
'*': {
|
||||
'css': 'lib/css'
|
||||
}
|
||||
},
|
||||
shim : { // 按需加载css
|
||||
'app/index': { deps: ['css!/css/home/index.css','css!/js/lib/swiper/swiper.min.css'] },
|
||||
'app/about': { deps: ['css!/css/home/about.css'] },
|
||||
'app/register': { deps: ['css!/css/home/register.css'] }
|
||||
}
|
||||
});
|
||||
|
||||
// 读取每个页面自定义属性data-module获取js文件名,然后自动加载并调用非对应页面的js文件中的 init 方法
|
||||
requirejs(["jquery"],function ($) {
|
||||
var module = $('.pages').attr('data-module');
|
||||
if(module != undefined){
|
||||
requirejs([ `app/${ module }` ], function (module) {
|
||||
module.init();
|
||||
})
|
||||
}
|
||||
});
|
||||
1
康唯唯私活/Vr项目/code/src/resources/static/js/app/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
0d7537f8-59c8-42fb-bf9c-c4b663f5957f
|
||||
12
康唯唯私活/Vr项目/code/src/resources/static/js/app/about.js
Executable file
@@ -0,0 +1,12 @@
|
||||
define(['jquery','utils'],function ($,utils) {
|
||||
function about() {
|
||||
|
||||
}
|
||||
|
||||
about.prototype = {
|
||||
init () {
|
||||
}
|
||||
};
|
||||
|
||||
return new about();
|
||||
});
|
||||
30
康唯唯私活/Vr项目/code/src/resources/static/js/app/index.js
Executable file
@@ -0,0 +1,30 @@
|
||||
define(['jquery','swiper','utils', 'zui'],function ($,swiper,utils) {
|
||||
function Index() {
|
||||
|
||||
}
|
||||
|
||||
Index.prototype = {
|
||||
init () {
|
||||
new $.zui.Messager('zui弹窗。', {
|
||||
icon: 'heart',
|
||||
placement: 'center'
|
||||
}).show();
|
||||
},
|
||||
|
||||
//初始化 swiper 轮播图
|
||||
newSwiper () {
|
||||
// new swiper ('.swiper-container', {
|
||||
// direction: 'horizontal',
|
||||
// loop: true,
|
||||
// autoplay: true,
|
||||
// pagination: {
|
||||
// el: '.swiper-pagination',
|
||||
// clickable :true,
|
||||
// }
|
||||
// });
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
return new Index();
|
||||
})
|
||||
14
康唯唯私活/Vr项目/code/src/resources/static/js/app/register.js
Normal file
@@ -0,0 +1,14 @@
|
||||
define(['jquery','swiper','utils'],function ($,swiper,utils) {
|
||||
function Register() {
|
||||
|
||||
}
|
||||
|
||||
Register.prototype = {
|
||||
init () {
|
||||
console.log("用户注册")
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
return new Register();
|
||||
});
|
||||
1
康唯唯私活/Vr项目/code/src/resources/static/js/config/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
dfeeb4ef-f1ca-449f-aa0c-9ae39d019a27
|
||||
10
康唯唯私活/Vr项目/code/src/resources/static/js/config/index.js
Executable file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* 网站前端的 config 配置文件
|
||||
*/
|
||||
define([], function () {
|
||||
return {
|
||||
|
||||
// 请求基地址
|
||||
baseURL: 'http://www.geekhelp.cn/bmy/api'
|
||||
}
|
||||
})
|
||||
1
康唯唯私活/Vr项目/code/src/resources/static/js/lib/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
0fac95a9-0111-44b7-89a1-f8d18375630e
|
||||
169
康唯唯私活/Vr项目/code/src/resources/static/js/lib/css.js
Executable file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Require-CSS RequireJS css! loader plugin
|
||||
* 0.1.10
|
||||
* Guy Bedford 2014
|
||||
* MIT
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Usage:
|
||||
* require(['css!./mycssFile']);
|
||||
*
|
||||
* Tested and working in (up to latest versions as of March 2013):
|
||||
* Android
|
||||
* iOS 6
|
||||
* IE 6 - 10
|
||||
* Chrome 3 - 26
|
||||
* Firefox 3.5 - 19
|
||||
* Opera 10 - 12
|
||||
*
|
||||
* browserling.com used for virtual testing environment
|
||||
*
|
||||
* Credit to B Cavalier & J Hann for the IE 6 - 9 method,
|
||||
* refined with help from Martin Cermak
|
||||
*
|
||||
* Sources that helped along the way:
|
||||
* - https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent
|
||||
* - http://www.phpied.com/when-is-a-stylesheet-really-loaded/
|
||||
* - https://github.com/cujojs/curl/blob/master/src/curl/plugin/css.js
|
||||
*
|
||||
*/
|
||||
|
||||
define(function() {
|
||||
//>>excludeStart('excludeRequireCss', pragmas.excludeRequireCss)
|
||||
if (typeof window == 'undefined')
|
||||
return { load: function(n, r, load){ load() } };
|
||||
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
|
||||
var engine = window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)|AndroidWebKit\/([^ ;]*)/) || 0;
|
||||
|
||||
// use <style> @import load method (IE < 9, Firefox < 18)
|
||||
var useImportLoad = false;
|
||||
|
||||
// set to false for explicit <link> load checking when onload doesn't work perfectly (webkit)
|
||||
var useOnload = true;
|
||||
|
||||
// trident / msie
|
||||
if (engine[1] || engine[7])
|
||||
useImportLoad = parseInt(engine[1]) < 6 || parseInt(engine[7]) <= 9;
|
||||
// webkit
|
||||
else if (engine[2] || engine[8] || 'WebkitAppearance' in document.documentElement.style)
|
||||
useOnload = false;
|
||||
// gecko
|
||||
else if (engine[4])
|
||||
useImportLoad = parseInt(engine[4]) < 18;
|
||||
|
||||
//>>excludeEnd('excludeRequireCss')
|
||||
//main api object
|
||||
var cssAPI = {};
|
||||
|
||||
//>>excludeStart('excludeRequireCss', pragmas.excludeRequireCss)
|
||||
cssAPI.pluginBuilder = './css-builder';
|
||||
|
||||
// <style> @import load method
|
||||
var curStyle, curSheet;
|
||||
var createStyle = function () {
|
||||
curStyle = document.createElement('style');
|
||||
head.appendChild(curStyle);
|
||||
curSheet = curStyle.styleSheet || curStyle.sheet;
|
||||
}
|
||||
var ieCnt = 0;
|
||||
var ieLoads = [];
|
||||
var ieCurCallback;
|
||||
|
||||
var createIeLoad = function(url) {
|
||||
curSheet.addImport(url);
|
||||
curStyle.onload = function(){ processIeLoad() };
|
||||
|
||||
ieCnt++;
|
||||
if (ieCnt == 31) {
|
||||
createStyle();
|
||||
ieCnt = 0;
|
||||
}
|
||||
}
|
||||
var processIeLoad = function() {
|
||||
ieCurCallback();
|
||||
|
||||
var nextLoad = ieLoads.shift();
|
||||
|
||||
if (!nextLoad) {
|
||||
ieCurCallback = null;
|
||||
return;
|
||||
}
|
||||
|
||||
ieCurCallback = nextLoad[1];
|
||||
createIeLoad(nextLoad[0]);
|
||||
}
|
||||
var importLoad = function(url, callback) {
|
||||
if (!curSheet || !curSheet.addImport)
|
||||
createStyle();
|
||||
|
||||
if (curSheet && curSheet.addImport) {
|
||||
// old IE
|
||||
if (ieCurCallback) {
|
||||
ieLoads.push([url, callback]);
|
||||
}
|
||||
else {
|
||||
createIeLoad(url);
|
||||
ieCurCallback = callback;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// old Firefox
|
||||
curStyle.textContent = '@import "' + url + '";';
|
||||
|
||||
var loadInterval = setInterval(function() {
|
||||
try {
|
||||
curStyle.sheet.cssRules;
|
||||
clearInterval(loadInterval);
|
||||
callback();
|
||||
} catch(e) {}
|
||||
}, 10);
|
||||
}
|
||||
}
|
||||
|
||||
// <link> load method
|
||||
var linkLoad = function(url, callback) {
|
||||
var link = document.createElement('link');
|
||||
link.type = 'text/css';
|
||||
link.rel = 'stylesheet';
|
||||
if (useOnload)
|
||||
link.onload = function() {
|
||||
link.onload = function() {};
|
||||
// for style dimensions queries, a short delay can still be necessary
|
||||
setTimeout(callback, 7);
|
||||
}
|
||||
else
|
||||
var loadInterval = setInterval(function() {
|
||||
for (var i = 0; i < document.styleSheets.length; i++) {
|
||||
var sheet = document.styleSheets[i];
|
||||
if (sheet.href == link.href) {
|
||||
clearInterval(loadInterval);
|
||||
return callback();
|
||||
}
|
||||
}
|
||||
}, 10);
|
||||
link.href = url;
|
||||
head.appendChild(link);
|
||||
}
|
||||
|
||||
//>>excludeEnd('excludeRequireCss')
|
||||
cssAPI.normalize = function(name, normalize) {
|
||||
if (name.substr(name.length - 4, 4) == '.css')
|
||||
name = name.substr(0, name.length - 4);
|
||||
|
||||
return normalize(name);
|
||||
}
|
||||
|
||||
//>>excludeStart('excludeRequireCss', pragmas.excludeRequireCss)
|
||||
cssAPI.load = function(cssId, req, load, config) {
|
||||
|
||||
(useImportLoad ? importLoad : linkLoad)(req.toUrl(cssId + '.css'), load);
|
||||
|
||||
}
|
||||
|
||||
//>>excludeEnd('excludeRequireCss')
|
||||
return cssAPI;
|
||||
});
|
||||
2
康唯唯私活/Vr项目/code/src/resources/static/js/lib/jquery.min.js
vendored
Executable file
5
康唯唯私活/Vr项目/code/src/resources/static/js/lib/require.js
Executable file
@@ -0,0 +1 @@
|
||||
08e9f3b8-8401-4ade-84db-61258a18447e
|
||||
12
康唯唯私活/Vr项目/code/src/resources/static/js/lib/swiper/swiper.min.css
vendored
Normal file
13
康唯唯私活/Vr项目/code/src/resources/static/js/lib/swiper/swiper.min.js
vendored
Executable file
1
康唯唯私活/Vr项目/code/src/resources/static/js/lib/zui/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
c7c5b662-c5fe-40cc-b3cf-f2d144a07971
|
||||
@@ -0,0 +1 @@
|
||||
0f81602e-ae70-48e1-8c16-e722ed3b7402
|
||||
1358
康唯唯私活/Vr项目/code/src/resources/static/js/lib/zui/css/zui-theme.css
Normal file
8876
康唯唯私活/Vr项目/code/src/resources/static/js/lib/zui/css/zui.css
Normal file
6775
康唯唯私活/Vr项目/code/src/resources/static/js/lib/zui/css/zui.lite.css
Normal file
@@ -0,0 +1 @@
|
||||
f59c5a14-d6c9-4a7b-92e0-ebe991fcd49a
|
||||
|
After Width: | Height: | Size: 290 KiB |
@@ -0,0 +1 @@
|
||||
bd647184-39f6-41a4-a685-eaedac314f5b
|
||||
6569
康唯唯私活/Vr项目/code/src/resources/static/js/lib/zui/js/zui.js
Normal file
3523
康唯唯私活/Vr项目/code/src/resources/static/js/lib/zui/js/zui.lite.js
Normal file
15
康唯唯私活/Vr项目/code/src/resources/static/js/lib/zui/js/zui.lite.min.js
vendored
Normal file
16
康唯唯私活/Vr项目/code/src/resources/static/js/lib/zui/js/zui.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
fddfacac-a741-43a9-98d0-24d034b8ddf7
|
||||
@@ -0,0 +1 @@
|
||||
9d442e40-a61a-4b3d-abcd-dfa1f7a3995c
|
||||