From caa91cf9e41d2e685e510e10387c1c920ae5c6c5 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 21 Sep 2025 10:23:06 +0800 Subject: [PATCH] bugfix --- iptv/downloadchannels.py | 54 +---- iptv/m3u8test.py | 110 +++++++-- models/mysql.ddl.sql | 488 +-------------------------------------- 3 files changed, 97 insertions(+), 555 deletions(-) diff --git a/iptv/downloadchannels.py b/iptv/downloadchannels.py index 544112f..8f9c8e2 100644 --- a/iptv/downloadchannels.py +++ b/iptv/downloadchannels.py @@ -11,7 +11,7 @@ from appPublic.uniqueID import getID from appPublic.log import debug from sqlor.dbpools import DBPools from iptv import m3u -from iptv.m3u8test import test_channels +from iptv.m3u8test import test_channels, write_goodchannel async def download(url): client = StreamHttpClient() @@ -23,59 +23,13 @@ async def download(url): clist = m3u.m3uParser(txt) return clist -async def saveChannels(media_type,clist, dbname): - pool = DBPools() - sql = """insert into iptvchannels -( - id, - tv_group, - tv_name, - logo_url, - url, - media_type, - download_date, - del_flg -) -values -( - ${id}$, - ${tv_group}$, - ${tv_name}$, - ${logo_url}$, - ${url}$, - ${media_type}$, - ${download_date}$, - '0' -)""" - - dup = 0 - query = """select * from iptvchannels where url=${url}$""" - async with pool.sqlorContext(dbname) as sor: - for r in clist: - q = await sor.sqlExe(query,r) - if len(q) < 1: - r['media_type'] = media_type - r['id'] = getID() - r['tv_group'] = r.get('group-title','')[:500] - r['tv_name'] = r.get('name','')[:500] - r['logo_url'] = r.get('tvg-logo',None) - if r['logo_url'] and len(r['logo_url']) > 1000: - r['logo_url'] = None - if len(r['url']) >= 1000: - continue; - dt = datetime.now() - r['download_date'] = '%d-%02d-%02d' % (dt.year,dt.month,dt.day) - await sor.sqlExe(sql,r) - else: - dup += 1 - debug(f'{dup} exists') async def load_url_iptv(media_type,url, dbname): clist = await download(url) - goodchannels, badchannels = test_channels(clist) - if goodchannels: + if clist: debug('%d channels' % len(goodchannels)) - await saveChannels(media_type,goodchannels, dbname) + good, bad = await test_channels(clist, if_ok=write_goodchannel) + debug(f'{len(good)} new channels add {len(bad)} channels exists') else: debug(f'{url} return None') diff --git a/iptv/m3u8test.py b/iptv/m3u8test.py index 5708cbe..8e9f193 100644 --- a/iptv/m3u8test.py +++ b/iptv/m3u8test.py @@ -1,39 +1,105 @@ +import time from appPublic.log import debug, exception from appPublic.uniqueID import getID +from sqlor.dbpools import DBPools +from ahserver.serverenv import ServerEnv from aiohttp import ( - client + client, + ClientSession ) from ahserver.serverenv import ServerEnv from sqlor.dbpools import DBPools -async def test_channels(channels): +async def test_channels(channels,if_failed=None, if_ok=None): goodchannels = [] badchannels = [] - for c in channels: - try: - x = await client.get(c.url) - x.close() - goodchannels.append(c) - except Exception as e: - debug(f'{c.url}, {e}') - badchannels.append(c) - return goodchannels, badchannels + env = ServerEnv() + dbname = env.get_module_dbname('iptv') + db = DBPools() + async with db.sqlorContext(dbname) as sor: + for c in channels: + try: + t1 = time.time() + async with ClientSession() as sess: + async with sess.get(c.url) as resp: + debug(f'{resp.status=}, {type(resp.status)=}') + if resp.status != 200: + badchannels.append(c) + if if_ok: + t2 = time.time() + c['channel_delay'] = t2 - t1 + await if_ok(sor, c) + else: + goodchannels.append(c) + if if_failed: + c['errorcode'] = resp.status + await if_failed(sor, c) + except Exception as e: + debug(f'{c.url}, {e}') + badchannels.append(c) + if if_failed: + await if_failed(sor, c) + return goodchannels, badchannels + +async def write_badchannel(sor, b): + await sor.C('badchannels', { + 'id':getID(), + 'channelid': b.id, + 'errorcode': b.errorcode + }) + sql = "update iptvchannels set del_flg='1' where id=${id}$" + await sor.sqlExe(sql, {'id': b.id}) + +async def write_goodchannel(sor, b): + sql = """insert into iptvchannels +( + id, + tv_group, + tv_name, + logo_url, + url, + media_type, + download_date, + del_flg +) +values +( + ${id}$, + ${tv_group}$, + ${tv_name}$, + ${logo_url}$, + ${url}$, + ${media_type}$, + ${download_date}$, + '0' +)""" + query = """select * from iptvchannels where url=${url}$""" + q = await sor.sqlExe(query,{'url', b['url']}) + if len(q) == 0: + r = copy(b) + r['media_type'] = media_type + r['id'] = getID() + if not r.get('tv_group'): + r['tv_group'] = r.get('group-title','')[:500] + if not r.get('tv_name'): + r['tv_name'] = r.get('name','')[:500] + if not r.get('logo_url'): + r['logo_url'] = r.get('tvg-logo',None) + if r['logo_url'] and len(r['logo_url']) > 1000: + r['logo_url'] = None + if len(r['url']) >= 1000: + return + dt = datetime.now() + r['download_date'] = '%d-%02d-%02d' % (dt.year,dt.month,dt.day) + await sor.sqlExe(sql,r) async def kickout_badchannels(): db = DBPools() env = ServerEnv() dbname = env.get_module_dbname('iptv') + channels = [] async with db.sqlorContext(dbname) as sor: channels = await sor.R('iptvchannels', {'del_flg':'0'}) - good, bad = await test_channels(channels) - for b in bad: - await sor.C('baschannels', { - 'id':getID(), - 'channelid': b.id, - 'errorcode': b.errorcode - }) - await sor.U('iptvchannels', { - 'id': b.id, - 'del_flg': '1' - }) + good, bad2 = await test_channels(channels, if_failed=write_badchannel) + debug(f'{len(good)=},{len(bad)}') diff --git a/models/mysql.ddl.sql b/models/mysql.ddl.sql index 0ceb25a..2f63d92 100644 --- a/models/mysql.ddl.sql +++ b/models/mysql.ddl.sql @@ -1,241 +1,17 @@ --- ./userapp.xlsx +-- ./badchannels.xlsx -drop table if exists userapp; -CREATE TABLE userapp -( - - `id` VARCHAR(32) comment 'id', - `userid` VARCHAR(32) DEFAULT '0' comment '用户id', - `appname` VARCHAR(99) comment '应用名称', - `apikey` VARCHAR(400) comment 'apikey' - - -,primary key(id) - - -) -engine=innodb -default charset=utf8 -comment '用户应用' -; - - --- ./userroles.xlsx - - - - - -drop table if exists userrole; -CREATE TABLE userrole -( - - `id` VARCHAR(32) comment '用户id', - `userid` VARCHAR(32) comment '用户id', - `roleid` VARCHAR(32) comment '角色id' - - -,primary key(id) - - -) -engine=innodb -default charset=utf8 -comment '用户角色' -; - - --- ./device.xlsx - - - - - -drop table if exists device; -CREATE TABLE device -( - - `id` VARCHAR(32) comment 'id', - `name` VARCHAR(255) comment '设备名称', - `takeover_flg` VARCHAR(1) comment '接管标志', - `userid` VARCHAR(32) comment '用户id' - - -,primary key(id) - - -) -engine=innodb -default charset=utf8 -comment '设备表' -; - - --- ./userapikey.xlsx - - - - - -drop table if exists userapikey; -CREATE TABLE userapikey -( - - `id` VARCHAR(32) comment 'id', - `providerid` VARCHAR(200) comment '供应商id', - `customerid` VARCHAR(32) DEFAULT '0' comment '用户id', - `apikey` VARCHAR(4000) DEFAULT '0' comment 'api密钥', - `secretkey` VARCHAR(4000) comment '附属密钥', - `rfname` VARCHAR(400) comment '函数名' - - -,primary key(id) - - -) -engine=innodb -default charset=utf8 -comment '用户api密码表' -; - -CREATE UNIQUE INDEX userapikey_idx1 ON userapikey(providerid,customerid); -CREATE INDEX userapikey_idx2 ON userapikey(customerid); - --- ./playhistory.xlsx - - - - - -drop table if exists playhistory; -CREATE TABLE playhistory -( - - `id` VARCHAR(32) comment 'id', - `deviceid` VARCHAR(32) comment '设备id', - `channelid` VARCHAR(32) comment '频道id', - `playtime` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '开始时间' - - -,primary key(id) - - -) -engine=innodb -default charset=utf8 -comment '播放历史' -; - - --- ./appcodes.xlsx - - - - - -drop table if exists appcodes; -CREATE TABLE appcodes -( - - `id` VARCHAR(32) comment 'id', - `name` VARCHAR(255) comment '编码名称', - `hierarchy_flg` VARCHAR(1) comment '多级标志' - - -,primary key(id) - - -) -engine=innodb -default charset=utf8 -comment '应用编码表' -; - -insert into appcodes (id,name,hierarchy_flg) values ('resp_mode','返回模式','0'); -insert into appcodes (id,name,hierarchy_flg) values ('params_type','参数类型','0'); -insert into appcodes (id,name,hierarchy_flg) values ('code_hierarchy','编码层次','0'); -insert into appcodes (id,name,hierarchy_flg) values ('minimax_acc_status','minimax账户状态','0'); -insert into appcodes (id,name,hierarchy_flg) values ('datatype','数据类型','0'); -insert into appcodes (id,name,hierarchy_flg) values ('uitype','UI类型','0'); -insert into appcodes (id,name,hierarchy_flg) values ('yesno','是否选项','0'); -insert into appcodes (id,name,hierarchy_flg) values ('org_type','机构类型','0'); - - --- ./permission.xlsx - - - - - -drop table if exists permission; -CREATE TABLE permission -( - - `id` VARCHAR(32) comment '权限id', - `name` VARCHAR(255) comment '名称', - `description` VARCHAR(255) comment '描述', - `ptype` VARCHAR(20) comment '类型', - `parentid` VARCHAR(32) comment '父权限id', - `path` VARCHAR(255) comment '路径', - `title` VARCHAR(255) comment '标题', - `icon` VARCHAR(255) comment '图标' - - -,primary key(id) - - -) -engine=innodb -default charset=utf8 -comment '权限' -; - -CREATE INDEX permission_idx1 ON permission(ptype); -CREATE INDEX permission_idx2 ON permission(parentid); - --- ./tags.xlsx - - - - - -drop table if exists tags; -CREATE TABLE tags -( - - `id` VARCHAR(32) comment 'id', - `userid` VARCHAR(32) comment '用户id', - `tag` VARCHAR(400) comment '标签名称' - - -,primary key(id) - - -) -engine=innodb -default charset=utf8 -comment '标签表' -; - - --- ./taging.xlsx - - - - - -drop table if exists taging; -CREATE TABLE taging +drop table if exists badchannels; +CREATE TABLE badchannels ( `id` VARCHAR(32) comment 'id', `channelid` VARCHAR(32) comment '频道id', - `tagid` VARCHAR(32) comment '标签id' + `errorcode` VARCHAR(10) comment '错误代码' ,primary key(id) @@ -244,262 +20,8 @@ CREATE TABLE taging ) engine=innodb default charset=utf8 -comment '打标签' +comment '坏频道' ; --- ./iptvchannels.xlsx - - - - - -drop table if exists iptvchannels; -CREATE TABLE iptvchannels -( - - `id` VARCHAR(32) comment '编号', - `tv_group` VARCHAR(500) comment '频道组', - `tv_name` VARCHAR(500) comment '频道名称', - `logo_url` VARCHAR(1000) comment '台标url', - `url` VARCHAR(1000) comment 'url', - `media_type` VARCHAR(100) comment '媒体类型', - `download_date` VARCHAR(10) comment '下载日期', - `channel_delay` int comment '频道延迟', - `channel_grade` int comment '频道等级', - `del_flg` VARCHAR(1) comment '删除标志' - - -,primary key(id) - - -) -engine=innodb -default charset=utf8 -comment 'IPTV频道清单' -; - -CREATE INDEX iptvchannels_idx1 ON iptvchannels(tv_group); -CREATE INDEX iptvchannels_idx2 ON iptvchannels(tv_name); -CREATE UNIQUE INDEX iptvchannels_idx3 ON iptvchannels(url); - --- ./users.xlsx - - - - - -drop table if exists users; -CREATE TABLE users -( - - `id` VARCHAR(32) comment '用户id', - `username` VARCHAR(255) comment '用户名', - `name` VARCHAR(255) comment '姓名', - `password` VARCHAR(255) comment '密码', - `email` VARCHAR(255) comment '邮件地址', - `orgid` VARCHAR(32) comment '所属机构', - `nick_name` VARCHAR(255) comment '显示名', - `address` VARCHAR(255) comment '地址', - `mobile` VARCHAR(255) comment '手机', - `user_status` VARCHAR(1) DEFAULT '0' comment '用户状态' - - -,primary key(id) - - -) -engine=innodb -default charset=utf8 -comment '用户' -; - -CREATE INDEX users_idx1 ON users(orgid); -CREATE UNIQUE INDEX users_idx2 ON users(username); -insert into users (id,username,password) values (' HappyCat123',' HappyCat123','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' GreenForest456',' GreenForest456','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' SunnySky789',' SunnySky789','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' OceanWave246',' OceanWave246','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' BraveLion135',' BraveLion135','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' MagicStar987',' MagicStar987','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' HappyFox654',' HappyFox654','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' RedSunshine321',' RedSunshine321','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' BlueMoon852',' BlueMoon852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' WiseOwl963',' WiseOwl963','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' SilverCloud741',' SilverCloud741','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' GoldenEagle258',' GoldenEagle258','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' QuickTiger369',' QuickTiger369','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' SmartBear147',' SmartBear147','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' GentleBreeze852',' GentleBreeze852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' FlyingHawk753',' FlyingHawk753','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' LuckyFish159',' LuckyFish159','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' BrightStar246',' BrightStar246','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' BoldWolf789',' BoldWolf789','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' ShinyGem963',' ShinyGem963','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' PeacefulDove357',' PeacefulDove357','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' NobleKnight456',' NobleKnight456','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' CleverRabbit852',' CleverRabbit852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' MysticRiver159',' MysticRiver159','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' SilentSnow753',' SilentSnow753','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' JoyfulBird369',' JoyfulBird369','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' StrongBull258',' StrongBull258','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' CalmSea147',' CalmSea147','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' HonestSheep963',' HonestSheep963','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' PlayfulPuppy357',' PlayfulPuppy357','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' GlowingSun147',' GlowingSun147','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' SweetCherry456',' SweetCherry456','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' DreamySky852',' DreamySky852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' FriendlyDuck963',' FriendlyDuck963','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' KindElephant741',' KindElephant741','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' HappyWhale258',' HappyWhale258','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' GracefulSwan159',' GracefulSwan159','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' BraveEagle753',' BraveEagle753','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' GentleRabbit369',' GentleRabbit369','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' SunnyMeadow852',' SunnyMeadow852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' WiseLion147',' WiseLion147','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' SilverMountain456',' SilverMountain456','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' MysticMoon852',' MysticMoon852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' ShinyStar963',' ShinyStar963','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' PeacefulTree357',' PeacefulTree357','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' GoldenRiver741',' GoldenRiver741','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' BoldHawk258',' BoldHawk258','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' BrightLeaf159',' BrightLeaf159','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' SmartPanda753',' SmartPanda753','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' SilentOcean369',' SilentOcean369','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' LuckyBear852',' LuckyBear852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' QuickFox147',' QuickFox147','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' HappyDeer456',' HappyDeer456','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' GreenValley852',' GreenValley852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' CalmRiver963',' CalmRiver963','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' HonestHawk357',' HonestHawk357','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' PlayfulCat147',' PlayfulCat147','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' GlowingStar456',' GlowingStar456','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' FriendlySheep852',' FriendlySheep852','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' NobleFox963',' NobleFox963','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' DreamyWhale741',' DreamyWhale741','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' KindDove258',' KindDove258','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); -insert into users (id,username,password) values (' GentleBear159',' GentleBear159','QUZVcXg5V1p1STMybG5Ia+zDtngv7A=='); - - --- ./userdepartment.xlsx - - - - - -drop table if exists userdepartment; -CREATE TABLE userdepartment -( - - `id` VARCHAR(32) comment 'id', - `userid` VARCHAR(32) comment '用户id', - `depid` VARCHAR(32) comment '部门id', - `del_flg` VARCHAR(1) DEFAULT '0' comment '删除标志', - `create_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '创建时间戳' - - -,primary key(id) - - -) -engine=innodb -default charset=utf8 -comment '用户部门表' -; - - --- ./channelfailed.xlsx - - - - - -drop table if exists channelfailed; -CREATE TABLE channelfailed -( - - `id` VARCHAR(32) comment 'id', - `deviceid` VARCHAR(32) comment '设备id', - `channelid` VARCHAR(32) comment '频道id', - `reporttime` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '报告时间' - - -,primary key(id) - - -) -engine=innodb -default charset=utf8 -comment '频道播放失败' -; - - --- ./appcodes_kv.xlsx - - - - - -drop table if exists appcodes_kv; -CREATE TABLE appcodes_kv -( - - `id` VARCHAR(32) comment 'id', - `parentid` VARCHAR(32) comment '父id', - `k` VARCHAR(32) comment '键', - `v` VARCHAR(255) comment '值' - - -,primary key(id) - - -) -engine=innodb -default charset=utf8 -comment '编码键值表' -; - -CREATE UNIQUE INDEX appcodes_kv_idx1 ON appcodes_kv(parentid,k); -CREATE INDEX appcodes_kv_idx2 ON appcodes_kv(parentid); -insert into appcodes_kv (id,parentid,k,v) values ('code0001','resp_mode','0','stream'); -insert into appcodes_kv (id,parentid,k,v) values ('code0002','resp_mode','1','sync'); -insert into appcodes_kv (id,parentid,k,v) values ('code0003','resp_mode','2','async'); -insert into appcodes_kv (id,parentid,k,v) values ('code0004','params_type','0','model'); -insert into appcodes_kv (id,parentid,k,v) values ('code0005','params_type','1','modelinstance'); -insert into appcodes_kv (id,parentid,k,v) values ('code0006','params_type','2','user'); -insert into appcodes_kv (id,parentid,k,v) values ('code0007','params_type','3','session'); -insert into appcodes_kv (id,parentid,k,v) values ('code0008','code_hierarchy','0','one l'); -insert into appcodes_kv (id,parentid,k,v) values ('code0009','code_hierarchy','1','hierarchy'); -insert into appcodes_kv (id,parentid,k,v) values ('code0010','minimax_acc_status','0','enabled'); -insert into appcodes_kv (id,parentid,k,v) values ('code0011','minimax_acc_status','2','disabled'); -insert into appcodes_kv (id,parentid,k,v) values ('code0012','datatype','str','str'); -insert into appcodes_kv (id,parentid,k,v) values ('code0013','datatype','char','char'); -insert into appcodes_kv (id,parentid,k,v) values ('code0014','datatype','short','short'); -insert into appcodes_kv (id,parentid,k,v) values ('code0015','datatype','long','long'); -insert into appcodes_kv (id,parentid,k,v) values ('code0016','datatype','llong','llong'); -insert into appcodes_kv (id,parentid,k,v) values ('code0017','datatype','date','date'); -insert into appcodes_kv (id,parentid,k,v) values ('code0018','datatype','time','time'); -insert into appcodes_kv (id,parentid,k,v) values ('code0019','datatype','timestamp','timestamp'); -insert into appcodes_kv (id,parentid,k,v) values ('code0020','datatype','float','float'); -insert into appcodes_kv (id,parentid,k,v) values ('code0021','datatype','double','double'); -insert into appcodes_kv (id,parentid,k,v) values ('code0022','datatype','ddouble','ddouble'); -insert into appcodes_kv (id,parentid,k,v) values ('code0023','datatype','decimal','decimal'); -insert into appcodes_kv (id,parentid,k,v) values ('code0024','uitype','str','str'); -insert into appcodes_kv (id,parentid,k,v) values ('code0025','uitype','text','text'); -insert into appcodes_kv (id,parentid,k,v) values ('code0026','uitype','date','date'); -insert into appcodes_kv (id,parentid,k,v) values ('code0027','uitype','int','int'); -insert into appcodes_kv (id,parentid,k,v) values ('code0028','uitype','float','float'); -insert into appcodes_kv (id,parentid,k,v) values ('code0029','uitype','file','file'); -insert into appcodes_kv (id,parentid,k,v) values ('code0030','uitype','email','email'); -insert into appcodes_kv (id,parentid,k,v) values ('code0031','uitype','tel','tel'); -insert into appcodes_kv (id,parentid,k,v) values ('code0032','uitype','audiotext','audiotext'); -insert into appcodes_kv (id,parentid,k,v) values ('code0033','uitype','password','password'); -insert into appcodes_kv (id,parentid,k,v) values ('code0034','uitype','checkbox','checkbox'); -insert into appcodes_kv (id,parentid,k,v) values ('code0035','uitype','check','check'); -insert into appcodes_kv (id,parentid,k,v) values ('code0036','uitype','code','code'); -insert into appcodes_kv (id,parentid,k,v) values ('code0037','yesno','1','yes'); -insert into appcodes_kv (id,parentid,k,v) values ('code0038','yesno','0','no'); -insert into appcodes_kv (id,parentid,k,v) values ('code0039','org_type','0','personal'); -insert into appcodes_kv (id,parentid,k,v) values ('code0040','org_type','1','organization'); -