蛋蛋星球-客户端
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.
 
 
 
 

36 lines
1.3 KiB

  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. defer redisConn.Close()
  12. sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn)
  13. 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")
  14. if c.GetHeader("platform") == "android" {
  15. return data["aliyun_captch_id_android"], data["aliyun_captch_key_android"]
  16. }
  17. if c.GetHeader("platform") == "iOS" {
  18. return data["aliyun_captch_id_ios"], data["aliyun_captch_key_ios"]
  19. }
  20. if c.GetHeader("platform") == "wap" {
  21. return data["aliyun_captch_id_h5"], data["aliyun_captch_key_h5"]
  22. }
  23. return "", ""
  24. }
  25. func AliyunSmsBase(c *gin.Context, types string) map[string]string {
  26. redisConn := cache.GetPool().Get()
  27. defer redisConn.Close()
  28. sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn)
  29. data := sysCfgDb.SysCfgFindWithDb("aliyun_sms_id", "aliyun_sms_secret", "aliyun_sms_code", "aliyun_sms_sign_name")
  30. data["aliyun_sms_code"] = gjson.Get(data["aliyun_sms_code"], types).String()
  31. return data
  32. }