Browse Source

## v1.8 -- 账户检测单独做成功能(拆分检测和充值功能:检测不充值、充值不检测、检测并充值)

GivenSir 4 years ago
parent
commit
57fde24de4
5 changed files with 392 additions and 250 deletions
  1. 3 2
      README.zh-CN.md
  2. 62 55
      mock/common.js
  3. 5 4
      src/main.js
  4. 310 178
      src/views/recharge/index.vue
  5. 12 11
      vue.config.js

+ 3 - 2
README.zh-CN.md

@@ -80,13 +80,14 @@ server
 2. [x] 添加账户余额与总充值金额判断。
 2. [x] 添加账户余额与总充值金额判断。
 3. [x] 优化添加账户检测后的请求逻辑,减少一定的总体请求时间。
 3. [x] 优化添加账户检测后的请求逻辑,减少一定的总体请求时间。
 
 
+## v1.8
+> 2021.11.26
+1. [x] 账户检测单独做成功能(拆分检测和充值功能:检测不充值、充值不检测、检测并充值)。
 
 
 # 测试模拟数据
 # 测试模拟数据
 ```json
 ```json
-// 可充值账户
 17719118763
 17719118763
 
 
-// 测试账户
 19999999900
 19999999900
 19999999901
 19999999901
 19999999902
 19999999902

+ 62 - 55
mock/common.js

@@ -134,21 +134,28 @@ module.exports = [
     url: '/v1/recharge/player/type',
     url: '/v1/recharge/player/type',
     type: 'post',
     type: 'post',
     response: config => {
     response: config => {
-      if (Math.round(Math.random() * 2) < 1) {
-        return {
-          code: 200,
-          status: true,
-          data: [],
-          message: '成功'
-        }
-      } else {
-        return {
-          code: 200,
-          status: false,
-          data: [],
-          message: '失败'
-        }
+      return {
+        code: 200,
+        status: true,
+        data: [],
+        message: '成功'
       }
       }
+
+      // if (Math.round(Math.random() * 2) < 1) {
+      //   return {
+      //     code: 200,
+      //     status: true,
+      //     data: [],
+      //     message: '成功'
+      //   }
+      // } else {
+      //   return {
+      //     code: 2001,
+      //     status: false,
+      //     data: [],
+      //     message: '失败'
+      //   }
+      // }
     }
     }
   },
   },
   // 进行充值
   // 进行充值
@@ -156,13 +163,13 @@ module.exports = [
     url: '/v1/recharge/player',
     url: '/v1/recharge/player',
     type: 'post',
     type: 'post',
     response: config => {
     response: config => {
-      return {
-        'status': true,
-        'code': 200,
-        'time': 1637055309,
-        'message': '成功',
-        'data': []
-      }
+      // return {
+      //   'status': true,
+      //   'code': 200,
+      //   'time': 1637055309,
+      //   'message': '成功',
+      //   'data': []
+      // }
 
 
       // return {
       // return {
       //   code: 35203,
       //   code: 35203,
@@ -171,40 +178,40 @@ module.exports = [
       //   message: '您的支付密码有误'
       //   message: '您的支付密码有误'
       // }
       // }
 
 
-      // const math = Math.round(Math.random() * 3)
-      // var result = []
-      // switch (math) {
-      //   case 0:
-      //     result = {
-      //       'status': true,
-      //       'code': 200,
-      //       'time': 1637055309,
-      //       'message': '成功~',
-      //       'data': []
-      //     }
-      //     break
-      //   case 1:
-      //     result = {
-      //       'status': false,
-      //       'code': 35203,
-      //       'time': 1637032613,
-      //       'message': '您的支付密码有误~',
-      //       'data': []
-      //     }
-      //     break
-      //   case 2:
-      //     result = {
-      //       code: 401,
-      //       status: false,
-      //       data: [],
-      //       message: '操作失败~'
-      //     }
-      //     break
-      //   case 3:
-      //     result = { 'status': false, 'code': 10007, 'time': 1637213822, 'message': '发放Flyme账户不存在,请确认', 'data': [] }
-      //     break
-      // }
-      // return result
+      const math = Math.round(Math.random() * 3)
+      var result = []
+      switch (math) {
+        case 0:
+          result = {
+            'status': true,
+            'code': 200,
+            'time': 1637055309,
+            'message': '成功~',
+            'data': []
+          }
+          break
+        case 1:
+          result = {
+            'status': false,
+            'code': 35203,
+            'time': 1637032613,
+            'message': '您的支付密码有误~',
+            'data': []
+          }
+          break
+        case 2:
+          result = {
+            code: 401,
+            status: false,
+            data: [],
+            message: '操作失败~'
+          }
+          break
+        case 3:
+          result = { 'status': false, 'code': 10007, 'time': 1637213822, 'message': '发放Flyme账户不存在,请确认', 'data': [] }
+          break
+      }
+      return result
     }
     }
   }
   }
 ]
 ]

+ 5 - 4
src/main.js

@@ -28,10 +28,11 @@ import * as filters from './filters' // global filters
  * Currently MockJs will be used in the production environment,
  * Currently MockJs will be used in the production environment,
  * please remove it before going online ! ! !
  * please remove it before going online ! ! !
  */
  */
-if (process.env.NODE_ENV === 'development') {
-  const { mockXHR } = require('../mock')
-  mockXHR()
-}
+// 开启后访问接口数据是 mock 的
+// if (process.env.NODE_ENV === 'development') {
+//   const { mockXHR } = require('../mock')
+//   mockXHR()
+// }
 
 
 Vue.use(Element, {
 Vue.use(Element, {
   size: Cookies.get('size') || 'medium', // set element-ui default size
   size: Cookies.get('size') || 'medium', // set element-ui default size

+ 310 - 178
src/views/recharge/index.vue

@@ -42,6 +42,9 @@
               />
               />
             </el-select>
             </el-select>
           </el-form-item>
           </el-form-item>
+          <el-form-item label="账户余额">
+            <span>{{ user_money }}元</span>
+          </el-form-item>
         </el-col>
         </el-col>
 
 
         <el-col :span="3">
         <el-col :span="3">
@@ -69,9 +72,6 @@
         </el-col>
         </el-col>
 
 
         <el-col :span="4">
         <el-col :span="4">
-          <el-form-item label="账户余额">
-            <span>{{ user_money }}元</span>
-          </el-form-item>
           <el-form-item label="充值金额" prop="money">
           <el-form-item label="充值金额" prop="money">
             <el-input v-model="dataForm.money" type="number" min="0" :max="maxMoney" class="filter-item" />
             <el-input v-model="dataForm.money" type="number" min="0" :max="maxMoney" class="filter-item" />
             <span style="font-size: var(--el-font-size-extra-small); color: #909399;">最大充值金额:{{ maxMoney }}</span>
             <span style="font-size: var(--el-font-size-extra-small); color: #909399;">最大充值金额:{{ maxMoney }}</span>
@@ -92,13 +92,19 @@
             <span>{{ rechargeMoney }} 元</span>
             <span>{{ rechargeMoney }} 元</span>
           </el-form-item>
           </el-form-item>
           <el-form-item label="账号检测">
           <el-form-item label="账号检测">
-            <el-radio-group v-model="dataForm.payway" prop="payway" class="filter-item">
+            <el-radio-group v-model="onCheck" prop="payway" class="filter-item">
               <el-switch v-model="onCheck" />
               <el-switch v-model="onCheck" />
             </el-radio-group>
             </el-radio-group>
           </el-form-item>
           </el-form-item>
+          <el-form-item label="是否充值">
+            <el-radio-group v-model="onRecharge" prop="onRecharge" class="filter-item">
+              <el-switch v-model="onRecharge" />
+            </el-radio-group>
+          </el-form-item>
           <el-form-item>
           <el-form-item>
-            <el-button type="primary" @click="onSubmit()">立即支付</el-button>
+            <el-button type="primary" @click="onSubmit()">提交</el-button>
           </el-form-item>
           </el-form-item>
+
         </el-col>
         </el-col>
         <el-col :span="9">
         <el-col :span="9">
           处理时间:<span>{{ startTime }}</span>  -- <span>{{ endTime }}</span>
           处理时间:<span>{{ startTime }}</span>  -- <span>{{ endTime }}</span>
@@ -193,7 +199,8 @@ export default {
 
 
       startTime: 0, // 开始时间
       startTime: 0, // 开始时间
       endTime: 0, // 结束时间
       endTime: 0, // 结束时间
-      onCheck: false, // 是否需要检测账号()
+      onCheck: false, // 是否需要检测账号
+      onRecharge: true, // 是否充值
       rechargeMoney: 0 // 支付总金额
       rechargeMoney: 0 // 支付总金额
 
 
     }
     }
@@ -234,12 +241,16 @@ export default {
     updateUserMoney() {
     updateUserMoney() {
       this.$store.dispatch('user/getInfo').then((res) => {
       this.$store.dispatch('user/getInfo').then((res) => {
         const { data } = res
         const { data } = res
-        this.user_money = data.user_money
+        this.user_money = Math.floor(data.user_money)
         if (this.accountNum > 0) {
         if (this.accountNum > 0) {
           this.maxMoney = Math.floor(data.user_money / this.accountNum)
           this.maxMoney = Math.floor(data.user_money / this.accountNum)
         } else {
         } else {
           this.maxMoney = Math.floor(data.user_money)
           this.maxMoney = Math.floor(data.user_money)
         }
         }
+        return Message({
+          type: 'success',
+          message: '账户余额已更新'
+        })
       })
       })
     },
     },
     // 统计充值账户数量并处理行数是否账号
     // 统计充值账户数量并处理行数是否账号
@@ -300,6 +311,24 @@ export default {
       //     message: '余额不足以充值.'
       //     message: '余额不足以充值.'
       //   })
       //   })
       // }
       // }
+
+      if (this.onCheck === false && this.onRecharge === false) {
+        return Message({
+          type: 'warning',
+          message: '请选择是否检测或充值!'
+        })
+      }
+
+      // 截取账号
+      var accountLists = this.dataForm.username.split('\n')
+      // 检测不充值
+      if (this.onCheck === true && this.onRecharge === false) {
+        this.startLoading()
+        this.sublmeRecharge(accountLists, 1)
+        return false
+      }
+
+      // 需要充值则检测余额
       if ((this.user_money - this.rechargeMoney) < 0) {
       if ((this.user_money - this.rechargeMoney) < 0) {
         return Message({
         return Message({
           type: 'warning',
           type: 'warning',
@@ -308,24 +337,18 @@ export default {
       }
       }
       this.$refs['dataForm'].validate((valid) => {
       this.$refs['dataForm'].validate((valid) => {
         if (valid) {
         if (valid) {
-          // 截取账号
-          var accountLists = this.dataForm.username.split('\n')
-          // console.log('# accountLists: ', accountLists)
-
           MessageBox.prompt('输入支付密码', 'Tip', {
           MessageBox.prompt('输入支付密码', 'Tip', {
             confirmButtonText: '确认',
             confirmButtonText: '确认',
             cancelButtonText: '取消'
             cancelButtonText: '取消'
           }).then(({ value }) => {
           }).then(({ value }) => {
-            // 遮屏
-            this.loading = Loading.service({
-              lock: true,
-              text: '处理中, 请稍等...',
-              background: 'rgba(0, 0, 0, 0.7)'
-            })
-            this.sublmeRecharge(accountLists, value)
+            this.startLoading()
+            if (this.onRecharge === true && this.onCheck === false) { // 充值不检测
+              this.sublmeRecharge(accountLists, 2, value)
+            } else if (this.onRecharge === true && this.onCheck === true) { // 充值并检测
+              this.sublmeRecharge(accountLists, 3, value)
+            }
           }).catch(() => {
           }).catch(() => {
             return Message({
             return Message({
-              type: 'info',
               message: '取消充值.'
               message: '取消充值.'
             })
             })
           })
           })
@@ -338,119 +361,170 @@ export default {
       })
       })
     },
     },
     // 提交检测和充值
     // 提交检测和充值
-    sublmeRecharge(accountLists, paypwd) {
+    async sublmeRecharge(accountLists, operationType, paypwd = '') {
       this.startTime = new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
       this.startTime = new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
-
-      // 是否需要验证账户
       // 提取第一条账号数据,进行提交测试
       // 提取第一条账号数据,进行提交测试
       const oneAccount = accountLists[0]
       const oneAccount = accountLists[0]
-      const oneData = { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: paypwd, username: oneAccount, money: this.dataForm.money, recharge: this.dataForm.recharge, payway: this.dataForm.payway, type: this.dataForm.type }
       const loadingNum = accountLists.length - 2
       const loadingNum = accountLists.length - 2
-      if (this.onCheck) {
-        // 账号检测
-        this.$store.dispatch('common/rechargePlayerType', { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, username: oneAccount }).then((res) => {
-          const { code, status, message } = res
-
-          if (code === 200 && status === true) {
-            // 充值
-            this.$store.dispatch('common/rechargePlayer', oneData).then((res) => {
-              const { code, status, message } = res
-              if (code === 200 && status === true) {
-                this.thenAccount = this.thenAccount + oneAccount + '\n'
-                this.thenAccountNum++
-
-                if (loadingNum > 1) {
-                  // 成功后处理剩下账号数据
-                  accountLists = LodashArray.drop(accountLists) // 删除第一个账户
-                  accountLists.forEach(async(item, index) => {
-                    await this.rechargePlayer(
-                      { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: paypwd, username: item, money: this.dataForm.money, recharge: this.dataForm.recharge, type: this.dataForm.type },
-                      index,
-                      this.onCheck,
-                      loadingNum
-                    )
-                  })
-                }
-              } else {
-                this.catchAccount = this.catchAccount + oneAccount + '\n'
-                this.catchAccountNum++
 
 
-                this.cloneLoading()
-                return Message({
-                  type: 'warning',
-                  message: message
-                })
-              }
-            }).catch((error) => {
-              this.catchAccount = this.catchAccount + oneAccount + '\n'
-              this.catchAccountNum++
+      switch (operationType) {
+        case 1: // 账号检测
+          await this.$store.dispatch('common/rechargePlayerType', { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, username: oneAccount }).then((res) => {
+            const { code, status, message } = res
+
+            if (code === 200 && status === true) {
+              this.thenAccount = this.thenAccount + oneAccount + '\n'
+              this.thenAccountNum++
+              Message({
+                type: 'success',
+                message: '检测成功 ' + oneAccount + ' : ' + message
+              })
 
 
-              this.cloneLoading()
+              // 成功后处理剩下账号数据
+              accountLists = LodashArray.drop(accountLists) // 删除第一个账户
+              accountLists.forEach(async(item, index) => {
+                await this.rechargePlayer(
+                  { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: paypwd, username: item, money: this.dataForm.money, recharge: this.dataForm.recharge, type: this.dataForm.type },
+                  index, operationType, loadingNum
+                )
+              })
+            } else {
+              this.noExistence = this.noExistence + oneAccount + '\n'
+              this.noExistenceNum++
+
+              this.cloneLoading(false)
               return Message({
               return Message({
-                type: 'error',
-                message: error.message
+                message: '检测 ' + oneAccount + ' : ' + message
               })
               })
-            })
-          } else {
-            this.noExistence = this.noExistence + oneAccount + '\n'
-            this.noExistenceNum++
+            }
+          }).catch((error) => {
+            this.catchAccount = this.catchAccount + oneAccount + '\n'
+            this.catchAccountNum++
 
 
-            this.cloneLoading()
+            this.cloneLoading(false)
             return Message({
             return Message({
               type: 'error',
               type: 'error',
-              message: '检测:' + message
+              message: '检测失败 ' + oneAccount + ' :' + error.message
             })
             })
-          }
-        }).catch((error) => {
-          console.log('# catch-message:', error.message)
-          this.catchAccount = this.catchAccount + oneAccount + '\n'
-          this.catchAccountNum++
-
-          this.cloneLoading()
-          return Message({
-            type: 'error',
-            message: '检测:' + error.message
           })
           })
-        })
-      } else {
-        this.$store.dispatch('common/rechargePlayer', oneData).then((res) => {
-          const { code, status, message } = res
-          if (code === 200 && status === true) {
-            this.thenAccount = this.thenAccount + oneAccount + '\n'
-            this.thenAccountNum++
-
-            if (loadingNum > 1) {
+          break
+        case 2: // 充值
+          this.$store.dispatch('common/rechargePlayer', { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: paypwd, username: oneAccount, money: this.dataForm.money, recharge: this.dataForm.recharge, payway: this.dataForm.payway, type: this.dataForm.type }).then((res) => {
+            const { code, status, message } = res
+            if (code === 200 && status === true) {
+              this.thenAccount = this.thenAccount + oneAccount + '\n'
+              this.thenAccountNum++
+              Message({
+                type: 'success',
+                message: '充值成功 ' + oneAccount + ' : ' + message
+              })
+
               // 成功后处理剩下账号数据
               // 成功后处理剩下账号数据
               accountLists = LodashArray.drop(accountLists) // 删除第一个账户
               accountLists = LodashArray.drop(accountLists) // 删除第一个账户
               accountLists.forEach(async(item, index) => {
               accountLists.forEach(async(item, index) => {
                 await this.rechargePlayer(
                 await this.rechargePlayer(
                   { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: paypwd, username: item, money: this.dataForm.money, recharge: this.dataForm.recharge, type: this.dataForm.type },
                   { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: paypwd, username: item, money: this.dataForm.money, recharge: this.dataForm.recharge, type: this.dataForm.type },
-                  index,
-                  this.onCheck,
-                  loadingNum
+                  index, operationType, loadingNum
                 )
                 )
               })
               })
+            } else {
+              this.catchAccount = this.catchAccount + oneAccount + '\n'
+              this.catchAccountNum++
+
+              this.cloneLoading()
+              return Message({
+                message: '充值 ' + oneAccount + ' : ' + message
+              })
             }
             }
-          } else {
+          }).catch((error) => {
             this.catchAccount = this.catchAccount + oneAccount + '\n'
             this.catchAccount = this.catchAccount + oneAccount + '\n'
             this.catchAccountNum++
             this.catchAccountNum++
 
 
             this.cloneLoading()
             this.cloneLoading()
             return Message({
             return Message({
-              type: 'warning',
-              message: message
+              type: 'error',
+              message: '充值失败 ' + oneAccount + ' : ' + error.message
             })
             })
-          }
-        }).catch((error) => {
-          this.catchAccount = this.catchAccount + oneAccount + '\n'
-          this.catchAccountNum++
+          })
+          break
+        case 3: // 充值并检测
+          // 账号检测
+          this.$store.dispatch('common/rechargePlayerType', { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, username: oneAccount }).then((res) => {
+            const { code, status, message } = res
+
+            if (code === 200 && status === true) {
+              Message({
+                type: 'success',
+                message: '检测成功 ' + oneAccount + ' : ' + message
+              })
 
 
-          this.cloneLoading()
-          return Message({
+              // 充值
+              this.$store.dispatch('common/rechargePlayer', { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: paypwd, username: oneAccount, money: this.dataForm.money, recharge: this.dataForm.recharge, payway: this.dataForm.payway, type: this.dataForm.type }).then((res) => {
+                const { code, status, message } = res
+
+                if (code === 200 && status === true) {
+                  this.thenAccount = this.thenAccount + oneAccount + '\n'
+                  this.thenAccountNum++
+                  Message({
+                    type: 'success',
+                    message: '充值成功 ' + oneAccount + ' : ' + message
+                  })
+
+                  // 成功后处理剩下账号数据
+                  accountLists = LodashArray.drop(accountLists) // 删除第一个账户
+                  accountLists.forEach(async(item, index) => {
+                    await this.rechargePlayer(
+                      { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: paypwd, username: item, money: this.dataForm.money, recharge: this.dataForm.recharge, type: this.dataForm.type },
+                      index, operationType, loadingNum
+                    )
+                  })
+                } else {
+                  this.catchAccount = this.catchAccount + oneAccount + '\n'
+                  this.catchAccountNum++
+
+                  this.cloneLoading()
+                  return Message({
+                    type: 'warning',
+                    message: '充值 ' + oneAccount + ' : ' + message
+                  })
+                }
+              }).catch((error) => {
+                this.catchAccount = this.catchAccount + oneAccount + '\n'
+                this.catchAccountNum++
+
+                this.cloneLoading(false)
+                return Message({
+                  type: 'error',
+                  message: '充值失败 ' + oneAccount + ' : ' + error.message
+                })
+              })
+            } else {
+              this.noExistence = this.noExistence + oneAccount + '\n'
+              this.noExistenceNum++
+
+              this.cloneLoading(false)
+              return Message({
+                message: '检测 ' + oneAccount + ' : ' + message
+              })
+            }
+          }).catch((error) => {
+            this.catchAccount = this.catchAccount + oneAccount + '\n'
+            this.catchAccountNum++
+
+            this.cloneLoading(false)
+            return Message({
+              type: 'error',
+              message: '检测失败 ' + oneAccount + ' : ' + error.message
+            })
+          })
+
+          break
+        default:
+          Message({
             type: 'error',
             type: 'error',
-            message: error.message
+            message: '操作有误!!!'
           })
           })
-        })
+          break
       }
       }
 
 
       // // ## 测试(去除第一个账户单独测试)
       // // ## 测试(去除第一个账户单独测试)
@@ -472,112 +546,170 @@ export default {
       //   )
       //   )
       // })
       // })
     },
     },
-    // 关闭加载页面
-    cloneLoading() {
-      // this.loading = false
+    // 启动遮屏
+    startLoading() {
+      this.loading = Loading.service({
+        lock: true,
+        text: '处理中, 请稍等...',
+        background: 'rgba(0, 0, 0, 0.7)'
+      })
+    },
+    // 关闭遮屏
+    cloneLoading(onMoney = true) {
       this.loading.close()
       this.loading.close()
-      this.updateUserMoney()
+      if (onMoney) {
+        this.updateUserMoney()
+      }
       this.endTime = new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
       this.endTime = new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
     },
     },
-    // 异步进行账户充值
-    rechargePlayer(data, index, onCheck, count) {
+    // 异步进行账户检测与充值
+    rechargePlayer(data, index, operationType, count) {
       // 延迟一秒处理
       // 延迟一秒处理
-      setTimeout((data, index, onCheck, count) => {
+      setTimeout((data, new_index, new_operationType, new_count) => {
         return new Promise((resolve, reject) => {
         return new Promise((resolve, reject) => {
           // 继续延迟
           // 继续延迟
-          setTimeout((_data, onCheck, { index, count }) => {
-            if (index === count || index > count) {
-              this.cloneLoading()
-            }
-            // 是否需要账号检测
-            if (onCheck === true) {
-              // 账号检测
-              this.$store.dispatch('common/rechargePlayerType', { pid: _data.pid, cid: _data.cid, gfid: _data.gfid, username: _data.username }).then((res) => {
-                const { code, status, message } = res
-                if (code === 200 && status !== true) {
-                  // this.thenAccount = this.thenAccount + _data.username + '\n'
-                  // this.thenAccountNum++
-
-                  // 充值
-                  this.$store.dispatch('common/rechargePlayer', _data).then((res) => {
-                    const { code, status, message } = res
-                    if (code === 200 && status === true) {
-                      this.thenAccount = this.thenAccount + _data.username + '\n'
-                      this.thenAccountNum++
-                    } else {
+          setTimeout((_data, _index, _operationType, _count) => {
+            switch (_operationType) {
+              case 1: // 检测账户
+                this.$store.dispatch('common/rechargePlayerType', { pid: _data.pid, cid: _data.cid, gfid: _data.gfid, username: _data.username }).then((res) => {
+                  const { code, status, message } = res
+                  if (code === 200 && status === true) {
+                    this.thenAccount = this.thenAccount + _data.username + '\n'
+                    this.thenAccountNum++
+                    Message({
+                      type: 'success',
+                      message: '检测成功 ' + _data.username + ' :' + message
+                    })
+                  } else {
+                    if (code === 10001) {
                       this.catchAccount = this.catchAccount + _data.username + '\n'
                       this.catchAccount = this.catchAccount + _data.username + '\n'
                       this.catchAccountNum++
                       this.catchAccountNum++
-
-                      Message({
-                        type: 'warning',
-                        message: 'Player:' + message
-                      })
+                    } else {
+                      this.noExistence = this.noExistence + _data.username + '\n'
+                      this.noExistenceNum++
                     }
                     }
-                  }).catch((error) => {
-                    this.catchAccount = this.catchAccount + _data.username + '\n'
-                    this.catchAccountNum++
-
                     Message({
                     Message({
-                      type: 'error',
-                      message: 'Player:' + error.message
+                      message: '检测 ' + _data.username + ' :' + message
                     })
                     })
+                  }
+                }).catch((error) => {
+                  this.catchAccount = this.catchAccount + _data.username + '\n'
+                  this.catchAccountNum++
+
+                  Message({
+                    type: 'error',
+                    message: '检测失败 ' + _data.username + ' :' + error.message
                   })
                   })
-                } else {
-                  if (code === 10001) {
+                })
+                break
+              case 2: // 充值账户
+                // 充值
+                this.$store.dispatch('common/rechargePlayer', _data).then((res) => {
+                  const { code, status, message } = res
+                  if (code === 200 && status === true) {
+                    this.thenAccount = this.thenAccount + _data.username + '\n'
+                    this.thenAccountNum++
+                    Message({
+                      type: 'success',
+                      message: '充值成功 ' + _data.username + ':' + message
+                    })
+                  } else {
                     this.catchAccount = this.catchAccount + _data.username + '\n'
                     this.catchAccount = this.catchAccount + _data.username + '\n'
                     this.catchAccountNum++
                     this.catchAccountNum++
-                  } else {
-                    this.noExistence = this.noExistence + _data.username + '\n'
-                    this.noExistenceNum++
+
+                    Message({
+                      message: '充值 ' + _data.username + ':' + message
+                    })
                   }
                   }
+                }).catch((error) => {
+                  this.catchAccount = this.catchAccount + _data.username + '\n'
+                  this.catchAccountNum++
 
 
                   Message({
                   Message({
                     type: 'error',
                     type: 'error',
-                    message: '检测:' + message
+                    message: '充值失败 ' + _data.username + ':' + error.message
                   })
                   })
-                }
-              }).catch((error) => {
-                this.catchAccount = this.catchAccount + _data.username + '\n'
-                this.catchAccountNum++
-
-                Message({
-                  type: 'error',
-                  message: '检测:' + error.message
                 })
                 })
-                resolve()
-              })
-            } else {
-              // 充值
-              this.$store.dispatch('common/rechargePlayer', _data).then((res) => {
-                const { code, status, message } = res
-                if (code === 200 && status === true) {
-                  this.thenAccount = this.thenAccount + _data.username + '\n'
-                  this.thenAccountNum++
-                } else {
+                break
+              case 3: // 检测并充值
+                // 账号检测
+                this.$store.dispatch('common/rechargePlayerType', { pid: _data.pid, cid: _data.cid, gfid: _data.gfid, username: _data.username }).then((res) => {
+                  const { code, status, message } = res
+                  if (code === 200 && status === true) {
+                    Message({
+                      type: 'success',
+                      message: '检测成功 ' + _data.username + ':' + message
+                    })
+
+                    // 充值
+                    this.$store.dispatch('common/rechargePlayer', _data).then((res) => {
+                      const { code, status, message } = res
+                      if (code === 200 && status === true) {
+                        this.thenAccount = this.thenAccount + _data.username + '\n'
+                        this.thenAccountNum++
+                        Message({
+                          type: 'success',
+                          message: '充值成功 ' + _data.username + ':' + message
+                        })
+                      } else {
+                        this.catchAccount = this.catchAccount + _data.username + '\n'
+                        this.catchAccountNum++
+
+                        Message({
+                          message: '充值 ' + _data.username + ':' + message
+                        })
+                      }
+                    }).catch((error) => {
+                      this.catchAccount = this.catchAccount + _data.username + '\n'
+                      this.catchAccountNum++
+
+                      Message({
+                        type: 'error',
+                        message: '充值失败 ' + _data.username + ':' + error.message
+                      })
+                    })
+                  } else {
+                    if (code === 10001) {
+                      this.catchAccount = this.catchAccount + _data.username + '\n'
+                      this.catchAccountNum++
+                    } else {
+                      this.noExistence = this.noExistence + _data.username + '\n'
+                      this.noExistenceNum++
+                    }
+
+                    Message({
+                      message: '检测 ' + _data.username + ':' + message
+                    })
+                  }
+                }).catch((error) => {
                   this.catchAccount = this.catchAccount + _data.username + '\n'
                   this.catchAccount = this.catchAccount + _data.username + '\n'
                   this.catchAccountNum++
                   this.catchAccountNum++
 
 
                   Message({
                   Message({
-                    type: 'warning',
-                    message: '充值:' + message
+                    type: 'error',
+                    message: '检测失败 ' + _data.username + ':' + error.message
                   })
                   })
-                }
-              }).catch((error) => {
-                this.catchAccount = this.catchAccount + _data.username + '\n'
-                this.catchAccountNum++
-
-                Message({
-                  type: 'error',
-                  message: '充值:' + error.message
                 })
                 })
-                resolve()
-              })
+                break
+              default:
+                break
+            }
+            if (_index !== null && _index === _count || _index > _count) {
+              setTimeout(() => {
+                // 检测不更新账户余额
+                var onMoney = true
+                if (new_operationType === 1) {
+                  onMoney = false
+                }
+                this.cloneLoading(onMoney)
+              }, 1500)
             }
             }
-          }, 1800 * (index + 1), data, onCheck, { index, count })
+            resolve()
+          }, 1800 * (index + 1), data, new_index, new_operationType, new_count)
           // }, (1600 + Math.round(Math.random() * 300)) * (index + 1), data, onCheck)
           // }, (1600 + Math.round(Math.random() * 300)) * (index + 1), data, onCheck)
           // 1500 * (index + 1): +1的原因是,这里是从第二条数据开始处理的,异步处理之前单独处理了一个,所以时间久点。
           // 1500 * (index + 1): +1的原因是,这里是从第二条数据开始处理的,异步处理之前单独处理了一个,所以时间久点。
         })
         })
-      }, 1000, data, index, onCheck, count)
+      }, 1000, data, index, operationType, count)
     },
     },
     // 渠道账号列表
     // 渠道账号列表
     getRechargePlatform(val) {
     getRechargePlatform(val) {

+ 12 - 11
vue.config.js

@@ -35,19 +35,20 @@ module.exports = {
     overlay: {
     overlay: {
       warnings: true,
       warnings: true,
       errors: true
       errors: true
-    }
+    },
     // before: require('./mock/mock-server.js'),
     // before: require('./mock/mock-server.js'),
 
 
-    // proxy: {
-    //   [process.env.VUE_APP_BASE_API]: { // 这里是公共部分,在调用接口时后面接不相同的部分,/api就相当于http://192.168.0.199:8926/api这一段
-    //     target: process.env.VUE_APP_BASE_URL, // 这里写的是访问接口的域名和端口号
-    //     changeOrigin: true, // 必须加上这个才能跨域请求
-    //     logLevel: 'debug',
-    //     pathRewrite: { // 重命名
-    //       ['^/' + process.env.VUE_APP_BASE_API]: ''
-    //     }
-    //   }
-    // }
+    // 开启后可以访问线上域名进行测试
+    proxy: {
+      [process.env.VUE_APP_BASE_API]: { // 这里是公共部分,在调用接口时后面接不相同的部分,/api就相当于http://192.168.0.199:8926/api这一段
+        target: process.env.VUE_APP_BASE_URL, // 这里写的是访问接口的域名和端口号
+        changeOrigin: true, // 必须加上这个才能跨域请求
+        logLevel: 'debug',
+        pathRewrite: { // 重命名
+          ['^/' + process.env.VUE_APP_BASE_API]: ''
+        }
+      }
+    }
   },
   },
   configureWebpack: {
   configureWebpack: {
     // provide the app's title in webpack's name field, so that
     // provide the app's title in webpack's name field, so that