Giter Club home page Giter Club logo

gpt-web-java's Introduction

GPT-WEB-CLIENT

Project Title

Demo地址:https://gptai.v-wim.xyz

基于Spring Boot Mybatis-plus的GPTweb后台

Getting Started

Major Function

--客户端

  • 登录
  • 注册赠送10次对话
  • 对话记录
  • 公告查看
  • 个人信息展示(剩余次数,身份,昵称)
  • 产品查询购买(支持支付宝,微信,QQ钱包)
  • 订单查询
  • 注册验证码(正在开发)
  • 邀请下单返现(正在开发)

--管理端

  • 首页(数据统计)
  • 支付配置
  • 对KEY配置
  • 用户管理
  • 订单管理
  • 公告管理
  • 产品管理

Installing

1.本地运行配置maven,jdk并检查版本是否兼容

2.安装redis

3.安装mysql8.0 并创建数据库gpt

4.导入sql

5.修改yml种的mysql与redis连接地址与账号密码

dev-开发环境  

prod-生产环境  

yml

spring:
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    url: jdbc:mysql://127.0.0.1/gpt?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true&autoReconnect=true&failOverReadOnly=false
    username: root
    password: root
    driver-class-name: com.mysql.cj.jdbc.Driver
    filters: stat
    maxActive: 20
    initialSize: 1
    maxWait: 60000
    minIdle: 1
    timeBetweenEvictionRunsMillis: 60000
    minEvictableIdleTimeMillis: 300000
    validationQuery: select 'x'
    testWhileIdle: true
    testOnBorrow: false
    testOnReturn: false
    poolPreparedStatements: true
    maxOpenPreparedStatements: 20
  data:
    redis:
      host: 127.0.0.1
      port: 6380
      password: password
      database: 0
      jedis:
        pool:
          max-idle: 100
          min-idle: 1
          max-active: 1000
          max-wait: -1  

SQL

-- Table structure for announcement  

 DROP TABLE IF EXISTS `announcement`;  
 CREATE TABLE `announcement` (
 `id` bigint NOT NULL,
 `title` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '标题',
 `content` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '公告内容',
 `sort` int DEFAULT '0' COMMENT '排序',
 `type` int DEFAULT NULL COMMENT '公告类型 1-公告、2-指南',
 `data_version` int DEFAULT '0' COMMENT '数据版本(默认为0,每次编辑+1)',
 `deleted` int DEFAULT '0' COMMENT '是否删除:0-否、1-是',
 `creator` bigint DEFAULT '0' COMMENT '创建人编号(默认为0)',
 `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(默认为创建时服务器时间)',
 `operator` bigint DEFAULT '0' COMMENT '操作人编号(默认为0)',
 `operate_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '操作时间(每次更新时自动更新)',
 PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='公告';  

-- Table structure for gpt_key  

DROP TABLE IF EXISTS `gpt_key`;
CREATE TABLE `gpt_key` (
 `id` bigint NOT NULL,
 `key` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'key',
 `use_number` int DEFAULT '0' COMMENT '使用次数',
 `sort` int DEFAULT '0' COMMENT '排序',
 `state` int DEFAULT '0' COMMENT '状态 0 启用 1禁用',
 `data_version` int DEFAULT '0' COMMENT '数据版本(默认为0,每次编辑+1)',
 `deleted` int DEFAULT '0' COMMENT '是否删除:0-否、1-是',
 `creator` bigint DEFAULT '0' COMMENT '创建人编号(默认为0)',
 `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(默认为创建时服务器时间)',
 `operator` bigint DEFAULT '0' COMMENT '操作人编号(默认为0)',
 `operate_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '操作时间(每次更新时自动更新)',
 PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='gptkey\n';  

-- Table structure for pay_config  

DROP TABLE IF EXISTS `pay_config`;
CREATE TABLE `pay_config` (
 `id` bigint NOT NULL,
 `pid` int DEFAULT NULL COMMENT '商户id',
 `secret_key` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '商户密钥',
 `notify_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '回调域名',
 `return_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '跳转通知地址',
 `submit_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '支付请求域名',
 `data_version` int DEFAULT '0' COMMENT '数据版本(默认为0,每次编辑+1)',
 `deleted` int DEFAULT '0' COMMENT '是否删除:0-否、1-是',
 `creator` bigint DEFAULT '0' COMMENT '创建人编号(默认为0)',
 `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(默认为创建时服务器时间)',
 `operator` bigint DEFAULT '0' COMMENT '操作人编号(默认为0)',
 `operate_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '操作时间(每次更新时自动更新)',
 PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='支付配置';    

-- Table structure for product  

DROP TABLE IF EXISTS `product`;
CREATE TABLE `product` (
 `id` bigint NOT NULL,
 `name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '产品名',
 `price` decimal(10,2) DEFAULT NULL COMMENT '价格',
 `type` tinyint DEFAULT '0' COMMENT '类型 0 次数 1 月卡 2 加油包',
 `number_times` int DEFAULT NULL COMMENT '次数',
 `monthly_number` int DEFAULT NULL COMMENT '月卡每日可使用次数',
 `sort` int DEFAULT '0' COMMENT '排序',
 `stock` int DEFAULT '1' COMMENT '库存数',
 `data_version` int DEFAULT '0' COMMENT '数据版本(默认为0,每次编辑+1)',
 `deleted` int DEFAULT '0' COMMENT '是否删除:0-否、1-是',
 `creator` bigint DEFAULT '0' COMMENT '创建人编号(默认为0)',
 `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(默认为创建时服务器时间)',
 `operator` bigint DEFAULT '0' COMMENT '操作人编号(默认为0)',
 `operate_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '操作时间(每次更新时自动更新)',
 PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='产品表';  

-- Table structure for refueling_kit  

DROP TABLE IF EXISTS `refueling_kit`;
CREATE TABLE `refueling_kit` (
 `id` bigint NOT NULL,
 `product_id` bigint DEFAULT NULL COMMENT '产品id',
 `user_id` bigint DEFAULT NULL COMMENT '用户id',
 `number_times` int DEFAULT NULL COMMENT '可使用次数',
 `data_version` int DEFAULT '0' COMMENT '数据版本(默认为0,每次编辑+1)',
 `deleted` int DEFAULT '0' COMMENT '是否删除:0-否、1-是',
 `creator` bigint DEFAULT '0' COMMENT '创建人编号(默认为0)',
 `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(默认为创建时服务器时间)',
 `operator` bigint DEFAULT '0' COMMENT '操作人编号(默认为0)',
 `operate_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '操作时间(每次更新时自动更新)',
 PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='加油包';  

-- Table structure for t_order  

DROP TABLE IF EXISTS `t_order`;
CREATE TABLE `t_order` (
 `id` bigint NOT NULL,
 `product_id` bigint DEFAULT NULL COMMENT '产品id',
 `user_id` bigint DEFAULT NULL COMMENT '用户id',
 `price` decimal(10,2) DEFAULT NULL COMMENT '价格',
 `state` int DEFAULT '0' COMMENT '状态 0待支付 1支付完成 2 支付失败',
 `pay_type` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '支付方式 wxpay、alipay、qqpay',
 `pay_number` int DEFAULT NULL COMMENT '购买数量',
 `trade_no` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '易支付订单号',
 `msg` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '支付结果消息\n',
 `data_version` int DEFAULT '0' COMMENT '数据版本(默认为0,每次编辑+1)',
 `deleted` int DEFAULT '0' COMMENT '是否删除:0-否、1-是',
 `creator` bigint DEFAULT '0' COMMENT '创建人编号(默认为0)',
 `create_time` datetime DEFAULT NULL COMMENT '创建时间(默认为创建时服务器时间)',
 `operator` bigint DEFAULT '0' COMMENT '操作人编号(默认为0)',
 `operate_time` datetime DEFAULT NULL COMMENT '操作时间(每次更新时自动更新)',
 PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='订单表';  

-- Table structure for use_log  

DROP TABLE IF EXISTS `use_log`;
CREATE TABLE `use_log` (
 `id` bigint NOT NULL,
 `user_id` bigint DEFAULT NULL COMMENT '用户id',
 `use_number` int DEFAULT '1' COMMENT '使用次数',
 `use_type` tinyint DEFAULT '1' COMMENT '使用类型 1 次数 2 月卡 3加油包',
 `use_value` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '聊天内容',
 `kit_id` bigint DEFAULT NULL COMMENT '加油包id',
 `gpt_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '使用gptkey',
 `state` tinyint DEFAULT '0' COMMENT '是否成功 0成功 1失败',
 `question` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '问题',
 `answer` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '答案',
 `send_type` tinyint DEFAULT '0' COMMENT '消息类型 0-正常 1-流式',
 `data_version` int DEFAULT '0' COMMENT '数据版本(默认为0,每次编辑+1)',
 `deleted` int DEFAULT '0' COMMENT '是否删除:0-否、1-是',
 `creator` bigint DEFAULT '0' COMMENT '创建人编号(默认为0)',
 `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(默认为创建时服务器时间)',
 `operator` bigint DEFAULT '0' COMMENT '操作人编号(默认为0)',
 `operate_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '操作时间(每次更新时自动更新)',
 PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='使用记录表';

-- Table structure for user  

DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
 `id` bigint NOT NULL,
 `name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '姓名',
 `mobile` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '1' COMMENT '手机号',
 `password` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '密码',
 `last_login_time` datetime DEFAULT NULL COMMENT '上次登录时间',
 `type` tinyint DEFAULT '0' COMMENT '类型 0 次数用户 1 月卡用户 -1 管理员',
 `expiration_time` datetime DEFAULT NULL COMMENT '月卡到期日期',
 `remaining_times` int DEFAULT '0' COMMENT '剩余次数',
 `card_day_max_number` int DEFAULT '0' COMMENT '月卡当日使用最大次数',
 `data_version` int DEFAULT '0' COMMENT '数据版本(默认为0,每次编辑+1)',
 `deleted` int DEFAULT '0' COMMENT '是否删除:0-否、1-是',
 `creator` bigint DEFAULT '0' COMMENT '创建人编号(默认为0)',
 `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(默认为创建时服务器时间)',
 `operator` bigint DEFAULT '0' COMMENT '操作人编号(默认为0)',
 `operate_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '操作时间(每次更新时自动更新)',
 PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='用户表';  
         

Running the tests

启动idea出现如下信息说明运行成功

o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8000 (http) with context path ''

com.cn.app.chatgptbot.Application : Started Application in 5.138 seconds (process running for 5.521)

And coding style tests

后端基于另一个开源项目开发,所用到jdk17特性

Vue2.0前端地址GPT-WEB-CLIENT

Express gratitude

感谢开源作者 dulaiduwang003 提供的基础GPT功能可以的话点个Star

Contributors

这个项目的存在要感谢所有做出贡献的人.

Put It Last

解释一下pay_config内容,如果自己对接其他支付可忽略

系统对接其他支付,需要自己注册账号密码登录查看相关配置

支付网站地址:白晨易支付

image

此图片与表对应关系

接口地址:submit_url

商户Id:pid

商户秘钥:secret_key

其他描述

notify_url:支付成功后回调地址

return_url:支付成功后跳转页面

条件允许的情况下可以请作者喝一杯冰阔落

  • 支付宝
  • 微信

记得点一个Star哦!!!!

加入微信群

image

关注公众号

关注公众号

Star History Chart

License

Apache License 2.0

gpt-web-java's People

Contributors

a616567126 avatar

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.