create table member_auth
(
    id              bigint auto_increment
        primary key,
    ssid            varchar(64)      not null,
    out_trade_no    varchar(64)      null,
    auth            varchar(255)     not null,
    auth_value      bigint default 0 not null,
    start_timestamp bigint           not null,
    end_timestamp   bigint           not null,
    status          int    default 0 not null,
    create_time     datetime         not null,
    update_time     datetime         not null
);

create index idx_auth
    on member_auth (auth);

create index idx_out_trade_no
    on member_auth (out_trade_no);

create index idx_ssid
    on member_auth (ssid);


create table order_info
(
    id              bigint auto_increment
        primary key,
    out_trade_no    varchar(128) not null,
    ssid            varchar(64)  not null,
    device_id       varchar(64)  not null,
    phone           varchar(64)  null,
    item_id         bigint       not null,
    item_name       varchar(255) not null,
    original_amount bigint       not null,
    amount          bigint       not null,
    app_platform    int          not null,
    package_name    varchar(255) not null,
    channel_name    varchar(255) null,
    ip              varchar(255) null,
    create_time     datetime     not null,
    update_time     datetime     not null,
    pay_status      int          not null comment '-- 0:已创建 1:未支付 2:已支付 3:已关闭 4:已退款',
    status          int          not null,
    constraint idx_out_trade_no
        unique (out_trade_no)
);

create index idx_create_time
    on order_info (create_time);

create index idx_ssid
    on order_info (ssid);



