public.go 567 B

12345678910111213141516171819202122232425262728293031
  1. package public
  2. import (
  3. "strings"
  4. "github.com/eryajf/chatgpt-dingtalk/config"
  5. "github.com/eryajf/chatgpt-dingtalk/service"
  6. )
  7. var UserService service.UserServiceInterface
  8. func InitSvc() {
  9. config.LoadConfig()
  10. UserService = service.NewUserService()
  11. _, _ = GetBalance()
  12. }
  13. func FirstCheck(rmsg ReceiveMsg) bool {
  14. lc := UserService.GetUserMode(rmsg.SenderStaffId)
  15. if lc == "" {
  16. if config.LoadConfig().DefaultMode == "串聊" {
  17. return true
  18. } else {
  19. return false
  20. }
  21. }
  22. if lc != "" && strings.Contains(lc, "串聊") {
  23. return true
  24. }
  25. return false
  26. }