5 年之前
父节点
当前提交
5452d831ab
共有 29 个文件被更改,包括 0 次插入1785 次删除
  1. 0 137
      pom.xml
  2. 0 23
      src/main/java/com/hhsx/minigame/MinigameApplication.java
  3. 0 17
      src/main/java/com/hhsx/minigame/constant/Constant.java
  4. 0 73
      src/main/java/com/hhsx/minigame/controller/NewsController.java
  5. 0 102
      src/main/java/com/hhsx/minigame/controller/UserController.java
  6. 0 128
      src/main/java/com/hhsx/minigame/entity/News.java
  7. 0 125
      src/main/java/com/hhsx/minigame/entity/User.java
  8. 0 19
      src/main/java/com/hhsx/minigame/entity/vo/NewsVO.java
  9. 0 16
      src/main/java/com/hhsx/minigame/mapper/NewsMapper.java
  10. 0 16
      src/main/java/com/hhsx/minigame/mapper/UserMapper.java
  11. 0 26
      src/main/java/com/hhsx/minigame/service/NewsService.java
  12. 0 16
      src/main/java/com/hhsx/minigame/service/UserService.java
  13. 0 72
      src/main/java/com/hhsx/minigame/service/impl/NewsServiceImpl.java
  14. 0 20
      src/main/java/com/hhsx/minigame/service/impl/UserServiceImpl.java
  15. 0 50
      src/main/java/com/hhsx/minigame/utils/AccessToken.java
  16. 0 218
      src/main/java/com/hhsx/minigame/utils/CodeGenerator.java
  17. 0 293
      src/main/java/com/hhsx/minigame/utils/HttpKit.java
  18. 0 39
      src/main/java/com/hhsx/minigame/utils/HttpRespMsg.java
  19. 0 58
      src/main/java/com/hhsx/minigame/utils/MicroblogUsersNews.java
  20. 0 14
      src/main/java/com/hhsx/minigame/utils/Test.java
  21. 0 31
      src/main/java/com/hhsx/minigame/utils/WechatAndMicroblogUtil.java
  22. 0 50
      src/main/java/com/hhsx/minigame/utils/WechatUserNews.java
  23. 0 56
      src/main/resources/application.properties
  24. 0 30
      src/main/resources/application.yml
  25. 0 20
      src/main/resources/mapper/NewsMapper.xml
  26. 0 20
      src/main/resources/mapper/UserMapper.xml
  27. 0 36
      src/main/resources/static/index.html
  28. 0 64
      src/main/resources/templates/index.html
  29. 0 16
      src/test/java/com/hhsx/minigame/MinigameApplicationTests.java

+ 0 - 137
pom.xml

@@ -1,137 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.springframework.boot</groupId>
-        <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.1.8.RELEASE</version>
-        <relativePath/> <!-- lookup parent from repository -->
-    </parent>
-    <groupId>com.hhsx</groupId>
-    <artifactId>minigame</artifactId>
-    <version>0.0.1-SNAPSHOT</version>
-    <packaging>war</packaging>
-    <name>minigame</name>
-    <description>Demo project for Spring Boot</description>
-
-    <properties>
-        <java.version>1.8</java.version>
-    </properties>
-
-    <dependencies>
-
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-tomcat</artifactId>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-devtools</artifactId>
-            <scope>runtime</scope>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-            <scope>runtime</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <!-- mybatis-plus依赖 -->
-        <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>mybatis-plus-boot-starter</artifactId>
-            <version>3.1.2</version>
-        </dependency>
-        <!-- mybatis-plus代码生成器依赖 -->
-        <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>mybatis-plus-generator</artifactId>
-            <version>3.1.2</version>
-        </dependency>
-
-        <!-- velocity模板引擎 -->
-        <dependency>
-            <groupId>org.apache.velocity</groupId>
-            <artifactId>velocity-engine-core</artifactId>
-            <version>2.0</version>
-        </dependency>
-
-        <!-- freemarker 模板引擎-->
-        <dependency>
-            <groupId>org.freemarker</groupId>
-            <artifactId>freemarker</artifactId>
-            <version>2.3.23</version>
-        </dependency>
-
-        <!-- fastjson -->
-        <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>fastjson</artifactId>
-            <version>1.2.7</version>
-        </dependency>
-
-        <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-            <version>3.8.1</version>
-        </dependency>
-
-        <!-- https://mvnrepository.com/artifact/io.swagger/swagger-annotations -->
-        <dependency>
-            <groupId>io.swagger</groupId>
-            <artifactId>swagger-annotations</artifactId>
-            <version>1.5.15</version>
-        </dependency>
-
-        <!-- https://mvnrepository.com/artifact/com.belerweb/weibo4j-oauth2 -->
-        <dependency>
-            <groupId>com.belerweb</groupId>
-            <artifactId>weibo4j-oauth2</artifactId>
-            <version>2.1.1-beta2-3</version>
-        </dependency>
-
-        <!-- thymeleaf -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-thymeleaf</artifactId>
-        </dependency>
-
-
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-war-plugin</artifactId>
-                <configuration>
-                    <warName>minigame</warName>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>

+ 0 - 23
src/main/java/com/hhsx/minigame/MinigameApplication.java

@@ -1,23 +0,0 @@
-package com.hhsx.minigame;
-
-import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
-
-@SpringBootApplication
-@MapperScan("com.hhsx.minigame.mapper")
-public class MinigameApplication extends SpringBootServletInitializer {
-
-    @Override
-
-    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
-        return builder.sources(MinigameApplication.class);
-    }
-
-    public static void main(String[] args) {
-        SpringApplication.run(MinigameApplication.class, args);
-    }
-
-}

+ 0 - 17
src/main/java/com/hhsx/minigame/constant/Constant.java

@@ -1,17 +0,0 @@
-
-package com.hhsx.minigame.constant;
-/**
- * Author: 吴涛涛
- * Date : 2019 - 07 - 24 16:00
- * Description:<描述>常量配置类
- * Version: 1.0
- */
-public class Constant {
-    public static final String MICROBLOG_APPKEY = "2141531565";//微博的appkey
-    public static final String MICROBLOG_APPSECRET = "f39462b939a56ce6d846bf83e04c20b5";//微博的accesstoken
-    public static final String WECHAT_APPID = "wx749c84daac654e1e";//微信的appid
-    public static final String WECHAT_APPSECRET = "f39462b939a56ce6d846bf83e04c20b5";//微信的appsecret
-
-}
-
-

+ 0 - 73
src/main/java/com/hhsx/minigame/controller/NewsController.java

@@ -1,73 +0,0 @@
-package com.hhsx.minigame.controller;
-
-
-import com.hhsx.minigame.entity.vo.NewsVO;
-import com.hhsx.minigame.service.NewsService;
-import com.hhsx.minigame.utils.HttpRespMsg;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import java.io.IOException;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-
-/**
- * @author 吴涛涛
- * @since 2019-09-17
- */
-@Controller
-@RequestMapping("/news")
-public class NewsController {
-
-    @Autowired
-    NewsService newsService;
-    @Value("${callbackURL}")
-    private String callbackURL;
-
-    /**
-     * 添加分享信息
-     *
-     * 传递的参数:
-     * type: 0 -微信 1 -微博
-     * type=0时,所需其他参数: message:寄语 openid:用户openid
-     *
-     * type=1时,所需其他参数:message:寄语 uid:微博身份唯一凭证
-     * @return
-     */
-    @ApiOperation(value = "添加分享信息", notes = "添加分享信息方法")
-    @RequestMapping("/addNews")
-    @ResponseBody
-    public HttpRespMsg addUserNews(NewsVO newsVO){
-        HttpRespMsg msg =  newsService.addUserNews(newsVO);
-        return msg;
-
-    }
-    /**
-     * 微博授权登录
-     *
-     * 传递的参数:
-     * type: 0 -微信 1 -微博
-     * type=0时,所需其他参数: message:寄语 openid:用户openid
-     *
-     * type=1时,所需其他参数:message:寄语 uid:微博身份唯一凭证
-     * @return
-     */
-    @ApiOperation(value = "微博授权登录", notes = "微博授权登录方法")
-    @RequestMapping("/microblogLogin")
-    @ResponseBody
-    public HttpRespMsg microblogLogin(NewsVO newsVO) throws IOException, NoSuchAlgorithmException, NoSuchProviderException, KeyManagementException {
-        HttpRespMsg msg =  newsService.login(newsVO,callbackURL);
-        return msg;
-
-    }
-
-
-
-}
-

+ 0 - 102
src/main/java/com/hhsx/minigame/controller/UserController.java

@@ -1,102 +0,0 @@
-package com.hhsx.minigame.controller;
-
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.hhsx.minigame.constant.Constant;
-import com.hhsx.minigame.entity.User;
-import com.hhsx.minigame.service.UserService;
-import com.hhsx.minigame.utils.HttpKit;
-import com.hhsx.minigame.utils.HttpRespMsg;
-import io.swagger.annotations.ApiOperation;
-import org.apache.commons.lang3.StringEscapeUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.util.Date;
-
-/**
- * <p>
- * 前端控制器
- * </p>
- *
- * @author 吴涛涛
- * @since 2019-09-18
- */
-@RestController
-@RequestMapping("/user")
-public class UserController {
-
-    @Autowired
-    private UserService userService;
-
-    /**
-     * 微信授权登录
-     * 参数:
-     * type:授权类型,0-微信,1-微博
-     * code:平台返回的code值
-     *
-     * @return
-     */
-    @ApiOperation("微信/微博网页授权")
-    @RequestMapping(value = "weiXinLogin")
-    @ResponseBody
-    public Object weiXinLogin(@RequestParam String code, Integer type,
-                              HttpServletResponse response) throws Exception, KeyManagementException, NoSuchAlgorithmException, NoSuchProviderException, IOException {
-        HttpRespMsg msg = new HttpRespMsg();
-        if (type == 0) {
-            String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + Constant.WECHAT_APPID + "&secret=" + Constant.WECHAT_APPSECRET + "&code=" + code + "&grant_type=authorization_code";
-            String resp = HttpKit.get(url, true);
-            resp = StringEscapeUtils.unescapeJava(resp);
-            System.out.println(resp);
-            JSONObject json = (JSONObject) JSON.parse(resp);
-            if (!json.containsKey("errcode")) {
-                String openId = json.getString("openid");
-                String accessToken = json.getString("access_token");
-                User user = new User();
-                user.setType(type);
-                user.setVoucherId(openId);
-                String url1 = "https://api.weixin.qq.com/sns/userinfo?access_token="+accessToken+"&openid="+openId+"&lang=zh_CN";
-                //获取用户基本信息
-                 resp = HttpKit.get(url1, true);
-                resp = StringEscapeUtils.unescapeJava(resp);
-                System.out.println(resp);
-                 json = (JSONObject) JSON.parse(resp);
-                 if(!json.containsKey("errcode")){
-                     user.setNickName(json.getString("nickname"));
-                     user.setHeaderPic(json.getString("headimgurl"));
-                 }
-                QueryWrapper<User> qw = new QueryWrapper<>();
-                qw.eq("voucher_id", openId).eq("type", type);
-                if (userService.count(qw) == 0) {
-                    userService.save(user);
-                } else {
-                    //列表中已包含当前用户,
-                    user = userService.getOne(qw);
-                }
-                msg.data = user;
-            } else {
-                msg.setError(json.getString("errmsg"));
-            }
-        }else if(type == 1){
-//            String url = "https://api.weibo.com/oauth2/authorize?client_id="+Constant.MICROBLOG_APPKEY +"&response_type=code&redirect_uri="+callbackURL;
-
-        }
-
-        response.setContentType("application/json");
-        response.setCharacterEncoding("UTF-8");
-        return msg;
-    }
-
-}
-

+ 0 - 128
src/main/java/com/hhsx/minigame/entity/News.java

@@ -1,128 +0,0 @@
-package com.hhsx.minigame.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-
-import java.io.Serializable;
-
-/**
- * <p>
- * 
- * </p>
- *
- * @author 吴涛涛
- * @since 2019-09-17
- */
-@TableName("mini_news")
-public class News extends Model<News> {
-
-    private static final long serialVersionUID=1L;
-
-    /**
-     * mini游戏链接表主键
-     */
-    @TableId(value = "id", type = IdType.AUTO)
-    private Integer id;
-
-    /**
-     * 用户昵称
-     */
-    @TableField("nick_name")
-    private String nickName;
-
-    /**
-     * 用户头像
-     */
-    @TableField("header_pic")
-    private String headerPic;
-
-    /**
-     * 创建时间
-     */
-    @TableField("indate")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")    private LocalDateTime indate;
-    /**
-     * 获取链接的来源,0-微信 1-微博
-     */
-    @TableField("type")
-    private Integer type = 0;
-
-    /**
-     * 寄语
-     */
-    @TableField("message")
-    private String message;
-
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public String getNickName() {
-        return nickName;
-    }
-
-    public void setNickName(String nickName) {
-        this.nickName = nickName;
-    }
-
-    public String getHeaderPic() {
-        return headerPic;
-    }
-
-    public void setHeaderPic(String headerPic) {
-        this.headerPic = headerPic;
-    }
-
-    public LocalDateTime getIndate() {
-        return indate;
-    }
-
-    public void setIndate(LocalDateTime indate) {
-        this.indate = indate;
-    }
-
-    public Integer getType() {
-        return type;
-    }
-
-    public void setType(Integer type) {
-        this.type = type;
-    }
-
-    public String getMessage() {
-        return message;
-    }
-
-    public void setMessage(String message) {
-        this.message = message;
-    }
-
-    @Override
-    protected Serializable pkVal() {
-        return this.id;
-    }
-
-    @Override
-    public String toString() {
-        return "News{" +
-        "id=" + id +
-        ", nickName=" + nickName +
-        ", headerPic=" + headerPic +
-        ", indate=" + indate +
-        ", type=" + type +
-        ", message=" + message +
-        "}";
-    }
-}

+ 0 - 125
src/main/java/com/hhsx/minigame/entity/User.java

@@ -1,125 +0,0 @@
-package com.hhsx.minigame.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
-import com.baomidou.mybatisplus.annotation.TableField;
-import java.io.Serializable;
-
-/**
- * <p>
- * 
- * </p>
- *
- * @author 吴涛涛
- * @since 2019-09-18
- */
-@TableName("mini_user")
-public class User extends Model<User> {
-
-    private static final long serialVersionUID=1L;
-
-    /**
-     * 用户表主键
-     */
-    @TableId(value = "id", type = IdType.AUTO)
-    private Integer id;
-
-    /**
-     * 授权类型0-微信 1-微博
-     */
-    @TableField("type")
-    private Integer type;
-
-    /**
-     * 授权id type=0:openid  type=1:uid
-     */
-    @TableField("voucher_id")
-    private String voucherId;
-
-    /**
-     * 授权时间
-     */
-    @TableField("indate")
-    private LocalDateTime indate;
-
-    /**
-     * 微信/微博头像
-     */
-    @TableField("header_pic")
-    private String headerPic;
-
-    /**
-     * 微信/微博昵称
-     */
-    @TableField("nick_name")
-    private String nickName;
-
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public Integer getType() {
-        return type;
-    }
-
-    public void setType(Integer type) {
-        this.type = type;
-    }
-
-    public String getVoucherId() {
-        return voucherId;
-    }
-
-    public void setVoucherId(String voucherId) {
-        this.voucherId = voucherId;
-    }
-
-    public LocalDateTime getIndate() {
-        return indate;
-    }
-
-    public void setIndate(LocalDateTime indate) {
-        this.indate = indate;
-    }
-
-    public String getHeaderPic() {
-        return headerPic;
-    }
-
-    public void setHeaderPic(String headerPic) {
-        this.headerPic = headerPic;
-    }
-
-    public String getNickName() {
-        return nickName;
-    }
-
-    public void setNickName(String nickName) {
-        this.nickName = nickName;
-    }
-
-    @Override
-    protected Serializable pkVal() {
-        return this.id;
-    }
-
-    @Override
-    public String toString() {
-        return "User{" +
-        "id=" + id +
-        ", type=" + type +
-        ", voucherId=" + voucherId +
-        ", indate=" + indate +
-        ", headerPic=" + headerPic +
-        ", nickName=" + nickName +
-        "}";
-    }
-}

+ 0 - 19
src/main/java/com/hhsx/minigame/entity/vo/NewsVO.java

@@ -1,19 +0,0 @@
-package com.hhsx.minigame.entity.vo;
-
-import com.hhsx.minigame.entity.News;
-import lombok.Data;
-
-/**
- * Author: 吴涛涛 cuiyi@itany.com
- * Date : 2019 - 09 - 17 11:09
- * Description:<描述>
- * Version: 1.0
- */
-@Data
-public class NewsVO extends News {
-
-    private String openId;//用户openid
-
-    private String uid;//微博身份唯一凭证
-
-}

+ 0 - 16
src/main/java/com/hhsx/minigame/mapper/NewsMapper.java

@@ -1,16 +0,0 @@
-package com.hhsx.minigame.mapper;
-
-import com.hhsx.minigame.entity.News;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- * <p>
- *  Mapper 接口
- * </p>
- *
- * @author 吴涛涛
- * @since 2019-09-17
- */
-public interface NewsMapper extends BaseMapper<News> {
-
-}

+ 0 - 16
src/main/java/com/hhsx/minigame/mapper/UserMapper.java

@@ -1,16 +0,0 @@
-package com.hhsx.minigame.mapper;
-
-import com.hhsx.minigame.entity.User;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- * <p>
- *  Mapper 接口
- * </p>
- *
- * @author 吴涛涛
- * @since 2019-09-18
- */
-public interface UserMapper extends BaseMapper<User> {
-
-}

+ 0 - 26
src/main/java/com/hhsx/minigame/service/NewsService.java

@@ -1,26 +0,0 @@
-package com.hhsx.minigame.service;
-
-import com.hhsx.minigame.entity.News;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.hhsx.minigame.entity.vo.NewsVO;
-import com.hhsx.minigame.utils.HttpRespMsg;
-
-import java.io.IOException;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-
-/**
- * <p>
- *  服务类
- * </p>
- *
- * @author 吴涛涛
- * @since 2019-09-17
- */
-public interface NewsService extends IService<News> {
-
-    HttpRespMsg addUserNews(NewsVO newsVO);
-
-    HttpRespMsg login(NewsVO newsVO,String callbackURL) throws KeyManagementException, NoSuchAlgorithmException, NoSuchProviderException, IOException;
-}

+ 0 - 16
src/main/java/com/hhsx/minigame/service/UserService.java

@@ -1,16 +0,0 @@
-package com.hhsx.minigame.service;
-
-import com.hhsx.minigame.entity.User;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- * <p>
- *  服务类
- * </p>
- *
- * @author 吴涛涛
- * @since 2019-09-18
- */
-public interface UserService extends IService<User> {
-
-}

+ 0 - 72
src/main/java/com/hhsx/minigame/service/impl/NewsServiceImpl.java

@@ -1,72 +0,0 @@
-package com.hhsx.minigame.service.impl;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.hhsx.minigame.constant.Constant;
-import com.hhsx.minigame.entity.News;
-import com.hhsx.minigame.entity.vo.NewsVO;
-import com.hhsx.minigame.mapper.NewsMapper;
-import com.hhsx.minigame.service.NewsService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.hhsx.minigame.utils.*;
-import org.apache.commons.lang3.StringEscapeUtils;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.io.IOException;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-
-/**
- * <p>
- *  服务实现类
- * </p>
- *
- * @author 吴涛涛
- * @since 2019-09-17
- */
-@Service
-public class NewsServiceImpl extends ServiceImpl<NewsMapper, News> implements NewsService {
-
-    @Resource
-    NewsMapper newsMapper;
-
-    @Override
-    public HttpRespMsg addUserNews(NewsVO newsVO) {
-        HttpRespMsg msg = new HttpRespMsg();
-        if(newsVO.getType()==0){
-            //微信授权的链接
-            try {
-                WechatUserNews wechatUserNews = WechatAndMicroblogUtil.getWechatUserNews(newsVO.getOpenId(), AccessToken.getNewAccessToken());
-                News news = new News();
-                news.setNickName(wechatUserNews.getNickname());
-                news.setHeaderPic(wechatUserNews.getHeadimgurl());
-                news.setMessage(newsVO.getMessage());
-                news.setType(newsVO.getType());
-                newsMapper.insert(news);
-                msg.data = news;
-                return msg;
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-
-        }else if(newsVO.getType()==1){
-            //微博授权的链接
-
-
-        }
-
-        return null;
-    }
-
-    //微博授权登录
-    @Override
-    public HttpRespMsg login(NewsVO newsVO,String callbackURL) throws KeyManagementException, NoSuchAlgorithmException, NoSuchProviderException, IOException {
-        String authorizationURL = "https://api.weibo.com/oauth2/authorize?client_id="+Constant.MICROBLOG_APPKEY +"&response_type=code&redirect_uri="+callbackURL;
-        String resp = HttpKit.get(authorizationURL, true);
-        resp = StringEscapeUtils.unescapeJava(resp);
-        JSONObject json = (JSONObject) JSON.parse(resp);
-        return null;
-    }
-}

+ 0 - 20
src/main/java/com/hhsx/minigame/service/impl/UserServiceImpl.java

@@ -1,20 +0,0 @@
-package com.hhsx.minigame.service.impl;
-
-import com.hhsx.minigame.entity.User;
-import com.hhsx.minigame.mapper.UserMapper;
-import com.hhsx.minigame.service.UserService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- *  服务实现类
- * </p>
- *
- * @author 吴涛涛
- * @since 2019-09-18
- */
-@Service
-public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
-
-}

+ 0 - 50
src/main/java/com/hhsx/minigame/utils/AccessToken.java

@@ -1,50 +0,0 @@
-package com.hhsx.minigame.utils;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.hhsx.minigame.constant.Constant;
-import org.apache.commons.lang3.StringEscapeUtils;
-
-import java.io.IOException;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.util.Date;
-
-/**
- * Author: 吴涛涛 cuiyi@itany.com
- * Date : 2019 - 09 - 17 10:04
- * Description:<描述>
- * Version: 1.0
- */
-public class AccessToken {
-
-    private static String wechatAppId = Constant.WECHAT_APPID;
-
-    private static String wechatSecret = Constant.WECHAT_APPSECRET;
-
-    private static String oldAccessToken = null;
-
-    private static Date time = new Date();//oldAccessToken值创建时间
-
-    private static Long expiresIn = 7200L*1000;//accessToken值有效时长 单位毫秒
-
-    public static String getNewAccessToken() throws Exception {
-        if(oldAccessToken == null || (oldAccessToken != null && System.currentTimeMillis() > time.getTime()+expiresIn)){
-            String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + wechatAppId + "&secret=" + wechatSecret;
-            String resp = HttpKit.get(url, true);
-            resp = StringEscapeUtils.unescapeJava(resp);
-            JSONObject json = (JSONObject) JSON.parse(resp);
-            //获取值赋值给全局变量
-            if (!json.containsKey("errcode")) {
-                String newAccessToken = json.getString("access_token");
-                String newExpiresIn = json.getString("expires_in");
-                oldAccessToken = newAccessToken;
-                expiresIn = Long.parseLong(newExpiresIn) * 1000;
-                time = new Date();
-                System.out.println("获取新access_token==>" + oldAccessToken);
-            }
-        }
-        return oldAccessToken;
-    }
-}

+ 0 - 218
src/main/java/com/hhsx/minigame/utils/CodeGenerator.java

@@ -1,218 +0,0 @@
-package com.hhsx.minigame.utils;
-
-import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
-import com.baomidou.mybatisplus.core.toolkit.StringPool;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import com.baomidou.mybatisplus.generator.AutoGenerator;
-import com.baomidou.mybatisplus.generator.InjectionConfig;
-import com.baomidou.mybatisplus.generator.config.*;
-import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder;
-import com.baomidou.mybatisplus.generator.config.po.TableInfo;
-import com.baomidou.mybatisplus.generator.config.rules.FileType;
-import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
-import com.hhsx.minigame.constant.Constant;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Scanner;
-
-/**
- * mybatis-plus代码生成器
- *  使用该类需要添加以下依赖,在此之前请移除所有与mybatis有关的其他依赖,防止冲突
- *   <dependency>
- *      <groupId>com.baomidou</groupId>
- *       <artifactId>mybatis-plus-generator</artifactId>
- *       <version>3.1.2</version>
- *  </dependency>
- *
- *  <dependency>
- *        <groupId>com.baomidou</groupId>
- *        <artifactId>mybatis-plus-boot-starter</artifactId>
- *        <version>3.1.2</version>
- *   </dependency>
- *
- */
-// 演示例子,执行 main 方法控制台输入模块表名回车自动生成对应项目目录中
-public class CodeGenerator {
-
-    /**
-     * <p>
-     * 读取控制台内容
-     * </p>
-     */
-    public static String scanner(String tip) {
-        Scanner scanner = new Scanner(System.in);
-        StringBuilder help = new StringBuilder();
-        help.append("请输入" + tip + ":");
-        System.out.println(help.toString());
-        if (scanner.hasNext()) {
-            String ipt = scanner.next();
-            if (StringUtils.isNotEmpty(ipt)) {
-                return ipt;
-            }
-        }
-        throw new MybatisPlusException("请输入正确的" + tip + "!");
-    }
-
-    public static void main(String[] args) {
-        // 代码生成器
-        AutoGenerator mpg = new AutoGenerator();
-
-        // 全局配置
-        GlobalConfig gc = new GlobalConfig();
-        // 全局配置
-
-
-        // 自定义文件命名,注意 %s 会自动填充表实体属性!
-//        gc.setMapperName("%sDao");
-//        gc.setXmlName("%sMapper");
-//        gc.setServiceName("%sService");
-//        gc.setServiceImplName("%sServiceImap");
-//        gc.setControllerName("%sController");
-        //生成的代码存放到某个路径下,这里是E盘,
-//        gc.setOutputDir("E://");
-        //生成的代码位置为当前项目
-        String projectPath = System.getProperty("user.dir");
-        gc.setOutputDir(projectPath + "/src/main/java");
-        gc.setAuthor("吴涛涛");
-        gc.setOpen(false);
-        gc.setFileOverride(true);
-        gc.setActiveRecord(true);
-        //%s是实体类类名占位符,不配置这行的话,对于User会生成IUserService,配置后即可生成UserService;
-        gc.setServiceName("%sService");
-        // XML 二级缓存
-//      gc.setEnableCache(true);
-        // XML ResultMap
-        gc.setBaseResultMap(true);
-        // XML columList
-        gc.setBaseColumnList(true);
-        //
-        // gc.setSwagger2(true); 实体属性 Swagger2 注解
-        mpg.setGlobalConfig(gc);
-
-        // 数据源配置
-        DataSourceConfig dsc = new DataSourceConfig();
-        dsc.setUrl("jdbc:mysql://118.190.47.230:3306/minigame?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8");
-//        dsc.setSchemaName("public");
-        dsc.setDriverName("com.mysql.cj.jdbc.Driver");
-        dsc.setUsername("root");
-        dsc.setPassword("p011430seya10");
-        mpg.setDataSource(dsc);
-
-        // 包配置
-        PackageConfig pc = new PackageConfig();
-        //若果需要在Parent(此处即com.example.plus)下新建模块时打开下面注释,后续在控制台提示输入模块时,输入想要新建的模块名就可以
-//        pc.setModuleName(scanner("模块名"));
-        pc.setParent("com.hhsx.minigame");
-        mpg.setPackageInfo(pc);
-
-        // 自定义配置
-        InjectionConfig cfg = new InjectionConfig() {
-            @Override
-            public void initMap() {
-                // to do nothing
-            }
-        };
-        //以下为两种模板来生成*mapper.xml文件,任选一种即可,不同的模板对应不同的依赖
-        // 如果模板引擎是 freemarker,请添加以下依赖。
-        /**
-         *         <dependency>
-         *             <groupId>org.freemarker</groupId>
-         *             <artifactId>freemarker</artifactId>
-         *             <version>2.3.23</version>
-         *         </dependency>
-         */
-//        String templatePath = "/templates/mapper.xml.ftl";
-        // 如果模板引擎是 velocity 请添加以下依赖。
-        /**
-         *         <dependency>
-         *             <groupId>org.apache.velocity</groupId>
-         *             <artifactId>velocity-engine-core</artifactId>
-         *             <version>2.0</version>
-         *         </dependency>
-         */
-         String templatePath = "/templates/mapper.xml.vm";
-
-        // 自定义输出配置
-        List<FileOutConfig> focList = new ArrayList<>();
-        // 自定义配置会被优先输出
-        focList.add(new FileOutConfig(templatePath) {
-            @Override
-            public String outputFile(TableInfo tableInfo) {
-                if(pc.getModuleName() == null){
-                    return projectPath + "/src/main/resources/mapper/"
-                            + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
-                }else{
-                    // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
-                    return projectPath + "/src/main/resources/mapper/" + pc.getModuleName()
-                            + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
-                }
-
-            }
-
-        });
-
-        cfg.setFileCreate(new IFileCreate() {
-            @Override
-            public boolean isCreate(ConfigBuilder configBuilder, FileType fileType, String filePath) {
-                // 判断自定义文件夹是否需要创建,这里调用默认的方法
-                checkDir(filePath);
-                //对于已存在的文件,只需重复生成 entity 和 mapper.xml
-                File file = new File(filePath);
-                boolean exist = file.exists();
-                if(exist){
-                    if (filePath.endsWith("Mapper.xml")||FileType.ENTITY==fileType){
-                        return true;
-                    }else {
-                        return false;
-                    }
-                }
-                //不存在的文件都需要创建
-                return  true;
-            }
-        });
-
-        cfg.setFileOutConfigList(focList);
-        mpg.setCfg(cfg);
-        mpg.setTemplate(new TemplateConfig().setXml(null));
-
-        // 配置模板
-//        TemplateConfig templateConfig = new TemplateConfig();
-//
-//        // 配置自定义输出模板
-//        //指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
-//        // templateConfig.setEntity("templates/entity2.java");
-//        // templateConfig.setService();
-//        // templateConfig.setController();
-//
-//        templateConfig.setXml(null);
-//        mpg.setTemplate(templateConfig);
-
-        // 策略配置
-        StrategyConfig strategy = new StrategyConfig();
-        strategy.setNaming(NamingStrategy.underline_to_camel);
-        strategy.setColumnNaming(NamingStrategy.underline_to_camel);
-        //若想要生成的实体类继承某个类,则可打开下面注释。写上需要继承的类的位置即可
-//        strategy.setSuperEntityClass("com.baomidou.ant.common.BaseEntity");
-        //【实体】是否为lombok模型(默认 false)
-//        strategy.setEntityLombokModel(true);
-        //对控制器生成 @RestController 注解
-        strategy.setRestControllerStyle(true);
-        //是否生成实体时,生成字段注解
-        strategy.setEntityTableFieldAnnotationEnable(true);
-//        strategy.setEntitySerialVersionUID(false)//加此行不生成生成实体类序列化编号,不加默认生成
-        //若想要生成的实体类继承某个Controller,则可打开下面注释。写上需要继承的Controller的位置即可
-//        strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
-        //此处user是表名,多个英文逗号分割
-        strategy.setInclude("mini_user");
-//        strategy.setExclude();//数据库表全生成
-//        strategy.setInclude(scanner("user").split(","));//表名,多个英文逗号分割
-        strategy.setControllerMappingHyphenStyle(true);
-        //数据库表前缀,不配置这行的话,生成的类会带有T如:TUser,配置后即可将前缀去掉
-        strategy.setTablePrefix("mini_");
-        mpg.setStrategy(strategy);
-//        mpg.setTemplateEngine(new FreemarkerTemplateEngine());
-        mpg.execute();
-    }
-}

+ 0 - 293
src/main/java/com/hhsx/minigame/utils/HttpKit.java

@@ -1,293 +0,0 @@
-package com.hhsx.minigame.utils;
-
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-
-import javax.net.ssl.*;
-import java.io.*;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.Map;
-import java.util.Map.Entry;
-
-@Slf4j
-public class HttpKit {
-    
-    private static final String DEFAULT_CHARSET = "UTF-8";
-    /**
-     * 发送Get请求
-     * @param url
-     * @return
-     * @throws NoSuchProviderException 
-     * @throws NoSuchAlgorithmException 
-     * @throws IOException 
-     * @throws KeyManagementException 
-     */
-    public static String get(String url) throws NoSuchAlgorithmException, NoSuchProviderException, IOException, KeyManagementException {
-        StringBuffer bufferRes = null;
-        TrustManager[] tm = { new MyX509TrustManager() };  
-        SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");  
-        sslContext.init(null, tm, new java.security.SecureRandom());  
-        // 从上述SSLContext对象中得到SSLSocketFactory对象  
-        SSLSocketFactory ssf = sslContext.getSocketFactory();
-        
-        URL urlGet = new URL(url);
-        HttpsURLConnection http = (HttpsURLConnection) urlGet.openConnection();
-        // 连接超时
-        http.setConnectTimeout(25000);
-        // 读取超时 --服务器响应比较慢,增大时间
-        http.setReadTimeout(25000);
-        http.setRequestMethod("GET");
-        http.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
-        http.setSSLSocketFactory(ssf);
-        http.setDoOutput(true);
-        http.setDoInput(true);
-        http.connect();
-        
-        InputStream in = http.getInputStream();
-        BufferedReader read = new BufferedReader(new InputStreamReader(in, DEFAULT_CHARSET));
-        String valueString = null;
-        bufferRes = new StringBuffer();
-        while ((valueString = read.readLine()) != null){
-            bufferRes.append(valueString);
-        }
-        in.close();
-        if (http != null) {
-            // 关闭连接
-            http.disconnect();
-        }
-        return bufferRes.toString();
-    }
-    
-    /**
-     * 发送Get请求
-     * @param url
-     * @return
-     * @throws NoSuchProviderException 
-     * @throws NoSuchAlgorithmException 
-     * @throws IOException 
-     * @throws KeyManagementException 
-     */
-    public static String get(String url,Boolean https) throws NoSuchAlgorithmException, NoSuchProviderException, IOException, KeyManagementException {
-     if(https != null && https){
-      return get(url);
-     }else{
-      StringBuffer bufferRes = null;
-            URL urlGet = new URL(url);
-            HttpURLConnection http = (HttpURLConnection) urlGet.openConnection();
-            // 连接超时
-            http.setConnectTimeout(25000);
-            // 读取超时 --服务器响应比较慢,增大时间
-            http.setReadTimeout(25000);
-            http.setRequestMethod("GET");
-            http.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
-            http.setDoOutput(true);
-            http.setDoInput(true);
-            http.connect();
-            
-            InputStream in = http.getInputStream();
-            BufferedReader read = new BufferedReader(new InputStreamReader(in, DEFAULT_CHARSET));
-            String valueString = null;
-            bufferRes = new StringBuffer();
-            while ((valueString = read.readLine()) != null){
-                bufferRes.append(valueString);
-            }
-            in.close();
-            if (http != null) {
-                // 关闭连接
-                http.disconnect();
-            }
-            return bufferRes.toString();
-     }
-    }
-    /**
-     *  发送Get请求
-     * @param url
-     * @param params
-     * @return
-     * @throws IOException 
-     * @throws NoSuchProviderException 
-     * @throws NoSuchAlgorithmException 
-     * @throws KeyManagementException 
-     */
-    public static String get(String url, Map<String, String> params) throws KeyManagementException, NoSuchAlgorithmException, NoSuchProviderException, IOException {
-        return get(initParams(url, params));
-    }
-    /**
-     *  发送Post请求
-     * @param url
-     * @param params
-     * @return
-     * @throws IOException 
-     * @throws NoSuchProviderException 
-     * @throws NoSuchAlgorithmException 
-     * @throws KeyManagementException 
-     */
-    public static String post(String url, String params) throws IOException, NoSuchAlgorithmException, NoSuchProviderException, KeyManagementException {
-     StringBuffer bufferRes = null;
-        TrustManager[] tm = { new MyX509TrustManager() };
-        SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");
-        sslContext.init(null, tm, new java.security.SecureRandom());
-        // 从上述SSLContext对象中得到SSLSocketFactory对象  
-        SSLSocketFactory ssf = sslContext.getSocketFactory();
-        URL urlGet = new URL(url);
-        HttpsURLConnection http = (HttpsURLConnection) urlGet.openConnection();
-        // 连接超时
-        http.setConnectTimeout(25000);
-        // 读取超时 --服务器响应比较慢,增大时间
-        http.setReadTimeout(25000);
-        http.setRequestMethod("POST");
-        http.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
-        http.setSSLSocketFactory(ssf);
-        http.setDoOutput(true);
-        http.setDoInput(true);
-        http.connect();
-        OutputStream out = http.getOutputStream();
-        out.write(params.getBytes("UTF-8"));
-        out.flush();
-        out.close();
-        InputStream in = http.getInputStream();
-        BufferedReader read = new BufferedReader(new InputStreamReader(in, DEFAULT_CHARSET));
-        String valueString = null;
-        bufferRes = new StringBuffer();
-        while ((valueString = read.readLine()) != null){
-            bufferRes.append(valueString);
-        }
-        in.close();
-        if (http != null) {
-            // 关闭连接
-            http.disconnect();
-        }
-        return bufferRes.toString();
-    }
-    
-    /**
-     * 上传媒体文件
-     * @param url
-     * @param file
-     * @return
-     * @throws IOException
-     * @throws NoSuchAlgorithmException
-     * @throws NoSuchProviderException
-     * @throws KeyManagementException
-     */
-    public static String upload(String url,File file) throws IOException, NoSuchAlgorithmException, NoSuchProviderException, KeyManagementException {
-        String BOUNDARY = "----WebKitFormBoundaryiDGnV9zdZA1eM1yL"; // 定义数据分隔线  
-        StringBuffer bufferRes = null;
-        URL urlGet = new URL(url);
-        HttpURLConnection conn = (HttpURLConnection) urlGet.openConnection();
-        conn.setDoOutput(true);  
-        conn.setDoInput(true);  
-        conn.setUseCaches(false);  
-        conn.setRequestMethod("POST");  
-        conn.setRequestProperty("connection", "Keep-Alive");  
-        conn.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36");  
-        conn.setRequestProperty("Charsert", "UTF-8");   
-        conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);  
-          
-        OutputStream out = new DataOutputStream(conn.getOutputStream());  
-        byte[] end_data = ("\r\n--" + BOUNDARY + "--\r\n").getBytes();// 定义最后数据分隔线  
-        StringBuilder sb = new StringBuilder();    
-        sb.append("--");    
-        sb.append(BOUNDARY);    
-        sb.append("\r\n");    
-        sb.append("Content-Disposition: form-data;name=\"media\";filename=\""+ file.getName() + "\"\r\n");    
-        sb.append("Content-Type:application/octet-stream\r\n\r\n");    
-        byte[] data = sb.toString().getBytes();  
-        out.write(data);  
-        DataInputStream fs = new DataInputStream(new FileInputStream(file));  
-        int bytes = 0;  
-        byte[] bufferOut = new byte[1024];  
-        while ((bytes = fs.read(bufferOut)) != -1) {  
-            out.write(bufferOut, 0, bytes);  
-        }  
-        out.write("\r\n".getBytes()); //多个文件时,二个文件之间加入这个  
-        fs.close();  
-        out.write(end_data);  
-        out.flush();    
-        out.close();   
-          
-        // 定义BufferedReader输入流来读取URL的响应  
-        InputStream in = conn.getInputStream();
-        BufferedReader read = new BufferedReader(new InputStreamReader(in, DEFAULT_CHARSET));
-        String valueString = null;
-        bufferRes = new StringBuffer();
-        while ((valueString = read.readLine()) != null){
-            bufferRes.append(valueString);
-        }
-        in.close();
-        if (conn != null) {
-            // 关闭连接
-         conn.disconnect();
-        }
-        return bufferRes.toString();
-    }
-    
-    /**
-     * 构造url
-     * @param url
-     * @param params
-     * @return
-     */
-    private static String initParams(String url, Map<String, String> params){
-        if (null == params || params.isEmpty()) {
-            return url;
-        }
-        StringBuilder sb = new StringBuilder(url);
-        if (url.indexOf("?") == -1) {
-            sb.append("?");
-        } else {
-            sb.append("&");
-        }
-        boolean first = true;
-        for (Entry<String, String> entry : params.entrySet()) {
-            if (first) {
-                first = false;
-            } else {
-                sb.append("&");
-            }
-            String key = entry.getKey();
-            String value = entry.getValue();
-            sb.append(key).append("=");
-            if (StringUtils.isNotEmpty(value)) {
-                try {
-                    sb.append(URLEncoder.encode(value, DEFAULT_CHARSET));
-                } catch (UnsupportedEncodingException e) {
-                    e.printStackTrace();
-                    log.error(url,e);
-                }
-            }
-        }
-        return sb.toString();
-    }
-    
-    public static void main(String[] args) {
-     String fname = "dsasdas.mp4";
-     String s = fname.substring(0, fname.lastIndexOf("."));
-     String f = fname.substring(s.length()+1);
-  System.out.println(f);
- }
-}
-
-/**
- * 证书管理
- */
-class MyX509TrustManager implements X509TrustManager {
-    public X509Certificate[] getAcceptedIssuers() {
-        return null;  
-    }
-    @Override
-    public void checkClientTrusted(X509Certificate[] chain, String authType)
-            throws CertificateException {
-    }
-    @Override
-    public void checkServerTrusted(X509Certificate[] chain, String authType)
-            throws CertificateException {
-    }
-}

+ 0 - 39
src/main/java/com/hhsx/minigame/utils/HttpRespMsg.java

@@ -1,39 +0,0 @@
-package com.hhsx.minigame.utils;
-
-import com.alibaba.fastjson.JSONObject;
-import com.fasterxml.jackson.annotation.JsonInclude;
-
-import java.io.Serializable;
-
-public class HttpRespMsg implements Serializable {
-
-    //status code, ok or error.
-    public String code;
-
-
-    @JsonInclude(JsonInclude.Include.NON_NULL)
-    public String msg;
-
-    //data content, in jsonformat, or zipped string when format is gzip
-    @JsonInclude(JsonInclude.Include.NON_NULL)
-    public Object data;
-
-    public HttpRespMsg() {
-        code = "ok";
-    }
-
-    public void setError(String errorMsg) {
-        code = "error";
-        msg = errorMsg;
-    }
-
-
-    public String toJSONStr() {
-        JSONObject json = new JSONObject();
-        json.put("code", code);
-        json.put("data", data);
-        json.put("msg", msg);
-
-        return json.toJSONString();
-    }
-}

+ 0 - 58
src/main/java/com/hhsx/minigame/utils/MicroblogUsersNews.java

@@ -1,58 +0,0 @@
-package com.hhsx.minigame.utils;
-
-import lombok.Data;
-
-import java.util.List;
-
-/**
- * Author: 吴涛涛 cuiyi@itany.com
- * Date : 2019 - 09 - 17 11:39
- * Description:<描述>
- *     新浪微博用户基本详细返回的实体类封装
- * Version: 1.0
- */
-@Data
-public class MicroblogUsersNews {
-
-    private String subscribe;//用户是否订阅该公众号标识,值为0时,代表此用户没有关注该公众号,拉取不到其余信息,1表示用户已关注。
-
-    private String uid;//用户的标识,对当前公众号唯一
-
-    private String nickname;//用户的昵称
-
-    private String sex;//用户的性别,值为1时是男性,值为2时是女性,值为0时是未知
-
-    private String city;//用户所在城市
-
-    private String country;//用户所在国家
-
-    private String province;//用户所在省份
-
-    private String language;//用户的语言,简体中文为zh_CN
-
-    private String headimgurl;//用户头像地址(中图),50×50像素
-
-    private String headimgurl_large;//用户头像地址(大图),180×180像素
-
-    private String headimgurl_hd;//用户头像地址(高清),高清头像原图
-
-    private Integer follow;//该用户是否关注access_token中的uid,1:是,0:否
-
-    private Long subscribe_time;//用户关注时间,为时间戳。如果用户曾多次关注,则取最后关注时间
-
-    private String unionid;//只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段。
-
-    private String remark;//公众号运营者对粉丝的备注,公众号运营者可在微信公众平台用户管理界面对粉丝添加备注
-
-    private String groupid;//用户所在的分组ID(兼容旧的用户分组接口)
-
-    private List<Integer> tagid_list;//用户被打上的标签ID列表
-
-    private String subscribe_scene;//返回用户关注的渠道来源,ADD_SCENE_SEARCH 公众号搜索,ADD_SCENE_ACCOUNT_MIGRATION 公众号迁移,ADD_SCENE_PROFILE_CARD 名片分享,ADD_SCENE_QR_CODE 扫描二维码,ADD_SCENE_PROFILE_ LINK 图文页内名称点击,ADD_SCENE_PROFILE_ITEM 图文页右上角菜单,ADD_SCENE_PAID 支付后关注,ADD_SCENE_OTHERS 其他
-
-    private String qr_scene;//二维码扫码场景(开发者自定义)
-
-    private String qr_scene_str;//二维码扫码场景描述(开发者自定义)
-
-
-}

+ 0 - 14
src/main/java/com/hhsx/minigame/utils/Test.java

@@ -1,14 +0,0 @@
-package com.hhsx.minigame.utils;
-
-/**
- * Author: 吴涛涛 cuiyi@itany.com
- * Date : 2019 - 09 - 17 16:31
- * Description:<描述>
- * Version: 1.0
- */
-public class Test {
-
-    public static void main(String[] args) {
-
-    }
-}

+ 0 - 31
src/main/java/com/hhsx/minigame/utils/WechatAndMicroblogUtil.java

@@ -1,31 +0,0 @@
-package com.hhsx.minigame.utils;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import org.apache.commons.lang3.StringEscapeUtils;
-
-import java.util.Date;
-
-/**
- * Author: 吴涛涛 cuiyi@itany.com
- * Date : 2019 - 09 - 17 10:02
- * Description:<描述>
- * Version: 1.0
- */
-public class WechatAndMicroblogUtil {
-
-    public static WechatUserNews getWechatUserNews(String openId,String access_token)throws Exception{
-        WechatUserNews wechatUserNews = new WechatUserNews();
-        String url ="https://api.weixin.qq.com/cgi-bin/user/info?access_token="+access_token+"&openid="+openId+"&lang=zh_CN";
-        String resp = HttpKit.get(url, true);
-        resp = StringEscapeUtils.unescapeJava(resp);
-        JSONObject json = (JSONObject) JSON.parse(resp);
-        //获取值赋值给全局变量
-        if (!json.containsKey("errcode")) {
-            wechatUserNews.setHeadimgurl(json.getString("headimgurl"));
-            wechatUserNews.setNickname(json.getString("nickname"));
-//            System.out.println("获取新access_token==>" + oldAccessToken);
-        }
-        return wechatUserNews;
-    }
-}

+ 0 - 50
src/main/java/com/hhsx/minigame/utils/WechatUserNews.java

@@ -1,50 +0,0 @@
-package com.hhsx.minigame.utils;
-
-import lombok.Data;
-
-import java.util.List;
-
-/**
- * Author: 吴涛涛 cuiyi@itany.com
- * Date : 2019 - 09 - 17 10:25
- * Description:<描述>
- *     微信用户基本详细返回的实体类封装
- * Version: 1.0
- */
-@Data
-public class WechatUserNews {
-
-    private String subscribe;//用户是否订阅该公众号标识,值为0时,代表此用户没有关注该公众号,拉取不到其余信息,1表示用户已关注。
-
-    private String openid;//用户的标识,对当前公众号唯一
-
-    private String nickname;//用户的昵称
-
-    private String sex;//用户的性别,值为1时是男性,值为2时是女性,值为0时是未知
-
-    private String city;//用户所在城市
-
-    private String country;//用户所在国家
-
-    private String province;//用户所在省份
-
-    private String language;//用户的语言,简体中文为zh_CN
-
-    private String headimgurl;//用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空。若用户更换头像,原有头像URL将失效。
-
-    private Long subscribe_time;//用户关注时间,为时间戳。如果用户曾多次关注,则取最后关注时间
-
-    private String unionid;//只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段。
-
-    private String remark;//公众号运营者对粉丝的备注,公众号运营者可在微信公众平台用户管理界面对粉丝添加备注
-
-    private String groupid;//用户所在的分组ID(兼容旧的用户分组接口)
-
-    private List<Integer> tagid_list;//用户被打上的标签ID列表
-
-    private String subscribe_scene;//返回用户关注的渠道来源,ADD_SCENE_SEARCH 公众号搜索,ADD_SCENE_ACCOUNT_MIGRATION 公众号迁移,ADD_SCENE_PROFILE_CARD 名片分享,ADD_SCENE_QR_CODE 扫描二维码,ADD_SCENE_PROFILE_ LINK 图文页内名称点击,ADD_SCENE_PROFILE_ITEM 图文页右上角菜单,ADD_SCENE_PAID 支付后关注,ADD_SCENE_OTHERS 其他
-
-    private String qr_scene;//二维码扫码场景(开发者自定义)
-
-    private String qr_scene_str;//二维码扫码场景描述(开发者自定义)
-}

+ 0 - 56
src/main/resources/application.properties

@@ -1,56 +0,0 @@
-# ####################################################################################################
-# 服务端配置
-server.port=8095
-server.servlet.context-path=/
-server.tomcat.uri-encoding=UTF-8
-server.tomcat.max-http-post-size=-1
-server.connection-timeout=18000000s
-# ####################################################################################################
-# thymeleaf 配置
-spring.thymeleaf.cache=false
-spring.thymeleaf.jackson.time-zone=GMT+8
-spring.thymeleaf.jackson.date-format=yyyy-MM-dd HH:mm:ss
-# ####################################################################################################
-# 数据源配置
-spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
-spring.datasource.url=jdbc:mysql://118.190.47.230:3306/minigame?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
-spring.datasource.username=root
-spring.datasource.password=p011430seya10
-#spring.datasource.druid.test-on-borrow=true
-#spring.datasource.druid.test-while-idle=true
-# ####################################################################################################
-# MyBatis 配置
-mybatis.mapper-locations=mapper/*Mapper.xml
-mybatis.type-aliases-package=com.hssx.minigame.entity/*
-# 控制台输出SQL语句
-logging.level.com.hssx.minigame.mapper = debug
-# ####################################################################################################
-#配置Session
-spring.session.store-type=none
-# ####################################################################################################
-#成功页面跳转
-spring.thymeleaf.prefix=classpath:/static/
-######################################################################################################
-## redis 配置
-#spring.redis.host=localhost
-#spring.redis.port=6379
-######################################################################################################
-# 微博授权登录发放code的回调地址
-callbackURL=http://www.mini.game/index.html
-#######################################################################################################
-## 文件下载路径
-#download.path=D:/mould/download/
-## 邀请人员链接前缀
-#invitation.url.prefix=https://localhost:8090/#/invite/
-#######################################################################################################
-# 配置上传文件的大小设置
-# Single file max size  即单个文件大小
-spring.servlet.multipart.max-file-size=10000MB
-spring.servlet.multipart.max-request-size=10000MB
-##################SpringBoot连接池配置########
-spring.datasource.hikari.minimum-idle=3
-spring.datasource.hikari.maximum-pool-size=10
-spring.datasource.hikari.max-lifetime =30000
-spring.datasource.hikari.connection-test-query=SELECT 1
-logging.path=E:/
-

+ 0 - 30
src/main/resources/application.yml

@@ -1,30 +0,0 @@
-
-##########
-logging:
-  level:
-    root: info
-    org.mybatis: debug
-    java.sql: debug
-    org.springframework.web: trace
-    #打印sql语句
-    com.example.plus.mapper: debug
-##########
-mybatis-plus:
-#  mapper-locations: classpath:mapper/*/*.xml
-#  #实体扫描,多个package用逗号或者分号分隔
-#  typeAliasesPackage: com.hssx.cloudmodel
-  global-config:
-    #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
-    id-type: 0
-    #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
-    field-strategy: 2
-    db-column-underline: true
-    refresh-mapper:
-#################插入和更新非null判断
-    db-config:
-      insert-strategy: not_null
-      update-strategy: not_null
-  configuration:
-    map-underscore-to-camel-case: true
-    cache-enabled: false
-

+ 0 - 20
src/main/resources/mapper/NewsMapper.xml

@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.hhsx.minigame.mapper.NewsMapper">
-
-    <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="com.hhsx.minigame.entity.News">
-        <id column="id" property="id" />
-        <result column="nick_name" property="nickName" />
-        <result column="header_pic" property="headerPic" />
-        <result column="indate" property="indate" />
-        <result column="type" property="type" />
-        <result column="message" property="message" />
-    </resultMap>
-
-    <!-- 通用查询结果列 -->
-    <sql id="Base_Column_List">
-        id, nick_name, header_pic, indate, type, message
-    </sql>
-
-</mapper>

+ 0 - 20
src/main/resources/mapper/UserMapper.xml

@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.hhsx.minigame.mapper.UserMapper">
-
-    <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="com.hhsx.minigame.entity.User">
-        <id column="id" property="id" />
-        <result column="type" property="type" />
-        <result column="voucher_id" property="voucherId" />
-        <result column="indate" property="indate" />
-        <result column="header_pic" property="headerPic" />
-        <result column="nick_name" property="nickName" />
-    </resultMap>
-
-    <!-- 通用查询结果列 -->
-    <sql id="Base_Column_List">
-        id, type, voucher_id, indate, header_pic, nick_name
-    </sql>
-
-</mapper>

+ 0 - 36
src/main/resources/static/index.html

@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <title>Title</title>
-	<script>
-	//初始化用户信息数据
-	window.user_info = {
-		logo:'http://img5q.duitang.com/uploads/item/201502/25/20150225060808_wuANL.jpeg',//用户头像
-		nickname:'不羡鸳鸯',//用户昵称,
-		textmsg:'GOOD GOOD STUDY,DAY DAY UP'//寄语
-	};
-
-	//获取URL参数 url格式xxx=yyyy&xxx1=yyy1
-	//通过act 确定是否是海报页,act=hbshare 代表是海报页
-	var URLParams = new Array();  
-	var params = document.location.search.substr(1).split('&');   
-	for (i=0; i < params.length ; i++){  
-		var aParam = params[i].split('=');   
-		URLParams[aParam[0]] = aParam[1];   
-	}
-	if(URLParams['act']=='hbshare'){
-		document.write('<h1>这里是海报页</h1>');
-		document.write('头像<img src="'+window.user_info.logo+'" width=40 height=40 /><br>');
-		document.write('昵称:'+window.user_info.nickname+'<br>');
-		document.write('寄语:'+window.user_info.textmsg);
-	}else{
-		document.write('<h1>这是首页哦</h1>');
-	}
-	</script>
-</head>
-<body>
-
-
-</body>
-</html>

+ 0 - 64
src/main/resources/templates/index.html

@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-    <meta charset="UTF-8">
-    <title>测试用页面</title>
-    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
-    <script src="http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
-    <style>
-        div, a {
-            font-size: 60px;
-        }
-    </style>
-</head>
-<body>
-<div>
-    <a onclick="getMsgByWX()">获取微信数据</a>
-</div>
-<br>
-<div>
-    <a onclick="getMsgByWB()">获取微博数据</a>
-</div>
-<script>
-    function getMsgByWX() {
-    }
-
-    function getMsgByWB() {
-    }
-
-    (function() {
-        if (!!navigator.userAgent.match(/AppleWebKit.*Mobile.*/)) {
-            var ua = navigator.userAgent.toLowerCase() , url = "";
-            // if (ua.match(/MicroMessenger/i) == "micromessenger") {
-                alert("微信浏览器中打开");
-                url = "https://open.weixin.qq.com/connect/oauth2/authorize?"
-                        +"appid=wx749c84daac654e1e&"
-                        +"redirect_uri=wx.ttkuaiban.com&"
-                        +"response_type=code&"
-                        +"scope=snsapi_base&"
-                        +"state=STATE#wechat_redirect";
-                //https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx749c84daac654e1e&redirect_uri=wx.ttkuaiban.com&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect
-            // }
-
-            if (ua.match(/WeiBo/i) == "weibo") {
-                alert("在新浪微博客户端打开");
-                url = "https://api.weibo.cn/oauth2/authorize?"
-                    +"client_id=2141531565&"
-                    +"display=mobile&"
-                    +"response_type=code&"
-                    +"redirect_uri=code&"
-                    +"scope=snsapi_base";
-            }
-
-            //window.location.href = url;
-            $.get(url ,function(data,status){
-                console.log("Data: " + data + "nStatus: " + status);
-                $.post("demo_ajax_gethint.html",{suggest:txt},function(result){
-                    $("span").html(result);
-                });
-            });
-        }
-    })()
-</script>
-</body>
-</html>

+ 0 - 16
src/test/java/com/hhsx/minigame/MinigameApplicationTests.java

@@ -1,16 +0,0 @@
-package com.hhsx.minigame;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class MinigameApplicationTests {
-
-    @Test
-    public void contextLoads() {
-    }
-
-}