trick9191 7 years ago
parent
commit
04626545e4

+ 5 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/applets/AppletsService.java

@ -11,6 +11,8 @@ import com.yihu.wlyy.util.http.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
@ -28,6 +30,7 @@ import java.util.Map;
@Transactional
public class AppletsService extends BaseService {
    private static Logger logger = LoggerFactory.getLogger(AppletsService.class);
    @Value("${applets.appId}")
    private String appid;
    @Value("${applets.appSecret}")
@ -50,6 +53,8 @@ public class AppletsService extends BaseService {
        HttpResponse response = httpUtils.doGet("https://api.weixin.qq.com/sns/jscode2session", param);
        JSONObject rs = new JSONObject(response.getContent());
        Map<String, Object> res = new HashedMap();
        logger.info("checkApplets:"+response.getContent());
        res.put("openid", rs.getString("openid"));
        res.put("sessionKey", rs.getString("session_key"));
        res.put("unionid", rs.getString("unionid"));