dos преди 1 месец
родител
ревизия
eed35ba1a0

+ 15 - 2
game-business/src/main/java/com/game/business/controller/AppUsersCashrecordController.java

@@ -6,6 +6,7 @@ import java.net.URLEncoder;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -29,6 +30,7 @@ import com.game.common.constant.finance.FinTranType1;
 import com.game.common.constant.finance.FinTranType3;
 import com.game.common.constant.finance.TranCurrencyType;
 import com.game.common.core.domain.R;
+import com.game.common.core.redis.RedisCache;
 import com.game.common.exception.ServiceException;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -80,6 +82,9 @@ public class AppUsersCashrecordController extends BaseController
     @Autowired
     private IAppChargeChannelService appChargeChannelService;
 
+    @Autowired
+    private RedisCache redisCache;
+
     /**
      * 查询提现记录列表
      */
@@ -138,7 +143,7 @@ public class AppUsersCashrecordController extends BaseController
     @ApiOperation(value = "修改提现记录", notes = "修改提现记录")
     @PutMapping
     @DSTransactional()
-    @RepeatSubmit(interval = 1000,message = "频繁操作")
+    @RepeatSubmit(interval = 3000,message = "频繁操作")
     public R<String> edit(@RequestBody AppUsersCashrecord appUsersCashrecord) throws Exception {
         AppUsersCashrecord cashrecord = appUsersCashrecordService.selectAppUsersCashrecordById(appUsersCashrecord.getId());
         if(null == cashrecord){
@@ -158,6 +163,11 @@ public class AppUsersCashrecordController extends BaseController
         if(null == appChargeChannel){
             return R.fail("审核失败,提现渠道不存在");
         }
+        String key = "app_user_withdraw_order:" + appUsersCashrecord.getId();
+        boolean flag = redisCache.redisTemplate.opsForValue().setIfAbsent(key,1,60, TimeUnit.SECONDS);
+        if(!flag){
+            return R.fail("处理中,请勿重复提交");
+        }
         AppUsersCashrecord update = new AppUsersCashrecord();
         update.setId(cashrecord.getId());
         update.setStatus(appUsersCashrecord.getStatus());
@@ -214,6 +224,7 @@ public class AppUsersCashrecordController extends BaseController
                         jsonObject.put("ownerName", URLEncoder.encode(appUsersCashAccount.getName(),"UTF-8"));
                         extra = jsonObject.toString();
                     }else{
+                        redisCache.redisTemplate.delete(key);
                         logger.info("调起第三方失败,用户提现账号不存在");
                         throw new Exception("审核失败,用户提现账号不存在");
                     }
@@ -234,6 +245,7 @@ public class AppUsersCashrecordController extends BaseController
                     appUsersCashrecordService.updateAppUsersCashrecord(cashRecord);
                 }else{
                     appUsersCashrecordService.updateAppUsersCashrecord(cashRecord);
+                    redisCache.redisTemplate.delete(key);
                     throw new ServiceException("发起提现失败: " + map.get("msg"));
                 }
             /*}else{
@@ -262,9 +274,10 @@ public class AppUsersCashrecordController extends BaseController
         //更新用户可提现余额
         appUserCountTask.updateWithdrawAble(appUser.getUserid());
         if(rest < 1){
+            redisCache.redisTemplate.delete(key);
             return R.fail("审核失败");
         }
-
+        redisCache.redisTemplate.delete(key);
         return R.ok("审核成功");
     }
 

+ 12 - 0
game-ui/src/views/business/cashrecord/index.vue

@@ -430,17 +430,29 @@ export default {
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
+          const loading = this.$loading({
+            lock: true,
+            text: 'Loading',
+            spinner: 'el-icon-loading',
+            background: 'rgba(0, 0, 0, 0.7)'
+          });
           if (this.form.id != null) {
             updateCashrecord(this.form).then(response => {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
+              loading.close();
               this.getList();
+            }).catch(e=>{
+              loading.close();
             });
           } else {
             addCashrecord(this.form).then(response => {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
+              loading.close();
               this.getList();
+            }).catch(e=>{
+              loading.close();
             });
           }
         }