Giter VIP home page Giter VIP logo

Comments (3)

yuexing0921 avatar yuexing0921 commented on July 24, 2024

现在这个错误发现是配置了二级域名导致的,weixin.xxx.com/wechat,

然后配置正确了但是无法获取微信端发送的数据,调查源码发现是hook导致的,

一开始路由解析是这样:

route_parse: ["prepend", "csrf", "subdomain","parse_wechat"]

修改成:

route_parse: ["prepend", "parse_wechat","csrf", "subdomain"]

parse_wechat一定要紧跟prepend后面才行,否则没有办法正确的解析。

from think-wechat.

yuexing0921 avatar yuexing0921 commented on July 24, 2024

现在新的问题来了,能接收到微信的发送的数据,但是进入controller到init后,__before(包含)后就不走了

直接用域名访问weixin.xxx.com/wechat/text能正常的进入到controller,并且打印信息

下面是我的代码路径
image

下面是wechat.js的源代码

export default class extends Base {
       init(http){
		super.init(http); 
		console.log("init");
		var message = this.post();
		console.log(message);

	}
	__before(){
	 	console.log('__before');
	 }
	/**
	 * index action
	 * @return {Promise} []
	 */
	indexAction(){
		console.log("indexAction");
		let echostr = this.get('echostr');
		return this.end(echostr);
	}
	reply(message){
		console.log("reply");
		this.http.res.reply(message);
	}
	textAction(){
		console.log("textAction");
		var message = this.post();
		var msg = message.Content.trim();
		this.reply('测试成功:'+msg);
	}
	eventAction(){
		console.log("eventAction");
		let message = this.post();
		console.log(message);
		this.reply(JSON.stringify(message));
	}
	__call(){
		console.log("__call");
		this.reply(DEFULT_AUTO_REPLY);
	}
}

@akira-cn 月影大大看看是怎么回事

from think-wechat.

yuexing0921 avatar yuexing0921 commented on July 24, 2024

目前已经暂时解决了,把hook.js的csrf组件去除掉就好了。
应该是微信提交的没有csrf的认证信息,所以导致被拦截了,坑爹的是,这个组件也没有提示。

from think-wechat.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.