随笔

微信分享


此时此刻
在加班

ok, phper 在改各种 bug 闲来无事,看看微信分享(本来想做微信支付的,但是好像没有测试账号)

微信框架


此时已是早上十点,早上两点上线

用到的 package 是 wechat-api

init(http){
        super.init(http);
        var that = this;

        this.api = new WechatAPI("wxfa4e1d73e983881c", "e59088c78d2a36e5a2b6ed79e232b10b");
        this.api.registerTicketHandle(getTicketToken, saveTicketToken);

        // getTicketToken
        function getTicketToken(type, callback) {
            callback(null, that.ticketToken);
        }
        // saveTicketToken
        function saveTicketToken(type, _ticketToken, callback) {
            console.log("token: ");
            console.log(_ticketToken);
            that.ticketToken = _ticketToken;
            callback(null);
        }
    }

    async getWxConfigAction(path){
        let url = this.get("path");
        this.http.header("Access-Control-Allow-Origin","*");
        this.api.getTicket((err,result) => {
            var param = {
                url: url
            };
            this.api.getJsConfig(param, (err,result) => {
                return this.json(result);
            });            
        });
    }

尝试一下
但是 说实话
国人做的东西文档不是很好

本文链接:https://note.lilonghe.net/post/wechat-share.html

-- EOF --