智慧食堂
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

hdl_alipay.go 1.9 KiB

pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package hdl
  2. import (
  3. "applet/app/customer/lib/validate"
  4. "applet/app/customer/md"
  5. "applet/app/customer/svc"
  6. "applet/app/db"
  7. "applet/app/e"
  8. "applet/app/enum"
  9. "applet/app/utils"
  10. "encoding/json"
  11. "fmt"
  12. "github.com/gin-gonic/gin"
  13. )
  14. func AesDecrypt(c *gin.Context) {
  15. fmt.Println(">>>>>>>>>>>>>>>>>", c.Request.Body)
  16. var req md.CurlAesDecrypt
  17. err := c.ShouldBindJSON(&req)
  18. if err != nil {
  19. err = validate.HandleValidateErr(err)
  20. err1 := err.(e.E)
  21. e.OutErr(c, err1.Code, err1.Error())
  22. return
  23. }
  24. sysCfgDb := db.SysCfgDb{}
  25. sysCfgDb.Set()
  26. sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAesKey)
  27. req.AesKey = sysCfg[enum.OpenAppletAesKey]
  28. err, result := svc.AesDecrypt(req)
  29. if err != nil {
  30. e.OutErr(c, e.ERR, err.Error())
  31. return
  32. }
  33. resByre, _ := json.Marshal(result)
  34. var aesStruct md.AesStruct
  35. json.Unmarshal(resByre, &aesStruct)
  36. aesStruct.Mobile = utils.Base64StdEncode(aesStruct.Mobile)
  37. e.OutSuc(c, aesStruct, nil)
  38. return
  39. }
  40. func SystemOauthToken(c *gin.Context) {
  41. var req md.SystemOauthTokenReq
  42. err := c.ShouldBindJSON(&req)
  43. if err != nil {
  44. err = validate.HandleValidateErr(err)
  45. err1 := err.(e.E)
  46. e.OutErr(c, err1.Code, err1.Error())
  47. return
  48. }
  49. sysCfgDb := db.SysCfgDb{}
  50. sysCfgDb.Set()
  51. sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey)
  52. req.Config = struct {
  53. AliAppId string `json:"ali_app_id" label:"支付宝开放平台-小程序-appid"`
  54. AliPrivateKey string `json:"ali_private_key" label:"支付宝开放平台-小程序-应用私钥"`
  55. AliPublicKey string `json:"ali_public_key" label:"支付宝开放平台-小程序-支付宝公钥"`
  56. }{
  57. AliAppId: sysCfg[enum.OpenAppletAppid],
  58. AliPrivateKey: sysCfg[enum.OpenAppletAppPrivateKey],
  59. AliPublicKey: sysCfg[enum.OpenAppletPublicKey],
  60. }
  61. err, result := svc.SystemOauthToken(req)
  62. if err != nil {
  63. e.OutErr(c, e.ERR, err.Error())
  64. return
  65. }
  66. e.OutSuc(c, result, nil)
  67. return
  68. }