telecomReport.js 1.65 KB
/**
 * Created by Tommy Huang on 18/04/28.
 */
const sequelize = require('./db').db
const { INTEGER, STRING, BOOLEAN, TEXT, TIME } = require('sequelize')

const TelecomReport = sequelize.define('telecom_report', {
  id: {
    type: STRING,
    primaryKey: true
  },
  userId: {
    type: STRING,
    field: 'user_id',
    allowNull: false,
  },
  source: { // 运营商
    type: STRING,
    allowNull: false
  },
  number: { // 号码
    type: STRING,
    allowNull: false
  },
  raw: { //获取到的json
    type: TEXT,
    allowNull: true
  },
  mobileStatus: { //账户状态。正常、欠费、停机、销户、未激活、未知
    field: 'mobile_status',
    type: STRING,
    allowNull: true,
  },
  netTime: { // 入网时间, YYYY-MM-DD或未知
    field: 'net_time',
    type: STRING,
    allowNull: true
  },
  netAge: { // 网龄。整形数字精确到月或未知
    field: 'net_age',
    type: STRING,
    allowNull: true
  },
  payType: { // 缴费类型
    field: 'pay_type',
    type: STRING,
    allowNull: true
  },
  address: { // 联系地址。脱敏部分用*替代
    type: STRING,
    allowNull: true
  },
  email: { // 邮箱地址。如:123@qq.com
    type: STRING,
    allowNull: true
  },
  contactNo: {
    type: STRING,
    field: 'contact_no',
    allowNull: true
  },
  taskId: {
    type: STRING,
    field: 'task_id',
    allowNull: false
  },
  totalCallTime: {
    type: INTEGER,
    field: 'total_call_time',
    allowNull: true
  },
  totalCallCount: {
    type: INTEGER,
    field: 'total_call_count',
    allowNull: true
  },
}, {
  timestamp: true,
  createdAt: 'created_at',
  updatedAt: 'updated_at',
})

module.exports = TelecomReport