<?php
//升级数据表
pdo_query("CREATE TABLE IF NOT EXISTS `ims_rhinfo_service_account` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uniacid` int(10) unsigned NOT NULL DEFAULT '0',
`acid` int(10) unsigned NOT NULL DEFAULT '0',
`uid` int(10) unsigned NOT NULL DEFAULT '0',
`openid` varchar(50) NOT NULL,
`username` varchar(50) NOT NULL,
`password` varchar(32) NOT NULL,
`salt` varchar(6) NOT NULL,
`mobile` varchar(20) NOT NULL,
`status` tinyint(3) NOT NULL DEFAULT '2',
`store_id` int(10) unsigned NOT NULL DEFAULT '0',
`joindate` int(10) unsigned NOT NULL DEFAULT '0',
`joinip` varchar(15) NOT NULL DEFAULT '',
`lastvisit` int(10) unsigned NOT NULL DEFAULT '0',
`lastip` varchar(15) NOT NULL DEFAULT '',
`remark` varchar(500) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `uniacid` (`uniacid`),
KEY `uid` (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
");
if(!pdo_fieldexists('rhinfo_service_account','id')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD
`id` int(10) unsigned NOT NULL AUTO_INCREMENT");}
if(!pdo_fieldexists('rhinfo_service_account','uniacid')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD `uniacid` int(10) unsigned NOT NULL DEFAULT '0'");}
if(!pdo_fieldexists('rhinfo_service_account','acid')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD `acid` int(10) unsigned NOT NULL DEFAULT '0'");}
if(!pdo_fieldexists('rhinfo_service_account','uid')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD `uid` int(10) unsigned NOT NULL DEFAULT '0'");}
if(!pdo_fieldexists('rhinfo_service_account','openid')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD `openid` varchar(50) NOT NULL");}
if(!pdo_fieldexists('rhinfo_service_account','username')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD `username` varchar(50) NOT NULL");}
if(!pdo_fieldexists('rhinfo_service_account','password')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD `password` varchar(32) NOT NULL");}
if(!pdo_fieldexists('rhinfo_service_account','salt')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD `salt` varchar(6) NOT NULL");}
if(!pdo_fieldexists('rhinfo_service_account','mobile')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD `mobile` varchar(20) NOT NULL");}
if(!pdo_fieldexists('rhinfo_service_account','status')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD `status` tinyint(3) NOT NULL DEFAULT '2'");}
if(!pdo_fieldexists('rhinfo_service_account','store_id')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD `store_id` int(10) unsigned NOT NULL DEFAULT '0'");}
if(!pdo_fieldexists('rhinfo_service_account','joindate')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD `joindate` int(10) unsigned NOT NULL DEFAULT '0'");}
if(!pdo_fieldexists('rhinfo_service_account','joinip')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD `joinip` varchar(15) NOT NULL DEFAULT ''");}
if(!pdo_fieldexists('rhinfo_service_account','lastvisit')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD `lastvisit` int(10) unsigned NOT NULL DEFAULT '0'");}
if(!pdo_fieldexists('rhinfo_service_account','lastip')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD `lastip` varchar(15) NOT NULL DEFAULT ''");}
if(!pdo_fieldexists('rhinfo_service_account','remark')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD `remark` varchar(500) NOT NULL DEFAULT ''");}
if(!pdo_fieldexists('rhinfo_service_account','id')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD PRIMARY KEY (`id`)");}
if(!pdo_fieldexists('rhinfo_service_account','uniacid')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_account')." ADD KEY `uniacid` (`uniacid`)");}
pdo_query("CREATE TABLE IF NOT EXISTS `ims_rhinfo_service_activity_bargain` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uniacid` int(10) unsigned NOT NULL DEFAULT '0',
`sid` int(10) unsigned NOT NULL DEFAULT '0',
`title` varchar(20) NOT NULL,
`content` varchar(255) NOT NULL,
`order_limit` tinyint(3) unsigned NOT NULL DEFAULT '0',
`goods_limit` tinyint(3) unsigned NOT NULL DEFAULT '0',
`starttime` int(10) unsigned NOT NULL DEFAULT '0',
`endtime` int(10) unsigned NOT NULL DEFAULT '0',
`starthour` smallint(5) unsigned NOT NULL DEFAULT '0',
`endhour` smallint(5) unsigned NOT NULL DEFAULT '0',
`use_limit` tinyint(3) unsigned NOT NULL DEFAULT '1',
`displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0',
`addtime` int(10) unsigned NOT NULL DEFAULT '0',
`status` varchar(20) NOT NULL DEFAULT 'ongoing',
`total_updatetime` int(10) unsigned NOT NULL DEFAULT '0',
`agentid` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `uniacid` (`uniacid`),
KEY `sid` (`sid`),
KEY `agentid` (`agentid`),
KEY `status` (`status`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
");
if(!pdo_fieldexists('rhinfo_service_activity_bargain','id')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_activity_bargain')." ADD
`id` int(10) unsigned NOT NULL AUTO_INCREMENT");}
if(!pdo_fieldexists('rhinfo_service_activity_bargain','uniacid')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_activity_bargain')." ADD `uniacid` int(10) unsigned NOT NULL DEFAULT '0'");}
if(!pdo_fieldexists('rhinfo_service_activity_bargain','sid')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_activity_bargain')." ADD `sid` int(10) unsigned NOT NULL DEFAULT '0'");}
if(!pdo_fieldexists('rhinfo_service_activity_bargain','title')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_activity_bargain')." ADD `title` varchar(20) NOT NULL");}
if(!pdo_fieldexists('rhinfo_service_activity_bargain','content')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_activity_bargain')." ADD `content` varchar(255) NOT NULL");}
if(!pdo_fieldexists('rhinfo_service_activity_bargain','order_limit')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_activity_bargain')." ADD `order_limit` tinyint(3) unsigned NOT NULL DEFAULT '0'");}
if(!pdo_fieldexists('rhinfo_service_activity_bargain','goods_limit')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_activity_bargain')." ADD `goods_limit` tinyint(3) unsigned NOT NULL DEFAULT '0'");}
if(!pdo_fieldexists('rhinfo_service_activity_bargain','starttime')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_activity_bargain')." ADD `starttime` int(10) unsigned NOT NULL DEFAULT '0'");}
if(!pdo_fieldexists('rhinfo_service_activity_bargain','endtime')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_activity_bargain')." ADD `endtime` int(10) unsigned NOT NULL DEFAULT '0'");}
if(!pdo_fieldexists('rhinfo_service_activity_bargain','starthour')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_activity_bargain')." ADD `starthour` smallint(5) unsigned NOT NULL DEFAULT '0'");}
if(!pdo_fieldexists('rhinfo_service_activity_bargain','endhour')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_activity_bargain')." ADD `endhour` smallint(5) unsigned NOT NULL DEFAULT '0'");}
if(!pdo_fieldexists('rhinfo_service_activity_bargain','use_limit')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_activity_bargain')." ADD `use_limit` tinyint(3) unsigned NOT NULL DEFAULT '1'");}
if(!pdo_fieldexists('rhinfo_service_activity_bargain','displayorder')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_activity_bargain')." ADD `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0'");}
if(!pdo_fieldexists('rhinfo_service_activity_bargain','addtime')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_activity_bargain')." ADD `addtime` int(10) unsigned NOT NULL DEFAULT '0'");}
if(!pdo_fieldexists('rhinfo_service_activity_bargain','status')) {pdo_query("ALTER TABLE ".tablename('rhinfo_service_activity_bargain')." ADD `status` varchar(2