CREATE TABLE "app_ad_config" (
     "id" int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY,
     "name" varchar(255),
     "merchant_id" int4 NOT NULL ,
     "location_type" varchar(128),
     "ad_location" varchar(64),
     "ad_num" int4 default 1,
     "sub_type" varchar(64),
     "ad_label" text default 'all',
     "cost_type" varchar(64) default 'hb_act_ad_fee',
     "cost_amount" int4 default 0,
     "ref_id" int4,
     "ref_code" varchar(255),
     "ref_name" text,
     "img_url" text,
     "status" int2 default 0,
     "start_time" timestamp,
     "end_time" timestamp,
     "start_hour" int4 default 0,
     "end_hour" int4 default 24,
     "show_num" int4 default 0,
     "click_num" int4 default 0,
     "ad_amount" int4 default 0,
     "create_time" timestamp,
     "update_time" timestamp,
     PRIMARY KEY ("id")
);

COMMENT ON COLUMN "app_ad_config"."location_type" IS '位置类型,search_hot,sport_basketball,sport_Soccer,sport_other,sport_综合收藏,group,search';

COMMENT ON COLUMN "app_ad_config"."name" IS '名称';

COMMENT ON COLUMN "app_ad_config"."ad_location" IS '广告位置';

COMMENT ON COLUMN "app_ad_config"."ad_num" IS '广告序号,1,5,10';

COMMENT ON COLUMN "app_ad_config"."sub_type" IS '投放形式,拼团:group,店铺:shop';

COMMENT ON COLUMN "app_ad_config"."cost_type" IS '计费类型,积分,hb_act_ad_fee,金额:amount';

COMMENT ON COLUMN "app_ad_config"."cost_amount" IS '计费金额(积分),单位分';

COMMENT ON COLUMN "app_ad_config"."ref_id" IS '关联id';

COMMENT ON COLUMN "app_ad_config"."ref_code" IS '关联code';

COMMENT ON COLUMN "app_ad_config"."ref_name" IS '关联名称';

COMMENT ON COLUMN "app_ad_config"."img_url" IS '图片地址';

COMMENT ON COLUMN "app_ad_config"."status" IS '状态';

COMMENT ON COLUMN "app_ad_config"."start_time" IS '投放时间';

COMMENT ON COLUMN "app_ad_config"."end_time" IS '投放结束时间';

COMMENT ON COLUMN "app_ad_config"."start_hour" IS '当日起始时间,小时';

COMMENT ON COLUMN "app_ad_config"."end_hour" IS '当日结束时间,小时';

COMMENT ON COLUMN "app_ad_config"."ad_label" IS '投放标签,默认all全部';

COMMENT ON COLUMN "app_ad_config"."show_num" IS '显示次数';

COMMENT ON COLUMN "app_ad_config"."click_num" IS '点击次数';

COMMENT ON COLUMN "app_ad_config"."ad_amount" IS '广告实际费用,单位分';
