mirror of
				https://github.com/yangjian102621/geekai.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	feat: add switch to disable xxl-job service, update readme
This commit is contained in:
		@@ -8,7 +8,8 @@ ChatGLM,讯飞星火,文心一言等多个平台的大语言模型。集成了
 | 
			
		||||
* 内置了各种预训练好的角色应用,比如小红书写手,英语翻译大师,苏格拉底,孔子,乔布斯,周报助手等。轻松满足你的各种聊天和应用需求。
 | 
			
		||||
* 支持 OPenAI,Azure,文心一言,讯飞星火,清华 ChatGLM等多个大语言模型。
 | 
			
		||||
* 支持 MidJourney / Stable Diffusion AI 绘画集成,开箱即用。
 | 
			
		||||
* 支持使用个人微信二维码作为充值收费的支付渠道,无需企业支付通道。(可定制开发其他支付通道支持)
 | 
			
		||||
* 支持使用个人微信二维码作为充值收费的支付渠道,无需企业支付通道。
 | 
			
		||||
* 已集成支付宝支付功能,支持多种会员套餐和点卡购买功能。
 | 
			
		||||
* 集成插件 API 功能,可结合大语言模型的 function 功能开发各种强大的插件,已内置实现了微博热搜,今日头条,今日早报和 AI 绘画函数插件。
 | 
			
		||||
 | 
			
		||||
## 功能截图
 | 
			
		||||
@@ -133,7 +134,7 @@ cd docker/mysql
 | 
			
		||||
# 创建 mysql 容器
 | 
			
		||||
docker-compose up -d
 | 
			
		||||
# 导入数据库
 | 
			
		||||
docker exec -i chatgpt-plus-mysql sh -c 'exec mysql -uroot -p12345678' < ../../database/chatgpt_plus-v3.1.7.sql
 | 
			
		||||
docker exec -i chatgpt-plus-mysql sh -c 'exec mysql -uroot -p12345678' < ../../database/chatgpt_plus-v3.1.8.sql
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
如果你本地已经安装了 MySQL 服务,那么你只需手动导入数据库即可。
 | 
			
		||||
 
 | 
			
		||||
@@ -67,4 +67,24 @@ WeChatBot = false
 | 
			
		||||
  Enabled = false
 | 
			
		||||
  ApiURL = "http://172.22.11.200:7860"
 | 
			
		||||
  ApiKey = ""
 | 
			
		||||
  Txt2ImgJsonPath = "res/text2img.json"
 | 
			
		||||
  Txt2ImgJsonPath = "res/text2img.json"
 | 
			
		||||
 | 
			
		||||
[XXLConfig] # xxl-job 配置,需要你部署 XXL-JOB 定时任务工具,用来定期清理未支付订单和清理过期 VIP,如果你没有启用支付服务,则该服务也无需启动
 | 
			
		||||
  Enabled = false # 是否启用 XXL JOB 服务
 | 
			
		||||
  ServerAddr = "http://172.22.11.47:8080/xxl-job-admin" # xxl-job-admin 管理地址
 | 
			
		||||
  ExecutorIp = "" # 执行器 IP 地址
 | 
			
		||||
  ExecutorPort = "" # 执行器服务端口
 | 
			
		||||
  AccessToken = "" # 执行器 API 通信 token
 | 
			
		||||
  RegistryKey = "chatgpt-plus" # 任务注册 key
 | 
			
		||||
 | 
			
		||||
[AlipayConfig]
 | 
			
		||||
  Enabled = false
 | 
			
		||||
  SandBox = false
 | 
			
		||||
  Company = "sandbox 默认应用:2088721020750581"
 | 
			
		||||
  UserId = "2088721020750581"
 | 
			
		||||
  AppId = "9021000131658023"
 | 
			
		||||
  PrivateKey = "certs/alipay/privateKey.txt"
 | 
			
		||||
  PublicKey = "certs/alipay/appPublicCert.crt"
 | 
			
		||||
  AlipayPublicKey = "certs/alipay/alipayPublicCert.crt"
 | 
			
		||||
  RootCert = "certs/alipay/alipayRootCert.crt"
 | 
			
		||||
  NotifyURL = "http://r9it.com:6004/api/payment/alipay/notify"
 | 
			
		||||
@@ -74,10 +74,11 @@ type AlipayConfig struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type XXLConfig struct { // XXL 任务调度配置
 | 
			
		||||
	Enabled      bool
 | 
			
		||||
	ServerAddr   string
 | 
			
		||||
	AccessToken  string
 | 
			
		||||
	ExecutorIp   string
 | 
			
		||||
	ExecutorPort string
 | 
			
		||||
	AccessToken  string
 | 
			
		||||
	RegistryKey  string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -17,9 +17,15 @@ var logger = logger2.GetLogger()
 | 
			
		||||
type XXLJobExecutor struct {
 | 
			
		||||
	executor xxl.Executor
 | 
			
		||||
	db       *gorm.DB
 | 
			
		||||
	config   *types.XXLConfig
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewXXLJobExecutor(config *types.AppConfig, db *gorm.DB) *XXLJobExecutor {
 | 
			
		||||
	if !config.XXLConfig.Enabled {
 | 
			
		||||
		logger.Info("XXL-JOB service is disabled")
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	exec := xxl.NewExecutor(
 | 
			
		||||
		xxl.ServerAddr(config.XXLConfig.ServerAddr),
 | 
			
		||||
		xxl.AccessToken(config.XXLConfig.AccessToken),   //请求令牌(默认为空)
 | 
			
		||||
@@ -29,10 +35,14 @@ func NewXXLJobExecutor(config *types.AppConfig, db *gorm.DB) *XXLJobExecutor {
 | 
			
		||||
		xxl.SetLogger(&customLogger{}),                  //自定义日志
 | 
			
		||||
	)
 | 
			
		||||
	exec.Init()
 | 
			
		||||
	return &XXLJobExecutor{executor: exec, db: db}
 | 
			
		||||
	return &XXLJobExecutor{executor: exec, db: db, config: &config.XXLConfig}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (e *XXLJobExecutor) Run() error {
 | 
			
		||||
	if !e.config.Enabled {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	e.executor.RegTask("ClearOrder", e.ClearOrder)
 | 
			
		||||
	e.executor.RegTask("ResetVipCalls", e.ResetVipCalls)
 | 
			
		||||
	return e.executor.Run()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user