You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
629 lines
26 KiB
629 lines
26 KiB
1 month ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Threading.Tasks;
|
||
|
|
||
|
using MySql.Data.MySqlClient;
|
||
|
|
||
|
namespace bill_statistics
|
||
|
{
|
||
|
public static class BillSqlBuilder
|
||
|
{
|
||
|
public static void SqlAddOneType(int indexInLogLine, string onelog, ref string sql, ref string strindex)
|
||
|
{
|
||
|
string[] split = onelog.Split('=');
|
||
|
if (split.Length < 1)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
string colName = split[0];
|
||
|
char colType = colName[0];
|
||
|
colName = colName.Substring(1);
|
||
|
|
||
|
if (colName.Length < 1)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
string onecolstr = null;
|
||
|
|
||
|
if (colType == 'i')
|
||
|
{
|
||
|
onecolstr = string.Format("{0} int NOT NULL default 0,", colName);
|
||
|
}
|
||
|
if (colType == 'I')
|
||
|
{
|
||
|
onecolstr = string.Format("{0} bigint NOT NULL default 0,", colName);
|
||
|
}
|
||
|
|
||
|
if (colType == 's')
|
||
|
{
|
||
|
onecolstr = string.Format("{0} varchar(20) NOT NULL default '',", colName);
|
||
|
}
|
||
|
|
||
|
if (onecolstr != null)
|
||
|
{
|
||
|
sql += onecolstr;
|
||
|
|
||
|
if (colName == "uid")
|
||
|
{
|
||
|
strindex += string.Format(",index ({0})", colName);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
public static string GenCreateTableSql(string[] splitStr, int billType, string tableName)
|
||
|
{
|
||
|
string sql = "CREATE TABLE IF NOT EXISTS " + tableName + " (";
|
||
|
sql += "time datetime NOT NULL,";
|
||
|
sql += "Type int NOT NULL,";
|
||
|
|
||
|
string strkeyindex = "index (time),index (Type)";
|
||
|
|
||
|
//在线日志,直接时间作为key
|
||
|
if (billType == 3001)
|
||
|
{
|
||
|
strkeyindex = "primary key(time)," + strkeyindex;
|
||
|
}
|
||
|
|
||
|
for (int i = 2; i < splitStr.Length; i++)
|
||
|
{
|
||
|
SqlAddOneType(i, splitStr[i], ref sql, ref strkeyindex);
|
||
|
}
|
||
|
|
||
|
sql += strkeyindex;
|
||
|
|
||
|
sql = sql + ") ENGINE=InnoDB DEFAULT CHARSET=utf8;\n";
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
public static string GenInsertTableSql(string[] splitStr, string tableName, List<MySqlParameter> paramList)
|
||
|
{
|
||
|
string sql = string.Format("insert into {0} set time='{1}'", tableName, splitStr[0]);
|
||
|
|
||
|
for (int i = 1; i < splitStr.Length; i++)
|
||
|
{
|
||
|
string[] split = splitStr[i].Split('=');
|
||
|
if (split.Length < 1)
|
||
|
{
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
string colName = split[0];
|
||
|
char colType = colName[0];
|
||
|
colName = colName.Substring(1);
|
||
|
if (colName.Length < 1)
|
||
|
{
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
string value = "";
|
||
|
if (split.Length > 1 && string.IsNullOrEmpty(split[1]) == false)
|
||
|
{
|
||
|
value = split[1];
|
||
|
}
|
||
|
|
||
|
if (i > 0)
|
||
|
{
|
||
|
sql += ",";
|
||
|
}
|
||
|
|
||
|
string colParam = "?" + colName;
|
||
|
|
||
|
sql += string.Format("{0}={1}", colName, colParam);
|
||
|
|
||
|
MySqlParameter p_param = null;
|
||
|
|
||
|
if (colType == 'i')
|
||
|
{
|
||
|
int iValue = 0;
|
||
|
int.TryParse(value, out iValue);
|
||
|
|
||
|
p_param = new MySqlParameter(colParam, MySqlDbType.Int32) { Value = iValue };
|
||
|
}
|
||
|
if (colType == 'I')
|
||
|
{
|
||
|
long lValue = 0;
|
||
|
long.TryParse(value, out lValue);
|
||
|
|
||
|
p_param = new MySqlParameter(colParam, MySqlDbType.Int64) { Value = lValue };
|
||
|
}
|
||
|
|
||
|
if (colType == 's')
|
||
|
{
|
||
|
p_param = new MySqlParameter(colParam, MySqlDbType.VarChar, 255) { Value = value };
|
||
|
}
|
||
|
|
||
|
if (p_param != null)
|
||
|
{
|
||
|
paramList.Add(p_param);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
sql += ";";
|
||
|
// Console.WriteLine(sql);
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
public static string GenSelectOnlineByTime(string timeinlog)
|
||
|
{
|
||
|
string sql = string.Format("select * from bill_3001 where time='{0}'", timeinlog);
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
|
||
|
public static string GenCreateTableActiveUserNewSql(string tableName)
|
||
|
{
|
||
|
string sql = "CREATE TABLE IF NOT EXISTS " + tableName + " (";
|
||
|
sql += "`dateId` datetime NOT NULL,`newAddU` int not null,";
|
||
|
sql += "`retentionU_1` int not null,";
|
||
|
sql += "`retentionU_2` int not null,";
|
||
|
sql += "`retentionU_3` int not null,";
|
||
|
sql += "`retentionU_4` int not null,";
|
||
|
sql += "`retentionU_5` int not null,";
|
||
|
sql += "`retentionU_6` int not null,";
|
||
|
sql += "`retentionU_7` int not null,";
|
||
|
sql += "`retentionU_15` int not null,";
|
||
|
sql += "`retentionU_30` int not null,";
|
||
|
sql += "primary key (dateId)";
|
||
|
sql = sql + ") ENGINE=InnoDB DEFAULT CHARSET=utf8;\n";
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
public static string GenInsertTableActiveUserNewSql(string tableName, ActiveData_userNewAdd data)
|
||
|
{
|
||
|
string sql = string.Format("replace into {0}(dateId,newAddU,retentionU_1,retentionU_2,retentionU_3,retentionU_4,retentionU_5,retentionU_6,retentionU_7,retentionU_15,retentionU_30) values('{1}',{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}) "
|
||
|
, tableName
|
||
|
, data.dateId.ToString("u").Substring(0, 10)
|
||
|
, data.newAddU
|
||
|
, data.retentionU_1
|
||
|
, data.retentionU_2
|
||
|
, data.retentionU_3
|
||
|
, data.retentionU_4
|
||
|
, data.retentionU_5
|
||
|
, data.retentionU_6
|
||
|
, data.retentionU_7
|
||
|
, data.retentionU_15
|
||
|
, data.retentionU_30
|
||
|
);
|
||
|
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
public static string GenCreateTableActiveUserSql(string tableName)
|
||
|
{
|
||
|
string sql = "CREATE TABLE IF NOT EXISTS " + tableName + " (";
|
||
|
sql += "`dateId` datetime NOT NULL,";
|
||
|
sql += "`newU` int not null,"; //新用户
|
||
|
sql += "`oldU` int not null,"; //老用户
|
||
|
sql += "`dayActU` int not null,"; //日活跃用户
|
||
|
sql += "`retentionU_1` int not null,";
|
||
|
sql += "`retentionU_2` int not null,";
|
||
|
sql += "`retentionU_3` int not null,";
|
||
|
sql += "`retentionU_4` int not null,";
|
||
|
sql += "`retentionU_5` int not null,";
|
||
|
sql += "`retentionU_6` int not null,";
|
||
|
sql += "`retentionU_7` int not null,";
|
||
|
sql += "`retentionU_15` int not null,";
|
||
|
sql += "`retentionU_30` int not null,";
|
||
|
sql += "primary key (dateId)";
|
||
|
sql = sql + ") ENGINE=InnoDB DEFAULT CHARSET=utf8;\n";
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
public static string GenInsertTableActiveUserSql(string tableName, ActiveData_userActive data)
|
||
|
{
|
||
|
string sql = string.Format("replace into {0}(dateId,newU,oldU,dayActU,retentionU_1,retentionU_2,retentionU_3,retentionU_4,retentionU_5,retentionU_6,retentionU_7,retentionU_15,retentionU_30) values('{1}',{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13}) "
|
||
|
, tableName
|
||
|
, data.dateId.ToString("u").Substring(0, 10)
|
||
|
, data.newU
|
||
|
, data.oldU
|
||
|
, data.dayActU
|
||
|
, data.retentionU_1
|
||
|
, data.retentionU_2
|
||
|
, data.retentionU_3
|
||
|
, data.retentionU_4
|
||
|
, data.retentionU_5
|
||
|
, data.retentionU_6
|
||
|
, data.retentionU_7
|
||
|
, data.retentionU_15
|
||
|
, data.retentionU_30
|
||
|
);
|
||
|
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
public static string GenCreateTablePaymentSql(string tableName)
|
||
|
{
|
||
|
string sql = "CREATE TABLE IF NOT EXISTS " + tableName + " (";
|
||
|
sql += "`dateId` datetime NOT NULL,";
|
||
|
sql += "`dayIncome` bigint not null,"; //
|
||
|
sql += "`dayPayPeopleN` int not null,"; //
|
||
|
sql += "`dayArppu` float not null,"; //
|
||
|
sql += "`dayArpu` float not null,"; //
|
||
|
sql += "`dayPayPerm` float not null,";
|
||
|
sql += "`dayPayTimes` int not null,";
|
||
|
sql += "`monIncome` bigint not null,";
|
||
|
sql += "`monPayPeopleN` int not null,";
|
||
|
sql += "`monArppu` float not null,";
|
||
|
sql += "`monArpu` float not null,";
|
||
|
sql += "`monPayPerm` float not null,";
|
||
|
sql += "`retentionP_1` int not null,";
|
||
|
sql += "`retentionP_2` int not null,";
|
||
|
sql += "`retentionP_3` int not null,";
|
||
|
sql += "`retentionP_4` int not null,";
|
||
|
sql += "`retentionP_5` int not null,";
|
||
|
sql += "`retentionP_6` int not null,";
|
||
|
sql += "`retentionP_7` int not null,";
|
||
|
sql += "`retentionP_15` int not null,";
|
||
|
sql += "`retentionP_30` int not null,";
|
||
|
sql += "primary key (dateId)";
|
||
|
sql = sql + ") ENGINE=InnoDB DEFAULT CHARSET=utf8;\n";
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
public static string GenInsertTablePaymentSql(string tableName, IncomeData_daily data)
|
||
|
{
|
||
|
string sql = string.Format(@"replace into {0}(dateId,dayIncome,dayPayPeopleN,dayArppu,dayArpu,dayPayPerm,dayPayTimes,monIncome,monPayPeopleN,monArppu,monArpu,monPayPerm
|
||
|
,retentionP_1,retentionP_2,retentionP_3,retentionP_4,retentionP_5,retentionP_6,retentionP_7,retentionP_15,retentionP_30)
|
||
|
values('{1}',{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21}) "
|
||
|
, tableName
|
||
|
, data.dateId.ToString("u").Substring(0, 10)
|
||
|
, data.dayIncome
|
||
|
, data.dayPayPeopleN
|
||
|
, data.dayArppu
|
||
|
, data.dayArpu
|
||
|
, data.dayPayPerm
|
||
|
, data.dayPayTimes
|
||
|
, data.monIncome
|
||
|
, data.monPayPeopleN
|
||
|
, data.monArppu
|
||
|
, data.monArpu
|
||
|
, data.monPayPerm
|
||
|
, data.retentionP_1
|
||
|
, data.retentionP_2
|
||
|
, data.retentionP_3
|
||
|
, data.retentionP_4
|
||
|
, data.retentionP_5
|
||
|
, data.retentionP_6
|
||
|
, data.retentionP_7
|
||
|
, data.retentionP_15
|
||
|
, data.retentionP_30
|
||
|
);
|
||
|
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
|
||
|
public static string GenCreateTableCouponsql(string tableName)
|
||
|
{
|
||
|
string sql = "CREATE TABLE IF NOT EXISTS " + tableName + " (";
|
||
|
sql += "`dateId` datetime NOT NULL,";
|
||
|
sql += "`uid` int not null,"; //
|
||
|
sql += "`nick` varchar(100) not null,"; //
|
||
|
sql += "`itemid` int not null,"; //
|
||
|
sql += "`uniqueID` bigint not null,";
|
||
|
sql += "`phoneCardMoney` int not null,";
|
||
|
sql += "`transactionId` varchar(100) not null,";
|
||
|
sql += "`trueName` varchar(100) not null,";
|
||
|
sql += "`phoneNum` varchar(100) not null,";
|
||
|
sql += "`telcom` varchar(100) not null,";
|
||
|
sql += "`email` varchar(100) not null,";
|
||
|
sql += "primary key (dateId,uid,transactionId)";
|
||
|
sql = sql + ") ENGINE=InnoDB DEFAULT CHARSET=utf8;\n";
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
public static string GenInsertTableCouponSql(string tableName, Coupon_Info data, List<MySqlParameter> paramList)
|
||
|
{
|
||
|
string sql = string.Format(@"replace into {0}(dateId,uid,nick,itemid,uniqueID,phoneCardMoney,transactionId,trueName,phoneNum,telcom,email)
|
||
|
values('{1}',{2},?nick,{3},{4},{5},'{6}',?trueName,'{7}',?telcom,?email) "
|
||
|
, tableName
|
||
|
, data.dateId.ToString("u").Substring(0, 19)
|
||
|
, data.uid
|
||
|
|
||
|
, data.itemid
|
||
|
, data.uniqueID
|
||
|
, data.phoneCardMoney
|
||
|
, data.transactionId
|
||
|
|
||
|
, data.phoneNum
|
||
|
|
||
|
|
||
|
);
|
||
|
|
||
|
MySqlParameter p_nick = new MySqlParameter("?nick", MySqlDbType.VarChar, 100) { Value = data.nick };
|
||
|
paramList.Add(p_nick);
|
||
|
|
||
|
MySqlParameter p_trueName = new MySqlParameter("?trueName", MySqlDbType.VarChar, 100) { Value = data.trueName };
|
||
|
paramList.Add(p_trueName);
|
||
|
|
||
|
MySqlParameter p_email = new MySqlParameter("?email", MySqlDbType.VarChar, 100) { Value = data.email };
|
||
|
paramList.Add(p_email);
|
||
|
|
||
|
MySqlParameter p_telcom = new MySqlParameter("?telcom", MySqlDbType.VarChar, 100) { Value = data.telcom };
|
||
|
paramList.Add(p_telcom);
|
||
|
|
||
|
//Trace.Trace("asdfasdfasdfasdf");
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
|
||
|
public static string GenCreateTableNewUserRechargeSql(string tableName)
|
||
|
{
|
||
|
string sql = "CREATE TABLE IF NOT EXISTS " + tableName + " (";
|
||
|
sql += "`dateId` datetime NOT NULL,";
|
||
|
sql += "`m_newUser` int not null,"; //
|
||
|
sql += "`m_newUserRechargeMoney1` float not null,"; //
|
||
|
sql += "`m_newUserRechargeCount1` bigint not null,"; //
|
||
|
sql += "`m_newUserRechargeMoney2` float not null,";
|
||
|
sql += "`m_newUserRechargeCount2` bigint not null,";
|
||
|
sql += "`m_newUserRechargeMoney7` float not null,";
|
||
|
sql += "`m_newUserRechargeCount7` bigint not null,";
|
||
|
sql += "`m_newUserRechargeMoney30` float not null,";
|
||
|
sql += "`m_newUserRechargeCount30` bigint not null,";
|
||
|
sql += "primary key (dateId)";
|
||
|
sql = sql + ") ENGINE=InnoDB DEFAULT CHARSET=utf8;\n";
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
public static string GenInsertTableNewUserRechargeSql(string tableName, NewUserRecharge_Info data)
|
||
|
{
|
||
|
string sql = string.Format(@"replace into {0}(dateId,m_newUser,m_newUserRechargeMoney1,m_newUserRechargeCount1,m_newUserRechargeMoney2,m_newUserRechargeCount2,m_newUserRechargeMoney7,m_newUserRechargeCount7,m_newUserRechargeMoney30,m_newUserRechargeCount30)
|
||
|
values('{1}',{2},{3},{4},{5},{6},{7},{8},{9},{10}) "
|
||
|
, tableName
|
||
|
, data.dateId.ToString("u").Substring(0, 10)
|
||
|
, data.m_newUser
|
||
|
, data.m_newUserRechargeMoney1
|
||
|
, data.m_newUserRechargeCount1
|
||
|
, data.m_newUserRechargeMoney2
|
||
|
, data.m_newUserRechargeCount2
|
||
|
, data.m_newUserRechargeMoney7
|
||
|
, data.m_newUserRechargeCount7
|
||
|
, data.m_newUserRechargeMoney30
|
||
|
, data.m_newUserRechargeCount30
|
||
|
);
|
||
|
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
public static string GenCreateTablePrintTreasureDrawSql(string tableName)
|
||
|
{
|
||
|
string sql = "CREATE TABLE IF NOT EXISTS " + tableName + " (";
|
||
|
sql += "`dateId` datetime NOT NULL,";
|
||
|
sql += "`m_treasureUser` bigint not null,"; //
|
||
|
sql += "`TreasureDrawConsume` bigint not null,"; //
|
||
|
sql += "`m_treasureItemDrawCount1` int not null,"; //
|
||
|
sql += "`m_treasureItemDrawUserCount1` int not null,";
|
||
|
sql += "`m_treasureItemDrawCount2` int not null,";
|
||
|
sql += "`m_treasureItemDrawUserCount2` int not null,";
|
||
|
sql += "`m_treasureItemDrawCount3` int not null,";
|
||
|
sql += "`m_treasureItemDrawUserCount3` int not null,";
|
||
|
sql += "`m_treasureItemDrawCount4` int not null,";
|
||
|
sql += "`m_treasureItemDrawUserCount4` int not null,";
|
||
|
sql += "`m_treasureItemDrawCount5` int not null,";
|
||
|
sql += "`m_treasureItemDrawUserCount5` int not null,";
|
||
|
sql += "`m_treasureItemDrawCount6` int not null,";
|
||
|
sql += "`m_treasureItemDrawUserCount6` int not null,";
|
||
|
sql += "`m_treasureItemDrawCount7` int not null,";
|
||
|
sql += "`m_treasureItemDrawUserCount7` int not null,";
|
||
|
sql += "`m_treasureItemDrawCount8` int not null,";
|
||
|
sql += "`m_treasureItemDrawUserCount8` int not null,";
|
||
|
sql += "`m_treasureItemDrawCount9` int not null,";
|
||
|
sql += "`m_treasureItemDrawUserCount9` int not null,";
|
||
|
sql += "primary key (dateId)";
|
||
|
sql = sql + ") ENGINE=InnoDB DEFAULT CHARSET=utf8;\n";
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
public static string GenInsertTablePrintTreasureDrawSql(string tableName, PrintTreasureDraw_Info data)
|
||
|
{
|
||
|
string sql = string.Format(@"replace into {0}(dateId,m_treasureUser,TreasureDrawConsume,m_treasureItemDrawCount1,m_treasureItemDrawUserCount1,m_treasureItemDrawCount2,m_treasureItemDrawUserCount2,m_treasureItemDrawCount3,m_treasureItemDrawUserCount3,m_treasureItemDrawCount4,m_treasureItemDrawUserCount4,m_treasureItemDrawCount5,m_treasureItemDrawUserCount5,m_treasureItemDrawCount6,m_treasureItemDrawUserCount6,m_treasureItemDrawCount7,m_treasureItemDrawUserCount7,m_treasureItemDrawCount8,m_treasureItemDrawUserCount8,m_treasureItemDrawCount9,m_treasureItemDrawUserCount9)
|
||
|
values('{1}',{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21}) "
|
||
|
, tableName
|
||
|
, data.dateId.ToString("u").Substring(0, 10)
|
||
|
, data.m_treasureUser
|
||
|
, data.TreasureDrawConsume
|
||
|
, data.m_treasureItemDrawCount1
|
||
|
, data.m_treasureItemDrawUserCount1
|
||
|
, data.m_treasureItemDrawCount2
|
||
|
, data.m_treasureItemDrawUserCount2
|
||
|
, data.m_treasureItemDrawCount3
|
||
|
, data.m_treasureItemDrawUserCount3
|
||
|
, data.m_treasureItemDrawCount4
|
||
|
, data.m_treasureItemDrawUserCount4
|
||
|
, data.m_treasureItemDrawCount5
|
||
|
, data.m_treasureItemDrawUserCount5
|
||
|
, data.m_treasureItemDrawCount6
|
||
|
, data.m_treasureItemDrawUserCount6
|
||
|
, data.m_treasureItemDrawCount7
|
||
|
, data.m_treasureItemDrawUserCount7
|
||
|
, data.m_treasureItemDrawCount8
|
||
|
, data.m_treasureItemDrawUserCount8
|
||
|
, data.m_treasureItemDrawCount9
|
||
|
, data.m_treasureItemDrawUserCount9
|
||
|
);
|
||
|
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
public static string GenCreateTablePrintChipDiamondSql(string tableName)
|
||
|
{
|
||
|
string sql = "CREATE TABLE IF NOT EXISTS " + tableName + " (";
|
||
|
sql += "`dateId` datetime NOT NULL,";
|
||
|
sql += "`ChipGet` bigint not null,"; //
|
||
|
sql += "`ChipConsume` bigint not null,"; //
|
||
|
sql += "`getChipMail` bigint not null,"; //
|
||
|
sql += "`getChipInviteSns` bigint not null,";
|
||
|
sql += "`getChipBroken` bigint not null,";
|
||
|
sql += "`getChipSign` bigint not null,";
|
||
|
sql += "`getChipOnline` bigint not null,";
|
||
|
sql += "`getChipDiamond` bigint not null,";
|
||
|
sql += "`getChipPay` bigint not null,";
|
||
|
sql += "`guessCardWin` bigint not null,";
|
||
|
sql += "`getChipActivity` bigint not null,";
|
||
|
sql += "`getChipShareFB` bigint not null,";
|
||
|
sql += "`getChipFriendRank` bigint not null,";
|
||
|
sql += "`PlayerWinRobot` bigint not null,";
|
||
|
sql += "`RobotWinPlayer` bigint not null,";
|
||
|
sql += "`GuessCardBet` bigint not null,";
|
||
|
sql += "`MatchEntryFee` bigint not null,";
|
||
|
sql += "`DeskFee` bigint not null,";
|
||
|
sql += "`TreasureDrawConsume` bigint not null,";
|
||
|
sql += "`DiamondGet` bigint not null,";
|
||
|
sql += "`DiamondConsume` bigint not null,";
|
||
|
sql += "`getDiamondPay` bigint not null,";
|
||
|
sql += "`getDiamondMail` bigint not null,";
|
||
|
sql += "`getDiamondGm` bigint not null,";
|
||
|
sql += "`newUserChipGet` bigint not null,";
|
||
|
sql += "`newUserChipConsume` bigint not null,";
|
||
|
sql += "`GetItemMail` bigint not null,";
|
||
|
sql += "`InviteSnsFriendAward` bigint not null,";
|
||
|
sql += "`GetOnlineReward` bigint not null,";
|
||
|
sql += "`GetSignReward` bigint not null,";
|
||
|
sql += "`GetBrokeGrants` bigint not null,";
|
||
|
sql += "`GuessCardAward` bigint not null,";
|
||
|
sql += "`newUserGuessCardBet` bigint not null,";
|
||
|
sql += "primary key (dateId)";
|
||
|
sql = sql + ") ENGINE=InnoDB DEFAULT CHARSET=utf8;\n";
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
public static string GenInsertTablePrintChipDiamondSql(string tableName, PrintChipDiamond_Info data)
|
||
|
{
|
||
|
//string sqltest = "";
|
||
|
//sqltest += "set ChipGet=" + data.ChipGet.ToString();
|
||
|
string sql = string.Format(@"replace into {0}(dateId,ChipGet,ChipConsume,getChipMail,getChipInviteSns,getChipBroken,getChipSign,
|
||
|
getChipOnline,getChipDiamond,getChipPay,guessCardWin,getChipActivity,getChipShareFB,getChipFriendRank,PlayerWinRobot,RobotWinPlayer,GuessCardBet,
|
||
|
MatchEntryFee,DeskFee,TreasureDrawConsume,DiamondGet,DiamondConsume,getDiamondPay,getDiamondMail,getDiamondGm,newUserChipGet,newUserChipConsume,
|
||
|
GetItemMail,InviteSnsFriendAward,GetOnlineReward,GetSignReward,GetBrokeGrants,GuessCardAward,newUserGuessCardBet)
|
||
|
values('{1}',{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25},{26},{27},{28},{29},{30},{31},{32},{33},{34}) "
|
||
|
, tableName
|
||
|
, data.dateId.ToString("u").Substring(0, 10)
|
||
|
, data.ChipGet
|
||
|
, data.ChipConsume
|
||
|
, data.getChipMail
|
||
|
, data.getChipInviteSns
|
||
|
, data.getChipBroken
|
||
|
, data.getChipSign
|
||
|
, data.getChipOnline
|
||
|
, data.getChipDiamond
|
||
|
, data.getChipPay
|
||
|
, data.guessCardWin
|
||
|
, data.getChipActivity
|
||
|
, data.getChipShareFB
|
||
|
, data.getChipFriendRank
|
||
|
, data.PlayerWinRobot
|
||
|
, data.RobotWinPlayer
|
||
|
, 0
|
||
|
, 0
|
||
|
, 0
|
||
|
, data.TreasureDrawConsume
|
||
|
, data.DiamondGet
|
||
|
, data.DiamondConsume
|
||
|
, data.getDiamondPay
|
||
|
, data.getDiamondMail
|
||
|
, data.getDiamondGm
|
||
|
, data.newUserChipGet
|
||
|
, data.newUserChipConsume
|
||
|
, data.GetItemMail
|
||
|
, data.InviteSnsFriendAward
|
||
|
, data.GetOnlineReward
|
||
|
, data.GetSignReward
|
||
|
, data.GetBrokeGrants
|
||
|
, data.GuessCardAward
|
||
|
, data.newUserGuessCardBet
|
||
|
);
|
||
|
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
|
||
|
public static string GenCreateTablePrintChipDiamondRangeSql(string tableName)
|
||
|
{
|
||
|
string sql = "CREATE TABLE IF NOT EXISTS " + tableName + " (";
|
||
|
sql += "`dateId` datetime NOT NULL,";
|
||
|
sql += "`ActiveUser` int not null,"; //
|
||
|
sql += "`GetUserTotalChip` bigint not null,"; //
|
||
|
sql += "`GetChipRangeUserCount1` int not null,"; //
|
||
|
sql += "`GetChipRangeUserCount2` int not null,";
|
||
|
sql += "`GetChipRangeUserCount3` int not null,";
|
||
|
sql += "`GetChipRangeUserCount4` int not null,";
|
||
|
sql += "`GetChipRangeUserCount5` int not null,";
|
||
|
sql += "`GetChipRangeUserCount6` int not null,";
|
||
|
sql += "`GetChipRangeUserCount7` int not null,";
|
||
|
sql += "`GetChipRangeUserCount8` int not null,";
|
||
|
sql += "`GetChipRangeUserCount9` int not null,";
|
||
|
sql += "`GetChipRangeUserCount10` int not null,";
|
||
|
sql += "`GetChipRangeUserCount11` int not null,";
|
||
|
sql += "`GetChipRangeUserCount12` int not null,";
|
||
|
sql += "`GetDiamondRangeUserCount1` int not null,";
|
||
|
sql += "`GetDiamondRangeUserCount2` int not null,";
|
||
|
sql += "`GetDiamondRangeUserCount3` int not null,";
|
||
|
sql += "`GetDiamondRangeUserCount4` int not null,";
|
||
|
sql += "`GetDiamondRangeUserCount5` int not null,";
|
||
|
sql += "primary key (dateId)";
|
||
|
sql = sql + ") ENGINE=InnoDB DEFAULT CHARSET=utf8;\n";
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
public static string GenInsertTablePrintChipDiamondRangeSql(string tableName, PrintChipDiamondRange_Info data)
|
||
|
{
|
||
|
string sql = string.Format(@"replace into {0}(dateId,ActiveUser,GetUserTotalChip,GetChipRangeUserCount1,GetChipRangeUserCount2,
|
||
|
GetChipRangeUserCount3,GetChipRangeUserCount4,GetChipRangeUserCount5,GetChipRangeUserCount6,GetChipRangeUserCount7,
|
||
|
GetChipRangeUserCount8,GetChipRangeUserCount9,GetChipRangeUserCount10,GetChipRangeUserCount11,GetChipRangeUserCount12,
|
||
|
GetDiamondRangeUserCount1,GetDiamondRangeUserCount2,GetDiamondRangeUserCount3,GetDiamondRangeUserCount4,GetDiamondRangeUserCount5)
|
||
|
values('{1}',{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20}) "
|
||
|
, tableName
|
||
|
, data.dateId.ToString("u").Substring(0, 10)
|
||
|
, data.ActiveUser
|
||
|
, data.GetUserTotalChipp
|
||
|
, data.GetChipRangeUserCount1
|
||
|
, data.GetChipRangeUserCount2
|
||
|
, data.GetChipRangeUserCount3
|
||
|
, data.GetChipRangeUserCount4
|
||
|
, data.GetChipRangeUserCount5
|
||
|
, data.GetChipRangeUserCount6
|
||
|
, data.GetChipRangeUserCount7
|
||
|
, data.GetChipRangeUserCount8
|
||
|
, data.GetChipRangeUserCount9
|
||
|
, data.GetChipRangeUserCount10
|
||
|
, data.GetChipRangeUserCount11
|
||
|
, data.GetChipRangeUserCount12
|
||
|
, data.GetDiamondRangeUserCount1
|
||
|
, data.GetDiamondRangeUserCount2
|
||
|
, data.GetDiamondRangeUserCount3
|
||
|
, data.GetDiamondRangeUserCount4
|
||
|
, data.GetDiamondRangeUserCount5
|
||
|
);
|
||
|
|
||
|
|
||
|
return sql;
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|