public int WriteVIPLog(VIPLog model) { cmdstr = GenneralSqlFromConfig(DBCommand.WriteVIPLog); SqlParameter[] spam = { new SqlParameter("@IdentityType", model.IdentityType), new SqlParameter("@IdentityNum", model.IdentityNum), new SqlParameter("@VIPId", model.VIPId), new SqlParameter("@IPAddr", model.IPAddr) }; return(sqlhelper.ExecuteNonQuery(constr, text, cmdstr, spam)); }
public string Ext(string WebName, string type, string num, string VIPToken) { FreeVIP model = new FreeVIP(); VIPLog log = new VIPLog(); log.IdentityType = type; log.IdentityNum = num; log.IPAddr = HttpHelper.GetClientIP(); model = bll.GetVIPByWebName(log, WebName); JavaScriptSerializer js = new JavaScriptSerializer(); string content = js.Serialize(model); return(content); }
public FreeVIP GetVIPByWebName(VIPLog viplog, string WebName) { FreeVIP model = new FreeVIP(); model.errcode = 0; model.errmsg = "Everything Is Ok!"; //1.检查历史记录 string HasLog = CheckUserTimes(WebName, viplog.IdentityType, viplog.IdentityNum, viplog.IPAddr); switch (HasLog) { case "true": model = GenneralT <FreeVIP>(dal.GetNewAccount(WebName)); //获取账号 if (model == null || model.Id <= 0) { return(model); } viplog.VIPId = model.Id; dal.WriteVIPLog(viplog); //日志记录账号使用状态 if (dal.GetLogTimes(model.Id) >= int.Parse(ConfigHelper.GetSysConfigItem("AccountCanUseTimes", WebName))) //更新账号状态 { dal.UpdateAccountEnable(model.Id); } break; case "false": model.errcode = 400; model.errmsg = "今天的机会用完了,以后再来吧!"; break; default: model = GetModelById(int.Parse(HasLog)); break; } return(model); }