/// <summary> /// 加博币 /// </summary> /// <param name="_id">用户ID</param> /// <param name="_points">博币</param> public void AddPoints(string _id, int _points) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = "id=" + _id; _doh.Add("jcms_normal_user", "Points", _points); } }
/// <summary> /// 增加标签点击数 /// </summary> /// <param name="_channelid"></param> /// <param name="_tagname"></param> public void AddClickTimes(string _channelid, string _tagname) { if (_tagname.Length == 0) return; using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = "Title=@Title and ChannelId=" + _channelid; _doh.AddConditionParameter("@Title", _tagname); _doh.Add("jcms_normal_tag", "ClickTimes"); } }
public int Register(string _username, string _nickname, string _userpass, bool isMD5Passwd, int _sex, string _email, string _birthday, string _usersign, string _adminname, string _adminpass, string _oauth_code, string _oauth_token) { if (_oauth_code == "") _oauth_code = "tencent"; if (Exists(string.Format("username='******'", _username))) return 0; using (DbOperHandler _doh = new Common().Doh()) { string _md5pass = isMD5Passwd ? _userpass : JumboTCMS.Utils.MD5.Lower32(_userpass); string _md5pass2 = isMD5Passwd ? _adminpass : JumboTCMS.Utils.MD5.Lower32(_adminpass); int dPoints = Str2Int(JumboTCMS.Utils.XmlCOM.ReadConfig("~/_data/config/site", "DefaultPoints"), 0); int uState = site.CheckReg ? 0 : 1; object[,] addFields = new object[2, 19] { { "UserName", "NickName", "UserPass", "Sex", "Email", "Birthday", "Group", "Points", "Login", "State", "AdminId", "Setting", "UserSign", "AdminState", "IsVIP", "Integral","RegTime", "RegIp","Token_"+_oauth_code}, { _username, _nickname, _md5pass, _sex,_email, _birthday, 1, dPoints, 0, uState,0, ",,", _usersign, 0,0, 0, DateTime.Now.ToString(),IPHelp.ClientIP,_oauth_token} }; _doh.Reset(); _doh.AddFieldItems(addFields); int _uID = _doh.Insert("jcms_normal_user"); #region 复制头像 JumboTCMS.Utils.DirFile.CopyFile("~/_data/avatar/0_l.jpg", "~/_data/avatar/" + _uID + "_l.jpg", true); JumboTCMS.Utils.DirFile.CopyFile("~/_data/avatar/0_m.jpg", "~/_data/avatar/" + _uID + "_m.jpg", true); JumboTCMS.Utils.DirFile.CopyFile("~/_data/avatar/0_s.jpg", "~/_data/avatar/" + _uID + "_s.jpg", true); #endregion #region 同步升级为管理员 if (_adminname.Length > 0 && _adminpass.Length > 0) { _doh.Reset(); _doh.ConditionExpress = "id=" + _uID; _doh.AddFieldItem("State", 1); _doh.AddFieldItem("AdminState", 1); _doh.AddFieldItem("AdminId", _uID); _doh.AddFieldItem("AdminName", _adminname); _doh.AddFieldItem("AdminPass", _md5pass2); _doh.AddFieldItem("Group", site.AdminGroupId); _doh.Update("jcms_normal_user"); _doh.Reset(); _doh.ConditionExpress = "id=" + site.AdminGroupId; _doh.Add("jcms_normal_usergroup", "UserTotal"); } else { _doh.Reset(); _doh.ConditionExpress = "id=1"; _doh.Add("jcms_normal_usergroup", "UserTotal"); } #endregion #region 论坛同步注册 if (site.ForumAPIKey != "") { string _ForumAutoRegister = JumboTCMS.Utils.XmlCOM.ReadConfig("~/_data/config/site", "ForumAutoRegister"); if (_ForumAutoRegister == "true")//表示自动注册论坛用户 { JumboTCMS.API.Discuz.Toolkit.DiscuzSession ds = JumboTCMS.API.Discuz.DiscuzSessionHelper.GetSession(); int _userid = ds.Register(_username, _userpass, _email, isMD5Passwd); if (_userid > 0) { //注册成功 _doh.Reset(); _doh.ConditionExpress = "id=" + _uID; _doh.AddFieldItem("ForumName", _username); _doh.AddFieldItem("ForumPass", _md5pass); _doh.Update("jcms_normal_user"); return _uID; } return 0; } return _uID; } #endregion return _uID; } }