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

40 lines
1.4 KiB

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