|
|
@@ -174,6 +174,30 @@ func (self *PayController) GetVirtualRechargeStatus() {
|
|
|
self.ServeJSON()
|
|
|
}
|
|
|
|
|
|
+// 同步当前用户未完成的余额虚拟支付充值订单
|
|
|
+func (self *PayController) SyncVirtualRechargePending() {
|
|
|
+ wxUser := self.GetCurrentWxUser(true)
|
|
|
+ if wxUser == nil {
|
|
|
+ self.ReturnError(403, apps.NoExist, "", nil)
|
|
|
+ }
|
|
|
+ orders := balance_model.GetPendingVirtualRechargeCashOrdersByWxUId(wxUser.Id, 10)
|
|
|
+ syncedCount := 0
|
|
|
+ for _, order := range orders {
|
|
|
+ if self.syncVirtualRechargePaid(order, wxUser.Openid) {
|
|
|
+ paidOrder := balance_model.GetRechargeCashOrderByOId(order.OrderId, false)
|
|
|
+ if paidOrder != nil && paidOrder.State == 1 {
|
|
|
+ syncedCount++
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ type Ret struct {
|
|
|
+ PendingCount int `json:"pending_count"`
|
|
|
+ SyncedCount int `json:"synced_count"`
|
|
|
+ }
|
|
|
+ self.Data["json"] = &Ret{PendingCount: len(orders), SyncedCount: syncedCount}
|
|
|
+ self.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
// 微信小程序虚拟支付推送回调
|
|
|
func (self *PayController) VirtualRechargeNotify() {
|
|
|
if echo := self.GetString("echostr"); echo != "" {
|