create table hualianyun.agent_price (
    id int unsigned auto_increment
        primary key,
    product_id int unsigned not null comment '产品id',
    package_id int unsigned not null comment '套餐ID',
    agent_id int unsigned not null comment '代理商ID',
    status tinyint default 1 not null comment '启用状态',
    price decimal(10, 2) not null comment '价格',
    refund decimal(10, 2) default 0.00 not null comment '退款价格',
    create_time datetime default current_timestamp not null comment '创建时间',
    update_time datetime default current_timestamp not null on update current_timestamp comment '更新时间'
)
    charset = utf8mb4;

create table hualianyun.agent_score (
    id int auto_increment
        primary key,
    agent_id int not null comment '代理id',
    order_id int not null comment '订单ID',
    score_type tinyint not null comment '资金类型 (1:收入，2、退款，3、充值4扣款)',
    score_value decimal(10, 2) not null comment '金额',
    remark varchar(1000) null comment '备注',
    create_time datetime default current_timestamp not null,
    update_time datetime default current_timestamp not null on update current_timestamp,
    agent_name varchar(20) not null comment '代理商姓名',
    op_user varchar(20) not null comment '操作人',
    rest_amount1 decimal(10, 2) not null comment '操作前金额',
    rest_amount2 decimal(10, 2) not null comment '操作后金额'
)
    charset = utf8mb4;

create table hualianyun.agent_user (
    id int unsigned auto_increment
        primary key,
    username varchar(50) not null comment '用户名',
    password varchar(50) not null comment '密码',
    discount_id int default 0 not null comment '代理商折扣',
    realname varchar(50) null comment '真实姓名',
    qq varchar(50) null comment 'qq',
    phone varchar(20) null comment '电话号码',
    account decimal(10, 2) default 0.00 not null comment '账户',
    create_time datetime default current_timestamp not null
) comment '代理商用户表'
    charset = utf8mb4;

create table hualianyun.article (
    id int auto_increment
        primary key,
    tenantid int default 0 null,
    catalogid int default 0 null,
    title varchar(255) null,
    subtitle varchar(255) null,
    thumb varchar(255) null,
    keyword varchar(255) null,
    content text null,
    accesscount int null,
    publish int null,
    tag varchar(255) null,
    createtime datetime null,
    deletetag int null,
    linktype int default 0 null,
    linkid int default 0 null
)
    row_format = dynamic;

create table hualianyun.asset (
    id int auto_increment
        primary key,
    tenantid int null,
    groupid int null,
    name varchar(255) null,
    assettype int null,
    image varchar(255) null,
    baseurl varchar(255) null,
    path varchar(1000) null,
    deletetag int null,
    createtime datetime null
)
    row_format = dynamic;

create table hualianyun.asset_group (
    id int auto_increment
        primary key,
    tenantid int null,
    grouptype int null,
    name varchar(255) null,
    ordernum int null,
    deletetag int null
)
    row_format = dynamic;

create table hualianyun.browser_verify (
    id int auto_increment
        primary key,
    code varchar(50) not null comment '浏览器指纹',
    name varchar(20) null comment '名字',
    create_time datetime default current_timestamp not null on update current_timestamp comment '添加时间'
);

create table hualianyun.cash_out (
    id int auto_increment
        primary key,
    userid int not null comment '用户id',
    username varchar(50) not null comment '用户名称',
    real_name varchar(50) null comment '真实姓名',
    cash_no varchar(100) null comment '账单号',
    alipay_no varchar(50) null comment '支付宝转账订单号',
    status tinyint default 0 not null comment '提现状态（0：待处理；1：提现成功；2：拒绝提现）',
    money decimal(10, 2) default 0.00 not null comment '提现金额',
    apply_reason varchar(100) null comment '申请理由',
    alipay_account varchar(100) not null comment '客户的支付宝账号',
    op_user varchar(50) null comment '处理人',
    is_agent tinyint default 0 not null comment '是否是代理商',
    remark varchar(500) null comment '处理后备注',
    create_time datetime default current_timestamp not null comment '创建时间',
    update_time datetime default current_timestamp not null on update current_timestamp comment '更新时间'
)
    charset = utf8mb4;

create table hualianyun.finance (
    id int auto_increment
        primary key,
    xingxing decimal(10, 2) not null,
    xianfeng decimal(10, 2) not null,
    jike decimal(10, 2) not null,
    qiangzi decimal(10, 2) not null,
    xunlian decimal(10, 2) not null,
    tiantian decimal(10, 2) not null,
    laoying decimal(10, 2) not null,
    jinrui decimal(10, 2) not null,
    wujin decimal(10, 2) not null,
    wanmei decimal(10, 2) not null,
    jinqiao decimal(10, 2) not null,
    wuxian decimal(10, 2) not null,
    shihui decimal(10, 2) not null,
    gongxiang decimal(10, 2) not null,
    xigua decimal(10, 2) default 0.00 not null,
    mogu decimal(10, 2) default 0.00 not null,
    huohu decimal(10, 2) not null comment '火狐',
    remark text null,
    riqi datetime not null
)
    charset = utf8mb4;

create table hualianyun.finance_op (
    id int auto_increment
        primary key,
    finance_id int null comment '原后台财务id',
    product varchar(50) not null comment '产品名',
    type tinyint not null comment '类型 1充值 2退款 3补差价',
    money decimal(10, 2) not null comment '金额',
    riqi date not null comment '充退补日期',
    op_person varchar(50) not null comment '操作人',
    remark varchar(100) not null comment '备注',
    create_time datetime default current_timestamp not null on update current_timestamp comment '操作时间'
)
    charset = utf8mb4;

create table hualianyun.follow_record (
    id int unsigned auto_increment
        primary key,
    user_id int unsigned not null comment '用户id',
    op_user int null comment '处理人',
    follow_status tinyint default 1 null comment '跟进状态',
    active tinyint(1) default 1 null comment '记录是否是最新的',
    order_id int null,
    product_type varchar(20) null,
    sell_money decimal(10, 2) default 0.00 not null,
    sell_type tinyint default 0 not null comment '0:被动1：主动',
    telstarttime varchar(20) null,
    druation varchar(10) null,
    record varchar(50) null comment '维护记录',
    file varchar(100) null,
    remark varchar(1000) charset utf8mb4 null comment '备注',
    create_time datetime default current_timestamp not null comment '时间'
);

create table hualianyun.http_order (
    id int unsigned auto_increment
        primary key,
    user_id int unsigned not null,
    order_type tinyint(1) not null comment '1:新开2：续费',
    package_type int not null,
    durationtype int null,
    order_status tinyint(1) default 0 not null comment '0未支付1支付',
    money decimal(10, 2) not null,
    game_type tinyint(1) null comment '0-国内，1-海外',
    ip_count int null,
    order_id int null,
    paycash decimal(10, 2) null,
    order_no varchar(50) not null,
    serial varchar(50) null,
    status tinyint(1) default 0 not null comment '0请求后台失败1正常开通',
    create_time datetime default current_timestamp not null,
    update_time datetime default current_timestamp not null on update current_timestamp
)
    charset = utf8mb4;

create table hualianyun.http_package (
    id int auto_increment
        primary key,
    package_type int not null,
    durationtype int null,
    periodtype int null,
    periodamount int null,
    ipamount int null,
    isabroad tinyint(1) null,
    sharetype tinyint null,
    isrelayed tinyint(1) null,
    linetype tinyint null,
    bandwidth int null,
    price decimal(10, 4) not null,
    create_time datetime default current_timestamp not null,
    update_time datetime default current_timestamp not null on update current_timestamp
)
    charset = utf8mb4;

create table hualianyun.http_recharge (
    id int auto_increment
        primary key,
    user_id int unsigned not null,
    ju_money decimal(10, 2) not null,
    pay_money decimal(10, 2) not null,
    pay_type tinyint(1) not null comment '2:支付宝3：微信',
    pay_status tinyint(1) not null,
    channel varchar(20) null,
    order_no varchar(100) not null,
    ali_wx_no varchar(100) null,
    create_time datetime default current_timestamp null,
    update_time datetime default current_timestamp null
)
    charset = utf8mb4;

create index user_id on hualianyun.http_recharge (user_id);

create table hualianyun.income_check (
    id int auto_increment
        primary key,
    user_balance decimal(10, 2) default 0.00 not null comment '官网会员余额',
    ali_invest decimal(10, 2) default 0.00 not null comment '支付宝充值',
    wechat_invest decimal(10, 2) default 0.00 not null comment '微信充值',
    manager_invest decimal(10, 2) default 0.00 not null comment '管理员充值',
    taobao_invest decimal(10, 2) default 0.00 not null comment '淘宝充值',
    manager_deduct decimal(10, 2) default 0.00 not null comment '管理员扣除(不含提现和退款)',
    cash_out decimal(10, 2) default 0.00 not null comment '提现扣除',
    taobao_refund decimal(10, 2) default 0.00 not null comment '淘宝退款扣除',
    balance_pay decimal(10, 2) default 0.00 not null comment '余额支付',
    ali_pay decimal(10, 2) default 0.00 not null comment '支付宝支付',
    wechat_pay decimal(10, 2) default 0.00 not null comment '微信支付',
    new_amount decimal(10, 2) default 0.00 not null comment '新开金额',
    renew_amount decimal(10, 2) default 0.00 not null comment '续费金额',
    refund_amount decimal(10, 2) default 0.00 not null comment '退款金额',
    cash_out_refund decimal(10, 2) default 0.00 not null comment '提现拒绝退还',
    balance_diff decimal(10, 2) default 0.00 not null comment '余额差值',
    in_out_diff decimal(10, 2) default 0.00 not null comment '收支差值',
    sell_monet decimal(10, 2) default 0.00 not null comment '当日销售额',
    income decimal(10, 2) default 0.00 not null comment '当日总进账',
    expend decimal(10, 2) default 0.00 not null comment '当日总支出',
    day_time datetime not null comment '日期'
)
    charset = utf8mb4;

create table hualianyun.jinqiao_key (
    id int auto_increment
        primary key,
    isused tinyint default 0 not null,
    package_id int default 1 not null,
    code varchar(100) not null,
    user_id int null,
    create_time datetime default current_timestamp not null,
    update_time datetime default current_timestamp not null on update current_timestamp
)
    charset = utf8mb4;

create table hualianyun.jinqiao_order (
    id int auto_increment
        primary key,
    user_id int not null,
    package_id int unsigned not null,
    status tinyint default 0 not null comment '0:未支付 1：已支付',
    pay_type int not null,
    channel varchar(20) null,
    order_no varchar(50) not null,
    ali_wx_no varchar(50) null,
    money decimal(10, 2) not null,
    create_time datetime default current_timestamp not null,
    update_time datetime default current_timestamp not null on update current_timestamp
)
    charset = utf8mb4;

create table hualianyun.jinqiao_package (
    id int unsigned auto_increment
        primary key,
    package_type int not null comment '套餐类型',
    price decimal(10, 2) not null comment '价格',
    name varchar(20) not null
)
    charset = utf8mb4;

create table hualianyun.logs (
    id int unsigned auto_increment
        primary key,
    user varchar(50) charset utf8mb4 null comment '登录用戶',
    operation varchar(50) charset utf8mb4 null comment '操作',
    record varchar(50) charset utf8mb4 null comment '操作內容',
    info text charset utf8mb4 null comment '数据信息',
    create_time datetime null on update current_timestamp comment '操作时间'
)
    charset = armscii8;

create table hualianyun.manager (
    id int auto_increment comment '流水id'
        primary key,
    tenantid int not null,
    createtime datetime null,
    updatetime datetime null,
    deletetag int not null,
    creatorid int not null,
    updatorid int not null,
    logincode varchar(16) not null,
    password varchar(32) not null,
    roleid int not null,
    state int not null,
    photourl varchar(256) null,
    wxopenid varchar(50) null,
    wxnickname varchar(200) null,
    wximage varchar(500) null,
    source int default 10 null,
    phone varchar(20) null,
    managercode varchar(50) null,
    realname varchar(50) null,
    email varchar(100) null,
    isroot tinyint(1) default 0 null,
    systemid int null,
    tags varchar(255) null
) comment '物业管理员表'
    charset = utf8
    row_format = dynamic;

create index createtime on hualianyun.manager (createtime);

create index deletetag on hualianyun.manager (deletetag);

create index email on hualianyun.manager (email);

create index logincode on hualianyun.manager (logincode);

create index managercode on hualianyun.manager (managercode);

create index owner_id on hualianyun.manager (tenantid);

create index password on hualianyun.manager (password);

create index phone on hualianyun.manager (phone);

create index roleid on hualianyun.manager (roleid);

create index source on hualianyun.manager (source);

create index state on hualianyun.manager (state);

create index updatetime on hualianyun.manager (updatetime);

create table hualianyun.manager_permission (
    id int auto_increment comment '唯一id标识'
        primary key,
    creatorid int not null comment '创建人id',
    updatorid int not null comment '更新人id',
    createtime datetime not null comment '创建时间',
    updatetime datetime not null comment '更新时间',
    deletetag int not null comment '删除标记',
    permissioncode varchar(50) not null comment '权限编码',
    parentcode varchar(50) null,
    appcodes varchar(200) null,
    permissionlabel varchar(16) null comment '权限标签',
    permissionurl varchar(50) null comment '权限url',
    icon varchar(50) null,
    iconactivate varchar(50) null,
    isnew tinyint not null,
    allowview tinyint not null comment '是否查看',
    allowadd tinyint not null comment '是否添加',
    allowedit tinyint not null comment '是否修改',
    allowdel tinyint not null comment '是否删除',
    systemid int default 100 not null comment '100 为psip 系统，200 为ecloud系统',
    sortorder int not null,
    ischarge int default 0 not null,
    nodecode varchar(255) not null comment '模块编码'
)
    charset = utf8
    row_format = dynamic;

create table hualianyun.manager_permission_map (
    id int auto_increment comment '流水id'
        primary key,
    tenantid int not null comment '物业id',
    createtime datetime not null comment '创建时间',
    updatetime datetime not null comment '更新时间',
    creatorid int not null comment '创建人id',
    updatorid int not null comment '更新人id',
    deletetag int not null comment '删除标记',
    managerid int not null comment '管理员id',
    permissioncode varchar(50) not null comment '权限编码',
    allowview tinyint not null comment '是否查看',
    allowadd tinyint not null comment '是否添加',
    allowedit tinyint not null comment '是否修改',
    allowdel tinyint not null comment '是否删除',
    systemid int default 100 not null comment '100 为psip 系统，200 为ecloud系统',
    expiredtime datetime null comment '有效期，只对charge=1的权限有效'
) comment '管理员关联权限表'
    charset = utf8
    row_format = dynamic;

create table hualianyun.msgcenter_message (
    id bigint not null
        primary key,
    `Key` varchar(50) null,
    channel int null,
    content varchar(500) null,
    `From` varchar(255) null,
    `To` varchar(255) null,
    ownerid int null,
    createtime datetime null,
    updatetime datetime null,
    deletetag int default 0 null
)
    row_format = dynamic;

create table hualianyun.msgcenter_wxtemplete_map (
    id int auto_increment
        primary key,
    appid varchar(50) null comment '公众号Id',
    shorttempletecode varchar(50) null comment '模板编号',
    templeteid varchar(100) null comment '我的模板Id',
    createtime datetime null,
    updatetime datetime null
)
    row_format = dynamic;

create table hualianyun.msgcenter_wxtoken (
    id int auto_increment
        primary key,
    openappid varchar(50) null comment '开放平台appId',
    mpappid varchar(50) null comment '公众号appid',
    token varchar(500) null comment 'refreshToken',
    createtime datetime null,
    updatetime datetime null
)
    row_format = dynamic;

create table hualianyun.payment_record (
    id bigint(11) unsigned zerofill auto_increment comment '数据库ID'
        primary key,
    tenantid int not null comment '物业ID',
    storeid int null,
    requesttime datetime null comment '请求时间',
    requestparams text null comment '请求参数',
    paymentstatus int null comment '支付状态',
    paymentnumber varchar(32) null,
    paymentcompletiontime varchar(20) default '0001-01-01 00:00:00' null comment '0001-01-01 00:00:00',
    paymenttotal int null comment '支付金额，单位为分',
    paymenttype int null comment '支付类型',
    callbacknumber int null comment '回调次数',
    callbackurl varchar(500) null comment '回调地址',
    openid varchar(200) null,
    appid varchar(100) null,
    appname varchar(100) null,
    body varchar(200) null comment '支付内容',
    orderid varchar(200) default '0' null comment '订单号',
    createtime datetime null comment '创建时间',
    updatetime datetime null comment '更新时间',
    deletetag int default 0 null comment '删除标志',
    businesstype int default 10 null comment '10 短信包 20 停车 30 缴费 40 其它',
    ordertype int(11) unsigned zerofill default 0 null comment '订单类型',
    frompos int(4) unsigned zerofill default 0 null comment '来源Pos',
    taskstatus int(4) unsigned zerofill default 10 null comment '回调任务状态PaymentTaskStatus',
    paymentchannel int(11) unsigned zerofill default 0 null comment '支付通道',
    gensource varchar(255) null comment '处理来源，主要目的是识别当前订单由哪里处理，以做重复判断之用，内容可自定义',
    paysuccesstime datetime null comment '支付成功时间',
    refundtotalfee int default 0 null comment '总退款金额',
    paymentmethod int default 0 null comment '支付方式',
    callbackstatus int default 0 null comment '回调业务的状态',
    attach varchar(1000) null,
    transactionid varchar(50) null
) comment '支付记录(订单)表，当支付时会先在此创建一条记录'
    charset = utf8
    row_format = dynamic;

create index createtime on hualianyun.payment_record (createtime);

create index deletetag on hualianyun.payment_record (deletetag);

create index paysuccesstime on hualianyun.payment_record (paysuccesstime);

create index paymentmethod on hualianyun.payment_record (paymentmethod);

create index updatetime on hualianyun.payment_record (updatetime);

create index appid on hualianyun.payment_record (appid);

create index business_type on hualianyun.payment_record (businesstype);

create index frompos on hualianyun.payment_record (frompos);

create index openid on hualianyun.payment_record (openid);

create index orderid on hualianyun.payment_record (orderid);

create index ordertype on hualianyun.payment_record (ordertype);

create index owner_id on hualianyun.payment_record (tenantid);

create index paymentchannel on hualianyun.payment_record (paymentchannel);

create index payment_status on hualianyun.payment_record (paymentstatus);

create index payment_type on hualianyun.payment_record (paymenttype);

create index request_time on hualianyun.payment_record (requesttime);

create index taskstatus on hualianyun.payment_record (taskstatus);

create table hualianyun.payment_record_notify (
    id int unsigned auto_increment
        primary key,
    paymentrecordid int not null,
    url varchar(255) default '' not null,
    postdata longtext null,
    responsedata longtext null,
    retrycount int default 0 not null,
    createtime datetime default current_timestamp not null,
    updatetime datetime default current_timestamp not null,
    deletetag int default 0 not null,
    notifytype int null
)
    row_format = dynamic;

create table hualianyun.payment_refund_record (
    id int auto_increment
        primary key,
    createtime datetime null,
    updatetime datetime null,
    deletetag int null,
    tenantid int null,
    storeid int null,
    paymentrecordid int null comment '支付记录id',
    requesttime datetime null comment '发起退款的时间',
    orderid varchar(100) null comment '业务订单号',
    transactionid varchar(100) null comment '平台交易单号',
    refundid varchar(100) not null comment '业务退款单号',
    transactionrefundid varchar(100) null comment '交易平台退款单号',
    refundstatus int null comment '退款状态(请使用枚举RefundStatus)',
    refundfee int null comment '退款金额，单位：分',
    ordertotalfee int null comment '订单支付总金额，单位：分',
    paymentchannel int null comment '支付渠道',
    paymentmethod int default 0 not null comment '支付方法（支付渠道）',
    paymenttype int null comment '支付类型',
    refundsuccesstime datetime null comment '退款成功时间',
    refundreason varchar(2000) null comment '退款原因',
    applycanceltime datetime null comment '申请撤销时间',
    cancelreason varchar(2000) null comment '撤销原因',
    cancelstatus int null comment '撤销状态(请使用枚举CancelStatus)',
    queryjobpolltime datetime null comment '查询退款状态的后台任务，上次轮询该条记录的时间',
    statementjobpolltime datetime null comment '对账的后台任务，上次该条记录的时间',
    companyname varchar(100) null comment '公司名称',
    operatorid int null comment '管理员Id',
    operatorname varchar(50) null comment '管理员姓名',
    offlinerefund int default 0 null comment '是否是线下退款',
    taskstates int default 10 not null comment '服务处理状态(请使用枚举TaskStates)',
    bak varchar(255) null comment '备注',
    callbackurl varchar(255) default '' null comment '业务回调地址，作为url参数给固定的回调地址',
    constraint refundid unique (refundid)
)
    charset = utf8
    row_format = dynamic;

create index ownerid_reundid_deletetag on hualianyun.payment_refund_record (deletetag, tenantid, refundid);

create table hualianyun.product (
    id int auto_increment
        primary key,
    tenantid int null,
    name varchar(255) null,
    remark varchar(255) null,
    image varchar(255) null,
    sort int null,
    account varchar(255) null,
    pwd varchar(255) null,
    baseurl varchar(255) null,
    loginurl varchar(255) null,
    logincodeurl varchar(255) null,
    refrushtokenurl varchar(255) null,
    status int null,
    pcclientdownloadurl varchar(255) null,
    droiddownloadurl varchar(255) null,
    iosdownloadurl varchar(255) null,
    simulatordownloadurl varchar(255) null,
    content varchar(1000) null,
    profile varchar(255) null,
    groupno varchar(50) null,
    createtime datetime null,
    updatetime datetime null,
    token varchar(500) null,
    deletetag int null,
    refunddayprice decimal(10, 2) null,
    autorefund int null,
    daylimitprice decimal(10, 2) null,
    online int default 1 null,
    l2tppwd varchar(255) null,
    sstpport varchar(255) null
)
    row_format = dynamic;

create table hualianyun.product_account (
    id int auto_increment
        primary key,
    tenantid int null,
    userid int null,
    usercode varchar(255) null,
    userphone varchar(255) null,
    productid int null,
    productname varchar(255) null,
    packageid int null,
    packagename varchar(255) null,
    accounttype int null,
    account varchar(255) null,
    pwd varchar(255) null,
    connectcount int null,
    starttime datetime null,
    endtime datetime null,
    status int null,
    chargestatus int null comment '冲值状态',
    createtime datetime null,
    updatetime datetime null,
    remark varchar(255) null,
    deletetag int null,
    raw varchar(255) null,
    game_id int null,
    agent_id int default 0 not null comment '代理商id',
    im tinyint default 0 not null
)
    row_format = dynamic;

create index account on hualianyun.product_account (account);

create index agentid on hualianyun.product_account (agent_id);

create index userid on hualianyun.product_account (userid);

create table hualianyun.product_account_20250619 (
    id int auto_increment
        primary key,
    tenantid int null,
    userid int null,
    usercode varchar(255) null,
    userphone varchar(255) null,
    productid int null,
    productname varchar(255) null,
    packageid int null,
    packagename varchar(255) null,
    accounttype int null,
    account varchar(255) null,
    pwd varchar(255) null,
    connectcount int null,
    starttime datetime null,
    endtime datetime null,
    status int null,
    chargestatus int null comment '冲值状态',
    createtime datetime null,
    updatetime datetime null,
    remark varchar(255) null,
    deletetag int null,
    raw varchar(255) null,
    game_id int null,
    agent_id int default 0 not null comment '代理商id',
    im tinyint default 0 not null
)
    row_format = dynamic;

create index account on hualianyun.product_account_20250619 (account);

create index agentid on hualianyun.product_account_20250619 (agent_id);

create index userid on hualianyun.product_account_20250619 (userid);

create table hualianyun.product_account_20250619_2 (
    id int auto_increment
        primary key,
    tenantid int null,
    userid int null,
    usercode varchar(255) null,
    userphone varchar(255) null,
    productid int null,
    productname varchar(255) null,
    packageid int null,
    packagename varchar(255) null,
    accounttype int null,
    account varchar(255) null,
    pwd varchar(255) null,
    connectcount int null,
    starttime datetime null,
    endtime datetime null,
    status int null,
    chargestatus int null comment '冲值状态',
    createtime datetime null,
    updatetime datetime null,
    remark varchar(255) null,
    deletetag int null,
    raw varchar(255) null,
    game_id int null,
    agent_id int default 0 not null comment '代理商id',
    im tinyint default 0 not null
)
    row_format = dynamic;

create index account on hualianyun.product_account_20250619_2 (account);

create index agentid on hualianyun.product_account_20250619_2 (agent_id);

create index userid on hualianyun.product_account_20250619_2 (userid);

create table hualianyun.product_account_240926 (
    id int auto_increment
        primary key,
    tenantid int null,
    userid int null,
    usercode varchar(255) null,
    userphone varchar(255) null,
    productid int null,
    productname varchar(255) null,
    packageid int null,
    packagename varchar(255) null,
    accounttype int null,
    account varchar(255) null,
    pwd varchar(255) null,
    connectcount int null,
    starttime datetime null,
    endtime datetime null,
    status int null,
    chargestatus int null comment '冲值状态',
    createtime datetime null,
    updatetime datetime null,
    remark varchar(255) null,
    deletetag int null,
    raw varchar(255) null,
    game_id int null,
    agent_id int default 0 not null comment '代理商id'
)
    row_format = dynamic;

create index account on hualianyun.product_account_240926 (account);

create index agentid on hualianyun.product_account_240926 (agent_id);

create index userid on hualianyun.product_account_240926 (userid);

create table hualianyun.product_account_bak1126 (
    id int auto_increment
        primary key,
    tenantid int null,
    userid int null,
    usercode varchar(255) null,
    userphone varchar(255) null,
    productid int null,
    productname varchar(255) null,
    packageid int null,
    packagename varchar(255) null,
    accounttype int null,
    account varchar(255) null,
    pwd varchar(255) null,
    connectcount int null,
    starttime datetime null,
    endtime datetime null,
    status int null,
    chargestatus int null comment '冲值状态',
    createtime datetime null,
    updatetime datetime null,
    remark varchar(255) null,
    deletetag int null,
    raw varchar(255) null
)
    row_format = dynamic;

create table hualianyun.product_account_bak1205 (
    id int auto_increment
        primary key,
    tenantid int null,
    userid int null,
    usercode varchar(255) null,
    userphone varchar(255) null,
    productid int null,
    productname varchar(255) null,
    packageid int null,
    packagename varchar(255) null,
    accounttype int null,
    account varchar(255) null,
    pwd varchar(255) null,
    connectcount int null,
    starttime datetime null,
    endtime datetime null,
    status int null,
    chargestatus int null comment '冲值状态',
    createtime datetime null,
    updatetime datetime null,
    remark varchar(255) null,
    deletetag int null,
    raw varchar(255) null
)
    row_format = dynamic;

create table hualianyun.product_account_bak_521 (
    id int default 0 not null,
    tenantid int null,
    userid int null,
    usercode varchar(255) null,
    userphone varchar(255) null,
    productid int null,
    productname varchar(255) null,
    packageid int null,
    packagename varchar(255) null,
    accounttype int null,
    account varchar(255) null,
    pwd varchar(255) null,
    connectcount int null,
    starttime datetime null,
    endtime datetime null,
    status int null,
    chargestatus int null comment '冲值状态',
    createtime datetime null,
    updatetime datetime null,
    remark varchar(255) null,
    deletetag int null
);

create table hualianyun.product_account_recharge (
    id int auto_increment
        primary key,
    orderid int null,
    productid int null,
    productgroup varchar(50) null,
    packageid int null,
    packageoriginkey varchar(50) null,
    account varchar(50) null,
    accounttype int null,
    pwd varchar(255) null,
    status int null,
    connectcount int null,
    daycount int null,
    trytimes int null,
    operationtype int null comment '1:新开；2：批量新开 3：续费：4：退款',
    createtime datetime null,
    updatetime datetime null,
    remark varchar(255) null,
    deletetag int null
)
    row_format = dynamic;

create table hualianyun.product_bak (
    id int auto_increment
        primary key,
    tenantid int null,
    name varchar(255) null,
    remark varchar(255) null,
    image varchar(255) null,
    sort int null,
    account varchar(255) null,
    pwd varchar(255) null,
    baseurl varchar(255) null,
    loginurl varchar(255) null,
    logincodeurl varchar(255) null,
    refrushtokenurl varchar(255) null,
    status int null,
    pcclientdownloadurl varchar(255) null,
    droiddownloadurl varchar(255) null,
    iosdownloadurl varchar(255) null,
    simulatordownloadurl varchar(255) null,
    content varchar(1000) null,
    profile varchar(255) null,
    groupno varchar(50) null,
    createtime datetime null,
    updatetime datetime null,
    token varchar(500) null,
    deletetag int null,
    refunddayprice decimal(10, 2) null,
    autorefund int null,
    daylimitprice decimal(10, 2) null,
    online int default 1 null,
    l2tppwd varchar(255) null,
    sstpport varchar(255) null
)
    row_format = dynamic;

create table hualianyun.product_order (
    id int auto_increment
        primary key,
    tenantid int null,
    userid int null,
    username varchar(255) null,
    productid int null,
    productname varchar(255) null,
    packageid int null,
    packagename varchar(50) null,
    couponid int null,
    originkey varchar(255) null comment '原网站中套餐的值',
    ordername varchar(255) null,
    orderno varchar(50) null,
    tradeno varchar(255) null,
    orderstate int null,
    ordertype int null,
    paytype int null,
    paystate int null,
    connectcount int null,
    orderamount decimal(11, 2) null,
    paymentamount decimal(11, 2) null comment '在线支付金额',
    otherpayamount decimal(11, 2) null,
    accountpayamount decimal(11, 2) null comment '账户的支付金额',
    couponamount decimal(11, 2) null,
    dayprice decimal(11, 2) null comment '每天价格',
    daycount int null,
    refundcount int null,
    refundamount decimal(11, 2) null,
    refundresttime varchar(50) null,
    clienttype int null,
    channel varchar(255) null,
    channeltype int null,
    createtime datetime null,
    updatetime datetime null,
    accounts varchar(5000) null,
    accountcount int null comment '开通账号的数量',
    accountpwd varchar(255) null,
    remark varchar(255) null,
    deletetag int null,
    starttime datetime null,
    endtime datetime null,
    paychannel int default 30 null,
    isautorefund int default 0 null,
    backamount decimal null,
    refundreason varchar(50) null comment '退款原因',
    agent_id int default 0 not null comment '代理商id',
    remark2 text null
)
    row_format = dynamic;

create index agentid on hualianyun.product_order (agent_id);

create index orderno on hualianyun.product_order (orderno);

create index orderstate on hualianyun.product_order (orderstate);

create index ordertype on hualianyun.product_order (ordertype);

create table hualianyun.product_order_0201 (
    id int auto_increment
        primary key,
    tenantid int null,
    userid int null,
    username varchar(255) null,
    productid int null,
    productname varchar(255) null,
    packageid int null,
    packagename varchar(50) null,
    couponid int null,
    originkey varchar(255) null comment '原网站中套餐的值',
    ordername varchar(255) null,
    orderno varchar(50) null,
    tradeno varchar(255) null,
    orderstate int null,
    ordertype int null,
    paytype int null,
    paystate int null,
    connectcount int null,
    orderamount decimal(11, 2) null,
    paymentamount decimal(11, 2) null comment '在线支付金额',
    otherpayamount decimal(11, 2) null,
    accountpayamount decimal(11, 2) null comment '账户的支付金额',
    couponamount decimal(11, 2) null,
    dayprice decimal(11, 2) null comment '每天价格',
    daycount int null,
    refundcount int null,
    refundamount decimal(11, 2) null,
    refundresttime varchar(50) null,
    clienttype int null,
    channel varchar(255) null,
    channeltype int null,
    createtime datetime null,
    updatetime datetime null,
    accounts varchar(5000) null,
    accountcount int null comment '开通账号的数量',
    accountpwd varchar(255) null,
    remark varchar(255) null,
    deletetag int null,
    starttime datetime null,
    endtime datetime null,
    paychannel int default 30 null,
    isautorefund int default 0 null,
    backamount decimal null,
    refundreason varchar(50) null comment '退款原因'
)
    row_format = dynamic;

create table hualianyun.product_order_20220724 (
    id int auto_increment
        primary key,
    tenantid int null,
    userid int null,
    username varchar(255) null,
    productid int null,
    productname varchar(255) null,
    packageid int null,
    packagename varchar(50) null,
    couponid int null,
    originkey varchar(255) null comment '原网站中套餐的值',
    ordername varchar(255) null,
    orderno varchar(50) null,
    tradeno varchar(255) null,
    orderstate int null,
    ordertype int null,
    paytype int null,
    paystate int null,
    connectcount int null,
    orderamount decimal(11, 2) null,
    paymentamount decimal(11, 2) null comment '在线支付金额',
    otherpayamount decimal(11, 2) null,
    accountpayamount decimal(11, 2) null comment '账户的支付金额',
    couponamount decimal(11, 2) null,
    dayprice decimal(11, 2) null comment '每天价格',
    daycount int null,
    refundcount int null,
    refundamount decimal(11, 2) null,
    refundresttime varchar(50) null,
    clienttype int null,
    channel varchar(255) null,
    channeltype int null,
    createtime datetime null,
    updatetime datetime null,
    accounts varchar(5000) null,
    accountcount int null comment '开通账号的数量',
    accountpwd varchar(255) null,
    remark varchar(255) null,
    deletetag int null,
    starttime datetime null,
    endtime datetime null,
    paychannel int default 30 null,
    isautorefund int default 0 null,
    backamount decimal null,
    refundreason varchar(50) null comment '退款原因',
    agent_id int default 0 not null comment '代理商id'
)
    row_format = dynamic;

create index agentid on hualianyun.product_order_20220724 (agent_id);

create index orderno on hualianyun.product_order_20220724 (orderno);

create index orderstate on hualianyun.product_order_20220724 (orderstate);

create index ordertype on hualianyun.product_order_20220724 (ordertype);

create table hualianyun.product_order_20250619 (
    id int auto_increment
        primary key,
    tenantid int null,
    userid int null,
    username varchar(255) null,
    productid int null,
    productname varchar(255) null,
    packageid int null,
    packagename varchar(50) null,
    couponid int null,
    originkey varchar(255) null comment '原网站中套餐的值',
    ordername varchar(255) null,
    orderno varchar(50) null,
    tradeno varchar(255) null,
    orderstate int null,
    ordertype int null,
    paytype int null,
    paystate int null,
    connectcount int null,
    orderamount decimal(11, 2) null,
    paymentamount decimal(11, 2) null comment '在线支付金额',
    otherpayamount decimal(11, 2) null,
    accountpayamount decimal(11, 2) null comment '账户的支付金额',
    couponamount decimal(11, 2) null,
    dayprice decimal(11, 2) null comment '每天价格',
    daycount int null,
    refundcount int null,
    refundamount decimal(11, 2) null,
    refundresttime varchar(50) null,
    clienttype int null,
    channel varchar(255) null,
    channeltype int null,
    createtime datetime null,
    updatetime datetime null,
    accounts varchar(5000) null,
    accountcount int null comment '开通账号的数量',
    accountpwd varchar(255) null,
    remark varchar(255) null,
    deletetag int null,
    starttime datetime null,
    endtime datetime null,
    paychannel int default 30 null,
    isautorefund int default 0 null,
    backamount decimal null,
    refundreason varchar(50) null comment '退款原因',
    agent_id int default 0 not null comment '代理商id',
    remark2 text null
)
    row_format = dynamic;

create index agentid on hualianyun.product_order_20250619 (agent_id);

create index orderno on hualianyun.product_order_20250619 (orderno);

create index orderstate on hualianyun.product_order_20250619 (orderstate);

create index ordertype on hualianyun.product_order_20250619 (ordertype);

create table hualianyun.product_order_210305 (
    id int auto_increment
        primary key,
    tenantid int null,
    userid int null,
    username varchar(255) null,
    productid int null,
    productname varchar(255) null,
    packageid int null,
    packagename varchar(50) null,
    couponid int null,
    originkey varchar(255) null comment '原网站中套餐的值',
    ordername varchar(255) null,
    orderno varchar(50) null,
    tradeno varchar(255) null,
    orderstate int null,
    ordertype int null,
    paytype int null,
    paystate int null,
    connectcount int null,
    orderamount decimal(11, 2) null,
    paymentamount decimal(11, 2) null comment '在线支付金额',
    otherpayamount decimal(11, 2) null,
    accountpayamount decimal(11, 2) null comment '账户的支付金额',
    couponamount decimal(11, 2) null,
    dayprice decimal(11, 2) null comment '每天价格',
    daycount int null,
    refundcount int null,
    refundamount decimal(11, 2) null,
    refundresttime varchar(50) null,
    clienttype int null,
    channel varchar(255) null,
    channeltype int null,
    createtime datetime null,
    updatetime datetime null,
    accounts varchar(5000) null,
    accountcount int null comment '开通账号的数量',
    accountpwd varchar(255) null,
    remark varchar(255) null,
    deletetag int null,
    starttime datetime null,
    endtime datetime null,
    paychannel int default 30 null,
    isautorefund int default 0 null,
    backamount decimal null,
    refundreason varchar(50) null comment '退款原因',
    agent_id int default 0 not null comment '代理商id'
)
    row_format = dynamic;

create table hualianyun.product_order_items (
    id int auto_increment
        primary key,
    tenantid int null,
    orderid int null,
    userid int null,
    username varchar(255) null,
    productid int null,
    productname varchar(255) null,
    packageid int null,
    packagename varchar(50) null,
    account varchar(50) null,
    accountpwd varchar(255) null,
    connectcount int null,
    accounttype int default 0 null,
    startnum int default 0 null,
    endnum int default 0 null,
    orderno varchar(50) null,
    orderstate int null,
    ordertype int null,
    paytype int null,
    paystate int null,
    price decimal null,
    dayprice decimal(11, 2) null comment '每天价格',
    daycount int null,
    createtime datetime null,
    updatetime datetime null,
    remark varchar(255) null,
    deletetag int null
)
    row_format = dynamic;

create table hualianyun.product_package (
    id int auto_increment
        primary key,
    tenantid int null,
    productid int null,
    name varchar(255) null,
    packagetype int null,
    title varchar(255) null,
    image varchar(255) null,
    status int null,
    profile varchar(255) null,
    price decimal(10, 2) null,
    lineprice decimal(10, 2) null,
    dayprice decimal(10, 2) null,
    minprice decimal(10, 2) null,
    daycount int null,
    originkey varchar(50) null,
    originname varchar(255) null,
    createtime datetime null,
    updatetime datetime null,
    deletetag int null,
    istest int default 0 null
)
    row_format = dynamic;

create index productid on hualianyun.product_package (productid);

create table hualianyun.product_package_unit (
    id int auto_increment
        primary key,
    packageid int null,
    basepackageid int null,
    count int null
)
    row_format = dynamic;

create table hualianyun.product_price_discount (
    id int auto_increment
        primary key,
    schemeid int null,
    productid int null,
    packageid int default 0 null,
    status int null,
    buypricediscount int null,
    refunddaypricediscount int null,
    createtime datetime null,
    updatetime datetime null,
    deletetag int default 0 null,
    remark varchar(255) null,
    tenantid int null
)
    row_format = dynamic;

create table hualianyun.product_price_scheme (
    id int auto_increment
        primary key,
    name varchar(255) null,
    discount int default 100 not null comment '折扣力度',
    createtime datetime null,
    updatetime datetime null,
    deletetag int default 0 null,
    remark varchar(255) null
);

create table hualianyun.product_route (
    id int auto_increment
        primary key,
    productid int null,
    productname varchar(255) null,
    province varchar(255) null,
    city varchar(255) null,
    name varchar(255) null,
    serverurl varchar(255) null,
    status varchar(255) default '正常' null,
    linetype varchar(255) null,
    bandwidth varchar(255) null,
    ipremark varchar(255) null,
    remark varchar(255) null,
    online int default 0 null,
    keyword varchar(255) null,
    sort int default 0 null,
    deletetag int default 0 null
)
    row_format = dynamic;

create table hualianyun.product_route_bak (
    id int auto_increment
        primary key,
    productid int null,
    productname varchar(255) null,
    province varchar(255) null,
    city varchar(255) null,
    name varchar(255) null,
    serverurl varchar(255) null,
    status varchar(255) default '正常' null,
    linetype varchar(255) null,
    bandwidth varchar(255) null,
    ipremark varchar(255) null,
    remark varchar(255) null,
    online int default 0 null,
    keyword varchar(255) null,
    sort int default 0 null,
    deletetag int default 0 null
)
    row_format = dynamic;

create table hualianyun.product_route_old (
    id int auto_increment
        primary key,
    productid int null,
    productname varchar(255) null,
    province varchar(255) null,
    city varchar(255) null,
    name varchar(255) null,
    serverurl varchar(255) null,
    status varchar(255) null,
    linetype varchar(255) null,
    bandwidth varchar(255) null,
    ipremark varchar(255) null,
    remark varchar(255) null,
    online int default 0 null,
    keyword varchar(255) null,
    sort int default 0 null,
    deletetag int null
)
    row_format = dynamic;

create table hualianyun.product_user_price (
    id int auto_increment
        primary key,
    tenantid int null,
    productid int null,
    packageid int default 0 null,
    userid int null,
    status int null,
    userprice decimal(10, 2) null,
    refunddayprice decimal(10, 2) null,
    originkey varchar(50) null,
    createtime datetime null,
    updatetime datetime null,
    deletetag int null,
    remark varchar(255) null
)
    row_format = dynamic;

create table hualianyun.product_user_price_210115 (
    id int auto_increment
        primary key,
    tenantid int null,
    productid int null,
    packageid int default 0 null,
    userid int null,
    status int null,
    userprice decimal(10, 2) null,
    refunddayprice decimal(10, 2) null,
    originkey varchar(50) null,
    createtime datetime null,
    updatetime datetime null,
    deletetag int null,
    remark varchar(255) null
)
    row_format = dynamic;

create table hualianyun.ros_buyer (
    id int auto_increment
        primary key,
    user_id int not null,
    name varchar(50) not null,
    phone varchar(11) not null,
    address varchar(300) not null,
    update_time datetime default current_timestamp not null on update current_timestamp
)
    charset = utf8mb4;

create table hualianyun.ros_order (
    id int auto_increment
        primary key,
    user_id int not null,
    username varchar(11) not null comment '用户会员名',
    product_id int not null,
    product_name varchar(50) not null comment '产品名',
    order_price decimal(10, 2) not null comment '定价',
    real_price decimal(10, 2) not null comment '实付',
    channel varchar(20) null,
    order_no varchar(50) not null,
    ali_wx_no varchar(50) null,
    user varchar(50) not null,
    phone varchar(11) not null,
    address varchar(300) not null,
    status tinyint(1) default 0 null comment '0:未付款/失败 1：成功',
    is_send tinyint(1) default 0 not null comment '0 未发货  1已发货',
    create_time datetime default current_timestamp not null,
    update_time datetime default current_timestamp not null on update current_timestamp
)
    charset = utf8mb4;

create table hualianyun.ros_product (
    id int auto_increment
        primary key,
    name varchar(20) not null comment '产品名称',
    describe1 varchar(100) not null comment '描述',
    src varchar(200) not null comment '图片',
    price decimal(10, 2) not null comment '价格',
    lineprice decimal(10, 2) not null comment '划线价',
    status tinyint(1) default 1 not null
)
    charset = utf8mb4;

create table hualianyun.sell_coupon (
    id int auto_increment
        primary key,
    tenantid int null,
    storeid int null,
    name varchar(255) null,
    remark varchar(255) null,
    coupontype int null,
    totalcount int null comment '优惠券总量',
    grantcount int null comment '已经领取的数量',
    usedcount int null,
    getlimitcount int null comment '允许领取数量',
    userange int null comment '使用范围：1：全部商品 2：指定商品',
    allowminamount int null comment '满多少金额可以使用，-1：不限制',
    couponvalue int null comment '减少的数量，满减券：金额；折扣券：折扣',
    daterule int null comment '时间规则：1：时间范围；2：领取当日；3领取次日',
    validday int null comment '多少天内可以，配合DateRule',
    startdate datetime null,
    enddate datetime null,
    createdate datetime null,
    isoverlay int not null comment '是否可重叠使用',
    isopen int null,
    disabled int null,
    deletetag int null
)
    row_format = dynamic;

create table hualianyun.sell_coupon_resource (
    id int auto_increment
        primary key,
    tenantid int null,
    storeid int null,
    couponid int null,
    resourceid int null,
    resourceimage varchar(255) null,
    resourcename varchar(255) null,
    resourcetype int null,
    price decimal(10, 2) null,
    deletetag int null
)
    row_format = dynamic;

create table hualianyun.sell_coupon_user_orgin (
    id int auto_increment
        primary key,
    tenantid int null,
    storeid int null,
    `From` varchar(255) null,
    touser int null,
    couponid int null,
    couponcount int null,
    origintype int null,
    remark varchar(255) null,
    deletetag int null,
    createdate datetime null,
    starttime datetime null,
    endtime datetime null,
    status int default 1 null,
    touserref varchar(255) default '暂无' null
)
    row_format = dynamic;

create table hualianyun.sell_coupon_user_use (
    id int auto_increment
        primary key,
    tenantid int null,
    storeid int null,
    userid int null,
    couponid int null,
    couponcount int null,
    orderno varchar(255) null,
    amount decimal(64) null,
    remark int null,
    status int null,
    deletetag int null,
    createdate datetime null,
    ordertype int null
)
    row_format = dynamic;

create table hualianyun.sell_taobao (
    id int auto_increment
        primary key,
    num int null,
    tid varchar(100) null,
    sellerflag int null,
    platform varchar(255) null,
    platformuserid varchar(55) null,
    receivername varchar(255) null,
    phone varchar(255) null,
    receiveraddress varchar(255) null,
    sellernick varchar(255) null,
    buyernick varchar(255) null,
    buyerarea varchar(255) null,
    createdate datetime null,
    status varchar(255) null,
    buyermessage varchar(255) null,
    price decimal(10, 2) null,
    totalfee decimal(10, 2) null,
    payment decimal(10, 2) null,
    created datetime(6) null,
    tradefrom varchar(255) null,
    sellermemo varchar(255) null,
    skupropertiesname varchar(255) null
)
    row_format = dynamic;

create table hualianyun.sell_taobao_refund (
    id int auto_increment
        primary key,
    refundid varchar(50) null,
    buyernick varchar(50) null comment '淘宝会员名',
    refundfee varchar(20) null comment '退款金额',
    oid varchar(50) null comment '子订单编号',
    tid varchar(50) null comment '交易编号',
    refundphase varchar(50) null,
    billtype varchar(50) null,
    sellernick varchar(50) null comment '产品名',
    modified varchar(50) null comment '申请时间',
    phone varchar(20) null comment '电话号码',
    handle_time datetime default current_timestamp null on update current_timestamp comment '处理时间',
    remark varchar(50) null comment '备注',
    status tinyint default 0 not null comment '状态 0 待处理 1 同意 2 拒绝',
    f_balance decimal(11, 2) null comment '扣除前余额',
    handle_user varchar(50) null comment '处理人'
)
    charset = utf8mb4;

create table hualianyun.tenant (
    id int auto_increment comment 'ID'
        primary key,
    name varchar(20) null comment '物业名称',
    logo varchar(100) null comment 'logo',
    contactname varchar(11) null comment '联系人',
    contactphone varchar(50) null comment '联系人电话',
    licenseimg varchar(500) null comment '营业执照',
    state int null comment '状态，10 未审核、20已审核、30未通过',
    createtime datetime not null comment '创建时间',
    updatetime datetime not null comment '修改时间',
    deletetag int not null comment '删除标记',
    bak varchar(100) null comment '备注',
    province int default 0 null comment '省份',
    city int default 0 null comment '市',
    area int default 0 null comment '区',
    location varchar(500) null comment '地址',
    legalperson varchar(20) null comment '企业法人',
    longlatitude varchar(100) null comment '经纬度',
    introduction varchar(200) null comment '企业简介',
    scopeoperation varchar(500) null comment '企业经营范围',
    bank varchar(50) null comment '银行',
    bankcode varchar(30) null comment '银行账号',
    expiredtime datetime null,
    bankchargename varchar(150) null comment '开户名称',
    bankchargeadress varchar(150) null comment '开户行地址',
    appid varchar(150) default '2019363401' null,
    appsecret varchar(255) null,
    paymentchannel int(11) unsigned zerofill default 0 null,
    mchid varchar(50) null comment '商户号',
    mchkey varchar(255) null comment '商户支付密钥',
    miniappid varchar(255) null,
    miniappsecret varchar(255) null,
    minimchid varchar(255) null,
    minimchkey varchar(255) null
) comment '接入的物业信息表'
    charset = utf8
    row_format = dynamic;

create index createtime on hualianyun.tenant (createtime);

create index deletetag on hualianyun.tenant (deletetag);

create index state on hualianyun.tenant (state);

create index updatetime on hualianyun.tenant (updatetime);

create table hualianyun.tenant_ad (
    id int auto_increment
        primary key,
    tentantid int null,
    name varchar(255) null,
    adtype varchar(255) null,
    position int null,
    imageurl varchar(255) null,
    targetid int null,
    deletetag int null
)
    row_format = dynamic;

create table hualianyun.tenant_notice (
    id int auto_increment
        primary key,
    tenantid int null,
    title varchar(255) null,
    profile varchar(255) null,
    content varchar(2000) null,
    deletetag varchar(255) null,
    createtime datetime null,
    online int null
)
    row_format = dynamic;

create table hualianyun.tenant_store (
    id int auto_increment
        primary key,
    tenantid int null,
    name varchar(255) null,
    type int null,
    theme int null,
    public int null,
    coursegroups varchar(1000) null,
    livegroups varchar(1000) null,
    textgroups varchar(2000) null,
    packagegroups varchar(1000) null,
    swipergroups varchar(1000) null,
    navgroups varchar(1000) null,
    adgroups varchar(1000) null,
    articlegroups varchar(1000) null,
    activitygroups varchar(1000) null,
    topcoursegroups varchar(1000) null,
    deletetag int null,
    createtime datetime null,
    customertel varchar(11) null,
    appid int null,
    appsecret varchar(255) null,
    isopen int null
)
    row_format = dynamic;

create table hualianyun.tenant_store_config (
    id int auto_increment comment 'ID'
        primary key,
    name varchar(20) null comment '物业名称',
    logo varchar(100) null comment 'logo',
    contactname varchar(11) null comment '联系人',
    contactphone varchar(50) null comment '联系人电话',
    licenseimg varchar(500) null comment '营业执照',
    state int null comment '状态，10 未审核、20已审核、30未通过',
    createtime datetime not null comment '创建时间',
    updatetime datetime not null comment '修改时间',
    deletetag int not null comment '删除标记',
    bak varchar(100) null comment '备注',
    province int default 0 null comment '省份',
    city int default 0 null comment '市',
    area int default 0 null comment '区',
    location varchar(500) null comment '地址',
    legalperson varchar(20) null comment '企业法人',
    longlatitude varchar(100) null comment '经纬度',
    introduction varchar(200) null comment '企业简介',
    scopeoperation varchar(500) null comment '企业经营范围',
    bank varchar(50) null comment '银行',
    bankcode varchar(30) null comment '银行账号',
    expiredtime datetime null,
    bankchargename varchar(150) null comment '开户名称',
    bankchargeadress varchar(150) null comment '开户行地址',
    appid int default 2019363401 null,
    appsecret varchar(255) null,
    paymentchannel int(11) unsigned zerofill default 0 null,
    mchid varchar(50) null comment '商户号',
    mchkey varchar(255) null comment '商户支付密钥'
) comment '接入的物业信息表'
    charset = utf8
    row_format = dynamic;

create index createtime on hualianyun.tenant_store_config (createtime);

create index deletetag on hualianyun.tenant_store_config (deletetag);

create index state on hualianyun.tenant_store_config (state);

create index updatetime on hualianyun.tenant_store_config (updatetime);

create table hualianyun.tenant_wxapp (
    id int auto_increment
        primary key,
    tenantid int null,
    apptype int null,
    appid varchar(50) null,
    appcode varchar(50) null,
    headimg varchar(255) null,
    nickname varchar(50) null,
    principalname varchar(50) null,
    authorizerstate int null,
    createdate datetime null,
    detetetag int null,
    signature varchar(255) null,
    accesstoken varchar(255) null,
    authorizerrefreshtoken varchar(255) null,
    expiresin int null
)
    row_format = dynamic;

create table hualianyun.use_agreement (
    id int auto_increment
        primary key,
    user_id int unsigned not null,
    status tinyint default 1 not null,
    username varchar(20) not null,
    id_code varchar(50) null,
    `describe` varchar(100) not null,
    xieyi varchar(100) not null,
    yewu varchar(100) null,
    create_time datetime default current_timestamp not null
)
    charset = utf8mb4;

create table hualianyun.user (
    id int auto_increment
        primary key,
    tenantid int null,
    sguserid int null,
    logincode varchar(255) null,
    password varchar(255) null,
    discount_id int default 0 not null comment '折扣id',
    name varchar(255) null,
    phone varchar(255) null,
    profile varchar(255) null,
    photourl varchar(255) null,
    jgday tinyint default 0 not null,
    enabled int null,
    updatetime datetime null,
    createtime datetime null,
    createtype int null comment '1:管理员添加 2：自己注册 3：来自淘宝',
    lastlogindate datetime null,
    productaccountcount int null,
    expiredproductaccountcount int null,
    restamount decimal(11, 2) null,
    ju_money decimal(10, 2) default 0.00 not null,
    consumeamount decimal(11, 2) null,
    remark varchar(255) null,
    deletetag int null,
    sex int null,
    wx varchar(255) null,
    qq varchar(255) null,
    email varchar(255) null,
    taobao varchar(255) null,
    wangwang varchar(255) null,
    testcountlimit int default 0 null,
    usetestcount int null,
    managerid int default 0 null,
    managername varchar(255) null,
    follow_status tinyint default 1 not null comment '1待跟进-未购买 2跟进超时-未购买 3待跟进-消费减少 4跟进超时-消费减少  5流失-需求减少 6流失-暂时不用 7流失-价格问题 8流失-产品问题 9流失-也可自定义 10高意向客户 11已完成',
    pay_time varchar(20) default '无消费' null comment '最后支付时间',
    id_code varchar(50) default '' null,
    is_verify tinyint default 0 null,
    certify_id varchar(100) null comment '支付宝唯一标识',
    agent_id int default 0 not null comment '代理商id',
    is_agent tinyint(1) default 0 not null,
    parent_id int default 0 not null,
    apikey varchar(50) null comment '用户对应apikey',
    ip_addr varchar(20) null comment 'ip地址'
)
    row_format = dynamic;

create index logincode on hualianyun.user (logincode);

create index phone on hualianyun.user (phone);

create index taobao on hualianyun.user (taobao);

create table hualianyun.user22 (
    id int auto_increment
        primary key,
    phone varchar(20) not null
);

create table hualianyun.user_charge_order (
    id int auto_increment
        primary key,
    tenantid int null,
    userid int null,
    username varchar(255) null,
    orderno varchar(50) null,
    ordername varchar(255) null,
    tradeno varchar(255) null,
    orderstate int null,
    ordertype int null,
    paytype int null,
    paystate int null,
    paychannel int default 30 null,
    orderamount decimal(11, 2) null,
    paymentamount decimal(11, 2) null comment '在线支付金额',
    channel varchar(255) null,
    channeltype int null,
    createtime datetime null,
    updatetime datetime null,
    remark varchar(255) null,
    deletetag int default 0 null
)
    row_format = dynamic;

create table hualianyun.user_favor (
    id int not null,
    tenantid int null,
    userid int null,
    favortype int null,
    title varchar(255) null,
    target varchar(255) null,
    createtime datetime null,
    deletetag int null
)
    row_format = dynamic;

create table hualianyun.user_score (
    id int auto_increment
        primary key,
    tenantid int null,
    userid int null,
    scoretype int null,
    scoretypename varchar(255) null,
    scorevalue decimal(11, 2) null,
    scoretarget varchar(255) null,
    remark text null,
    createtime datetime default current_timestamp null,
    updatetime datetime null,
    deletetag int null,
    username varchar(255) null,
    operateusername varchar(255) null,
    restamount1 decimal(10, 2) default 0.00 null,
    restamount2 decimal(10, 2) default 0.00 null
)
    row_format = dynamic;

create index userid on hualianyun.user_score (userid, scoretype);

create table hualianyun.wx_app (
    id int auto_increment,
    tenantid int not null,
    storeid int null,
    openappid int null comment '开发平台appid',
    appid varchar(30) null comment '微信appid',
    apptype int null,
    headimg varchar(200) null comment 'logo图片',
    nickname varchar(30) null comment '昵称',
    username varchar(30) null comment '用户名',
    principalname varchar(30) null comment '主体名称',
    bussinessinfo text null comment '信息',
    createtime datetime null,
    deletetag int null,
    authorizerstate int null comment '公众号授权状态',
    refreshtoken varchar(255) null,
    expiresin int null,
    updatetime datetime null,
    primary key (id, tenantid)
) comment '第三方授权公众号信息表'
    charset = utf8
    row_format = dynamic;

create table hualianyun.wx_app_user (
    id int auto_increment
        primary key,
    tenantid int not null,
    storeid int null,
    appid varchar(30) charset utf8 null comment '微信appid',
    apptype int null,
    userid int null comment 'logo图片',
    unionid varchar(55) charset utf8 null,
    openid varchar(55) charset utf8 null,
    nickname varchar(30) charset utf8 null comment '昵称',
    username varchar(30) charset utf8 null comment '用户名',
    headimgurl varchar(255) charset utf8 null,
    sex int null comment '主体名称',
    city varchar(55) charset utf8 null comment '信息',
    country varchar(255) charset utf8 null,
    issubscribe int null,
    invateuserid int null,
    createtime datetime null,
    updatetime datetime null,
    deletetag int null
) comment '第三方授权公众号信息表'
    row_format = dynamic;

create table hualianyun.wx_app_user_copy1 (
    id int auto_increment
        primary key,
    tenantid int not null,
    storeid int null,
    appid varchar(30) null comment '微信appid',
    apptype int null,
    userid int null comment 'logo图片',
    unionid varchar(55) null,
    openid varchar(55) null,
    nickname varchar(30) null comment '昵称',
    username varchar(30) null comment '用户名',
    headimgurl varchar(255) null,
    sex int null comment '主体名称',
    city varchar(55) null comment '信息',
    country varchar(255) null,
    issubscribe int null,
    invateuserid int null,
    createtime datetime null,
    updatetime datetime null,
    deletetag int null
) comment '第三方授权公众号信息表'
    charset = utf8
    row_format = dynamic;
