├── .gitignore ├── README.md ├── api ├── admin.md ├── order.md ├── shop.md ├── ticket.md ├── type.md ├── user.md └── 关于api用法的说明.md ├── config └── default.js ├── controller ├── admin │ └── index.js ├── order │ └── index.js ├── shop │ └── index.js ├── ticket │ └── index.js ├── type │ └── index.js └── user │ └── index.js ├── enum └── index.js ├── helper ├── index.js └── pojo.js ├── index.js ├── lib └── mysql.js ├── package.json ├── routers └── index.js ├── routes ├── admin │ └── index.js ├── index.js ├── methods.js ├── model │ └── index.js ├── order │ └── index.js ├── shop │ └── index.js ├── ticket │ └── index.js ├── type │ └── index.js └── user │ └── index.js ├── services ├── admin │ └── index.js ├── model │ └── index.js ├── order │ └── index.js ├── shop │ └── index.js ├── ticket │ └── index.js ├── type │ └── index.js └── user │ └── index.js ├── sql ├── lottery.sql └── lottery0-0-1.sql └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Loterry-node 2 | A backend for lottery 3 | 4 | 1. 打开mysql,运行sql下的sql语句 5 | 2. npm install 6 | 3. npm start 7 | 4. 查看api下各个接口所需要的参数及路径 8 | ### 文件夹详解 9 | 1. controller 10 | > 与数据库直接连接层,当不知道参数需要哪几个时可以进入看 11 | 2. routes 12 | > 里面定义了一堆路由,地址为/api/文件夹名/属性名,还有调用api相关的http方法 13 | 3. config 14 | > 里面定义了数据库的端口和数据库名称以及密码 15 | 4. api 16 | > 说明了各个api的用法 17 | -------------------------------------------------------------------------------- /api/admin.md: -------------------------------------------------------------------------------- 1 | - list 2 | > 获取所有admin列表 3 | - 参数:无 4 | - 返回:admin列表 5 | - del 6 | > 根据id删除对应的admin 7 | - 参数: id 8 | - 返回:无 9 | - add 10 | > 添加一个新的admin 11 | - 参数: account, phone, password, name, creator 12 | - 返回:无 13 | - update 14 | > 根据id修改管理员信息 15 | - 参数: account, phone, password, name, type, id(以上参数可变) 16 | - 返回:无 17 | -------------------------------------------------------------------------------- /api/order.md: -------------------------------------------------------------------------------- 1 | - list 2 | > 获取所有order列表 3 | - 参数:无 4 | - 返回:order列表 5 | - listb 6 | > 根据商家id查询订单信息 7 | - 参数: shopId 8 | - 返回: order列表 9 | - listu 10 | > 根据用户id查询订单信息 11 | - 参数: userId 12 | - 返回: order列表 13 | - del 14 | > 根据id删除对应的order 15 | - 参数: id 16 | - 返回:无 17 | - add 18 | > 添加一个新的order 19 | - 参数: userId, shopId, lotteryNumber, totalMoney 20 | - 返回:无 21 | - update 22 | > 根据id修改order信息 23 | - 参数: userId, shopId, name, lotteryNumber, orderTime, totalMoney, extraInfo(以上参数可变), id 24 | - 返回:无 25 | 26 | -------------------------------------------------------------------------------- /api/shop.md: -------------------------------------------------------------------------------- 1 | - list 2 | > 获取所有shop列表 3 | - 参数:无 4 | - 返回:shop列表 5 | - del 6 | > 根据id删除对应的shop 7 | - 参数: id 8 | - 返回:无 9 | - add 10 | > 添加一个新的shop 11 | - 参数: account, phone, password, name, address, businessNo 12 | - 返回:无 13 | - update 14 | > 根据id修改shop信息 15 | - 参数: account, phone, password, name, address, businessNo, extraInfo(以上参数可变), id 16 | - 返回:无 17 | - one 18 | > 根据单个id查询商家信息 19 | - 参数: id 20 | - 返回: 单个shop对象 21 | -------------------------------------------------------------------------------- /api/ticket.md: -------------------------------------------------------------------------------- 1 | - list 2 | > 获取所有ticket列表 3 | - 参数:无 4 | - 返回:ticket列表 5 | - lista 6 | > 获取所有ticket对应的列表名称 7 | - 参数:无 8 | - 返回:ticket列表 9 | - del 10 | > 根据id删除对应的ticket 11 | - 参数: id 12 | - 返回:无 13 | - add 14 | > 添加一个新的ticket 15 | - 参数: account, phone, password, name, creator 16 | - 返回:无 17 | - update 18 | > 根据id修改信息 19 | - 参数: account, phone, password, name, ticket, id(以上参数可变) 20 | - 返回:无 21 | - one 22 | > 根据id查询信息 23 | - 参数:id 24 | - 返回:单个对象 25 | -------------------------------------------------------------------------------- /api/type.md: -------------------------------------------------------------------------------- 1 | - list 2 | > 获取所有type列表 3 | - 参数:无 4 | - 返回:type列表 5 | - del 6 | > 根据id删除对应的type 7 | - 参数: id 8 | - 返回:无 9 | - add 10 | > 添加一个新的type 11 | - 参数: account, phone, password, name, creator 12 | - 返回:无 13 | - update 14 | > 根据id修改信息 15 | - 参数: account, phone, password, name, type, id(以上参数可变) 16 | - 返回:无 17 | - one 18 | > 根据id查询信息 19 | - 参数:id 20 | - 返回:单个对象 21 | -------------------------------------------------------------------------------- /api/user.md: -------------------------------------------------------------------------------- 1 | - list 2 | > 获取所有user列表 3 | - 参数:无 4 | - 返回:user列表 5 | - del 6 | > 根据id删除对应的user 7 | - 参数: id 8 | - 返回: retValue为空 9 | - add 10 | > 添加一个新的user 11 | - 参数: username, phone, password 12 | - 返回: retValue为空 13 | - update 14 | > 根据id修改用户信息 15 | - 参数: account, phone, password, name, type, id(以上参数可变) 16 | - 返回: retValue为空 -------------------------------------------------------------------------------- /api/关于api用法的说明.md: -------------------------------------------------------------------------------- 1 | ### 关于api用法的说明 2 | 3 | #### 1.基本路径为: api/文件名/方法名 4 | 5 | > 可以查看services下的文件夹名 6 | 7 | - 示例 8 | 9 | ```js 10 | // 文件在services下的admin 11 | const model = require('../model') 12 | const m = model([ 13 | 'list', // 这里是路径 14 | 'add', 15 | 'update', 16 | 'del' 17 | ], 'admin') 18 | 19 | module.exports = { 20 | ...m, 21 | } 22 | ``` 23 | 24 | 之后在目录生成的路径就是 25 | 26 | `/api/admin/list` 27 | 28 | `/api/admin/add` 29 | 30 | 调用时应使用 31 | 32 | `http://localhost:port/api/admin/xxx` 33 | 34 | #### 2.各个接口所需要的参数 35 | 36 | > 查看controller下的文件夹 37 | 38 | - 示例 39 | 40 | 对应`/api/admin/add`所需要的参数是: 41 | 42 | ```js 43 | const add = (val) => { 44 | // 在val里面解构出来的就是所需要的参数,以及参数名 45 | const { account, phone, password, name, creator } = val 46 | let _sql = 'insert into lottery_admin(account,phone,password,create_time,creator,name,type,status) values(?,?,?,now(),?,?,?,?);' 47 | return query( _sql, [ account, phone, password, creator, name,TYPES.NORMAL,STATUS.NORMAL] ) 48 | } 49 | ``` 50 | 51 | 52 | 53 | #### 3.其他 54 | 55 | - 所有的http方法只分为两种 56 | - 有参数为post 57 | - 无参数为get 58 | - 待补充... 59 | 60 | ​ -------------------------------------------------------------------------------- /config/default.js: -------------------------------------------------------------------------------- 1 | const config = { 2 | // 启动端口 3 | port: 1200, 4 | 5 | // 数据库配置 6 | database: { 7 | DATABASE: 'lottery', 8 | USERNAME: 'root', 9 | PASSWORD: 'lotterygroup', 10 | PORT: '3306', 11 | HOST: 'localhost' 12 | } 13 | } 14 | 15 | module.exports = config 16 | -------------------------------------------------------------------------------- /controller/admin/index.js: -------------------------------------------------------------------------------- 1 | const pool = require('../../lib/mysql') 2 | const { NtNUpdate } = require('../../helper') 3 | const STATUS = require('../../enum') 4 | const TYPES = { 5 | NORMAL: 0, 6 | } 7 | const { query } = pool 8 | // 新添管理员 9 | const add = (val) => { 10 | const { account, phone, password, name, creator } = val 11 | const _sql = 'insert into lottery_admin(account,phone,password,create_time,creator,name,type,status) values(?,?,?,now(),?,?,?,?);' 12 | return query( _sql, [ account, phone, password, creator, name,TYPES.NORMAL,STATUS.NORMAL] ) 13 | } 14 | 15 | const login = (val) => { 16 | const { account, password } = val 17 | const _sql = 'select * from lottery_admin where account = ? and password = ? and status = ?' 18 | return query( _sql, [ account, password, STATUS.NORMAL ] ) 19 | } 20 | 21 | // 更改管理员 22 | const update = (val) => { 23 | const { account, phone, password, name, type, id } = val 24 | const _sql = 'update lottery_admin set ' 25 | const { sql, args } = NtNUpdate({ account, phone, password, name, type }, _sql) 26 | _sql = sql + 'where id = ?' 27 | return query( _sql, [...args, id] ) 28 | } 29 | 30 | // 查询管理员 31 | const list = val => { 32 | const sql = 'select * from lottery_admin where status != ?' 33 | return query(sql, [ STATUS.DEL ]) 34 | } 35 | 36 | // 删除管理员 37 | const del = val => { 38 | const { id } = val 39 | const sql = 'update lottery_admin set status = ? where id = ?' 40 | return query(sql, [ STATUS.DEL, id ]) 41 | } 42 | 43 | module.exports = { 44 | add, 45 | list, 46 | update, 47 | del, 48 | login, 49 | } -------------------------------------------------------------------------------- /controller/order/index.js: -------------------------------------------------------------------------------- 1 | const pool = require('../../lib/mysql') 2 | const { NtNUpdate } = require('../../helper') 3 | const { query } = pool 4 | const STATUS = require('../../enum') 5 | 6 | // 新添订单 7 | const add = (val) => { 8 | const { userId, shopId, lotteryNumber, totalMoney } = val 9 | let _sql = 'insert into lottery_order(user_id,shop_id,lottery_number,total_money,order_time) values(?,?,?,?,now());' 10 | return query( _sql, [ userId, shopId, lotteryNumber, totalMoney ] ) 11 | } 12 | 13 | // 更改订单 14 | const update = (val) => { 15 | const { userId, shopId, lotteryNumber, totalMoney, orderTime, extraInfo, id } = val 16 | let _sql = 'update lottery_order set ' 17 | const { sql, args } = NtNUpdate({ user_id: userId, shop_id: shopId, lottery_number: lotteryNumber,total_money: totalMoney, order_time: orderTime, extra_info: extraInfo }, _sql) 18 | _sql = sql + 'where id = ?' 19 | return query( _sql, [...args, id] ) 20 | } 21 | 22 | // 查询订单 23 | const list = val => { 24 | const sql = 'select * from lottery_order where status != ?' 25 | return query(sql, [ STATUS.DEL ]) 26 | } 27 | 28 | // 根据商家查订单 29 | const listb = val => { 30 | const { shopId } = val 31 | const sql = 'select * from lottery_order where status != ? and shop_id = ?' 32 | return query(sql, [ STATUS.DEL, shopId ]) 33 | } 34 | 35 | // 根据用户查订单 36 | const listu = val => { 37 | const { userId } = val 38 | const sql = 'select * from lottery_order where status != ? and user_id = ?' 39 | return query(sql, [ STATUS.DEL, userId ]) 40 | } 41 | 42 | // 删除订单 43 | const del = val => { 44 | const { id } = val 45 | const sql = 'update lottery_order set status = ? where id = ?' 46 | return query(sql, [ STATUS.DEL, id ]) 47 | } 48 | 49 | module.exports = { 50 | add, 51 | list, 52 | listu, 53 | listb, 54 | update, 55 | del, 56 | } 57 | 58 | -------------------------------------------------------------------------------- /controller/shop/index.js: -------------------------------------------------------------------------------- 1 | const { query } = require('../../lib/mysql') 2 | const { NtNUpdate } = require('../../helper') 3 | const STATUS = require('../../enum') 4 | 5 | // 新添店铺 6 | const add = (val) => { 7 | const { account, name, password, address, phone, businessNo } = val 8 | let _sql = 'insert into lottery_shop(account,name,password,address,phone,business_no,status,create_time) values(?,?,?,?,?,?,?,now());' 9 | return query( _sql, [ account, name, password, address,phone,businessNo, STATUS.NORMAL] ) 10 | } 11 | 12 | // 更改店铺 13 | const update = (val) => { 14 | const { account, name, id, password, address, phone, businessNo, extraInfo} = val 15 | let _sql = 'update lottery_shop set ' 16 | const { sql, args } = NtNUpdate({ account, name, password, address, phone, business_no: businessNo, extra_info: extraInfo }, _sql) 17 | _sql = sql + 'where id = ?' 18 | return query( _sql, [...args, id] ) 19 | } 20 | 21 | // 查询店铺 22 | const list = val => { 23 | const sql = 'select * from lottery_shop where status != ?' 24 | return query(sql, [ STATUS.DEL ]) 25 | } 26 | 27 | // 根据Id查询 28 | const one = val => { 29 | const { id } = val 30 | const sql = 'select * from lottery_shop where status != ? and id = ?' 31 | return query(sql, [ STATUS.DEL, id ]) 32 | } 33 | 34 | 35 | // 删除店铺 36 | const del = val => { 37 | const { id } = val 38 | const sql = 'update lottery_shop set status = ? where id = ?' 39 | return query(sql, [ STATUS.DEL, id ]) 40 | } 41 | 42 | module.exports = { 43 | add, 44 | list, 45 | one, 46 | update, 47 | del, 48 | } 49 | 50 | -------------------------------------------------------------------------------- /controller/ticket/index.js: -------------------------------------------------------------------------------- 1 | const { query } = require('../../lib/mysql') 2 | const { NtNUpdate } = require('../../helper') 3 | const STATUS = require('../../enum') 4 | 5 | // 新添投注 6 | const add = (val) => { 7 | const { typeId, period, boomTime, prize } = val 8 | let _sql = 'insert into lottery_ticket(type_id,period,boom_time,prize,status,create_time) values(?,?,?,?,?,now());' 9 | return query( _sql, [ typeId, period, boomTime,prize ? prize : 0, STATUS.NORMAL] ) 10 | } 11 | 12 | // 更改投注 13 | const update = (val) => { 14 | const { typeId, period, boomTime, prize, winningNumber, extraInfo, id } = val 15 | let _sql = 'update lottery_ticket set ' 16 | const { sql, args } = NtNUpdate({ typeId, period, boom_time: boomTime, prize, winning_number: winningNumber, extra_info: extraInfo }, _sql) 17 | _sql = sql + 'where id = ?' 18 | return query( _sql, [...args, id] ) 19 | } 20 | 21 | // 查询投注 22 | const list = val => { 23 | const sql = 'select * from lottery_ticket where status != ?' 24 | return query(sql, [ STATUS.DEL ]) 25 | } 26 | 27 | // 查询所有集合标注 28 | const lista = val => { 29 | const sql = 'select t.period , ty.name, t.boom_time as boomTime, t.boom_number as boomNumber, t.winning_number as winningNumber, t.prize, t.extra_info as extraInfo from lottery_ticket as t, lottery_type as ty where t.type_id = ty.id and t.status != ?' 30 | return query(sql, [ STATUS.ABA ]) 31 | } 32 | 33 | // 根据Id查询 34 | const one = val => { 35 | const { id } = val 36 | const sql = 'select * from lottery_ticket where status != ? and id = ?' 37 | return query(sql, [ STATUS.DEL, id ]) 38 | } 39 | 40 | 41 | // 删除投注 42 | const del = val => { 43 | const { id } = val 44 | const sql = 'update lottery_ticket set status = ? where id = ?' 45 | return query(sql, [ STATUS.DEL, id ]) 46 | } 47 | 48 | module.exports = { 49 | add, 50 | list, 51 | lista, 52 | one, 53 | update, 54 | del, 55 | } 56 | 57 | -------------------------------------------------------------------------------- /controller/type/index.js: -------------------------------------------------------------------------------- 1 | const { query } = require('../../lib/mysql') 2 | const { NtNUpdate } = require('../../helper') 3 | const STATUS = require('../../enum') 4 | 5 | // 新添彩票类型 6 | const add = (val) => { 7 | const { name, creator } = val 8 | let _sql = 'insert into lottery_type(name,creator,status,create_time) values(?,?,?,now());' 9 | return query( _sql, [ name, creator, STATUS.NORMAL ] ) 10 | } 11 | 12 | // 更改彩票类型 13 | const update = (val) => { 14 | const { name, extraInfo, id } = val 15 | let _sql = 'update lottery_type set ' 16 | const { sql, args } = NtNUpdate({ name, extra_info: extraInfo }, _sql) 17 | _sql = sql + 'where id = ?' 18 | return query( _sql, [...args, id] ) 19 | } 20 | 21 | // 查询彩票类型 22 | const list = val => { 23 | const sql = 'select * from lottery_type where status != ?' 24 | return query(sql, [ STATUS.DEL ]) 25 | } 26 | 27 | // 根据Id查询 28 | const one = val => { 29 | const { shopId } = val 30 | const sql = 'select * from lottery_type where status != ? and id = ?' 31 | return query(sql, [ STATUS.DEL, shopId ]) 32 | } 33 | 34 | 35 | // 删除彩票类型 36 | const del = val => { 37 | const { id } = val 38 | const sql = 'update lottery_type set status = ? where id = ?' 39 | return query(sql, [ STATUS.DEL, id ]) 40 | } 41 | 42 | module.exports = { 43 | add, 44 | list, 45 | one, 46 | update, 47 | del, 48 | } 49 | 50 | -------------------------------------------------------------------------------- /controller/user/index.js: -------------------------------------------------------------------------------- 1 | const pool = require('../../lib/mysql') 2 | const { NtNUpdate } = require('../../helper') 3 | const { query } = pool 4 | const TYPES = require('../../enum') 5 | 6 | // 新添用户 7 | const add = (val) => { 8 | const { username, phone, password } = val 9 | let _sql = 'insert into lottery_user(username,phone,password,create_time,status) values(?,?,?,now(),?);' 10 | return query( _sql, [ username, phone, password, creator, TYPES.normal] ) 11 | } 12 | 13 | // 更改用户 14 | const update = (val) => { 15 | const { username, phone, password, balance, lastBetTime, extraInfo, carNo, id } = val 16 | let _sql = 'update lottery_user set ' 17 | const { sql, args } = NtNUpdate({ username, phone, password,last_bet_time: lastBetTime, car_no: carNo, balance, extra_info: extraInfo }, _sql) 18 | _sql = sql + 'where id = ?' 19 | return query( _sql, [...args, id] ) 20 | } 21 | 22 | // 查询用户 23 | const list = val => { 24 | const sql = 'select * from lottery_user where status != ?' 25 | return query(sql, [ TYPES.deled ]) 26 | } 27 | 28 | // 删除用户 29 | const del = val => { 30 | const { id } = val 31 | const sql = 'update lottery_user set status = ? where id = ?' 32 | return query(sql, [ TYPES.deled, id ]) 33 | } 34 | 35 | module.exports = { 36 | add, 37 | list, 38 | update, 39 | del, 40 | } -------------------------------------------------------------------------------- /enum/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | DEL: 404, 3 | ABA: 111, 4 | NORMAL: 0, 5 | } -------------------------------------------------------------------------------- /helper/index.js: -------------------------------------------------------------------------------- 1 | const update = (params, sql) => { 2 | let keys = Object.keys(params) 3 | let arr = [] 4 | keys.forEach((key) => { 5 | if (key) { 6 | sql = sql + `${key} = ? ,` 7 | arr.push(params[key]) 8 | } 9 | }) 10 | sql = sql.substring(0, sql.length - 1) 11 | return { 12 | args: arr, 13 | sql, 14 | } 15 | } 16 | 17 | module.exports = { 18 | NtNUpdate: update, 19 | } 20 | -------------------------------------------------------------------------------- /helper/pojo.js: -------------------------------------------------------------------------------- 1 | const success = (result) => { 2 | return { 3 | retCode: 200, 4 | retValue: result 5 | } 6 | } 7 | const failed = (error) => { 8 | console.log(error) 9 | return { 10 | retCode: 500, 11 | msg: error.message || '服务器异常' 12 | } 13 | } 14 | 15 | module.exports = { 16 | success, 17 | failed 18 | } -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var Koa=require('koa'); 2 | var path=require('path') 3 | var bodyParser = require('koa-bodyparser'); 4 | var session = require('koa-session-minimal'); 5 | var MysqlStore = require('koa-mysql-session'); 6 | var config = require('./config/default.js'); 7 | var router=require('koa-router') 8 | var views = require('koa-views') 9 | var koaStatic = require('koa-static') 10 | var app=new Koa() 11 | const routers = require('./routers/index') 12 | 13 | 14 | 15 | // session存储配置 16 | const sessionMysqlConfig= { 17 | user: config.database.USERNAME, 18 | password: config.database.PASSWORD, 19 | database: config.database.DATABASE, 20 | host: config.database.HOST, 21 | } 22 | 23 | // 配置session中间件 24 | app.use(session({ 25 | key: 'USER_SID', 26 | store: new MysqlStore(sessionMysqlConfig) 27 | })) 28 | 29 | // 配置跨域 30 | app.use(async (ctx, next) => { 31 | ctx.set('Access-Control-Allow-Headers', 'Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With') 32 | ctx.set('Access-Control-Allow-Origin', 'http://localhost:8080'); 33 | ctx.set('Access-Control-Allow-Methods', 'PUT,DELETE,POST,GET'); 34 | ctx.set('Access-Control-Allow-Credentials', true); 35 | ctx.set('Access-Control-Max-Age', 3600 * 24); 36 | await next(); 37 | }); 38 | // 配置静态资源加载中间件 39 | app.use(koaStatic( 40 | path.join(__dirname , './public') 41 | )) 42 | 43 | // // 配置服务端模板渲染引擎中间件 44 | // app.use(views(path.join(__dirname, './views'), { 45 | // extension: 'ejs' 46 | // })) 47 | 48 | // 使用表单解析中间件 49 | app.use(bodyParser()) 50 | 51 | // 使用新建的路由文件 52 | // app.use(require('./routers/signin.js').routes()) 53 | app.use(routers.routes()).use(routers.allowedMethods()) 54 | 55 | // app.use(require('./routers/user').routes()) 56 | // app.use(require('./routers/posts.js').routes()) 57 | // app.use(require('./routers/signout.js').routes()) 58 | 59 | // 监听在1200 60 | app.listen(config.port) 61 | 62 | console.log(`listening on port ${config.port}`) 63 | -------------------------------------------------------------------------------- /lib/mysql.js: -------------------------------------------------------------------------------- 1 | const mysql = require('mysql'); 2 | const config = require('../config/default.js') 3 | 4 | const pool = mysql.createPool({ 5 | host : config.database.HOST, 6 | user : config.database.USERNAME, 7 | password : config.database.PASSWORD, 8 | database : config.database.DATABASE 9 | }); 10 | 11 | const query = function( sql, values ) { 12 | return new Promise(( resolve, reject ) => { 13 | pool.getConnection(function(err, connection) { 14 | if (err) { 15 | console.log(err) 16 | resolve( err ) 17 | } else { 18 | connection.query(sql, values, ( err, rows) => { 19 | if ( err ) { 20 | reject( err ) 21 | } else { 22 | resolve( rows ) 23 | } 24 | connection.release() 25 | }) 26 | } 27 | }) 28 | }) 29 | 30 | } 31 | 32 | users= 33 | `create table if not exists users( 34 | id INT NOT NULL AUTO_INCREMENT, 35 | name VARCHAR(100) NOT NULL, 36 | pass VARCHAR(40) NOT NULL, 37 | PRIMARY KEY ( id ) 38 | );` 39 | 40 | posts= 41 | `create table if not exists posts( 42 | id INT NOT NULL AUTO_INCREMENT, 43 | name VARCHAR(100) NOT NULL, 44 | title VARCHAR(40) NOT NULL, 45 | content VARCHAR(40) NOT NULL, 46 | uid VARCHAR(40) NOT NULL, 47 | moment VARCHAR(40) NOT NULL, 48 | comments VARCHAR(40) NOT NULL DEFAULT '0', 49 | pv VARCHAR(40) NOT NULL DEFAULT '0', 50 | PRIMARY KEY ( id ) 51 | );` 52 | 53 | comment= 54 | `create table if not exists comment( 55 | id INT NOT NULL AUTO_INCREMENT, 56 | name VARCHAR(100) NOT NULL, 57 | content VARCHAR(40) NOT NULL, 58 | postid VARCHAR(40) NOT NULL, 59 | PRIMARY KEY ( id ) 60 | );` 61 | 62 | let createTable = function( sql ) { 63 | return query( sql, [] ) 64 | } 65 | 66 | // // 建表 67 | // createTable(users) 68 | // createTable(posts) 69 | // createTable(comment) 70 | 71 | // 注册用户 72 | let insertData = function( value ) { 73 | let _sql = "insert into users(name,pass) values(?,?);" 74 | return query( _sql, value ) 75 | } 76 | // 发表文章 77 | let insertPost = function( value ) { 78 | let _sql = "insert into posts(name,title,content,uid,moment) values(?,?,?,?,?);" 79 | return query( _sql, value ) 80 | } 81 | // 更新文章评论数 82 | let updatePostComment = function( value ) { 83 | let _sql = "update posts set comments=? where id=?" 84 | return query( _sql, value ) 85 | } 86 | 87 | // 更新浏览数 88 | let updatePostPv = function( value ) { 89 | let _sql = "update posts set pv=? where id=?" 90 | return query( _sql, value ) 91 | } 92 | 93 | // 发表评论 94 | let insertComment = function( value ) { 95 | let _sql = "insert into comment(name,content,postid) values(?,?,?);" 96 | return query( _sql, value ) 97 | } 98 | // 通过名字查找用户 99 | let findDataByName = function ( name ) { 100 | let _sql = ` 101 | SELECT * from users 102 | where name="${name}" 103 | ` 104 | return query( _sql) 105 | } 106 | // 通过文章的名字查找用户 107 | let findDataByUser = function ( name ) { 108 | let _sql = ` 109 | SELECT * from posts 110 | where name="${name}" 111 | ` 112 | return query( _sql) 113 | } 114 | // 通过文章id查找 115 | let findDataById = function ( id ) { 116 | let _sql = ` 117 | SELECT * from posts 118 | where id="${id}" 119 | ` 120 | return query( _sql) 121 | } 122 | // 通过评论id查找 123 | let findCommentById = function ( id ) { 124 | let _sql = ` 125 | SELECT * FROM comment where postid="${id}" 126 | ` 127 | return query( _sql) 128 | } 129 | 130 | // 查询所有文章 131 | let findAllPost = function ( ) { 132 | let _sql = ` 133 | SELECT * FROM posts 134 | ` 135 | return query( _sql) 136 | } 137 | // 更新修改文章 138 | let updatePost = function(values){ 139 | let _sql=`update posts set title=?,content=? where id=?` 140 | return query(_sql,values) 141 | } 142 | // 删除文章 143 | let deletePost = function(id){ 144 | let _sql=`delete from posts where id = ${id}` 145 | return query(_sql) 146 | } 147 | // 删除评论 148 | let deleteComment = function(id){ 149 | let _sql=`delete from comment where id = ${id}` 150 | return query(_sql) 151 | } 152 | // 删除所有评论 153 | let deleteAllPostComment = function(id){ 154 | let _sql=`delete from comment where postid = ${id}` 155 | return query(_sql) 156 | } 157 | // 查找 158 | let findCommentLength = function(id){ 159 | let _sql=`select content from comment where postid in (select id from posts where id=${id})` 160 | return query(_sql) 161 | } 162 | 163 | 164 | 165 | module.exports={ 166 | query, 167 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "loterry-node", 3 | "version": "1.0.0", 4 | "description": "A backend for lottery", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node index.js" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/frank994/Loterry-node.git" 13 | }, 14 | "keywords": [ 15 | "node" 16 | ], 17 | "author": "frank-wu", 18 | "license": "ISC", 19 | "bugs": { 20 | "url": "https://github.com/frank994/Loterry-node/issues" 21 | }, 22 | "homepage": "https://github.com/frank994/Loterry-node#readme", 23 | "dependencies": { 24 | "koa": "^2.5.1", 25 | "koa-bodyparser": "^4.2.1", 26 | "koa-mysql-session": "^0.0.2", 27 | "koa-router": "^7.4.0", 28 | "koa-session-minimal": "^3.0.4", 29 | "koa-static": "^4.0.3", 30 | "koa-views": "^6.1.4", 31 | "md5": "^2.2.1", 32 | "moment": "^2.22.1", 33 | "mysql": "^2.15.0" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /routers/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 整合所有子路由 3 | */ 4 | 5 | const router = require('koa-router')() 6 | const routes = require('../routes') 7 | 8 | routes.forEach(item => { 9 | const service = require(`../services/${item.service}`) 10 | router[item.method](item.path, service[item.action]) 11 | }) 12 | module.exports = router 13 | -------------------------------------------------------------------------------- /routes/admin/index.js: -------------------------------------------------------------------------------- 1 | const model = require('../model') 2 | module.exports = { 3 | ...model, 4 | 'login': { method: methods.post }, 5 | } 6 | -------------------------------------------------------------------------------- /routes/index.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = (config => { 3 | return config.reduce((copy, name) => { 4 | const obj = require(`./${name}`) 5 | const newArr = Object.keys(obj).reduce((total, each) => { 6 | let item = { path: `/api/${name}/${each}`, method: obj[each].method, action: each, service: name } 7 | total.push(item) 8 | return total 9 | }, []) 10 | copy = copy.concat(newArr) 11 | return copy 12 | }, []) 13 | })([ 14 | 'admin', 15 | 'user', 16 | 'order', 17 | 'shop', 18 | 'ticket', 19 | 'type', 20 | ]) 21 | -------------------------------------------------------------------------------- /routes/methods.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | get: 'get', 3 | post: 'post', 4 | } -------------------------------------------------------------------------------- /routes/model/index.js: -------------------------------------------------------------------------------- 1 | 2 | const methods = require('../methods') 3 | 4 | module.exports = { 5 | 'list': { method: methods.get }, 6 | 'add': { method: methods.post }, 7 | 'update': { method: methods.post }, 8 | 'del': { method: methods.post }, 9 | } 10 | -------------------------------------------------------------------------------- /routes/order/index.js: -------------------------------------------------------------------------------- 1 | const model = require('../model') 2 | const methods = require('../methods') 3 | module.exports = { 4 | ...model, 5 | 'listu': { method: methods.post }, 6 | 'listb': { method: methods.post }, 7 | } 8 | -------------------------------------------------------------------------------- /routes/shop/index.js: -------------------------------------------------------------------------------- 1 | const model = require('../model') 2 | const methods = require('../methods') 3 | module.exports = { 4 | ...model, 5 | 'one': { method: methods.post }, 6 | } 7 | -------------------------------------------------------------------------------- /routes/ticket/index.js: -------------------------------------------------------------------------------- 1 | const model = require('../model') 2 | const methods = require('../methods') 3 | module.exports = { 4 | ...model, 5 | 'one': { method: methods.post }, 6 | 'lista': { method: methods.get }, 7 | } 8 | -------------------------------------------------------------------------------- /routes/type/index.js: -------------------------------------------------------------------------------- 1 | const model = require('../model') 2 | module.exports = { 3 | ...model, 4 | } 5 | -------------------------------------------------------------------------------- /routes/user/index.js: -------------------------------------------------------------------------------- 1 | const model = require('../model') 2 | module.exports = { 3 | ...model, 4 | } 5 | -------------------------------------------------------------------------------- /services/admin/index.js: -------------------------------------------------------------------------------- 1 | const controller = require('../../controller/admin') 2 | const model = require('../model') 3 | const m = model([ 4 | 'list', 5 | 'add', 6 | 'update', 7 | 'del', 8 | ], 'admin') 9 | 10 | 11 | const login = async ctx => { 12 | let res; 13 | try { 14 | await controller.login().then(result => { 15 | res = success(result) 16 | }) 17 | } catch(err) { 18 | res = failed(err) 19 | } 20 | ctx.body = res 21 | } 22 | module.exports = { 23 | ...m, 24 | login, 25 | } 26 | 27 | // const add = async ctx => { 28 | // let res; 29 | // try { 30 | // const val = ctx.request.body 31 | // await controller.add(val).then(result => { 32 | // res = success(result) 33 | // }) 34 | // } catch(err) { 35 | // res = failed(err) 36 | // } 37 | // ctx.body = res 38 | // } 39 | 40 | // const update = async ctx => { 41 | // let res; 42 | // try { 43 | // const val = ctx.request.body 44 | // await controller.update(val).then(result => { 45 | // res = success(result) 46 | // }) 47 | // } catch(err) { 48 | // res = failed(err) 49 | // } 50 | // ctx.body = res 51 | // } 52 | 53 | // const del = async ctx => { 54 | // let res; 55 | // try { 56 | // const val = ctx.request.body 57 | // await controller.del(val).then(result => { 58 | // res = success(result) 59 | // }) 60 | // } catch(err) { 61 | // res = failed(err) 62 | // } 63 | // ctx.body = res 64 | // } 65 | 66 | // // module.exports = { 67 | // // list, 68 | // // add, 69 | // // update, 70 | // // del, 71 | // // } 72 | 73 | -------------------------------------------------------------------------------- /services/model/index.js: -------------------------------------------------------------------------------- 1 | const pojo = require('../../helper/pojo') 2 | const { success, failed } = pojo 3 | module.exports = (config, file) => { 4 | const controller = require(`../../controller/${file}`) 5 | return config.reduce((copy, name) => { 6 | copy[name] = async ctx => { 7 | let res; 8 | try { 9 | const val = ctx.request.body 10 | await controller[name](val).then(result => { 11 | res = success(result) 12 | }) 13 | } catch(err) { 14 | res = failed(err) 15 | } 16 | ctx.body = res 17 | } 18 | return copy 19 | }, {}) 20 | } 21 | -------------------------------------------------------------------------------- /services/order/index.js: -------------------------------------------------------------------------------- 1 | const model = require('../model') 2 | const m = model([ 3 | 'list', 4 | 'add', 5 | 'update', 6 | 'del', 7 | 'listb', 8 | 'listu', 9 | ], 'order') 10 | 11 | module.exports = { 12 | ...m, 13 | } 14 | 15 | // const listu = async ctx => { 16 | // let res; 17 | // try { 18 | // await controller.listu().then(result => { 19 | // res = success(result) 20 | // }) 21 | // } catch(err) { 22 | // res = failed(err) 23 | // } 24 | // ctx.body = res 25 | // } 26 | 27 | // const listb = async ctx => { 28 | // let res; 29 | // try { 30 | // await controller.listub().then(result => { 31 | // res = success(result) 32 | // }) 33 | // } catch(err) { 34 | // res = failed(err) 35 | // } 36 | // ctx.body = res 37 | // } 38 | 39 | // const list = async ctx => { 40 | // let res; 41 | // try { 42 | // await controller.list().then(result => { 43 | // res = success(result) 44 | // }) 45 | // } catch(err) { 46 | // res = failed(err) 47 | // } 48 | // ctx.body = res 49 | // } 50 | 51 | // const add = async ctx => { 52 | // let res; 53 | // try { 54 | // const val = ctx.request.body 55 | // await controller.add(val).then(result => { 56 | // res = success(result) 57 | // }) 58 | // } catch(err) { 59 | // res = failed(err) 60 | // } 61 | // ctx.body = res 62 | // } 63 | 64 | // const update = async ctx => { 65 | // let res; 66 | // try { 67 | // const val = ctx.request.body 68 | // await controller.update(val).then(result => { 69 | // res = success(result) 70 | // }) 71 | // } catch(err) { 72 | // res = failed(err) 73 | // } 74 | // ctx.body = res 75 | // } 76 | 77 | // const del = async ctx => { 78 | // let res; 79 | // try { 80 | // const val = ctx.request.body 81 | // await controller.del(val).then(result => { 82 | // res = success(result) 83 | // }) 84 | // } catch(err) { 85 | // res = failed(err) 86 | // } 87 | // ctx.body = res 88 | // } 89 | 90 | 91 | // module.exports = { 92 | // list, 93 | // add, 94 | // update, 95 | // del, 96 | // listb, 97 | // listu, 98 | // } 99 | 100 | 101 | // module.exports = (config => { 102 | // return config.reduce((copy, name) => { 103 | // copy[name] = async ctx => { 104 | // let res; 105 | // try { 106 | // const val = ctx.request.body 107 | // await controller.del(val).then(result => { 108 | // res = success(result) 109 | // }) 110 | // } catch(err) { 111 | // res = failed(err) 112 | // } 113 | // ctx.body = res 114 | // } 115 | // return copy 116 | // }, {}) 117 | // })() 118 | -------------------------------------------------------------------------------- /services/shop/index.js: -------------------------------------------------------------------------------- 1 | const model = require('../model') 2 | const m = model([ 3 | 'list', 4 | 'add', 5 | 'update', 6 | 'del', 7 | 'one', 8 | ], 'shop') 9 | 10 | module.exports = { 11 | ...m, 12 | } 13 | -------------------------------------------------------------------------------- /services/ticket/index.js: -------------------------------------------------------------------------------- 1 | const model = require('../model') 2 | const m = model([ 3 | 'list', 4 | 'add', 5 | 'update', 6 | 'del', 7 | 'one', 8 | 'lista', 9 | ], 'ticket') 10 | 11 | module.exports = { 12 | ...m, 13 | } 14 | -------------------------------------------------------------------------------- /services/type/index.js: -------------------------------------------------------------------------------- 1 | const model = require('../model') 2 | const m = model([ 3 | 'list', 4 | 'add', 5 | 'update', 6 | 'del', 7 | 'one', 8 | ], 'type') 9 | 10 | module.exports = { 11 | ...m, 12 | } 13 | -------------------------------------------------------------------------------- /services/user/index.js: -------------------------------------------------------------------------------- 1 | const model = require('../model') 2 | const m = model([ 3 | 'list', 4 | 'add', 5 | 'update', 6 | 'del' 7 | ], 'user') 8 | module.exports = { 9 | ...m, 10 | } 11 | 12 | // const controller = require('../../controller/user') 13 | // const pojo = require('../../helper/pojo') 14 | // const { success, failed } = pojo 15 | // const list = async ctx => { 16 | // let res; 17 | // try { 18 | // await controller.list().then(result => { 19 | // res = success(result) 20 | // }) 21 | // } catch(err) { 22 | // res = failed(err) 23 | // } 24 | // ctx.body = res 25 | // } 26 | 27 | // const add = async ctx => { 28 | // let res; 29 | // try { 30 | // const val = ctx.request.body 31 | // await controller.add(val).then(result => { 32 | // res = success(result) 33 | // }) 34 | // } catch(err) { 35 | // res = failed(err) 36 | // } 37 | // ctx.body = res 38 | // } 39 | 40 | // const update = async ctx => { 41 | // let res; 42 | // try { 43 | // const val = ctx.request.body 44 | // await controller.update(val).then(result => { 45 | // res = success(result) 46 | // }) 47 | // } catch(err) { 48 | // res = failed(err) 49 | // } 50 | // ctx.body = res 51 | // } 52 | 53 | // const del = async ctx => { 54 | // let res; 55 | // try { 56 | // const val = ctx.request.body 57 | // await controller.del(val).then(result => { 58 | // res = success(result) 59 | // }) 60 | // } catch(err) { 61 | // res = failed(err) 62 | // } 63 | // ctx.body = res 64 | // } 65 | 66 | // module.exports = { 67 | // list, 68 | // add, 69 | // update, 70 | // del, 71 | // } 72 | -------------------------------------------------------------------------------- /sql/lottery.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat MySQL Data Transfer 3 | 4 | Source Server : l-node 5 | Source Server Version : 80011 6 | Source Host : localhost 7 | Source Database : lottery 8 | 9 | Target Server Version : 80011 10 | File Encoding : utf-8 11 | 12 | Date: 06/12/2018 15:51:58 PM 13 | */ 14 | 15 | SET NAMES utf8; 16 | SET FOREIGN_KEY_CHECKS = 0; 17 | 18 | -- ---------------------------- 19 | -- Table structure for `_mysql_session_store` 20 | -- ---------------------------- 21 | DROP TABLE IF EXISTS `_mysql_session_store`; 22 | CREATE TABLE `_mysql_session_store` ( 23 | `id` varchar(255) NOT NULL, 24 | `expires` bigint(20) DEFAULT NULL, 25 | `data` text, 26 | PRIMARY KEY (`id`) 27 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 28 | 29 | -- ---------------------------- 30 | -- Table structure for `lottery_admin` 31 | -- ---------------------------- 32 | DROP TABLE IF EXISTS `lottery_admin`; 33 | CREATE TABLE `lottery_admin` ( 34 | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键,自增', 35 | `account` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '账号', 36 | `phone` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '手机号', 37 | `password` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码', 38 | `create_time` mediumtext NOT NULL COMMENT '被创建时间', 39 | `creator` varchar(20) NOT NULL COMMENT '创建人', 40 | `name` varchar(20) NOT NULL COMMENT '姓名', 41 | `type` int(11) NOT NULL COMMENT '类型', 42 | `status` int(11) DEFAULT NULL COMMENT '状态,是否被删(404为被删,300为异常,200为正常)', 43 | PRIMARY KEY (`id`) 44 | ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 45 | 46 | -- ---------------------------- 47 | -- Records of `lottery_admin` 48 | -- ---------------------------- 49 | BEGIN; 50 | INSERT INTO `lottery_admin` VALUES ('1', 'test', '13212312321', '123456', '2018-05-28 17:10:34', 'Admin', 'test', '1', '0'), ('2', 'test', '13212312321', '123456', '2018-05-28 17:11:20', 'Admin', 'test', '1', '0'), ('3', 'test', '13212312321', '123456', '2018-05-28 17:12:26', 'Admin', 'test', '1', '0'), ('4', 'test', '13212312321', '123456', '2018-05-28 17:26:31', 'Admin', 'test', '1', '0'); 51 | COMMIT; 52 | 53 | -- ---------------------------- 54 | -- Table structure for `lottery_order` 55 | -- ---------------------------- 56 | DROP TABLE IF EXISTS `lottery_order`; 57 | CREATE TABLE `lottery_order` ( 58 | `id` int(11) NOT NULL AUTO_INCREMENT, 59 | `user_id` varchar(10) NOT NULL, 60 | `shop_id` varchar(16) NOT NULL, 61 | `lotter_number` varchar(300) NOT NULL, 62 | `total_money` decimal(8,2) NOT NULL, 63 | `order_time` mediumtext NOT NULL, 64 | `status` int(11) DEFAULT NULL, 65 | `extra_info` varchar(500) DEFAULT NULL, 66 | PRIMARY KEY (`id`) 67 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 68 | 69 | -- ---------------------------- 70 | -- Table structure for `lottery_shop` 71 | -- ---------------------------- 72 | DROP TABLE IF EXISTS `lottery_shop`; 73 | CREATE TABLE `lottery_shop` ( 74 | `id` int(11) NOT NULL AUTO_INCREMENT, 75 | `account` varchar(50) NOT NULL, 76 | `name` varchar(100) NOT NULL, 77 | `password` varchar(16) NOT NULL, 78 | `address` varchar(200) NOT NULL, 79 | `phone` varchar(11) NOT NULL, 80 | `create_time` mediumtext, 81 | `business_no` varchar(13) NOT NULL, 82 | `status` int(11) DEFAULT NULL, 83 | `extra_info` varchar(500) DEFAULT NULL, 84 | PRIMARY KEY (`id`) 85 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 86 | 87 | -- ---------------------------- 88 | -- Table structure for `lottery_ticket` 89 | -- ---------------------------- 90 | DROP TABLE IF EXISTS `lottery_ticket`; 91 | CREATE TABLE `lottery_ticket` ( 92 | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '期数编号', 93 | `type_id` int(11) NOT NULL COMMENT '类型编号', 94 | `period` int(11) NOT NULL COMMENT '第几期', 95 | `boom_time` bigint(20) NOT NULL COMMENT '开奖时间', 96 | `create_time` bigint(20) NOT NULL, 97 | `boom_number` varchar(500) NOT NULL COMMENT '获奖号码', 98 | `winning_number` varchar(500) DEFAULT NULL COMMENT '获奖号码', 99 | `prize` decimal(10,0) NOT NULL DEFAULT '0' COMMENT '奖金池', 100 | `status` int(11) NOT NULL DEFAULT '0' COMMENT '期号开奖状态', 101 | `extra_info` varchar(500) NOT NULL DEFAULT '' COMMENT '补充的信息', 102 | PRIMARY KEY (`id`) 103 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 104 | 105 | -- ---------------------------- 106 | -- Table structure for `lottery_type` 107 | -- ---------------------------- 108 | DROP TABLE IF EXISTS `lottery_type`; 109 | CREATE TABLE `lottery_type` ( 110 | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键,自增', 111 | `name` varchar(120) NOT NULL COMMENT '名称', 112 | `create_time` bigint(20) NOT NULL COMMENT '创建时间', 113 | `creator` varchar(60) NOT NULL COMMENT '创建人', 114 | `status` int(11) NOT NULL DEFAULT '0' COMMENT '类型状态(是否已被弃用)', 115 | `extra_info` varchar(200) NOT NULL DEFAULT ' ' COMMENT '备注', 116 | PRIMARY KEY (`id`) 117 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 118 | 119 | -- ---------------------------- 120 | -- Table structure for `lottery_user` 121 | -- ---------------------------- 122 | DROP TABLE IF EXISTS `lottery_user`; 123 | CREATE TABLE `lottery_user` ( 124 | `id` int(11) NOT NULL AUTO_INCREMENT, 125 | `username` varchar(50) NOT NULL, 126 | `phone` varchar(11) NOT NULL, 127 | `password` varchar(16) NOT NULL, 128 | `create_time` bigint(20) NOT NULL, 129 | `last_bet_time` bigint(20) DEFAULT NULL, 130 | `car_no` varchar(18) DEFAULT NULL, 131 | `balance` decimal(8,2) DEFAULT NULL, 132 | `status` int(11) DEFAULT NULL, 133 | `extra_info` varchar(300) DEFAULT NULL, 134 | PRIMARY KEY (`id`) 135 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 136 | 137 | SET FOREIGN_KEY_CHECKS = 1; 138 | -------------------------------------------------------------------------------- /sql/lottery0-0-1.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat MySQL Data Transfer 3 | 4 | Source Server : l-node 5 | Source Server Version : 80011 6 | Source Host : localhost 7 | Source Database : lottery 8 | 9 | Target Server Version : 80011 10 | File Encoding : utf-8 11 | 12 | Date: 06/11/2018 15:21:21 PM 13 | */ 14 | 15 | SET NAMES utf8; 16 | SET FOREIGN_KEY_CHECKS = 0; 17 | 18 | -- ---------------------------- 19 | -- Table structure for `_mysql_session_store` 20 | -- ---------------------------- 21 | DROP TABLE IF EXISTS `_mysql_session_store`; 22 | CREATE TABLE `_mysql_session_store` ( 23 | `id` varchar(255) NOT NULL, 24 | `expires` bigint(20) DEFAULT NULL, 25 | `data` text, 26 | PRIMARY KEY (`id`) 27 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 28 | 29 | -- ---------------------------- 30 | -- Table structure for `lottery_admin` 31 | -- ---------------------------- 32 | DROP TABLE IF EXISTS `lottery_admin`; 33 | CREATE TABLE `lottery_admin` ( 34 | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键,自增', 35 | `account` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '账号', 36 | `phone` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '手机号', 37 | `password` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码', 38 | `create_time` mediumtext NOT NULL COMMENT '被创建时间', 39 | `creator` varchar(20) NOT NULL COMMENT '创建人', 40 | `name` varchar(20) NOT NULL COMMENT '姓名', 41 | `type` int(11) NOT NULL COMMENT '类型', 42 | `status` int(11) DEFAULT NULL COMMENT '状态,是否被删(404为被删,300为异常,200为正常)', 43 | PRIMARY KEY (`id`) 44 | ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 45 | 46 | -- ---------------------------- 47 | -- Records of `lottery_admin` 48 | -- ---------------------------- 49 | BEGIN; 50 | INSERT INTO `lottery_admin` VALUES ('1', 'test', '13212312321', '123456', '2018-05-28 17:10:34', 'Admin', 'test', '1', '0'), ('2', 'test', '13212312321', '123456', '2018-05-28 17:11:20', 'Admin', 'test', '1', '0'), ('3', 'test', '13212312321', '123456', '2018-05-28 17:12:26', 'Admin', 'test', '1', '0'), ('4', 'test', '13212312321', '123456', '2018-05-28 17:26:31', 'Admin', 'test', '1', '0'); 51 | COMMIT; 52 | 53 | -- ---------------------------- 54 | -- Table structure for `lottery_order` 55 | -- ---------------------------- 56 | DROP TABLE IF EXISTS `lottery_order`; 57 | CREATE TABLE `lottery_order` ( 58 | `id` int(11) NOT NULL AUTO_INCREMENT, 59 | `user_id` varchar(10) NOT NULL, 60 | `shop_id` varchar(16) NOT NULL, 61 | `lotter_number` varchar(300) NOT NULL, 62 | `total_money` decimal(8,2) NOT NULL, 63 | `order_time` mediumtext NOT NULL, 64 | `status` int(11) DEFAULT NULL, 65 | PRIMARY KEY (`id`) 66 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 67 | 68 | -- ---------------------------- 69 | -- Table structure for `lottery_shop` 70 | -- ---------------------------- 71 | DROP TABLE IF EXISTS `lottery_shop`; 72 | CREATE TABLE `lottery_shop` ( 73 | `id` int(11) NOT NULL AUTO_INCREMENT, 74 | `account` varchar(50) NOT NULL, 75 | `name` varchar(100) NOT NULL, 76 | `password` varchar(16) NOT NULL, 77 | `address` varchar(200) NOT NULL, 78 | `phone` varchar(11) NOT NULL, 79 | `create_time` mediumtext, 80 | `business_no` varchar(13) NOT NULL, 81 | `status` int(11) DEFAULT NULL, 82 | PRIMARY KEY (`id`) 83 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 84 | 85 | -- ---------------------------- 86 | -- Table structure for `lottery_user` 87 | -- ---------------------------- 88 | DROP TABLE IF EXISTS `lottery_user`; 89 | CREATE TABLE `lottery_user` ( 90 | `id` int(11) NOT NULL AUTO_INCREMENT, 91 | `username` varchar(50) NOT NULL, 92 | `phone` varchar(11) NOT NULL, 93 | `password` varchar(16) NOT NULL, 94 | `last_bet_time` mediumtext, 95 | `car_no` varchar(18) NOT NULL, 96 | `balance` decimal(8,2) DEFAULT NULL, 97 | `status` int(11) DEFAULT NULL, 98 | PRIMARY KEY (`id`) 99 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 100 | 101 | SET FOREIGN_KEY_CHECKS = 1; 102 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | abbrev@1: 6 | version "1.1.1" 7 | resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" 8 | 9 | accepts@^1.2.2: 10 | version "1.3.5" 11 | resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.5.tgz#eb777df6011723a3b14e8a72c0805c8e86746bd2" 12 | dependencies: 13 | mime-types "~2.1.18" 14 | negotiator "0.6.1" 15 | 16 | any-promise@^1.0.0, any-promise@^1.1.0: 17 | version "1.3.0" 18 | resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" 19 | 20 | bignumber.js@4.0.4: 21 | version "4.0.4" 22 | resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-4.0.4.tgz#7c40f5abcd2d6623ab7b99682ee7db81b11889a4" 23 | 24 | bluebird@^3.0.5, bluebird@^3.1.1: 25 | version "3.5.1" 26 | resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9" 27 | 28 | bytes@3.0.0: 29 | version "3.0.0" 30 | resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" 31 | 32 | charenc@~0.0.1: 33 | version "0.0.2" 34 | resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" 35 | 36 | co-body@^6.0.0: 37 | version "6.0.0" 38 | resolved "https://registry.yarnpkg.com/co-body/-/co-body-6.0.0.tgz#965b9337d7f5655480787471f4237664820827e3" 39 | dependencies: 40 | inflation "^2.0.0" 41 | qs "^6.5.2" 42 | raw-body "^2.3.3" 43 | type-is "^1.6.16" 44 | 45 | co-mysql@^0.4.1: 46 | version "0.4.1" 47 | resolved "https://registry.yarnpkg.com/co-mysql/-/co-mysql-0.4.1.tgz#7273ebff27681c03c38af980bc7e28f78a7b1939" 48 | dependencies: 49 | mysql "*" 50 | 51 | co@^3.1.0: 52 | version "3.1.0" 53 | resolved "https://registry.yarnpkg.com/co/-/co-3.1.0.tgz#4ea54ea5a08938153185e15210c68d9092bc1b78" 54 | 55 | co@^4.6.0: 56 | version "4.6.0" 57 | resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" 58 | 59 | commander@^2.9.0: 60 | version "2.15.1" 61 | resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" 62 | 63 | condense-newlines@^0.2.1: 64 | version "0.2.1" 65 | resolved "https://registry.yarnpkg.com/condense-newlines/-/condense-newlines-0.2.1.tgz#3de985553139475d32502c83b02f60684d24c55f" 66 | dependencies: 67 | extend-shallow "^2.0.1" 68 | is-whitespace "^0.3.0" 69 | kind-of "^3.0.2" 70 | 71 | config-chain@~1.1.5: 72 | version "1.1.11" 73 | resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.11.tgz#aba09747dfbe4c3e70e766a6e41586e1859fc6f2" 74 | dependencies: 75 | ini "^1.3.4" 76 | proto-list "~1.2.1" 77 | 78 | consolidate@^0.15.0: 79 | version "0.15.1" 80 | resolved "https://registry.yarnpkg.com/consolidate/-/consolidate-0.15.1.tgz#21ab043235c71a07d45d9aad98593b0dba56bab7" 81 | dependencies: 82 | bluebird "^3.1.1" 83 | 84 | content-disposition@~0.5.0: 85 | version "0.5.2" 86 | resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.2.tgz#0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4" 87 | 88 | content-type@^1.0.0: 89 | version "1.0.4" 90 | resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" 91 | 92 | cookies@~0.7.0: 93 | version "0.7.1" 94 | resolved "https://registry.yarnpkg.com/cookies/-/cookies-0.7.1.tgz#7c8a615f5481c61ab9f16c833731bcb8f663b99b" 95 | dependencies: 96 | depd "~1.1.1" 97 | keygrip "~1.0.2" 98 | 99 | copy-to@^2.0.1: 100 | version "2.0.1" 101 | resolved "https://registry.yarnpkg.com/copy-to/-/copy-to-2.0.1.tgz#2680fbb8068a48d08656b6098092bdafc906f4a5" 102 | 103 | core-util-is@~1.0.0: 104 | version "1.0.2" 105 | resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" 106 | 107 | crypt@~0.0.1: 108 | version "0.0.2" 109 | resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" 110 | 111 | debug@*, debug@^3.1.0: 112 | version "3.1.0" 113 | resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" 114 | dependencies: 115 | ms "2.0.0" 116 | 117 | debug@^2.6.3: 118 | version "2.6.9" 119 | resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" 120 | dependencies: 121 | ms "2.0.0" 122 | 123 | deep-equal@^1.0.1, deep-equal@~1.0.1: 124 | version "1.0.1" 125 | resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5" 126 | 127 | delegates@^1.0.0: 128 | version "1.0.0" 129 | resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" 130 | 131 | depd@^1.1.0, depd@~1.1.1, depd@~1.1.2: 132 | version "1.1.2" 133 | resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" 134 | 135 | destroy@^1.0.3: 136 | version "1.0.4" 137 | resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" 138 | 139 | editorconfig@^0.13.2: 140 | version "0.13.3" 141 | resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-0.13.3.tgz#e5219e587951d60958fd94ea9a9a008cdeff1b34" 142 | dependencies: 143 | bluebird "^3.0.5" 144 | commander "^2.9.0" 145 | lru-cache "^3.2.0" 146 | semver "^5.1.0" 147 | sigmund "^1.0.1" 148 | 149 | ee-first@1.1.1: 150 | version "1.1.1" 151 | resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" 152 | 153 | error-inject@~1.0.0: 154 | version "1.0.0" 155 | resolved "https://registry.yarnpkg.com/error-inject/-/error-inject-1.0.0.tgz#e2b3d91b54aed672f309d950d154850fa11d4f37" 156 | 157 | escape-html@~1.0.1: 158 | version "1.0.3" 159 | resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" 160 | 161 | extend-shallow@^2.0.1: 162 | version "2.0.1" 163 | resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" 164 | dependencies: 165 | is-extendable "^0.1.0" 166 | 167 | fresh@^0.5.2: 168 | version "0.5.2" 169 | resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" 170 | 171 | fs-extra@^4.0.2: 172 | version "4.0.3" 173 | resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" 174 | dependencies: 175 | graceful-fs "^4.1.2" 176 | jsonfile "^4.0.0" 177 | universalify "^0.1.0" 178 | 179 | get-paths@^0.0.2: 180 | version "0.0.2" 181 | resolved "https://registry.yarnpkg.com/get-paths/-/get-paths-0.0.2.tgz#a9c27b1a8d006c931a4f26fcf7d1546e3ad71bea" 182 | dependencies: 183 | fs-extra "^4.0.2" 184 | 185 | graceful-fs@^4.1.2, graceful-fs@^4.1.6: 186 | version "4.1.11" 187 | resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" 188 | 189 | http-assert@^1.1.0: 190 | version "1.3.0" 191 | resolved "https://registry.yarnpkg.com/http-assert/-/http-assert-1.3.0.tgz#a31a5cf88c873ecbb5796907d4d6f132e8c01e4a" 192 | dependencies: 193 | deep-equal "~1.0.1" 194 | http-errors "~1.6.1" 195 | 196 | http-errors@1.6.3, http-errors@^1.2.8, http-errors@^1.3.1, http-errors@^1.6.1, http-errors@~1.6.1, http-errors@~1.6.2: 197 | version "1.6.3" 198 | resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d" 199 | dependencies: 200 | depd "~1.1.2" 201 | inherits "2.0.3" 202 | setprototypeof "1.1.0" 203 | statuses ">= 1.4.0 < 2" 204 | 205 | iconv-lite@0.4.23: 206 | version "0.4.23" 207 | resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63" 208 | dependencies: 209 | safer-buffer ">= 2.1.2 < 3" 210 | 211 | inflation@^2.0.0: 212 | version "2.0.0" 213 | resolved "https://registry.yarnpkg.com/inflation/-/inflation-2.0.0.tgz#8b417e47c28f925a45133d914ca1fd389107f30f" 214 | 215 | inherits@2.0.3, inherits@~2.0.3: 216 | version "2.0.3" 217 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" 218 | 219 | ini@^1.3.4: 220 | version "1.3.5" 221 | resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" 222 | 223 | is-buffer@^1.1.5, is-buffer@~1.1.1: 224 | version "1.1.6" 225 | resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" 226 | 227 | is-extendable@^0.1.0: 228 | version "0.1.1" 229 | resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" 230 | 231 | is-generator-function@^1.0.3: 232 | version "1.0.7" 233 | resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.7.tgz#d2132e529bb0000a7f80794d4bdf5cd5e5813522" 234 | 235 | is-whitespace@^0.3.0: 236 | version "0.3.0" 237 | resolved "https://registry.yarnpkg.com/is-whitespace/-/is-whitespace-0.3.0.tgz#1639ecb1be036aec69a54cbb401cfbed7114ab7f" 238 | 239 | isarray@0.0.1: 240 | version "0.0.1" 241 | resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" 242 | 243 | isarray@~1.0.0: 244 | version "1.0.0" 245 | resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" 246 | 247 | js-beautify@^1.6.12: 248 | version "1.7.5" 249 | resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.7.5.tgz#69d9651ef60dbb649f65527b53674950138a7919" 250 | dependencies: 251 | config-chain "~1.1.5" 252 | editorconfig "^0.13.2" 253 | mkdirp "~0.5.0" 254 | nopt "~3.0.1" 255 | 256 | jsonfile@^4.0.0: 257 | version "4.0.0" 258 | resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" 259 | optionalDependencies: 260 | graceful-fs "^4.1.6" 261 | 262 | keygrip@~1.0.2: 263 | version "1.0.2" 264 | resolved "https://registry.yarnpkg.com/keygrip/-/keygrip-1.0.2.tgz#ad3297c557069dea8bcfe7a4fa491b75c5ddeb91" 265 | 266 | kind-of@^3.0.2: 267 | version "3.2.2" 268 | resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" 269 | dependencies: 270 | is-buffer "^1.1.5" 271 | 272 | koa-bodyparser@^4.2.1: 273 | version "4.2.1" 274 | resolved "https://registry.yarnpkg.com/koa-bodyparser/-/koa-bodyparser-4.2.1.tgz#4d7dacb5e6db1106649b595d9e5ccb158b6f3b29" 275 | dependencies: 276 | co-body "^6.0.0" 277 | copy-to "^2.0.1" 278 | 279 | koa-compose@^3.0.0: 280 | version "3.2.1" 281 | resolved "https://registry.yarnpkg.com/koa-compose/-/koa-compose-3.2.1.tgz#a85ccb40b7d986d8e5a345b3a1ace8eabcf54de7" 282 | dependencies: 283 | any-promise "^1.1.0" 284 | 285 | koa-compose@^4.0.0: 286 | version "4.1.0" 287 | resolved "https://registry.yarnpkg.com/koa-compose/-/koa-compose-4.1.0.tgz#507306b9371901db41121c812e923d0d67d3e877" 288 | 289 | koa-convert@^1.2.0: 290 | version "1.2.0" 291 | resolved "https://registry.yarnpkg.com/koa-convert/-/koa-convert-1.2.0.tgz#da40875df49de0539098d1700b50820cebcd21d0" 292 | dependencies: 293 | co "^4.6.0" 294 | koa-compose "^3.0.0" 295 | 296 | koa-is-json@^1.0.0: 297 | version "1.0.0" 298 | resolved "https://registry.yarnpkg.com/koa-is-json/-/koa-is-json-1.0.0.tgz#273c07edcdcb8df6a2c1ab7d59ee76491451ec14" 299 | 300 | koa-mysql-session@^0.0.2: 301 | version "0.0.2" 302 | resolved "https://registry.yarnpkg.com/koa-mysql-session/-/koa-mysql-session-0.0.2.tgz#b7f32f4dd2c37a5f7992261797c59373704edc89" 303 | dependencies: 304 | co "^3.1.0" 305 | co-mysql "^0.4.1" 306 | 307 | koa-router@^7.4.0: 308 | version "7.4.0" 309 | resolved "https://registry.yarnpkg.com/koa-router/-/koa-router-7.4.0.tgz#aee1f7adc02d5cb31d7d67465c9eacc825e8c5e0" 310 | dependencies: 311 | debug "^3.1.0" 312 | http-errors "^1.3.1" 313 | koa-compose "^3.0.0" 314 | methods "^1.0.1" 315 | path-to-regexp "^1.1.1" 316 | urijs "^1.19.0" 317 | 318 | koa-send@^4.0.0, koa-send@^4.1.3: 319 | version "4.1.3" 320 | resolved "https://registry.yarnpkg.com/koa-send/-/koa-send-4.1.3.tgz#0822207bbf5253a414c8f1765ebc29fa41353cb6" 321 | dependencies: 322 | debug "^2.6.3" 323 | http-errors "^1.6.1" 324 | mz "^2.6.0" 325 | resolve-path "^1.4.0" 326 | 327 | koa-session-minimal@^3.0.4: 328 | version "3.0.4" 329 | resolved "https://registry.yarnpkg.com/koa-session-minimal/-/koa-session-minimal-3.0.4.tgz#d6a15beeed77d5d3e26a421dbb98a61f63a8afcd" 330 | dependencies: 331 | co "^4.6.0" 332 | deep-equal "^1.0.1" 333 | uid-safe "^2.1.2" 334 | 335 | koa-static@^4.0.3: 336 | version "4.0.3" 337 | resolved "https://registry.yarnpkg.com/koa-static/-/koa-static-4.0.3.tgz#5f93ad00fb1905db9ce46667c0e8bb7d22abfcd8" 338 | dependencies: 339 | debug "^3.1.0" 340 | koa-send "^4.1.3" 341 | 342 | koa-views@^6.1.4: 343 | version "6.1.4" 344 | resolved "https://registry.yarnpkg.com/koa-views/-/koa-views-6.1.4.tgz#595eb683ca17d8dfaa1d100b42ba4e34c762154d" 345 | dependencies: 346 | consolidate "^0.15.0" 347 | debug "^3.1.0" 348 | get-paths "^0.0.2" 349 | koa-send "^4.0.0" 350 | mz "^2.4.0" 351 | pretty "^2.0.0" 352 | 353 | koa@^2.5.1: 354 | version "2.5.1" 355 | resolved "https://registry.yarnpkg.com/koa/-/koa-2.5.1.tgz#79f8b95f8d72d04fe9a58a8da5ebd6d341103f9c" 356 | dependencies: 357 | accepts "^1.2.2" 358 | content-disposition "~0.5.0" 359 | content-type "^1.0.0" 360 | cookies "~0.7.0" 361 | debug "*" 362 | delegates "^1.0.0" 363 | depd "^1.1.0" 364 | destroy "^1.0.3" 365 | error-inject "~1.0.0" 366 | escape-html "~1.0.1" 367 | fresh "^0.5.2" 368 | http-assert "^1.1.0" 369 | http-errors "^1.2.8" 370 | is-generator-function "^1.0.3" 371 | koa-compose "^4.0.0" 372 | koa-convert "^1.2.0" 373 | koa-is-json "^1.0.0" 374 | mime-types "^2.0.7" 375 | on-finished "^2.1.0" 376 | only "0.0.2" 377 | parseurl "^1.3.0" 378 | statuses "^1.2.0" 379 | type-is "^1.5.5" 380 | vary "^1.0.0" 381 | 382 | lru-cache@^3.2.0: 383 | version "3.2.0" 384 | resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-3.2.0.tgz#71789b3b7f5399bec8565dda38aa30d2a097efee" 385 | dependencies: 386 | pseudomap "^1.0.1" 387 | 388 | md5@^2.2.1: 389 | version "2.2.1" 390 | resolved "https://registry.yarnpkg.com/md5/-/md5-2.2.1.tgz#53ab38d5fe3c8891ba465329ea23fac0540126f9" 391 | dependencies: 392 | charenc "~0.0.1" 393 | crypt "~0.0.1" 394 | is-buffer "~1.1.1" 395 | 396 | media-typer@0.3.0: 397 | version "0.3.0" 398 | resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" 399 | 400 | methods@^1.0.1: 401 | version "1.1.2" 402 | resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" 403 | 404 | mime-db@~1.33.0: 405 | version "1.33.0" 406 | resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.33.0.tgz#a3492050a5cb9b63450541e39d9788d2272783db" 407 | 408 | mime-types@^2.0.7, mime-types@~2.1.18: 409 | version "2.1.18" 410 | resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.18.tgz#6f323f60a83d11146f831ff11fd66e2fe5503bb8" 411 | dependencies: 412 | mime-db "~1.33.0" 413 | 414 | minimist@0.0.8: 415 | version "0.0.8" 416 | resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" 417 | 418 | mkdirp@~0.5.0: 419 | version "0.5.1" 420 | resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" 421 | dependencies: 422 | minimist "0.0.8" 423 | 424 | moment@^2.22.1: 425 | version "2.22.1" 426 | resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.1.tgz#529a2e9bf973f259c9643d237fda84de3a26e8ad" 427 | 428 | ms@2.0.0: 429 | version "2.0.0" 430 | resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" 431 | 432 | mysql@*, mysql@^2.15.0: 433 | version "2.15.0" 434 | resolved "https://registry.yarnpkg.com/mysql/-/mysql-2.15.0.tgz#ea16841156343e8f2e47fc8985ec41cdd9573b5c" 435 | dependencies: 436 | bignumber.js "4.0.4" 437 | readable-stream "2.3.3" 438 | safe-buffer "5.1.1" 439 | sqlstring "2.3.0" 440 | 441 | mz@^2.4.0, mz@^2.6.0: 442 | version "2.7.0" 443 | resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" 444 | dependencies: 445 | any-promise "^1.0.0" 446 | object-assign "^4.0.1" 447 | thenify-all "^1.0.0" 448 | 449 | negotiator@0.6.1: 450 | version "0.6.1" 451 | resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" 452 | 453 | nopt@~3.0.1: 454 | version "3.0.6" 455 | resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" 456 | dependencies: 457 | abbrev "1" 458 | 459 | object-assign@^4.0.1: 460 | version "4.1.1" 461 | resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" 462 | 463 | on-finished@^2.1.0: 464 | version "2.3.0" 465 | resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" 466 | dependencies: 467 | ee-first "1.1.1" 468 | 469 | only@0.0.2: 470 | version "0.0.2" 471 | resolved "https://registry.yarnpkg.com/only/-/only-0.0.2.tgz#2afde84d03e50b9a8edc444e30610a70295edfb4" 472 | 473 | parseurl@^1.3.0: 474 | version "1.3.2" 475 | resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3" 476 | 477 | path-is-absolute@1.0.1: 478 | version "1.0.1" 479 | resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" 480 | 481 | path-to-regexp@^1.1.1: 482 | version "1.7.0" 483 | resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d" 484 | dependencies: 485 | isarray "0.0.1" 486 | 487 | pretty@^2.0.0: 488 | version "2.0.0" 489 | resolved "https://registry.yarnpkg.com/pretty/-/pretty-2.0.0.tgz#adbc7960b7bbfe289a557dc5f737619a220d06a5" 490 | dependencies: 491 | condense-newlines "^0.2.1" 492 | extend-shallow "^2.0.1" 493 | js-beautify "^1.6.12" 494 | 495 | process-nextick-args@~1.0.6: 496 | version "1.0.7" 497 | resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" 498 | 499 | proto-list@~1.2.1: 500 | version "1.2.4" 501 | resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" 502 | 503 | pseudomap@^1.0.1: 504 | version "1.0.2" 505 | resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" 506 | 507 | qs@^6.5.2: 508 | version "6.5.2" 509 | resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" 510 | 511 | random-bytes@~1.0.0: 512 | version "1.0.0" 513 | resolved "https://registry.yarnpkg.com/random-bytes/-/random-bytes-1.0.0.tgz#4f68a1dc0ae58bd3fb95848c30324db75d64360b" 514 | 515 | raw-body@^2.3.3: 516 | version "2.3.3" 517 | resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.3.tgz#1b324ece6b5706e153855bc1148c65bb7f6ea0c3" 518 | dependencies: 519 | bytes "3.0.0" 520 | http-errors "1.6.3" 521 | iconv-lite "0.4.23" 522 | unpipe "1.0.0" 523 | 524 | readable-stream@2.3.3: 525 | version "2.3.3" 526 | resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c" 527 | dependencies: 528 | core-util-is "~1.0.0" 529 | inherits "~2.0.3" 530 | isarray "~1.0.0" 531 | process-nextick-args "~1.0.6" 532 | safe-buffer "~5.1.1" 533 | string_decoder "~1.0.3" 534 | util-deprecate "~1.0.1" 535 | 536 | resolve-path@^1.4.0: 537 | version "1.4.0" 538 | resolved "https://registry.yarnpkg.com/resolve-path/-/resolve-path-1.4.0.tgz#c4bda9f5efb2fce65247873ab36bb4d834fe16f7" 539 | dependencies: 540 | http-errors "~1.6.2" 541 | path-is-absolute "1.0.1" 542 | 543 | safe-buffer@5.1.1: 544 | version "5.1.1" 545 | resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" 546 | 547 | safe-buffer@~5.1.0, safe-buffer@~5.1.1: 548 | version "5.1.2" 549 | resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" 550 | 551 | "safer-buffer@>= 2.1.2 < 3": 552 | version "2.1.2" 553 | resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" 554 | 555 | semver@^5.1.0: 556 | version "5.5.0" 557 | resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" 558 | 559 | setprototypeof@1.1.0: 560 | version "1.1.0" 561 | resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" 562 | 563 | sigmund@^1.0.1: 564 | version "1.0.1" 565 | resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590" 566 | 567 | sqlstring@2.3.0: 568 | version "2.3.0" 569 | resolved "https://registry.yarnpkg.com/sqlstring/-/sqlstring-2.3.0.tgz#525b8a4fd26d6f71aa61e822a6caf976d31ad2a8" 570 | 571 | "statuses@>= 1.4.0 < 2", statuses@^1.2.0: 572 | version "1.5.0" 573 | resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" 574 | 575 | string_decoder@~1.0.3: 576 | version "1.0.3" 577 | resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" 578 | dependencies: 579 | safe-buffer "~5.1.0" 580 | 581 | thenify-all@^1.0.0: 582 | version "1.6.0" 583 | resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" 584 | dependencies: 585 | thenify ">= 3.1.0 < 4" 586 | 587 | "thenify@>= 3.1.0 < 4": 588 | version "3.3.0" 589 | resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.0.tgz#e69e38a1babe969b0108207978b9f62b88604839" 590 | dependencies: 591 | any-promise "^1.0.0" 592 | 593 | type-is@^1.5.5, type-is@^1.6.16: 594 | version "1.6.16" 595 | resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.16.tgz#f89ce341541c672b25ee7ae3c73dee3b2be50194" 596 | dependencies: 597 | media-typer "0.3.0" 598 | mime-types "~2.1.18" 599 | 600 | uid-safe@^2.1.2: 601 | version "2.1.5" 602 | resolved "https://registry.yarnpkg.com/uid-safe/-/uid-safe-2.1.5.tgz#2b3d5c7240e8fc2e58f8aa269e5ee49c0857bd3a" 603 | dependencies: 604 | random-bytes "~1.0.0" 605 | 606 | universalify@^0.1.0: 607 | version "0.1.1" 608 | resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7" 609 | 610 | unpipe@1.0.0: 611 | version "1.0.0" 612 | resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" 613 | 614 | urijs@^1.19.0: 615 | version "1.19.1" 616 | resolved "https://registry.yarnpkg.com/urijs/-/urijs-1.19.1.tgz#5b0ff530c0cbde8386f6342235ba5ca6e995d25a" 617 | 618 | util-deprecate@~1.0.1: 619 | version "1.0.2" 620 | resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" 621 | 622 | vary@^1.0.0: 623 | version "1.1.2" 624 | resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" 625 | --------------------------------------------------------------------------------