/******  2017-12-6更新 ******/
alter table [dbo].[e_article] ADD [addtip] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL
GO
UPDATE [dbo].[e_article] SET [addtip] =''
GO
alter table [dbo].[mvc_info] ADD [iscms] [tinyint] NULL 
GO
UPDATE [dbo].[mvc_info] SET [iscms] =0
GO
if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[e_cmsset]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
CREATE TABLE [dbo].[e_cmsset] (
    [id] [int] IDENTITY (1, 1) NOT NULL ,
	[cmstype] [tinyint] NULL ,
	[cataurl] [varchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[cataurl2] [varchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[posturl] [varchar] (150) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO
if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PK_e_cmsset]') and OBJECTPROPERTY(id, N'IsPrimaryKey') = 1)
BEGIN
ALTER TABLE [dbo].[e_cmsset] WITH NOCHECK ADD 
	CONSTRAINT [PK_e_cmsset] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
END
GO
exec sp_rename 'dbo.e_setting.isfloat','iscms','column' 
GO
exec sp_rename 'dbo.e_setting.run_type','mwidth','column' 
GO
alter table [dbo].[e_setting] alter column  mwidth [int]  NULL
GO
UPDATE [dbo].[e_setting] SET [mwidth]= 1078
GO
INSERT [dbo].[mvc_adminmenu] ([id], [classname], [classen], [classdes], [parentid], [depth], [parentpath], [sortid], [isrefer], [referurl]) VALUES (105, N'新闻同步设置', convert(text, N'' collate Chinese_PRC_CI_AS), N'', 3, 1, convert(text, N'0.3.105.' collate Chinese_PRC_CI_AS),4, 1, convert(text, N'CmsSetup.aspx' collate Chinese_PRC_CI_AS))
GO
GO
UPDATE [dbo].[mvc_adminjb] SET [menus]='3,77,4,5,12,78,79,82,89,53,73,75,80,74,76,81,83,84,85,68,72,69,57,58,90,91,92,93,94,99,95,96,97,98,101' WHERE id=1
GO
if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mvc_userweixin]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
CREATE TABLE [dbo].[mvc_userweixin] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[userid] [int] NULL ,
	[openid] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[nickname][nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[sex] [tinyint] NULL ,
	[city] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[province] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[country] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[headimgurl] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[privilege] [varchar] (300) COLLATE Chinese_PRC_CI_AS NULL ,
	[unionid] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]  
GO
if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PK_mvc_userweixin]') and OBJECTPROPERTY(id, N'IsPrimaryKey') = 1)
BEGIN
ALTER TABLE [dbo].[mvc_userweixin] WITH NOCHECK ADD 
	CONSTRAINT [PK_mvc_userweixin] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
END
GO
if not  exists(select * from sysindexes where name='mvc_userweixin_userid')
 CREATE  INDEX [mvc_userweixin_userid] ON [dbo].[mvc_userweixin]([userid]) ON [PRIMARY]
GO
alter table [dbo].[e_order] ADD [zonger] [decimal](10,2) NULL ,[payway] [tinyint]  NULL
GO
UPDATE [dbo].[e_order] SET [payway]=2 ,[zonger] =b.pfee from  [dbo].[e_order] as a,[dbo].[e_package] as b where a.packageid=b.id
GO
/******  2018-3-13更新 ******/
if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[e_fapiao]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
CREATE TABLE [dbo].[e_fapiao] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[userid] [int] NULL ,
	[orderid] [int] NULL ,
	[companyname][nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[shuihao] [varchar] (32) COLLATE Chinese_PRC_CI_AS NULL ,
	[contact] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[address] [nvarchar] (120) COLLATE Chinese_PRC_CI_AS NULL ,
	[mobile] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[remark] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[addtime] [datetime] NULL 
) ON [PRIMARY]  
GO
if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PK_e_fapiao]') and OBJECTPROPERTY(id, N'IsPrimaryKey') = 1)
BEGIN
ALTER TABLE [dbo].[e_fapiao] WITH NOCHECK ADD 
	CONSTRAINT [PK_e_fapiao] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
END
GO
if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mvc_log]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
CREATE TABLE [dbo].[mvc_log] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[logtype] [tinyint] NULL ,
	[logjb] [tinyint] NULL ,
	[username] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[cururl] [varchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[fromurl] [varchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[logcon] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[logip] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
	[addtime] [datetime] NULL 
) ON [PRIMARY]  
GO
if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PK_mvc_log]') and OBJECTPROPERTY(id, N'IsPrimaryKey') = 1)
BEGIN
ALTER TABLE [dbo].[mvc_log] WITH NOCHECK ADD 
	CONSTRAINT [PK_mvc_log] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
END
GO

if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[e_card]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
CREATE TABLE [dbo].[e_card] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[cardnum] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[cardfee] [decimal](8,2) NULL ,
	[orderid] [int] NULL 
) ON [PRIMARY]  
GO