蛋蛋星球-客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

svc_aliyun_base.go 1.2 KiB

1 viikko sitten
123456789101112131415161718192021222324252627282930313233
  1. package svc
  2. import (
  3. "applet/app/db"
  4. "applet/app/utils/cache"
  5. "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
  6. "github.com/gin-gonic/gin"
  7. "github.com/tidwall/gjson"
  8. )
  9. func AliyunCaptchBase(c *gin.Context) (string, string) {
  10. redisConn := cache.GetPool().Get()
  11. sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn)
  12. data := sysCfgDb.SysCfgFindWithDb("aliyun_captch_id_android", "aliyun_captch_key_android", "aliyun_captch_id_ios", "aliyun_captch_key_ios", "aliyun_captch_id_h5", "aliyun_captch_key_h5")
  13. if c.GetHeader("platform") == "android" {
  14. return data["aliyun_captch_id_android"], data["aliyun_captch_key_android"]
  15. }
  16. if c.GetHeader("platform") == "iOS" {
  17. return data["aliyun_captch_id_ios"], data["aliyun_captch_key_ios"]
  18. }
  19. if c.GetHeader("platform") == "wap" {
  20. return data["aliyun_captch_id_h5"], data["aliyun_captch_key_h5"]
  21. }
  22. return "", ""
  23. }
  24. func AliyunSmsBase(c *gin.Context, types string) map[string]string {
  25. redisConn := cache.GetPool().Get()
  26. sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn)
  27. data := sysCfgDb.SysCfgFindWithDb("aliyun_sms_id", "aliyun_sms_secret", "aliyun_sms_code", "aliyun_sms_sign_name")
  28. data["aliyun_sms_code"] = gjson.Get(data["aliyun_sms_code"], types).String()
  29. return data
  30. }