123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- # -*- coding: utf-8 -*-
- """
- @author: zsc
- @time: 2024/11/18
- @desc: 数据采集
- """
- import random
- # 数据收集模块
- class DataCollector:
- def __init__(self):
- self.data = []
- def collect(self):
- # 定义三个流程及其名称
- processes = {
- '申请流程': ['浏览-产品介绍页', '点击-立即申请', '浏览-公积金授权页', '浏览-额度申请结果'],
- '提额流程': ['点击-立即提额', '浏览-提额方式选择页', '点击-线上公积金认证', '浏览-提额申请结果'],
- '支用流程': ['点击-立即支用', '填写-借款申请页', '浏览-确认借款页', '浏览-支用结果页', '结果-支用成功']
- }
- users = ['User{}'.format(i) for i in range(1, 201)]
- for user in users:
- # 随机选择一个流程
- process_name, process_steps = random.choice(list(processes.items()))
- # 确保生成一个完整的行为序列
- start_index = 0
- end_index = random.randint(start_index, len(process_steps) - 1)
- actions = process_steps[start_index:end_index + 1]
- user_actions = {
- 'user': user,
- 'process': process_name,
- 'actions': actions,
- 'product': random.choice(['渝快贷', '渝悦贷', '房快贷']),
- 'channel': random.choice(['手机银行', '微银行'])
- }
- self.data.append(user_actions)
- return self.data
|