Beispiel #1
0
        /// <summary>
        /// 得到内容
        /// </summary>
        /// <param name="_channeltype"></param>
        /// <param name="_contentid"></param>
        /// <returns></returns>
        public Normal_Digg GetDigg(string _channeltype, string _contentid)
        {
            using (DbOperHandler _doh = new Common().Doh())
            {
                Normal_Digg digg = new Normal_Digg();
                digg.ChannelType = _channeltype;
                digg.ContentId = Str2Int(_contentid);
                _doh.Reset();
                _doh.ConditionExpress = "channeltype=@channeltype and contentid=@contentid";
                _doh.AddConditionParameter("@channeltype", _channeltype);
                _doh.AddConditionParameter("@contentid", _contentid);
                if (!_doh.Exist("jcms_normal_digg"))
                {
                    _doh.Reset();
                    _doh.AddFieldItem("ChannelType", _channeltype);
                    _doh.AddFieldItem("ContentId", _contentid);

                    _doh.AddFieldItem("DiggNum", 0);
                    _doh.Insert("jcms_normal_digg");
                }
                _doh.Reset();
                _doh.ConditionExpress = "channeltype=@channeltype and contentid=@contentid";
                _doh.AddConditionParameter("@channeltype", _channeltype);
                _doh.AddConditionParameter("@contentid", _contentid);
                digg.DiggNum = Str2Int(_doh.GetField("jcms_normal_digg", "DiggNum").ToString());
                return digg;
            }
        }
Beispiel #2
0
 /// <summary>
 /// 保存用户日志
 /// </summary>
 /// <param name="_uid">会员ID</param>
 /// <param name="_info">保存信息</param>
 /// <param name="_type">操作类型,1=分组移动,2=扣除博币,3=积分增加(2,3为系统操作),4=增加博币,5=VIP升级,6积分扣除(4,5,6为管理员操作)</param>
 public void SaveLog(string _uid, string _info, int _type)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.AddFieldItem("UserId", _uid);
         _doh.AddFieldItem("OperInfo", _info);
         _doh.AddFieldItem("OperType", _type);
         _doh.AddFieldItem("OperTime", DateTime.Now.ToString());
         _doh.AddFieldItem("OperIP", IPHelp.ClientIP);
         _doh.Insert("jcms_normal_user_logs");
     }
 }
Beispiel #3
0
 /// <summary>
 /// 加为好友,如果已经存在返回false
 /// </summary>
 /// <param name="_userid">主动方ID</param>
 /// <param name="_username">主动方name</param>
 /// <param name="_friendid">被动方ID</param>
 /// <returns></returns>
 public bool AddFriend(string _userid, string _username, string _friendid)
 {
     if (Exists(_userid, _friendid)) return false;//已经存在
     _username = _username == "" ? "user(id:" + _userid + ")" : _username;
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.AddFieldItem("FriendId", _friendid);
         _doh.AddFieldItem("UserId", _userid);
         _doh.AddFieldItem("AddDate", DateTime.Now.ToString());
         _doh.Insert("jcms_normal_user_friends");
         new JumboTCMS.DAL.Normal_UserNoticeDAL().SendNotite("加好友", "<a href=\"javascript:void(0);\" onclick=\"ShowUserPage(" + _userid + ");\">" + _username + "</a> 把你加为了好友", _friendid, "friend");
     }
     return true;
 }
Beispiel #4
0
 /// <summary>
 /// 发站内通知
 /// </summary>
 /// <param name="_Title">标题</param>
 /// <param name="_Content">内容</param>
 /// <param name="_ReceiveUserId">接收人ID,0表示所有人</param>
 /// <param name="_NoticeType">类型,比如:friend</param>
 public bool SendNotite(string _Title, string _Content, string _ReceiveUserId, string _NoticeType)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.AddFieldItem("Title", _Title);
         _doh.AddFieldItem("AddDate", DateTime.Now.ToString());
         _doh.AddFieldItem("Content", _Content);
         _doh.AddFieldItem("UserId", _ReceiveUserId);
         _doh.AddFieldItem("NoticeType", _NoticeType);
         _doh.AddFieldItem("State", 0);
         _doh.AddFieldItem("ReadTime", DateTime.Now.ToString());
         _doh.Insert("jcms_normal_user_notice");
         return true;
     }
 }
Beispiel #5
0
 /// <summary>
 ///  新增充值信息
 /// </summary>
 /// <param name="_uid"></param>
 /// <param name="_points">博币</param>
 /// <param name="_payway">如:alipay、tenpay等</param>
 /// <returns></returns>
 public string NewOrder(string _uid, int _points, string _payway)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         string _ordernum = GetProductOrderNum();//订单号
         _doh.Reset();
         _doh.AddFieldItem("UserId", _uid);
         _doh.AddFieldItem("OrderNum", _ordernum);
         _doh.AddFieldItem("Points", _points);
         _doh.AddFieldItem("State", 0);
         _doh.AddFieldItem("PaymentWay", _payway);
         _doh.AddFieldItem("OrderTime", DateTime.Now.ToString());
         _doh.AddFieldItem("OrderIP", IPHelp.ClientIP);
         _doh.Insert("jcms_normal_recharge");
         return _ordernum;
     }
 }
Beispiel #6
0
 /// <summary>
 /// 新增购物信息
 /// </summary>
 /// <param name="_goods"></param>
 /// <returns></returns>
 public int NewGoods(JumboTCMS.Entity.Normal_UserGoods _goods)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.AddFieldItem("UserId", _goods.UserId);
         _doh.AddFieldItem("OrderNum", _goods.OrderNum);
         _doh.AddFieldItem("ProductId", _goods.ProductId);
         _doh.AddFieldItem("ProductName", _goods.ProductName);
         _doh.AddFieldItem("ProductImg", _goods.ProductImg);
         _doh.AddFieldItem("ProductLink", _goods.ProductLink);
         _doh.AddFieldItem("UnitPrice", _goods.UnitPrice);
         _doh.AddFieldItem("BuyCount", _goods.BuyCount);
         _doh.AddFieldItem("TotalPrice", _goods.TotalPrice);
         _doh.AddFieldItem("State", 0);
         _doh.AddFieldItem("GoodsTime", DateTime.Now.ToString());
         int _newid = _doh.Insert("jcms_normal_user_goods");
         return _newid;
     }
 }
Beispiel #7
0
 /// <summary>
 /// 发站内短信
 /// </summary>
 /// <param name="_Title">标题</param>
 /// <param name="_Content">内容</param>
 /// <param name="_SendUserId">发送人ID</param>
 /// <param name="_ReceiveUserId">接收人ID,多个用逗号隔开</param>
 /// <param name="_ReceiveUserName">接收人用户名,多个用逗号隔开</param>
 public bool SendMessage(string _Title, string _Content, string _SendUserId, string _ReceiveUserId, string _ReceiveUserName)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         string[] _uId = _ReceiveUserId.Split(',');
         string[] _uName = _ReceiveUserName.Split(',');
         for (int i = 0; i < _uId.Length; i++)
         {
             _doh.Reset();
             _doh.AddFieldItem("Title", _Title);
             _doh.AddFieldItem("AddDate", DateTime.Now.ToString());
             _doh.AddFieldItem("Content", _Content);
             _doh.AddFieldItem("SendIP", IPHelp.ClientIP);
             _doh.AddFieldItem("SendUserId", _SendUserId);
             _doh.AddFieldItem("ReceiveUserId", _uId[i]);
             _doh.AddFieldItem("ReceiveUserName", _uName[i]);
             _doh.AddFieldItem("State", 0);
             _doh.Insert("jcms_normal_user_message");
         }
         return true;
     }
 }
Beispiel #8
0
 /// <summary>
 /// 新增购物车商品信息
 /// </summary>
 /// <param name="_cart"></param>
 /// <returns></returns>
 public int NewGoods(JumboTCMS.Entity.Normal_UserCart _cart)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.AddFieldItem("UserId", _cart.UserId);
         _doh.AddFieldItem("ProductId", _cart.ProductId);
         _doh.AddFieldItem("ProductLink", _cart.ProductLink);
         _doh.AddFieldItem("BuyCount", _cart.BuyCount);
         _doh.AddFieldItem("State", 0);
         _doh.AddFieldItem("CartTime", DateTime.Now.ToString());
         int _newid = _doh.Insert("jcms_normal_user_cart");
         return _newid;
     }
 }
Beispiel #9
0
 /// <summary>
 /// 自动增添Tag标签到数据库
 /// </summary>
 /// <param name="_channelid">频道ID</param>
 /// <param name="_tags">要增加的Tag,多个Tag以,隔开</param>
 public void InsertTags(string _channelid, string _tags)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         if (_tags.Length == 0) return;
         string[] tag = _tags.Split(',');
         for (int i = 0; i < tag.Length; i++)
         {
             if (!ExistTitle(tag[i].ToString(), "0", "ChannelId=" + _channelid))
             {
                 _doh.Reset();
                 _doh.AddFieldItem("Title", tag[i].ToString());
                 _doh.AddFieldItem("ClickTimes", "0");
                 _doh.AddFieldItem("ChannelId", _channelid);
                 _doh.Insert("jcms_normal_tag");
             }
         }
     }
 }
Beispiel #10
0
 /// <summary>
 /// 内容加入专题
 /// </summary>
 /// <param name="_specialid">专题ID</param>
 /// <param name="_channelid">频道ID</param>
 /// <param name="_channeltype">频道类型,也就是内容的模型</param>
 /// <param name="_contentids">内容ID,以,隔开</param>
 public bool Move2Special(int _specialid, string _channelid, string _channeltype, string _contentids)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         string _contentid = string.Empty;
         string _title = string.Empty;
         _doh.Reset();
         _doh.SqlCmd = "SELECT [Id],[Title] FROM [jcms_module_" + _channeltype + "] WHERE [ChannelId]=" + _channelid + " AND [Id] In (" + _contentids + ")";
         DataTable dt = _doh.GetDataTable();
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             _contentid = dt.Rows[i]["Id"].ToString();
             _title = dt.Rows[i]["Title"].ToString();
             _doh.Reset();
             _doh.ConditionExpress = "sid=@sid and contentid=@contentid and channelid=@channelid";
             _doh.AddConditionParameter("@sid", _specialid);
             _doh.AddConditionParameter("@contentid", _contentid);
             _doh.AddConditionParameter("@channelid", _channelid);
             if (!_doh.Exist("jcms_normal_specialcontent"))
             {
                 _doh.Reset();
                 _doh.AddFieldItem("Title", _title);
                 _doh.AddFieldItem("sId", _specialid);
                 _doh.AddFieldItem("ChannelId", _channelid);
                 _doh.AddFieldItem("ContentId", _contentid);
                 _doh.Insert("jcms_normal_specialcontent");
             }
         }
     }
     return true;
 }
Beispiel #11
0
 /// <summary>
 /// 安装插件
 /// </summary>
 /// <param name="_name"></param>
 /// <param name="_response">返回信息</param>
 public bool Install(string _name, ref string _response)
 {
     if (!JumboTCMS.Utils.DirFile.FileExists(site.Dir + "extends/" + _name + "/install.config"))
     {
         _response = "插件的安装文件损坏或不存在";
         return false;
     }
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.ConditionExpress = "1=1";
         int pId = _doh.MaxValue("jcms_normal_extends", "pId");
         string _Title = JumboTCMS.Utils.XmlCOM.ReadConfig(site.Dir + "extends/" + _name + "/install", "Title");
         string _Author = JumboTCMS.Utils.XmlCOM.ReadConfig(site.Dir + "extends/" + _name + "/install", "Author");
         string _Info = JumboTCMS.Utils.XmlCOM.ReadConfig(site.Dir + "extends/" + _name + "/install", "Info");
         string _Type = JumboTCMS.Utils.XmlCOM.ReadConfig(site.Dir + "extends/" + _name + "/install", "Type");
         string _BaseTable = JumboTCMS.Utils.XmlCOM.ReadConfig(site.Dir + "extends/" + _name + "/install", "BaseTable");
         string _ManageUrl = JumboTCMS.Utils.XmlCOM.ReadConfig(site.Dir + "extends/" + _name + "/install", "ManageUrl");
         int _Locked = JumboTCMS.Utils.Validator.StrToInt(JumboTCMS.Utils.XmlCOM.ReadConfig(site.Dir + "extends/" + _name + "/install", "Locked"), 0);
         if (_BaseTable != "")//需要安装数据库
         {
             string _SqlScriptText = JumboTCMS.Utils.XmlCOM.ReadConfig(site.Dir + "extends/" + _name + "/install", "SqlScript" + base.DBType);
             string _SqlScriptFile = site.Dir + "extends/" + _name + "/install.sql";
             JumboTCMS.Utils.DirFile.SaveFile(_SqlScriptText, _SqlScriptFile);
             if (!ExecuteSqlInFile(HttpContext.Current.Server.MapPath(_SqlScriptFile)))
             {
                 _response = "数据表创建有误,可能已存在";
                 return false;
             }
         }
         _doh.Reset();
         _doh.AddFieldItem("Title", _Title);
         _doh.AddFieldItem("Name", _name);
         _doh.AddFieldItem("Author", _Author);
         _doh.AddFieldItem("Info", _Info);
         _doh.AddFieldItem("Type", _Type);
         _doh.AddFieldItem("BaseTable", _BaseTable);
         _doh.AddFieldItem("ManageUrl", _ManageUrl);
         _doh.AddFieldItem("Locked", _Locked);
         _doh.AddFieldItem("Enabled", 0);
         _doh.AddFieldItem("pId", pId + 1);
         _doh.Insert("jcms_normal_extends");
         _response = "插件安装成功";
     }
     return true;
 }
Beispiel #12
0
 /// <summary>
 /// 新增订单信息
 /// </summary>
 /// <param name="_uid"></param>
 /// <param name="_truename"></param>
 /// <param name="_address"></param>
 /// <param name="_zipcode"></param>
 /// <param name="_mobiletel"></param>
 /// <returns></returns>
 public bool NewOrder(string _uid, string _truename, string _address, string _zipcode, string _mobiletel)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         string _ordernum = GetProductOrderNum();//订单号
         int page = 1;
         int PSize = 1000;
         int countNum = 0;
         string sqlStr = "";
         string joinStr = "A.[ProductId]=B.Id";
         string whereStr1 = "A.State=0 AND A.UserId=" + _uid;
         string whereStr2 = "State=0 AND UserId=" + _uid;
         _doh.Reset();
         _doh.ConditionExpress = whereStr2;
         countNum = _doh.Count("jcms_normal_user_cart");
         sqlStr = JumboTCMS.Utils.SqlHelp.GetSql("A.*,b.points as unitprice,(b.points*a.buycount) as totalprice,b.id as productid,b.title as productname,b.img as productimg", "jcms_normal_user_cart", "jcms_module_product", "Id", PSize, page, "desc", joinStr, whereStr1, whereStr2);
         _doh.Reset();
         _doh.SqlCmd = sqlStr;
         DataTable dt = _doh.GetDataTable();
         if (dt.Rows.Count == 0)
             return false;
         float _money = 0;
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             JumboTCMS.Entity.Normal_UserGoods _goods = new JumboTCMS.Entity.Normal_UserGoods();
             _goods.UserId = Str2Int(_uid);
             _goods.OrderNum = _ordernum;
             _goods.ProductId = Str2Int(dt.Rows[i]["ProductId"].ToString());
             _goods.ProductName = dt.Rows[i]["ProductName"].ToString();
             _goods.ProductImg = dt.Rows[i]["ProductImg"].ToString();
             _goods.ProductLink = dt.Rows[i]["ProductLink"].ToString();
             _goods.UnitPrice = Convert.ToSingle(dt.Rows[i]["UnitPrice"].ToString());
             _goods.BuyCount = Str2Int(dt.Rows[i]["BuyCount"].ToString());
             _goods.TotalPrice = Convert.ToSingle(dt.Rows[i]["TotalPrice"].ToString());
             new JumboTCMS.DAL.Normal_UserGoodsDAL().NewGoods(_goods);
             _money += _goods.TotalPrice;
         }
         dt.Clear();
         dt.Dispose();
         _doh.Reset();
         _doh.AddFieldItem("UserId", _uid);
         _doh.AddFieldItem("OrderNum", _ordernum);
         _doh.AddFieldItem("TrueName", _truename);
         _doh.AddFieldItem("Address", _address);
         _doh.AddFieldItem("ZipCode", _zipcode);
         _doh.AddFieldItem("MobileTel", _mobiletel);
         _doh.AddFieldItem("Money", _money);
         _doh.AddFieldItem("State", 0);
         _doh.AddFieldItem("OrderTime", DateTime.Now.ToString());
         _doh.AddFieldItem("OrderIP", IPHelp.ClientIP);
         _doh.Insert("jcms_normal_user_order");
         _doh.Reset();
         _doh.SqlCmd = string.Format("UPDATE [jcms_normal_user_cart] SET [State]=1 WHERE UserId={0}", _uid);
         _doh.ExecuteSqlNonQuery();
         return true;
     }
 }
Beispiel #13
0
 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;
     }
 }
Beispiel #14
0
 /// <summary>
 /// 保存发信日志
 /// </summary>
 /// <param name="_adminid">管理员ID</param>
 /// <param name="_title">发信标题</param>
 /// <param name="_users">发信收信人</param>
 public void SaveLog(string _adminid, string _title, string _users)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.AddFieldItem("AdminId", _adminid);
         _doh.AddFieldItem("SendTitle", _title);
         _doh.AddFieldItem("SendUsers", _users);
         _doh.AddFieldItem("SendTime", DateTime.Now.ToString());
         _doh.AddFieldItem("SendIP", IPHelp.ClientIP);
         _doh.Insert("jcms_normal_emaillogs");
     }
 }