recharge_service.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. package service
  2. import (
  3. "context"
  4. "errors"
  5. "fmt"
  6. log "github.com/sirupsen/logrus"
  7. "github.com/wechatpay-apiv3/wechatpay-go/core"
  8. "github.com/wechatpay-apiv3/wechatpay-go/core/option"
  9. "github.com/wechatpay-apiv3/wechatpay-go/services/payments/native"
  10. "github.com/wechatpay-apiv3/wechatpay-go/utils"
  11. "gorm.io/gorm"
  12. "time"
  13. "youngee_b_api/app/dao"
  14. "youngee_b_api/app/entity"
  15. "youngee_b_api/app/util"
  16. "youngee_b_api/app/vo"
  17. )
  18. type RechargeService struct{}
  19. // 充值管理——对公转账
  20. func (s RechargeService) TransferToPublic(param *vo.RechargeTransferParam) (*string, error) {
  21. var rechargeId string
  22. var phone string
  23. //if param.SubAccountId == 0 {
  24. // rechargeId = util.MakeRechargeId(param.EnterpriseId)
  25. // phone, _ = dao.EnterpriseDao{}.GetEnterprisePhone(param.EnterpriseId)
  26. //} else {
  27. // rechargeId = util.MakeRechargeId(strconv.FormatInt(param.SubAccountId, 10))
  28. // phone, _ = dao.SubAccountDao{}.GetSubAccountPhone(param.SubAccountId)
  29. //}
  30. rechargeId = util.GenerateDateRelatedUUID(16)
  31. phone, _ = dao.EnterpriseDao{}.GetEnterprisePhone(param.EnterpriseId)
  32. var t = time.Now()
  33. rechargeRecord := entity.RechargeRecord{
  34. RechargeID: rechargeId,
  35. EnterpriseID: param.EnterpriseId,
  36. SubAccountId: param.SubAccountId,
  37. RechargeAmount: param.Amount,
  38. TransferVoucherUrl: param.TransferVoucherUrl,
  39. Phone: phone,
  40. RechargeMethod: 1,
  41. Status: 1,
  42. CommitAt: &t,
  43. }
  44. err := dao.RechargeRecordDao{}.Insert(&rechargeRecord)
  45. if err != nil {
  46. return nil, err
  47. }
  48. return &rechargeId, nil
  49. }
  50. // 获取微信支付CodeUrl
  51. func (s RechargeService) NativeApiServicePrepay(enterpriseId string, subAccountId int64, tradeId string, amount int64) (string, *time.Time, error) {
  52. var (
  53. mchID string = "1615933939" // 商户号
  54. mchCertificateSerialNumber string = "33DDFEC51BF5412F663B9B56510FD567B625FC68" // 商户证书序列号
  55. mchAPIv3Key string = "V10987654321younggee12345678910V" // 商户APIv3密钥,用于加密和解密平台证书
  56. )
  57. // 使用 utils 提供的函数从本地文件中加载商户私钥
  58. mchPrivateKey, err := utils.LoadPrivateKeyWithPath("./apiclient_key.pem") // 商户私钥,用于生成请求的签名
  59. if err != nil {
  60. log.Print("load merchant private key error")
  61. }
  62. ctx := context.Background()
  63. // 使用商户私钥等初始化 微信支付client,并使它具有自动定时获取微信支付平台证书的能力
  64. opts := []core.ClientOption{
  65. option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
  66. }
  67. client, err := core.NewClient(ctx, opts...)
  68. if err != nil {
  69. log.Printf("new wechat pay client err: %s", err)
  70. }
  71. // 采用 Native 支付方式
  72. svc := native.NativeApiService{Client: client}
  73. // 发送请求
  74. timeExpire := time.Now().Add(5 * time.Minute)
  75. resp, result, err := svc.Prepay(ctx,
  76. native.PrepayRequest{
  77. Appid: core.String("wxac396a3be7a16844"),
  78. Mchid: core.String("1615933939"),
  79. Description: core.String("样叽微信支付充值"),
  80. OutTradeNo: core.String(tradeId),
  81. TimeExpire: core.Time(timeExpire),
  82. Attach: core.String("微信支付充值"),
  83. NotifyUrl: core.String("https://www.weixin.qq.com/wxpay/pay.php"),
  84. SupportFapiao: core.Bool(true),
  85. Amount: &native.Amount{
  86. Currency: core.String("CNY"),
  87. Total: core.Int64(amount),
  88. },
  89. },
  90. )
  91. if err != nil {
  92. // 处理错误
  93. log.Printf("call Prepay err:%s", err)
  94. return "", nil, err
  95. } else {
  96. // 处理返回结果
  97. log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
  98. log.Println("codeUrl:", *resp.CodeUrl)
  99. }
  100. // 生成充值记录
  101. phone, _ := dao.EnterpriseDao{}.GetEnterprisePhone(enterpriseId)
  102. var t = time.Now()
  103. rechargeRecord := entity.RechargeRecord{
  104. RechargeID: tradeId,
  105. EnterpriseID: enterpriseId,
  106. SubAccountId: subAccountId,
  107. RechargeAmount: float64(amount) / 100,
  108. Phone: phone,
  109. RechargeMethod: 2,
  110. Status: 1,
  111. CommitAt: &t,
  112. RefuseAt: &timeExpire,
  113. }
  114. err = dao.RechargeRecordDao{}.Insert(&rechargeRecord)
  115. if err != nil {
  116. return "", nil, err
  117. }
  118. return *resp.CodeUrl, &timeExpire, nil
  119. }
  120. // 根据交易id查询微信是否扫码付款
  121. // https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_2.shtml
  122. func (s RechargeService) QueryOrderByTradeId(enterpriseId string, subAccountId int64, tradeId string) (tradeState string, err error) {
  123. var (
  124. mchID string = "1615933939" // 商户号
  125. mchCertificateSerialNumber string = "33DDFEC51BF5412F663B9B56510FD567B625FC68" // 商户证书序列号
  126. mchAPIv3Key string = "V10987654321younggee12345678910V" // 商户APIv3密钥
  127. )
  128. // 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
  129. mchPrivateKey, err := utils.LoadPrivateKeyWithPath("./apiclient_key.pem")
  130. if err != nil {
  131. log.Print("load merchant private key error")
  132. }
  133. ctx := context.Background()
  134. // 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
  135. opts := []core.ClientOption{
  136. option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
  137. }
  138. client, err := core.NewClient(ctx, opts...)
  139. if err != nil {
  140. log.Printf("new wechat pay client err: %s", err)
  141. }
  142. svc := native.NativeApiService{Client: client}
  143. resp, result, err := svc.QueryOrderByOutTradeNo(ctx,
  144. native.QueryOrderByOutTradeNoRequest{
  145. OutTradeNo: core.String(tradeId),
  146. Mchid: core.String("1615933939"),
  147. },
  148. )
  149. fmt.Printf("支付 %+v\n", resp)
  150. if err != nil {
  151. // 处理错误
  152. log.Printf("call QueryOrderByOutTradeNo err: %s", err)
  153. return "", err
  154. } else {
  155. // 处理返回结果
  156. log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
  157. }
  158. // 更新充值记录/账户金额相关信息
  159. if "SUCCESS" == *resp.TradeState {
  160. payTime := resp.SuccessTime
  161. t, _ := time.Parse(time.RFC3339, *payTime)
  162. err = dao.RechargeRecordDao{}.UpdateRechargeStatus(tradeId, 2, &t)
  163. amount := float64(*resp.Amount.Total) / 100
  164. _, err = dao.EnterpriseDao{}.UpdateEnterpriseBalance(enterpriseId, amount)
  165. } else if "CLOSED" == *resp.TradeState {
  166. var t = time.Now()
  167. err = dao.RechargeRecordDao{}.UpdateRechargeStatus(tradeId, 3, &t)
  168. }
  169. return *resp.TradeState, err
  170. }
  171. // 余额管理——总金额、可用余额、冻结金额
  172. func (s RechargeService) ShowBalance(param *vo.BalanceParam) (*vo.ReBalanceShow, error) {
  173. reBalanceShow := new(vo.ReBalanceShow)
  174. enterprise, err := dao.EnterpriseDao{}.GetEnterpriseInfo(param.EnterpriseId)
  175. if err != nil {
  176. if errors.Is(err, gorm.ErrRecordNotFound) {
  177. return reBalanceShow, nil
  178. } else {
  179. return nil, err
  180. }
  181. }
  182. reBalanceShow.TotalBalance = enterprise.Balance
  183. reBalanceShow.AvailBalance = enterprise.AvailableBalance
  184. reBalanceShow.FrozenBalance = enterprise.FrozenBalance
  185. return reBalanceShow, nil
  186. }
  187. // 余额管理——冻结记录
  188. func (s RechargeService) FrozenInfoList(param *vo.BalanceParam) (vo.ResultVO, error) {
  189. if param.Page <= 0 {
  190. param.Page = 1
  191. }
  192. if param.PageSize <= 0 {
  193. param.PageSize = 10
  194. }
  195. var result vo.ResultVO
  196. var reBalanceShows []*vo.ReFrozenInfo
  197. var selectionInfos []*entity.SelectionInfo
  198. var projects []*entity.Project
  199. var localLifes []*entity.LocalLifeInfo
  200. if param.FrozenState == 1 {
  201. // 电商带货
  202. selectionInfos, _ = dao.SelectionInfoDAO{}.GetSelectionFrozenList(param.EnterpriseId)
  203. // 品牌种草
  204. projects, _ = dao.ProjectDAO{}.GetProjectFrozenList(param.EnterpriseId)
  205. // 本地生活
  206. localLifes, _ = dao.LocalLifeDao{}.GetLocalFrozenList(param.EnterpriseId)
  207. } else {
  208. // 电商带货
  209. selectionInfos, _ = dao.SelectionInfoDAO{}.GetSelectionFrozenCancelList(param.EnterpriseId)
  210. // 品牌种草
  211. projects, _ = dao.ProjectDAO{}.GetProjectFrozenCancelList(param.EnterpriseId)
  212. // 本地生活
  213. localLifes, _ = dao.LocalLifeDao{}.GetLocalFrozenCancelList(param.EnterpriseId)
  214. }
  215. // 汇总结果
  216. for _, selection := range selectionInfos {
  217. // 获取商品详情字段
  218. var creatorName string
  219. var productName string
  220. var productPrice float64
  221. var mainImage string
  222. if selection.SubAccountId == 0 {
  223. enterprise, err := dao.EnterpriseDao{}.GetEnterprise(selection.EnterpriseID)
  224. if err == nil && enterprise != nil {
  225. creatorName = enterprise.BusinessName
  226. }
  227. } else {
  228. subAccount, err := dao.SubAccountDao{}.GetSubAccount(selection.SubAccountId)
  229. if err == nil && subAccount != nil {
  230. creatorName = subAccount.SubAccountName
  231. }
  232. }
  233. product, err := dao.ProductDAO{}.GetProductByID(selection.ProductID)
  234. if err == nil && product != nil {
  235. productName = product.ProductName
  236. productPrice = product.ProductPrice
  237. }
  238. mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(selection.ProductID)
  239. // 电商带货汇总
  240. reBalanceShow := &vo.ReFrozenInfo{
  241. ProductId: selection.ProductID,
  242. MainImage: mainImage,
  243. ProductName: productName,
  244. ProductPrice: productPrice,
  245. Platform: selection.Platform,
  246. CreatorName: creatorName,
  247. TaskType: "电商带货",
  248. FrozenBalance: selection.EstimatedCost,
  249. FrozenTime: selection.PayAt.Format("2006-01-02 15:04:05"),
  250. EnterpriseId: selection.EnterpriseID,
  251. SubAccountId: selection.SubAccountId,
  252. TaskId: selection.SelectionID,
  253. }
  254. if param.FrozenState == 2 {
  255. reBalanceShow.FrozenCancelBalance = selection.SettlementAmount
  256. }
  257. reBalanceShows = append(reBalanceShows, reBalanceShow)
  258. }
  259. for _, project := range projects {
  260. // 获取商品详情字段
  261. var creatorName string
  262. var productName string
  263. var productPrice float64
  264. var mainImage string
  265. if project.SubAccountId == 0 {
  266. enterprise, err := dao.EnterpriseDao{}.GetEnterprise(project.EnterpriseID)
  267. if err == nil && enterprise != nil {
  268. creatorName = enterprise.BusinessName
  269. }
  270. } else {
  271. subAccount, err := dao.SubAccountDao{}.GetSubAccount(project.SubAccountId)
  272. if err == nil && subAccount != nil {
  273. creatorName = subAccount.SubAccountName
  274. }
  275. }
  276. product, err := dao.ProductDAO{}.GetProductByID(project.ProductID)
  277. if err == nil && product != nil {
  278. productName = product.ProductName
  279. productPrice = product.ProductPrice
  280. }
  281. mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(project.ProductID)
  282. // 品牌种草汇总
  283. reBalanceShow := &vo.ReFrozenInfo{
  284. ProductId: project.ProductID,
  285. MainImage: mainImage,
  286. ProductName: productName,
  287. ProductPrice: productPrice,
  288. Platform: project.ProjectPlatform,
  289. CreatorName: creatorName,
  290. TaskType: "品牌种草",
  291. FrozenBalance: project.NeedPay,
  292. FrozenTime: project.PayAt.Format("2006-01-02 15:04:05"),
  293. EnterpriseId: project.EnterpriseID,
  294. SubAccountId: project.SubAccountId,
  295. TaskId: project.ProjectId,
  296. }
  297. if param.FrozenState == 2 {
  298. reBalanceShow.FrozenCancelBalance = project.SettlementAmount
  299. }
  300. reBalanceShows = append(reBalanceShows, reBalanceShow)
  301. }
  302. for _, localLife := range localLifes {
  303. // 获取门店详情字段
  304. var creatorName string
  305. var storName string
  306. var price float64
  307. var mainImage string
  308. if localLife.SubAccountID == 0 {
  309. enterprise, err := dao.EnterpriseDao{}.GetEnterprise(localLife.EnterpriseID)
  310. if err == nil && enterprise != nil {
  311. creatorName = enterprise.BusinessName
  312. }
  313. } else {
  314. subAccount, err := dao.SubAccountDao{}.GetSubAccount(localLife.SubAccountID)
  315. if err == nil && subAccount != nil {
  316. creatorName = subAccount.SubAccountName
  317. }
  318. }
  319. store, err := dao.StoreDao{}.GetStoreByID(localLife.StoreID)
  320. if err == nil && store != nil {
  321. storName = store.StoreName
  322. price = 0.0
  323. }
  324. mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(localLife.StoreID)
  325. // 本地生活汇总
  326. reBalanceShow := &vo.ReFrozenInfo{
  327. ProductId: localLife.StoreID,
  328. MainImage: mainImage,
  329. ProductName: storName,
  330. ProductPrice: price,
  331. Platform: localLife.LocalPlatform,
  332. CreatorName: creatorName,
  333. TaskType: "本地生活",
  334. FrozenBalance: localLife.NeedPay,
  335. FrozenTime: localLife.PayAt.Format("2006-01-02 15:04:05"),
  336. EnterpriseId: localLife.EnterpriseID,
  337. SubAccountId: localLife.SubAccountID,
  338. TaskId: localLife.LocalID,
  339. }
  340. if param.FrozenState == 2 {
  341. reBalanceShow.FrozenCancelBalance = localLife.SettlementAmount
  342. }
  343. reBalanceShows = append(reBalanceShows, reBalanceShow)
  344. }
  345. startIndex := (param.Page - 1) * param.PageSize
  346. endIndex := startIndex + param.PageSize
  347. // 分页
  348. if startIndex >= len(reBalanceShows) {
  349. result = vo.ResultVO{
  350. Page: param.Page,
  351. PageSize: param.PageSize,
  352. Total: int64(len(reBalanceShows)),
  353. Data: nil,
  354. }
  355. return result, nil
  356. }
  357. if endIndex > len(reBalanceShows) {
  358. endIndex = len(reBalanceShows)
  359. }
  360. result = vo.ResultVO{
  361. Page: param.Page,
  362. PageSize: param.PageSize,
  363. Total: int64(len(reBalanceShows)),
  364. Data: reBalanceShows[startIndex:endIndex],
  365. }
  366. return result, nil
  367. }
  368. // 余额管理——冻结记录-角标
  369. func (t RechargeService) FrozenInfoCount(param *vo.BalanceParam) map[string]int64 {
  370. res := make(map[string]int64)
  371. var blockNum1 int64
  372. var blockNum2 int64
  373. var blockNum3 int64
  374. var blockReleaseNum1 int64
  375. var blockReleaseNum2 int64
  376. var blockReleaseNum3 int64
  377. // 冻结中
  378. dao.Db.Model(entity.SelectionInfo{}).Where(fmt.Sprintf("enterprise_id = ? AND (selection_status between 5 and 6) "), param.EnterpriseId).Count(&blockNum1)
  379. dao.Db.Model(entity.Project{}).Where(fmt.Sprintf("enterprise_id = ? AND project_type = ? AND (project_status between 7 and 8) "), param.EnterpriseId, 1).Count(&blockNum2)
  380. dao.Db.Model(entity.LocalLifeInfo{}).Where(fmt.Sprintf("enterprise_id = ? AND local_type = ? AND (task_status between 7 and 8) "), param.EnterpriseId, 1).Count(&blockNum3)
  381. // 冻结解除
  382. dao.Db.Model(entity.SelectionInfo{}).Where(fmt.Sprintf("enterprise_id = ? AND (selection_status between 7 and 8) "), param.EnterpriseId).Count(&blockReleaseNum1)
  383. dao.Db.Model(entity.Project{}).Where(fmt.Sprintf("enterprise_id = ? AND project_type = ? AND (project_status between 9 and 10) "), param.EnterpriseId, 1).Count(&blockReleaseNum2)
  384. dao.Db.Model(entity.LocalLifeInfo{}).Where(fmt.Sprintf("enterprise_id = ? AND local_type = ? AND (task_status between 9 and 10) "), param.EnterpriseId, 1).Count(&blockReleaseNum3)
  385. res["blockNum"] = blockNum1 + blockNum2 + blockNum3
  386. res["blockReleaseNum"] = blockReleaseNum1 + blockReleaseNum2 + blockReleaseNum3
  387. return res
  388. }
  389. // 充值管理——累计充值金额、确认中金额
  390. func (s RechargeService) ShowRecharge(param *vo.RechargeParam) (*vo.ReRechargeShow, error) {
  391. reRechargeShow := new(vo.ReRechargeShow)
  392. confirmingRecharge, _ := dao.RechargeRecordDao{}.GetRechargeAmount(param.EnterpriseId, 1)
  393. totalRecharge, _ := dao.RechargeRecordDao{}.GetRechargeAmount(param.EnterpriseId, 2)
  394. reRechargeShow.ConfirmingRecharge = confirmingRecharge
  395. reRechargeShow.TotalRecharge = totalRecharge
  396. return reRechargeShow, nil
  397. }
  398. // 充值管理——充值记录
  399. func (s RechargeService) RechargeInfoList(param *vo.RechargeParam) (vo.ResultVO, error) {
  400. if param.Page <= 0 {
  401. param.Page = 1
  402. }
  403. if param.PageSize <= 0 {
  404. param.PageSize = 10
  405. }
  406. var result vo.ResultVO
  407. var reRechargeInfos []*vo.ReRechargeInfo
  408. rechargeRecords, total, err := dao.RechargeRecordDao{}.RechargeInfoList(param)
  409. if err != nil {
  410. return result, err
  411. }
  412. for _, rechargeRecord := range rechargeRecords {
  413. var creatorName string
  414. if rechargeRecord.SubAccountId == 0 {
  415. enterprise, err := dao.EnterpriseDao{}.GetEnterprise(rechargeRecord.EnterpriseID)
  416. if err == nil && enterprise != nil {
  417. creatorName = enterprise.BusinessName
  418. }
  419. } else {
  420. subAccount, err := dao.SubAccountDao{}.GetSubAccount(rechargeRecord.SubAccountId)
  421. if err == nil && subAccount != nil {
  422. creatorName = subAccount.SubAccountName
  423. }
  424. }
  425. reRechargeInfo := &vo.ReRechargeInfo{
  426. RechargeId: rechargeRecord.RechargeID,
  427. CreatorName: creatorName,
  428. RechargeAmount: rechargeRecord.RechargeAmount,
  429. RechargeMethod: rechargeRecord.RechargeMethod,
  430. TransferVoucherUrl: rechargeRecord.TransferVoucherUrl,
  431. }
  432. if param.RechargeState == 1 {
  433. reRechargeInfo.CommitAt = rechargeRecord.CommitAt.Format("2006-01-02 15:04:05")
  434. } else if param.RechargeState == 2 {
  435. reRechargeInfo.ConfirmAt = rechargeRecord.ConfirmAt.Format("2006-01-02 15:04:05")
  436. } else if param.RechargeState == 3 {
  437. reRechargeInfo.RefuseAt = rechargeRecord.RefuseAt.Format("2006-01-02 15:04:05")
  438. reRechargeInfo.FailReason = rechargeRecord.FailReason
  439. }
  440. reRechargeInfos = append(reRechargeInfos, reRechargeInfo)
  441. }
  442. //rechargingNum, _ := dao.RechargeRecordDao{}.RechargeStatusCount(param.EnterpriseId, 1)
  443. //rechargedNum, _ := dao.RechargeRecordDao{}.RechargeStatusCount(param.EnterpriseId, 2)
  444. //failNum, _ := dao.RechargeRecordDao{}.RechargeStatusCount(param.EnterpriseId, 3)
  445. resMap := make(map[string]interface{})
  446. //resMap["rechargingNum"] = rechargingNum
  447. //resMap["rechargedNum"] = rechargedNum
  448. //resMap["failNum"] = failNum
  449. resMap["reRechargeInfos"] = reRechargeInfos
  450. result = vo.ResultVO{
  451. Page: param.Page,
  452. PageSize: param.PageSize,
  453. Total: total,
  454. Data: resMap,
  455. }
  456. return result, nil
  457. }
  458. // 余额管理——冻结记录-角标
  459. func (t RechargeService) RechargeInfoCount(param *vo.RechargeParam) map[string]int64 {
  460. res := make(map[string]int64)
  461. var rechargeConfirming int64
  462. var recharged int64
  463. var rechargeFail int64
  464. dao.Db.Model(&entity.RechargeRecord{}).Where("enterprise_id = ? AND status = ?", param.EnterpriseId, 1).Count(&rechargeConfirming)
  465. dao.Db.Model(&entity.RechargeRecord{}).Where("enterprise_id = ? AND status = ?", param.EnterpriseId, 2).Count(&recharged)
  466. dao.Db.Model(&entity.RechargeRecord{}).Where("enterprise_id = ? AND status = ?", param.EnterpriseId, 3).Count(&rechargeFail)
  467. res["rechargeConfirming"] = rechargeConfirming
  468. res["recharged"] = recharged
  469. res["rechargeFail"] = rechargeFail
  470. return res
  471. }
  472. // 财务待办——充值确认中金额
  473. func (s RechargeService) GetFinance(param *vo.CommonParam) (float64, error) {
  474. confirmingRecharge, err := dao.RechargeRecordDao{}.GetRechargeAmount(param.EnterpriseId, 1)
  475. if err != nil {
  476. return 0, err
  477. }
  478. return confirmingRecharge, nil
  479. }