package svc import ( "applet/app/db" "applet/app/svc/sys_cfg" "github.com/gin-gonic/gin" "github.com/tidwall/gjson" ) func AliyunCaptchBase(c *gin.Context) (string, string) { sysCfgDb := sys_cfg.NewSysCfgDb(db.Db) 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") if c.GetHeader("platform") == "android" { return data["aliyun_captch_id_android"], data["aliyun_captch_key_android"] } if c.GetHeader("platform") == "iOS" { return data["aliyun_captch_id_ios"], data["aliyun_captch_key_ios"] } if c.GetHeader("platform") == "wap" { return data["aliyun_captch_id_h5"], data["aliyun_captch_key_h5"] } return "", "" } func AliyunSmsBase(c *gin.Context, types string) map[string]string { sysCfgDb := sys_cfg.NewSysCfgDb(db.Db) data := sysCfgDb.SysCfgFindWithDb("aliyun_sms_id", "aliyun_sms_secret", "aliyun_sms_code", "aliyun_sms_sign_name") data["aliyun_sms_code"] = gjson.Get(data["aliyun_sms_code"], types).String() return data }