-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
224 additions
and
43 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
{"name":"匿名","username":"customer","password":"91ec1f9324753048c0096d036a694f86","token":"","expiredTime":1453310980791,"is_admin":false,"is_windower":false,"_id":"Nbz2GlZ62bl7ZbBO"} | ||
{"name":"匿名","username":"windower","password":"d376867b1d99e6e188d5b658a4a51153","token":"","expiredTime":1453310980803,"is_admin":false,"is_windower":true,"_id":"w7dgbO00j0nRIZn5"} | ||
{"name":"匿名","username":"admin","password":"21232f297a57a5a743894a0e4a801fc3","token":"","expiredTime":1453310980817,"is_admin":true,"is_windower":false,"_id":"qT6cDv6c7AKBXQWH"} | ||
{"name":"匿名","username":"admin","password":"21232f297a57a5a743894a0e4a801fc3","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6InFUNmNEdjZjN0FLQlhRV0giLCJpYXQiOjE0NTMzMTA5ODB9.N_RQlNJU2f1Xq3wnYlkhVo2jlmRjAgfTyxDTlkGvr-U","expiredTime":1453397380852,"is_admin":true,"is_windower":false,"_id":"qT6cDv6c7AKBXQWH"} | ||
{"name":"匿名","username":"customer","password":"91ec1f9324753048c0096d036a694f86","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6Ik5iejJHbFo2MmJsN1piQk8iLCJpYXQiOjE0NTMzMTA5ODB9.JloeVjVbeCUGZ548ByUEP6RJSlZLG6F0pVjyOP4LJVY","expiredTime":1453397380872,"is_admin":false,"is_windower":false,"_id":"Nbz2GlZ62bl7ZbBO"} | ||
{"name":"匿名","username":"windower","password":"d376867b1d99e6e188d5b658a4a51153","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6Inc3ZGdiTzAwajBuUklabjUiLCJpYXQiOjE0NTMzMTA5ODB9.6UekluLyscBKU93G0O6NAFoNFtfQXAgIecU-cPoTWX4","expiredTime":1453397380889,"is_admin":false,"is_windower":true,"_id":"w7dgbO00j0nRIZn5"} | ||
{"name":"张三","username":"customer","password":"91ec1f9324753048c0096d036a694f86","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6Ik5iejJHbFo2MmJsN1piQk8iLCJpYXQiOjE0NTMzMTA5ODB9.JloeVjVbeCUGZ548ByUEP6RJSlZLG6F0pVjyOP4LJVY","expiredTime":1453397380872,"is_admin":false,"is_windower":false,"_id":"Nbz2GlZ62bl7ZbBO"} | ||
{"name":"张三","username":"customer","password":"f5bb0c8de146c67b44babbf4e6584cc0","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6Ik5iejJHbFo2MmJsN1piQk8iLCJpYXQiOjE0NTMzMTA5ODB9.JloeVjVbeCUGZ548ByUEP6RJSlZLG6F0pVjyOP4LJVY","expiredTime":1453397380872,"is_admin":false,"is_windower":false,"_id":"Nbz2GlZ62bl7ZbBO"} | ||
{"name":"匿名","username":"admin","password":"21232f297a57a5a743894a0e4a801fc3","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6InFUNmNEdjZjN0FLQlhRV0giLCJpYXQiOjE0NTMzMTA5ODB9.N_RQlNJU2f1Xq3wnYlkhVo2jlmRjAgfTyxDTlkGvr-U","expiredTime":1453397380852,"is_admin":false,"is_windower":false,"_id":"qT6cDv6c7AKBXQWH"} | ||
{"name":"匿名","username":"admin","password":"21232f297a57a5a743894a0e4a801fc3","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6InFUNmNEdjZjN0FLQlhRV0giLCJpYXQiOjE0NTMzMTA5ODB9.N_RQlNJU2f1Xq3wnYlkhVo2jlmRjAgfTyxDTlkGvr-U","expiredTime":1453397380852,"is_admin":true,"is_windower":false,"_id":"qT6cDv6c7AKBXQWH"} | ||
{"name":"匿名","username":"windower","password":"d376867b1d99e6e188d5b658a4a51153","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6Inc3ZGdiTzAwajBuUklabjUiLCJpYXQiOjE0NTMzMTA5ODB9.6UekluLyscBKU93G0O6NAFoNFtfQXAgIecU-cPoTWX4","expiredTime":1453397380889,"is_admin":false,"is_windower":true,"_id":"w7dgbO00j0nRIZn5"} | ||
{"name":"匿名","username":"windower","password":"d376867b1d99e6e188d5b658a4a51153","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6Inc3ZGdiTzAwajBuUklabjUiLCJpYXQiOjE0NTMzMTA5ODB9.6UekluLyscBKU93G0O6NAFoNFtfQXAgIecU-cPoTWX4","expiredTime":1453397380889,"is_admin":false,"is_windower":false,"_id":"w7dgbO00j0nRIZn5"} | ||
{"name":"匿名","username":"windower","password":"d376867b1d99e6e188d5b658a4a51153","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6Inc3ZGdiTzAwajBuUklabjUiLCJpYXQiOjE0NTMzMTA5ODB9.6UekluLyscBKU93G0O6NAFoNFtfQXAgIecU-cPoTWX4","expiredTime":1453397380889,"is_admin":false,"is_windower":true,"_id":"w7dgbO00j0nRIZn5"} | ||
{"name":"匿名","username":"customer","password":"91ec1f9324753048c0096d036a694f86","token":"","expiredTime":1453367237162,"is_admin":false,"is_windower":false,"_id":"Iyf2wz65jn3ERVsy"} | ||
{"name":"匿名","username":"windower","password":"d376867b1d99e6e188d5b658a4a51153","token":"","expiredTime":1453367237177,"is_admin":false,"is_windower":true,"_id":"igYTpIqgxe1fQnPO"} | ||
{"name":"匿名","username":"admin","password":"21232f297a57a5a743894a0e4a801fc3","token":"","expiredTime":1453367237195,"is_admin":true,"is_windower":false,"_id":"jVm2Fltx6rmKycjf"} | ||
{"name":"匿名","username":"admin","password":"21232f297a57a5a743894a0e4a801fc3","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6ImpWbTJGbHR4NnJtS3ljamYiLCJpYXQiOjE0NTMzNjcyMzd9.eG-6YvKMoCaQo2EyExE2uE9yGMutedq_pYN2yV9uvus","expiredTime":1453453637234,"is_admin":true,"is_windower":false,"_id":"jVm2Fltx6rmKycjf"} | ||
{"name":"匿名","username":"customer","password":"91ec1f9324753048c0096d036a694f86","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6Ikl5ZjJ3ejY1am4zRVJWc3kiLCJpYXQiOjE0NTMzNjcyMzd9.v7OVvMCImeViVMAy6xr-ibKu1MfYgSKkD4UgvHQ3PTU","expiredTime":1453453637247,"is_admin":false,"is_windower":false,"_id":"Iyf2wz65jn3ERVsy"} | ||
{"name":"匿名","username":"windower","password":"d376867b1d99e6e188d5b658a4a51153","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6ImlnWVRwSXFneGUxZlFuUE8iLCJpYXQiOjE0NTMzNjcyMzd9.Ku3NbZq7cCe2AVROAJbhQ4e5n7d2olFg8dO4OM1RRaA","expiredTime":1453453637260,"is_admin":false,"is_windower":true,"_id":"igYTpIqgxe1fQnPO"} | ||
{"name":"张三","username":"customer","password":"91ec1f9324753048c0096d036a694f86","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6Ikl5ZjJ3ejY1am4zRVJWc3kiLCJpYXQiOjE0NTMzNjcyMzd9.v7OVvMCImeViVMAy6xr-ibKu1MfYgSKkD4UgvHQ3PTU","expiredTime":1453453637247,"is_admin":false,"is_windower":false,"_id":"Iyf2wz65jn3ERVsy"} | ||
{"name":"张三","username":"customer","password":"f5bb0c8de146c67b44babbf4e6584cc0","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6Ikl5ZjJ3ejY1am4zRVJWc3kiLCJpYXQiOjE0NTMzNjcyMzd9.v7OVvMCImeViVMAy6xr-ibKu1MfYgSKkD4UgvHQ3PTU","expiredTime":1453453637247,"is_admin":false,"is_windower":false,"_id":"Iyf2wz65jn3ERVsy"} | ||
{"name":"匿名","username":"admin","password":"21232f297a57a5a743894a0e4a801fc3","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6ImpWbTJGbHR4NnJtS3ljamYiLCJpYXQiOjE0NTMzNjcyMzd9.eG-6YvKMoCaQo2EyExE2uE9yGMutedq_pYN2yV9uvus","expiredTime":1453453637234,"is_admin":false,"is_windower":false,"_id":"jVm2Fltx6rmKycjf"} | ||
{"name":"匿名","username":"admin","password":"21232f297a57a5a743894a0e4a801fc3","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6ImpWbTJGbHR4NnJtS3ljamYiLCJpYXQiOjE0NTMzNjcyMzd9.eG-6YvKMoCaQo2EyExE2uE9yGMutedq_pYN2yV9uvus","expiredTime":1453453637234,"is_admin":true,"is_windower":false,"_id":"jVm2Fltx6rmKycjf"} | ||
{"name":"匿名","username":"windower","password":"d376867b1d99e6e188d5b658a4a51153","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6ImlnWVRwSXFneGUxZlFuUE8iLCJpYXQiOjE0NTMzNjcyMzd9.Ku3NbZq7cCe2AVROAJbhQ4e5n7d2olFg8dO4OM1RRaA","expiredTime":1453453637260,"is_admin":false,"is_windower":true,"_id":"igYTpIqgxe1fQnPO"} | ||
{"name":"匿名","username":"windower","password":"d376867b1d99e6e188d5b658a4a51153","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6ImlnWVRwSXFneGUxZlFuUE8iLCJpYXQiOjE0NTMzNjcyMzd9.Ku3NbZq7cCe2AVROAJbhQ4e5n7d2olFg8dO4OM1RRaA","expiredTime":1453453637260,"is_admin":false,"is_windower":false,"_id":"igYTpIqgxe1fQnPO"} | ||
{"name":"匿名","username":"windower","password":"d376867b1d99e6e188d5b658a4a51153","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6ImlnWVRwSXFneGUxZlFuUE8iLCJpYXQiOjE0NTMzNjcyMzd9.Ku3NbZq7cCe2AVROAJbhQ4e5n7d2olFg8dO4OM1RRaA","expiredTime":1453453637260,"is_admin":false,"is_windower":true,"_id":"igYTpIqgxe1fQnPO"} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
|
||
commonBiz = require './src/bizs/commonBiz' | ||
|
||
_ = require 'underscore' | ||
|
||
HashMap = require('hashmap') | ||
|
||
|
||
oldData = { | ||
name: '匿名' | ||
username:'1232324' | ||
username: '1232324' | ||
token: '' | ||
} | ||
|
||
newData = { | ||
name: '匿名aasdf' | ||
username: 12 | ||
token:'asdfasdf' | ||
token: 'asdfasdf' | ||
} | ||
|
||
array = [] | ||
|
||
|
||
_.map(array,(doc)-> | ||
console.log(doc.name) | ||
) | ||
|
||
|
||
result = commonBiz.concatPostData(oldData,newData,{'name'}) | ||
console.log(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
db = require('./../libs/db') | ||
|
||
config = require('./../config/config') | ||
|
||
commonBiz = require './commonBiz' | ||
Utils = require './../utils/Utils' | ||
|
||
_ = require 'underscore' | ||
|
||
# 添加食物 | ||
addFood = (req,res,next) -> | ||
windowId = req.params['id'] | ||
token = req.headers['x-token'] | ||
|
||
|
||
db.windows.findOne({_id: windowId}, (err,window) -> | ||
return next(err) if err | ||
return next(commonBiz.customError(404,'没有找到该窗口')) if not window | ||
return next(commonBiz.customError(401,'您没有权利这么做')) if window.author.id isnt Utils.idFromToken(token) | ||
|
||
postData = { | ||
name: req.body.name ?= '麻婆豆腐' # 食物名称 | ||
price: req.body.price ?= 2.5 # 食物价格 | ||
number: req.body.price ?= 100 # 食物余量 | ||
is_delete: false | ||
window_id: windowId | ||
} | ||
db.foods.insert(postData,(err,doc) -> | ||
return next(err) if err | ||
return res.json({id: doc._id}) | ||
|
||
) | ||
|
||
|
||
) | ||
|
||
|
||
module.exports = { | ||
addFood: addFood | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.