-
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
15 changed files
with
191 additions
and
201 deletions.
There are no files selected for viewing
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 was deleted.
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
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
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,36 @@ | ||
var request = require("request"); | ||
var path = require("path"); | ||
var now = new Date(); | ||
var timeStamp = parseInt(now.getTime() / 1000); /*秒数*/ | ||
var fs = require("fs"); | ||
var encoding = { | ||
encoding: "utf8" | ||
}; | ||
var url = ""; | ||
|
||
|
||
function getAccessToken(cb) { | ||
var app_id = "wx4b6e962611f5e662"; | ||
var app_secret = "78f0744a1d73bbbd423859840fd1255d"; | ||
|
||
console.log("timestamp", timeStamp); | ||
|
||
//if (dataObj.timeStamp + 7200 < timeStamp) { //已经超时 需要重新获取 | ||
var url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential"; | ||
url += "&appid=" + app_id; | ||
url += "&secret=" + app_secret; | ||
|
||
//var url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx3eb0718281190cf6&secret=6ff53b417eb39296fc92134c0e0d04bd"; | ||
request.get(url, function(err, res, body) { | ||
var jsonObj = JSON.parse(body); | ||
console.log("body", body); | ||
//jsonObj.timeStamp = timeStamp; | ||
//fs.writeFileSync(path.resolve(__dirname,"./data.json"), JSON.stringify(jsonObj), encoding); | ||
cb && cb(jsonObj); | ||
}); | ||
//} else { | ||
//cb && cb(); | ||
//} | ||
} | ||
module.exports=getAccessToken; | ||
//getAccessToken(); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,29 +1,5 @@ | ||
require("should"); | ||
var wechat=require("wechat"); | ||
console.log("wechat",wechat); | ||
|
||
var name = "zhaojian"; | ||
|
||
describe("Name", function() { | ||
it("The name should be zhaojian", function() { | ||
name.should.eql("zhaojian"); | ||
}); | ||
}); | ||
|
||
var Person = function(name) { | ||
this.name = name; | ||
}; | ||
var zhaojian = new Person(name); | ||
|
||
describe("InstanceOf", function() { | ||
it("Zhaojian should be an instance of Person", function() { | ||
zhaojian.should.be.an.instanceof(Person); | ||
}); | ||
|
||
it("Zhaojian should be an instance of Object", function() { | ||
zhaojian.should.be.an.instanceof(Object); | ||
}); | ||
}); | ||
describe("Property", function() { | ||
it("Zhaojian should have property name", function() { | ||
zhaojian.should.have.property("name"); | ||
}); | ||
}); | ||
var fn=wechat("",function(){}); | ||
console.log(fn); |
Oops, something went wrong.