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

48 regels
1.7 KiB

  1. package alipay
  2. import (
  3. "applet/app/db"
  4. "applet/app/utils/cache"
  5. "applet/app/utils/logx"
  6. "code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
  7. "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
  8. "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum"
  9. "errors"
  10. )
  11. func FacePrepareAlipayCode(method string, params map[string]string) (interface{}, error) {
  12. sysCfgDb := implement.NewSysCfgDb(db.Db, cache.GetPool().Get())
  13. defer func(sysCfgDb dao.SysCfgDao) {
  14. err := sysCfgDb.Close()
  15. if err != nil {
  16. logx.Error("redis close err:" + err.Error()) // 记录错误信息
  17. }
  18. }(sysCfgDb)
  19. sysCfgMap := sysCfgDb.SysCfgFindWithDb("alipay_face_url", enum.AlipayAppId, enum.AlipayPrivateKey, enum.AlipayPublicKey, enum.AlipayPublicContentRSA2, enum.AlipayRootContent, enum.AppPublicContent)
  20. // 获取私钥和APPID
  21. var paySet = &PayData{
  22. AlipayAppId: sysCfgMap[enum.AlipayAppId],
  23. AlipayPrivateKey: sysCfgMap[enum.AlipayPrivateKey],
  24. AlipayPublicKey: sysCfgMap[enum.AlipayPublicKey],
  25. AlipayPublicContentRSA2: sysCfgMap[enum.AlipayPublicContentRSA2],
  26. AlipayRootContent: sysCfgMap[enum.AlipayRootContent],
  27. AppPublicContent: sysCfgMap[enum.AppPublicContent],
  28. }
  29. notifyURL := sysCfgMap["alipay_face_url"]
  30. var param interface{}
  31. var err error
  32. switch method {
  33. case "face_init":
  34. param, err = UserCertifyOpenInit(params["name"], params["id_num"], params["oid"], notifyURL, paySet)
  35. case "face_certify":
  36. param, err = UserCertifyOpenCertify(params["certify_id"], notifyURL, paySet)
  37. case "face_query":
  38. param, err = UserCertifyOpenQuery(params["certify_id"], notifyURL, paySet)
  39. default:
  40. return "", errors.New("失败")
  41. }
  42. return param, err
  43. }