package alipay import ( "applet/app/db" "applet/app/utils/cache" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" "errors" ) func FacePrepareAlipayCode(method string, params map[string]string) (interface{}, error) { sysCfgDb := implement.NewSysCfgDb(db.Db, cache.GetPool().Get()) sysCfgMap := sysCfgDb.SysCfgFindWithDb("alipay_face_url", enum.AlipayAppId, enum.AlipayPrivateKey, enum.AlipayPublicKey, enum.AlipayPublicContentRSA2, enum.AlipayRootContent, enum.AppPublicContent) // 获取私钥和APPID var paySet = &PayData{ AlipayAppId: sysCfgMap[enum.AlipayAppId], AlipayPrivateKey: sysCfgMap[enum.AlipayPrivateKey], AlipayPublicKey: sysCfgMap[enum.AlipayPublicKey], AlipayPublicContentRSA2: sysCfgMap[enum.AlipayPublicContentRSA2], AlipayRootContent: sysCfgMap[enum.AlipayRootContent], AppPublicContent: sysCfgMap[enum.AppPublicContent], } notifyURL := sysCfgMap["alipay_face_url"] var param interface{} var err error switch method { case "face_init": param, err = UserCertifyOpenInit(params["name"], params["id_num"], params["oid"], notifyURL, paySet) case "face_certify": param, err = UserCertifyOpenCertify(params["certify_id"], notifyURL, paySet) case "face_query": param, err = UserCertifyOpenQuery(params["certify_id"], notifyURL, paySet) default: return "", errors.New("失败") } return param, err }