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

  1. package svc
  2. import (
  3. "applet/app/cfg"
  4. "applet/app/db"
  5. "applet/app/svc/sys_cfg"
  6. "github.com/gin-gonic/gin"
  7. "github.com/tidwall/gjson"
  8. "os"
  9. )
  10. func AliyunCaptchBase(c *gin.Context) (string, string) {
  11. sysCfgDb := sys_cfg.NewSysCfgDb(db.Db)
  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. sysCfgDb := sys_cfg.NewSysCfgDb(db.Db)
  26. data := sysCfgDb.SysCfgFindWithDb("aliyun_sms_id", "aliyun_sms_secret", "aliyun_sms_code", "aliyun_sms_sign_name")
  27. if cfg.Prd {
  28. data["aliyun_sms_id"] = os.Getenv("aliyun_sms_id")
  29. data["aliyun_sms_secret"] = os.Getenv("aliyun_sms_secret")
  30. }
  31. data["aliyun_sms_code"] = gjson.Get(data["aliyun_sms_code"], types).String()
  32. return data
  33. }