|
- package hdl
-
- import (
- md2 "applet/app/customer/md"
- svc2 "applet/app/customer/svc"
- "applet/app/db"
- "applet/app/e"
- "applet/app/enum"
- "fmt"
- "github.com/gin-gonic/gin"
- "time"
- )
-
- // Demo 测试
- func Demo(c *gin.Context) {
- sysCfgDb := db.SysCfgDb{}
- sysCfgDb.Set()
- sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAlipayAppid, enum.OpenAlipayAppPrivateKey, enum.OpenAlipayPublicKey)
-
- //调用支付宝进行退款
- err6, _ := svc2.CurlAlipayTradeRefund(md2.CurlAlipayTradeRefundReq{
- Config: struct {
- PayAliAppId string `json:"pay_ali_app_id" label:"支付宝开放平台-第三方应用-appid"`
- PayAliPrivateKey string `json:"pay_ali_private_key" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`
- PayAliPublicKey string `json:"pay_ali_public_key" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"`
- }{
- PayAliAppId: sysCfg[enum.OpenAlipayAppid],
- PayAliPrivateKey: sysCfg[enum.OpenAlipayAppPrivateKey],
- PayAliPublicKey: sysCfg[enum.OpenAlipayPublicKey],
- },
- OutTradeNo: "800169659125681442",
- RefundAmount: "180.00",
- RefundReason: "央厨订餐退款",
- OutRequestNo: "r_800169659125681442_1705546121",
- AppAuthToken: "202308BB8ef30019cd8d4a40a3853192c397dX35",
- })
- if err6 != nil {
- fmt.Println(err6.Error())
- }
- return
- qrcodeWithBatchRecordsDb := db.AdminDb{}
- qrcodeWithBatchRecordsDb.Set()
- data, _, err := qrcodeWithBatchRecordsDb.GetAdminRolePermission(1001)
- if err != nil {
- e.OutErr(c, e.ERR_DB_ORM, err.Error())
- return
- }
- e.OutSuc(c, data, nil)
- go GoOnExecuting()
- return
- }
-
- func GoOnExecuting() {
- for i := 0; i < 20; i++ {
- time.Sleep(1 * time.Second)
- fmt.Println(i)
- }
- }
|