|
@@ -0,0 +1,421 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="app-container">
|
|
|
|
|
+ <div class="one">
|
|
|
|
|
+ <el-form ref="ruleForm" :model="ruleForm" :rules="rules" class="demo-ruleForm">
|
|
|
|
|
+ <el-row :gutter="20">
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item :label="'查询账户:' + handle_num" prop="account_list">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="ruleForm.account_list"
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ :rows="20"
|
|
|
|
|
+ placeholder="请输入查询账户,一行一个"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="游戏平台" prop="pid">
|
|
|
|
|
+ <el-select v-model="ruleForm.pid" placeholder="请选择 游戏平台" disabled>
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="(item, index) in platform_list"
|
|
|
|
|
+ :key="index"
|
|
|
|
|
+ :label="item.platform"
|
|
|
|
|
+ :value="item.pid"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ item.platform }}
|
|
|
|
|
+ </el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item label="渠道账户" prop="cid">
|
|
|
|
|
+ <el-select v-model="ruleForm.cid" placeholder="请选择 渠道账户" filterable @change="changeCid">
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="(item, index) in channle_list"
|
|
|
|
|
+ :key="item.cid"
|
|
|
|
|
+ :label="item.title"
|
|
|
|
|
+ :value="item.cid"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item label="游戏" prop="yxid">
|
|
|
|
|
+<!-- yxid_index-->
|
|
|
|
|
+ <el-select v-model="ruleForm.yxid" placeholder="请选择 游戏" filterable @change="changeYxid">
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="(item, index) in game_list"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :label="item.name"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <el-button type="primary" @click="submitForm('ruleForm')">查询</el-button>
|
|
|
|
|
+ <el-button @click="resetForm('ruleForm')">重置</el-button>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="three">
|
|
|
|
|
+ <el-card class="box-card">
|
|
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
|
|
+ <span>正常:</span>{{ success_num }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="text item">
|
|
|
|
|
+ <el-input v-model="success_list" type="textarea" :rows="20" disabled />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-card>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="four">
|
|
|
|
|
+ <el-card class="box-card">
|
|
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
|
|
+ <span>暂无归属:</span>{{ no_num }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="text item">
|
|
|
|
|
+ <el-input v-model="no_list" type="textarea" :rows="20" disabled />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-card>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="five">
|
|
|
|
|
+ <el-card class="box-card">
|
|
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
|
|
+ <span>不归属:</span>{{ noth_num }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="text item">
|
|
|
|
|
+ <el-input v-model="noth_list" type="textarea" :rows="20" disabled />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-card>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script>
|
|
|
|
|
+import { getPlatform, getChannle, getGame, accountCheck } from '@/api/ascription'
|
|
|
|
|
+
|
|
|
|
|
+export default {
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ formLoading: false,
|
|
|
|
|
+
|
|
|
|
|
+ // 游戏平台
|
|
|
|
|
+ platform_list: [
|
|
|
|
|
+ {
|
|
|
|
|
+ 'pid': 'd65aa6d7614589bffe62456b88e98811',
|
|
|
|
|
+ 'platform': 'MM'
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+ // 渠道账户
|
|
|
|
|
+ channle_list: [],
|
|
|
|
|
+ // 游戏列表
|
|
|
|
|
+ game_list: [],
|
|
|
|
|
+
|
|
|
|
|
+ yxid_index: '', // 选中的游戏
|
|
|
|
|
+ ruleForm: {
|
|
|
|
|
+ // 录入数据
|
|
|
|
|
+ pid: 'd65aa6d7614589bffe62456b88e98811',
|
|
|
|
|
+ cid: 21751,
|
|
|
|
|
+ yxid: 54252,
|
|
|
|
|
+
|
|
|
|
|
+ // 追加
|
|
|
|
|
+ id: '',
|
|
|
|
|
+ channel_no: '',
|
|
|
|
|
+ game_name: '',
|
|
|
|
|
+
|
|
|
|
|
+ // 查询
|
|
|
|
|
+ account_list: ''
|
|
|
|
|
+ },
|
|
|
|
|
+ rules: {
|
|
|
|
|
+ pid: [
|
|
|
|
|
+ { required: true, message: '请选择 游戏平台', trigger: 'blur' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ cid: [
|
|
|
|
|
+ { required: true, message: '请选择 渠道账户', trigger: 'blur' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ yxid: [
|
|
|
|
|
+ { required: true, message: '请选择 游戏', trigger: 'blur' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ account_list: [
|
|
|
|
|
+ { required: true, message: '请输入查询的账户', trigger: 'blur' }
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ handle_list: '', // 处理账号列表
|
|
|
|
|
+ handle_num: 0,
|
|
|
|
|
+ success_list: '', // 正常账号
|
|
|
|
|
+ success_num: 0,
|
|
|
|
|
+ no_list: '', // 不归属
|
|
|
|
|
+ no_num: 0,
|
|
|
|
|
+ noth_list: '', // 暂无归属
|
|
|
|
|
+ noth_num: 0,
|
|
|
|
|
+
|
|
|
|
|
+ task: {
|
|
|
|
|
+ count: 0, // 总数
|
|
|
|
|
+ conduct: 0 // 进行中
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ error_list: '' // 处理失败的记录
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ watch: {
|
|
|
|
|
+ 'ruleForm.account_list': {
|
|
|
|
|
+ handler(val, oldVal) {
|
|
|
|
|
+ // this.accountSplit(this.ruleForm.account_list)
|
|
|
|
|
+ this.handle_num = this.ruleForm.account_list.split('\n').length
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ 'success_list': {
|
|
|
|
|
+ handler(val, oldVal) {
|
|
|
|
|
+ this.success_num = this.success_list.split('\n').length
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ 'no_list': {
|
|
|
|
|
+ handler(val, oldVal) {
|
|
|
|
|
+ this.no_num = this.no_list.split('\n').length
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ 'noth_list': {
|
|
|
|
|
+ handler(val, oldVal) {
|
|
|
|
|
+ this.noth_num = this.noth_list.split('\n').length
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ created() {
|
|
|
|
|
+ // this.getPlatform();
|
|
|
|
|
+ this.getChannle()
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ submitForm(formName) {
|
|
|
|
|
+ var data = {
|
|
|
|
|
+ pid: this.ruleForm.pid,
|
|
|
|
|
+ cid: this.ruleForm.cid,
|
|
|
|
|
+ yxid: this.ruleForm.yxid,
|
|
|
|
|
+ id: this.ruleForm.id,
|
|
|
|
|
+ channel_no: this.ruleForm.channel_no,
|
|
|
|
|
+ game_name: this.ruleForm.game_name,
|
|
|
|
|
+ account: ''
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
|
|
+ if (valid) {
|
|
|
|
|
+ console.log('## submitForm:', this.ruleForm)
|
|
|
|
|
+ var list = this.accountSplit(this.ruleForm.account_list)
|
|
|
|
|
+ this.formLoading = this.$loading({
|
|
|
|
|
+ lock: true,
|
|
|
|
|
+ text: 'Loading',
|
|
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ this.batchQuery(list, data)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log('error submit!!')
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ // 查询账号拆分
|
|
|
|
|
+ accountSplit(account_list) {
|
|
|
|
|
+ var account_list = account_list.split('\n')
|
|
|
|
|
+
|
|
|
|
|
+ // 账号去重
|
|
|
|
|
+ const newList = [] // 格式化后的账号列表
|
|
|
|
|
+ let newAccount = '' // 格式化后的账号字符串
|
|
|
|
|
+ const repeatList = [] // 重复账号记录
|
|
|
|
|
+
|
|
|
|
|
+ for (var i = 0; i < account_list.length; i++) {
|
|
|
|
|
+ if (account_list[i] === '') {
|
|
|
|
|
+ continue
|
|
|
|
|
+ }
|
|
|
|
|
+ // 账户去重,并提示
|
|
|
|
|
+ if (newList.indexOf(account_list[i]) === -1) {
|
|
|
|
|
+ newList.push(account_list[i])
|
|
|
|
|
+ newAccount += '\n' + account_list[i]
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // TODO:记录重复账号
|
|
|
|
|
+ repeatList.push(account_list[i])
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (repeatList.length > 0) {
|
|
|
|
|
+ // console.error("## 重复账号:", repeatList.join().split('\n'));
|
|
|
|
|
+ console.error('## 重复账号:', repeatList)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 账号列表格式修复
|
|
|
|
|
+ this.ruleForm.account_list = newAccount
|
|
|
|
|
+
|
|
|
|
|
+ return newList
|
|
|
|
|
+ },
|
|
|
|
|
+ // 批量查询
|
|
|
|
|
+ async batchQuery(list, data) {
|
|
|
|
|
+ var that = this
|
|
|
|
|
+ let i = list.length
|
|
|
|
|
+ that.task.count = i
|
|
|
|
|
+ that.task.conduct = 0
|
|
|
|
|
+
|
|
|
|
|
+ that.success_list = '' // 正常账号
|
|
|
|
|
+ that.no_list = '' // 不归属
|
|
|
|
|
+ that.noth_list = '' // 暂无归属
|
|
|
|
|
+
|
|
|
|
|
+ while (i--) {
|
|
|
|
|
+ if (i < 0) {
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const account = list[i]
|
|
|
|
|
+ data['account'] = account
|
|
|
|
|
+ await that.accountChecks(data, account, i)
|
|
|
|
|
+ that.sleep(1000)
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log('## 处理结束')
|
|
|
|
|
+ console.log('## 接口失败的账户:', this.errorList ? this.errorList : '无')
|
|
|
|
|
+
|
|
|
|
|
+ if (that.task.count != that.task.conduct) {
|
|
|
|
|
+ // 如果任务结束,程序还没执行完,则延迟2秒后关闭页面加载框
|
|
|
|
|
+ setTimeout(function(that) {
|
|
|
|
|
+ that.formLoading.close()
|
|
|
|
|
+ }, 2000, that)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ // 查询 -- 异步
|
|
|
|
|
+ async accountChecks(data, account, i) {
|
|
|
|
|
+ var that = this
|
|
|
|
|
+ // console.log("## "+i+" -- 查询 -- 异步 -- 开始")
|
|
|
|
|
+ await that.$store.dispatch('ascription/accountCheck', data).then((res) => {
|
|
|
|
|
+ this.task.conduct = i
|
|
|
|
|
+ // console.log("## 队列:", i, this.task.count);
|
|
|
|
|
+
|
|
|
|
|
+ const { code, data, message } = res
|
|
|
|
|
+ console.log('## ' + (this.task.count - i) + ' -- 查询 -- 异步 -- 结束:', res)
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 归属/正常 = 200 :
|
|
|
|
|
+ * {
|
|
|
|
|
+ * "status": true,
|
|
|
|
|
+ * "code": 200,
|
|
|
|
|
+ * "time": 1656664946,
|
|
|
|
|
+ * "message": "成功",
|
|
|
|
|
+ * "data": []
|
|
|
|
|
+ * }
|
|
|
|
|
+ *
|
|
|
|
|
+ * 不归属 = 21002/* :
|
|
|
|
|
+ * {
|
|
|
|
|
+ * "status": false,
|
|
|
|
|
+ * "code": 21002,
|
|
|
|
|
+ * "time": 1656661075,
|
|
|
|
|
+ * "message": "当前账号不归属此渠道",
|
|
|
|
|
+ * "data": []
|
|
|
|
|
+ * }
|
|
|
|
|
+ *
|
|
|
|
|
+ * 暂无归属 = 21003 :
|
|
|
|
|
+ * {
|
|
|
|
|
+ * "status": false,
|
|
|
|
|
+ * "code": 21003,
|
|
|
|
|
+ * "time": 1656664981,
|
|
|
|
|
+ * "message": "当前账号暂无归属渠道,可拓展为渠道下家",
|
|
|
|
|
+ * "data": []
|
|
|
|
|
+ * }
|
|
|
|
|
+ */
|
|
|
|
|
+ switch (code) {
|
|
|
|
|
+ case 200:
|
|
|
|
|
+ that.success_list += that.success_list ? '\n' + account : account
|
|
|
|
|
+ break
|
|
|
|
|
+ case 21002:
|
|
|
|
|
+ that.no_list += that.no_list ? '\n' + account : account
|
|
|
|
|
+ break
|
|
|
|
|
+ case 21003:
|
|
|
|
|
+ that.noth_list += that.noth_list ? '\n' + account : account
|
|
|
|
|
+ break
|
|
|
|
|
+ default:
|
|
|
|
|
+ that.no_list += that.no_list ? '\n' + account : account
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const msg = '进度:' + (this.task.count - i) + '/' + this.task.count
|
|
|
|
|
+ this.$notify({
|
|
|
|
|
+ title: '查询成功!' + msg,
|
|
|
|
|
+ message: account + ':' + message,
|
|
|
|
|
+ type: 'success',
|
|
|
|
|
+ position: 'top-left'
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ this.task.conduct = this.task.count - i
|
|
|
|
|
+ if (i == 0) {
|
|
|
|
|
+ this.formLoading.close()
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch((error) => {
|
|
|
|
|
+ that.errorList = that.errorList ? that.errorList + ',' + account : that.errorList
|
|
|
|
|
+ console.log('## 查询失败!', error)
|
|
|
|
|
+ })
|
|
|
|
|
+ // .finally(function (){
|
|
|
|
|
+ // that.errorList = !that.errorList?account:(that.errorList+','+account);
|
|
|
|
|
+ // })
|
|
|
|
|
+ },
|
|
|
|
|
+ // 休眠
|
|
|
|
|
+ sleep(ms = 2000) { // sleep延迟方法2ms
|
|
|
|
|
+ var unixtime_ms = new Date().getTime()
|
|
|
|
|
+ while (new Date().getTime() < unixtime_ms + ms) {}
|
|
|
|
|
+ },
|
|
|
|
|
+ resetForm(formName) {
|
|
|
|
|
+ this.$refs[formName].resetFields()
|
|
|
|
|
+ this.ruleForm = {
|
|
|
|
|
+ pid: 'd65aa6d7614589bffe62456b88e98811',
|
|
|
|
|
+ cid: '',
|
|
|
|
|
+ yxid: '',
|
|
|
|
|
+ id: '',
|
|
|
|
|
+ channel_no: '',
|
|
|
|
|
+ game_name: '',
|
|
|
|
|
+ account_list: ''
|
|
|
|
|
+ }
|
|
|
|
|
+ this.yxid_index = ''
|
|
|
|
|
+ this.handle_list = ''
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ // 游戏平台列表
|
|
|
|
|
+ getPlatform() {
|
|
|
|
|
+ getPlatform().then((res) => {
|
|
|
|
|
+ const { data } = res
|
|
|
|
|
+ this.platform_list = data.data
|
|
|
|
|
+ }).catch((error) => {})
|
|
|
|
|
+ },
|
|
|
|
|
+ // 渠道账号列表
|
|
|
|
|
+ getChannle() {
|
|
|
|
|
+ getChannle(this.ruleForm.pid).then((res) => {
|
|
|
|
|
+ const { data } = res
|
|
|
|
|
+ this.channle_list = data.data
|
|
|
|
|
+
|
|
|
|
|
+ this.changeCid('21751');
|
|
|
|
|
+ }).catch((error) => {})
|
|
|
|
|
+ },
|
|
|
|
|
+ // 选择渠道
|
|
|
|
|
+ changeCid(cid) {
|
|
|
|
|
+ this.getGame(this.ruleForm.pid, cid);
|
|
|
|
|
+ },
|
|
|
|
|
+ // 渠道账号列表
|
|
|
|
|
+ getGame(pid = '', cid = '') {
|
|
|
|
|
+ getGame(pid || this.ruleForm.pid, cid || this.ruleForm.cid).then((res) => {
|
|
|
|
|
+ const { data } = res
|
|
|
|
|
+ this.game_list = data.data
|
|
|
|
|
+ }).catch((error) => {})
|
|
|
|
|
+ },
|
|
|
|
|
+ // 选择游戏
|
|
|
|
|
+ changeYxid(index) {
|
|
|
|
|
+ this.ruleForm.id = this.game_list[index]['id']
|
|
|
|
|
+ this.ruleForm.yxid = this.game_list[index]['yxid']
|
|
|
|
|
+ this.ruleForm.channel_no = this.game_list[index]['channel_no']
|
|
|
|
|
+ this.ruleForm.game_name = this.game_list[index]['name']
|
|
|
|
|
+ // console.log("## changeYxid: ", this.game_list[index]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style lang="scss">
|
|
|
|
|
+ .app-container{
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: space-around;
|
|
|
|
|
+ }
|
|
|
|
|
+</style>
|