forked from lpbird/xcx-single-shop
-
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
陆鹏
committed
Sep 19, 2018
1 parent
6f0a239
commit d5095f6
Showing
22 changed files
with
2,489 additions
and
0 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.
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.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
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,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>KOA</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>com.aptana.ide.core.unifiedBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>com.aptana.projects.webnature</nature> | ||
</natures> | ||
<filteredResources> | ||
<filter> | ||
<id>0</id> | ||
<name></name> | ||
<type>26</type> | ||
<matcher> | ||
<id>org.eclipse.ui.ide.multiFilter</id> | ||
<arguments>1.0-name-matches-false-false-node_modules</arguments> | ||
</matcher> | ||
</filter> | ||
</filteredResources> | ||
</projectDescription> |
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,3 @@ | ||
var current_path = process.cwd(); | ||
console.log(current_path); | ||
require('runkoa')(__dirname + '/entry.js') |
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,35 @@ | ||
var crypto = require('crypto') | ||
|
||
function WXBizDataCrypt(appId, sessionKey) { | ||
this.appId = appId | ||
this.sessionKey = sessionKey | ||
} | ||
|
||
WXBizDataCrypt.prototype.decryptData = function (encryptedData, iv) { | ||
// base64 decode | ||
var sessionKey = new Buffer(this.sessionKey, 'base64') | ||
encryptedData = new Buffer(encryptedData, 'base64') | ||
iv = new Buffer(iv, 'base64') | ||
|
||
try { | ||
// 解密 | ||
var decipher = crypto.createDecipheriv('aes-128-cbc', sessionKey, iv) | ||
// 设置自动 padding 为 true,删除填充补位 | ||
decipher.setAutoPadding(true) | ||
var decoded = decipher.update(encryptedData, 'binary', 'utf8') | ||
decoded += decipher.final('utf8') | ||
|
||
decoded = JSON.parse(decoded) | ||
|
||
} catch (err) { | ||
throw new Error('Illegal Buffer') | ||
} | ||
|
||
if (decoded.watermark.appid !== this.appId) { | ||
throw new Error('Illegal Buffer') | ||
} | ||
|
||
return decoded | ||
} | ||
|
||
module.exports = WXBizDataCrypt |
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,42 @@ | ||
/* 微信参数AppID 和 Secret */ | ||
var wxConfig = { | ||
AppID: "YOUR_APPID", // 小程序ID | ||
Secret: "YOUR_APP_SERCRET", // 小程序Secret | ||
Mch_id: "YOUR_MCH_ID", // 商户号 | ||
Mch_key: "YOUR_MCH_KEY", // 商户key | ||
// 生成商户订单号 | ||
getWxPayOrdrID: function(){ | ||
var myDate = new Date(); | ||
var year = myDate.getFullYear(); | ||
var mouth = myDate.getMonth() + 1; | ||
var day = myDate.getDate(); | ||
var hour = myDate.getHours(); | ||
var minute = myDate.getMinutes(); | ||
var second = myDate.getSeconds(); | ||
var msecond = myDate.getMilliseconds(); //获取当前毫秒数(0-999) | ||
if(mouth < 10){ /*月份小于10 就在前面加个0*/ | ||
mouth = String(String(0) + String(mouth)); | ||
} | ||
if(day < 10){ /*日期小于10 就在前面加个0*/ | ||
day = String(String(0) + String(day)); | ||
} | ||
if(hour < 10){ /*时小于10 就在前面加个0*/ | ||
hour = String(String(0) + String(hour)); | ||
} | ||
if(minute < 10){ /*分小于10 就在前面加个0*/ | ||
minute = String(String(0) + String(minute)); | ||
} | ||
if(second < 10){ /*秒小于10 就在前面加个0*/ | ||
second = String(String(0) + String(second)); | ||
} | ||
if (msecond < 10) { | ||
msecond = String(String('00') + String(second)); | ||
} else if(msecond >= 10 && msecond < 100){ | ||
msecond = String(String(0) + String(second)); | ||
} | ||
|
||
var currentDate = String(year) + String(mouth) + String(day) + String(hour) + String(minute) + String(second) + String(msecond); | ||
return currentDate; | ||
} | ||
}; | ||
module.exports = wxConfig; |
Oops, something went wrong.