Ver Fonte

增加pdd可提现余额查询、增加滑块风控tag

dodo hold há 10 meses atrás
pai
commit
7eb3f5943e

+ 9 - 0
.claude/settings.local.json

@@ -0,0 +1,9 @@
+{
+  "permissions": {
+    "allow": [
+      "Bash(npm run type:check:*)"
+    ],
+    "deny": [],
+    "ask": []
+  }
+}

+ 3 - 0
.eslintrc.js

@@ -66,5 +66,8 @@ module.exports = {
     'no-param-reassign': 0,
     'prefer-regex-literals': 0,
     'import/no-extraneous-dependencies': 0,
+    'no-plusplus': 0,
+    'object-shorthand': 0,
+    'no-await-in-loop': 0,
   },
 };

+ 3 - 1
src/api/pdd.ts

@@ -35,6 +35,8 @@ export function updateCookiesWithId(data: UpdateCookieWithIdModel) {
     return axios.post<FormRes>('/api/PddUnion/updateCookies', data);
 }
 
+
+
 // list
 export interface PddPoolRecord {
     id: number;
@@ -100,7 +102,7 @@ export interface PddEstimateRevenueRecord {
     report_date: Date;
     create_time: Date;
     last_time: Date;
-    
+
     orderNum: number;
     orderAmount: number;
     feeAmount: number;

+ 3 - 0
src/views/jd/list.vue

@@ -190,6 +190,9 @@
                     <a-tag v-if="record.riskStrategy" size="small" bordered color="orange">
                         {{ record.riskStrategy }}-{{ record.launchScene }}
                     </a-tag>
+                    <a-tag v-if="record.riskCookie" size="small" bordered color="red">
+                        {{ record.riskCookie }}
+                    </a-tag>
                 </template>
                 <template #time="{ record }">
                     <div style="color:gray;">

+ 127 - 3
src/views/pdd/list.vue

@@ -51,6 +51,13 @@
                         <a-button type="outline" @click="handleRechargeAllOnlineAccountUsage">
                             重置账号当日分配权重
                         </a-button>
+                        <a-button
+                            type="primary"
+                            status="warning"
+                            :disabled="selectedRows.length === 0"
+                            @click="handleBatchUpdateBalance">
+                            批量更新余额 ({{ selectedRows.length }})
+                        </a-button>
                     </a-space>
                 </a-col>
                 <a-col :span="12" style="
@@ -111,7 +118,13 @@
 
             <a-table row-key="id" :loading="loading" :pagination="pagination" :summary="true" summary-text="汇总"
                 :columns="(cloneColumns as TableColumnData[])" :data="renderData" :bordered="{ headerCell: true }"
-                :row-class="getRowClass" :size="size" @page-change="onPageChange" @page-size-change="onPageSizeChange">
+                :row-class="getRowClass" :size="size"
+                v-model:selectedKeys="selectedRowKeys"
+                :row-selection="{
+                    type: 'checkbox',
+                    showCheckedAll: true
+                }"
+                @page-change="onPageChange" @page-size-change="onPageSizeChange">
                 <template #index="{ record }">
                     {{ record.id }}
                 </template>
@@ -140,6 +153,9 @@
                     <a-tag v-if="record.riskStrategy" size="small" bordered color="orange">
                         {{ record.riskStrategy }}-{{ record.launchScene }}
                     </a-tag>
+                    <a-tag v-if="record.riskCookie" size="small" bordered color="red">
+                        {{ record.riskCookie }}
+                    </a-tag>
                 </template>
                 <template #status="{ record }">
                     <a-tag v-if="record.status" bordered color="green" @click="changeStatus(record.id, false)">
@@ -254,6 +270,11 @@
                 <template #time_range="{ record }">
                     <WorkHourModel :record="record" @change="search" />
                 </template>
+                <template #draw_balance="{ record }">
+                    <a-tag bordered checkable @click="updateBalance(record)">
+                        {{ record.draw_balance }}
+                    </a-tag>
+                </template>
                 <template #hourly_calls_limit="{ record }">
                     <a-tag bordered
                         :color="record.current_hourly_calls > record.hourly_calls_limit && record.hourly_calls_limit > 0 ? 'red' : ''">
@@ -339,6 +360,15 @@ const cookieFormData = ref<UpdateCookieWithIdModel>({
 });
 const currentRecord = ref<PddPoolRecord | null>(null);
 
+// 行选择相关
+const selectedRowKeys = ref<(string | number)[]>([]);
+const selectedRows = ref<PddPoolRecord[]>([]);
+
+// 监听选中的行keys变化,同步更新选中的行数据
+watch(selectedRowKeys, (newKeys) => {
+    selectedRows.value = renderData.value.filter(item => newKeys.includes(item.id));
+});
+
 const basePagination: Pagination = {
     current: 1,
     pageSize: 50,
@@ -374,7 +404,7 @@ const columns = computed<TableColumnData[]>(() => [
         title: '#',
         dataIndex: 'index',
         slotName: 'index',
-        width: 50,
+        width: 60,
     },
     {
         title: '账号名',
@@ -385,7 +415,7 @@ const columns = computed<TableColumnData[]>(() => [
     {
         title: '',
         slotName: 'tags',
-        width: 40,
+        width: 60,
     },
     {
         title: '工作时间',
@@ -394,6 +424,13 @@ const columns = computed<TableColumnData[]>(() => [
         align: 'right',
         width: 200,
     },
+    {
+        title: '账户余额',
+        dataIndex: 'draw_balance',
+        slotName: 'draw_balance',
+        align: 'right',
+        width: 120,
+    },
     {
         title: '小时调用',
         slotName: 'hourly_calls_limit',
@@ -689,6 +726,29 @@ const handleCookieUpdate = async () => {
     }
 };
 
+
+const updateBalance = async (record: PddPoolRecord) => {
+    const args = {
+        id: record.id,
+        name: 'balance',
+    } as PddUpdateAccountModel;
+
+    setLoading(true);
+    try {
+        const { data } = await PddUpdateAccount(args);
+        console.log(data, data.msg);
+        const msg = data.msg || '更新成功!';
+        if (data.success) {
+            Message.success(msg);
+            search();
+        } else {
+            Message.error(data.msg);
+        }
+
+    } catch (e) { console.log(e) }
+    setLoading(false);
+};
+
 const handleCookieCancel = () => {
     cookieModalVisible.value = false;
     cookieFormData.value = {
@@ -725,6 +785,70 @@ const handleRechargeAllOnlineAccountUsage = async () => {
     });
 };
 
+// 批量更新余额
+const handleBatchUpdateBalance = async () => {
+    if (selectedRows.value.length === 0) {
+        Message.warning('请先选择要更新的账号');
+        return;
+    }
+
+    Modal.confirm({
+        title: '确认提示',
+        content: `确定要批量更新选中的 ${selectedRows.value.length} 个账号的可提现余额吗?`,
+        okText: '确认',
+        cancelText: '取消',
+        async onOk() {
+            setLoading(true);
+            let successCount = 0;
+            let failCount = 0;
+            const total = selectedRows.value.length;
+
+            try {
+                // 串行执行每个账号的余额更新
+                for (let i = 0; i < selectedRows.value.length; i += 1) {
+                    const record = selectedRows.value[i];
+                    try {
+                        const args = {
+                            id: record.id,
+                            name: 'balance',
+                        } as PddUpdateAccountModel;
+
+                        const { data } = await PddUpdateAccount(args);
+                        if (data.success) {
+                            successCount += 1;
+                            Message.info(`[${i + 1}/${total}] ${record.company} 更新成功`);
+                        } else {
+                            failCount += 1;
+                            Message.error(`[${i + 1}/${total}] ${record.company} 更新失败: ${data.msg}`);
+                        }
+                    } catch (e) {
+                        failCount += 1;
+                        console.error(`更新账号 ${record.company} 失败:`, e);
+                        Message.error(`[${i + 1}/${total}] ${record.company} 更新失败`);
+                    }
+                }
+
+                // 显示总结信息
+                if (successCount > 0) {
+                    Message.success(`批量更新完成!成功: ${successCount}, 失败: ${failCount}`);
+                } else {
+                    Message.error(`批量更新失败!失败: ${failCount}`);
+                }
+
+                // 清空选择并刷新列表
+                selectedRowKeys.value = [];
+                selectedRows.value = [];
+                search();
+            } catch (err) {
+                console.error(err);
+                Message.error('批量更新过程中发生错误');
+            } finally {
+                setLoading(false);
+            }
+        }
+    });
+};
+
 watch(
     () => columns.value,
     (val) => {

+ 2 - 2
src/views/settings/overrideRules.vue

@@ -215,7 +215,7 @@
                     <a-col :span="24">
                         <a-form-item label="输出文本" required>
                             <template #extra>
-                                <div>支持占位符:{query_text} 和 {url:query_text}</div>
+                                <div>支持占位符:{query_text}、{url:query_text}、{url2:query_text}</div>
                             </template>
                             <a-textarea v-model="editForm.output_text" placeholder="请输入替换后的文本"
                                 :auto-size="{ minRows: 2, maxRows: 4 }" />
@@ -253,7 +253,7 @@
                             <a-switch v-model="editForm.use_risk_control" :checked-value="1" :unchecked-value="0"
                                 checked-text="是" unchecked-text="否" />
                             <div style="font-size: 12px; color: #999; margin-top: 4px;">
-                                OAID/地区/IP控制(验证 special_text 时无效)
+                                OAID/地区/IP控制
                             </div>
                         </a-form-item>
                     </a-col>

+ 6 - 3
src/views/taobao/list.vue

@@ -143,6 +143,9 @@
                     <a-tag v-if="record.is_banned" size="small" bordered color="red">
                         封号
                     </a-tag>
+                    <a-tag v-if="record.riskCookie" size="small" bordered color="red">
+                        {{ record.riskCookie }}
+                    </a-tag>
                     <a-typography-text mark v-if="record.note">
                         {{ record.note }}
                     </a-typography-text>
@@ -617,10 +620,10 @@ const search = () => {
     } as unknown as TkPoolParams);
 };
 const onPageChange = (current: number) => {
-    fetchData({ 
-        ...basePagination, 
+    fetchData({
+        ...basePagination,
         ...formModel.value,
-        current 
+        current
     } as unknown as TkPoolParams);
 };