还有就是{"errcode":48001,"errmsg":"api unauthorized, hints: [ req_id: 1QoCla0699ns81 ]"}这种的
这种错误解决方案: https://www.cnblogs.com/liaolongjun/p/6080240.html
https://www.cnblogs.com/sxmny/articles/4969119.html
一般情况下,所有的错误都是因为code要么用过了,要么没授权导致的
注意: 获取到的code只能用一次
源码如下,时间赶得紧,写的比较烂
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.teeqee.threeKingdomsGame.wx.miniapp.config.WxMaProperties;
import com.teeqee.threeKingdomsGame.wx.miniapp.pojo.SanGuoUser;
import com.teeqee.threeKingdomsGame.wx.miniapp.service.SanGuoUserService;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestCo