Exemple #1
0
        private void OrderMsg(string msgCount, int price, string perPrice)
        {
            MsgPackage obj = new MsgPackage();

            obj.PackageName = "店铺管家短信套餐(淘宝)" + msgCount + "条";
            obj.Type        = "永久有效";
            obj.SellerNick  = Users.Nick;
            obj.Price       = price;
            obj.PerPrice    = perPrice;
            obj.Rank        = "短信套餐(短信充值)";
            obj.OrderDate   = DateTime.Now;
            obj.PayStatus   = true;
            MsgBLL.AddMsgPackage(obj);

            obj.CanUseStartDate = DateTime.Now;
            obj.MsgCanUseCount  = Convert.ToInt32(msgCount);
            obj.MsgTotalCount   = Convert.ToInt32(msgCount);
            MsgPagke(obj);
        }
Exemple #2
0
        private void OrderMsg(string msgCount, int price, string perPrice)
        {
            MsgPackage obj = new MsgPackage();

            obj.PackageName = "店铺管家短信套餐(淘宝)" + msgCount + "条";
            obj.Type        = "永久有效";
            obj.SellerNick  = Users.Nick;
            obj.Price       = price;
            obj.PerPrice    = perPrice;
            obj.Rank        = "短信套餐(短信充值)";
            obj.OrderDate   = DateTime.Now;
            obj.PayStatus   = true;
            bool b = MsgBLL.AddMsgPackage(obj);

            File.AppendAllText(@"D:\log\AddMsgPackage.txt", b.ToString(), Encoding.Default);
            obj.CanUseStartDate = DateTime.Now;
            obj.MsgCanUseCount  = Convert.ToInt32(msgCount);
            obj.MsgTotalCount   = Convert.ToInt32(msgCount);
            MsgPagke(obj);
        }
Exemple #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var checkIsExit = MsgBLL.CheckSellerMsgTransIsExit(txtNick.Text.Trim());

            if (String.IsNullOrEmpty(checkIsExit))//卖家第一次订购
            {
                MsgPackage obj = new MsgPackage();
                obj.PackageName = "店铺管家短信套餐(淘宝)" + txtCount.Text.Trim() + "条";
                obj.Type        = "赠送短信";
                obj.SellerNick  = txtNick.Text.Trim();
                obj.Price       = 0;
                obj.PerPrice    = "0";
                obj.Rank        = "短信套餐(赠送)";
                obj.OrderDate   = DateTime.Now;
                obj.PayStatus   = true;
                MsgBLL.AddMsgPackage(obj);
                obj.CanUseStartDate = DateTime.Now;
                obj.MsgCanUseCount  = Convert.ToInt32(txtCount.Text.Trim());
                obj.MsgTotalCount   = Convert.ToInt32(txtCount.Text.Trim());
                obj.ServiceStatus   = true;
                MsgBLL.AddMsgTrans(obj);
                lbMsg.Text = "增加成功";
            }
            else
            {
                MsgPackage obj = new MsgPackage();
                obj.PackageName = "店铺管家短信套餐(淘宝)" + txtCount.Text.Trim() + "条";
                obj.Type        = "赠送短信";
                obj.SellerNick  = txtNick.Text.Trim();
                obj.Price       = 0;
                obj.PerPrice    = "0";
                obj.Rank        = "短信套餐(手动添加)";
                obj.OrderDate   = DateTime.Now;
                obj.PayStatus   = true;
                MsgBLL.AddMsgPackage(obj);
                obj.MsgCanUseCount = Convert.ToInt32(txtCount.Text.Trim());
                obj.MsgTotalCount  = Convert.ToInt32(txtCount.Text.Trim());
                MsgBLL.UpdateMsgTransForSecond(obj);
                lbMsg.Text = "追加成功";
            }
        }
Exemple #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         //检查卖家是否为新卖家
         var result = SellersBLL.CheckSeller();
         if (result == "0")
         {
             Response.Redirect("http://container.api.taobao.com/container/transform?appkey=21088197", false);
         }
         //ExceptionReporter.WriteLog("result2:" + result, ExceptionPostion.TBApply_Data, ExceptionRank.important);
         if (!string.IsNullOrEmpty(Users.OrderVersion))
         {
             var checkIsExit = MsgBLL.CheckSellerMsgTransIsExit(Users.Nick);
             if (String.IsNullOrEmpty(checkIsExit))//卖家第一次订购
             {
                 MsgPackage obj = new MsgPackage();
                 obj.PackageName = "店铺管家短信套餐(淘宝)10条";
                 obj.Type        = "永久有效";
                 obj.SellerNick  = Users.Nick;
                 obj.Price       = 0;
                 obj.PerPrice    = "0";
                 obj.Rank        = "短信套餐(赠送)";
                 obj.OrderDate   = DateTime.Now;
                 obj.PayStatus   = true;
                 MsgBLL.AddMsgPackage(obj);
                 obj.ServiceStatus   = true;
                 obj.CanUseStartDate = DateTime.Now;
                 obj.MsgCanUseCount  = 10;
                 obj.MsgTotalCount   = 10;
                 MsgBLL.AddMsgTrans(obj);
             }
         }
         else
         {
             Response.Redirect("http://crm.new9channel.com/relogin.aspx");
         }
     }
 }
Exemple #5
0
        /// <summary>
        /// 初始信息处理
        /// </summary>
        /// <param name="hasShop"></param>
        public static string  WriteUserInfoToCookies()
        {
            HttpContext context       = HttpContext.Current;
            string      code          = HttpContext.Current.Request.QueryString["code"];
            string      state         = HttpContext.Current.Request.QueryString["state"];
            string      client_id     = appKey;
            string      client_secret = appSecret;
            string      grant_type    = "authorization_code";
            string      redirect_uri  = redirect_URL;
            int         s             = 0;//记录code获取源

            //从数据库获取code
            if (string.IsNullOrEmpty(code))
            {
                DataTable dt = SellersBLL.GetSellersCode(Users.Nick);
                if (dt != null && dt.Rows.Count > 0)
                {
                    s    = 1;
                    code = dt.Rows[0]["code"].ToString();
                }
            }
            #region 获取授权Code
            if (!string.IsNullOrEmpty(code))
            {
                DataTable dt = SellersBLL.GetSellersCode(Users.Nick);
                if (dt != null && dt.Rows.Count > 0 && s == 0)
                {
                    SellersBLL.UpdateSellersCode(Users.Nick, code);
                }
                else if (dt == null || dt.Rows.Count == 0)
                {
                    SellersBLL.AddSellersCode(Users.Nick, code);
                }

                //获取访问令牌
                string url  = "https://oauth.taobao.com/token?client_id={0}&client_secret={1}&grant_type={2}&code={3}&redirect_uri={4}&scope={5}&view={6}&state={7}";
                string urlS = string.Format(url, client_id, client_secret, grant_type, code, redirect_uri, "item", "web", state);
                string getAuthAcessToken = PostDataToUrl(urlS, urlS);
                if (string.IsNullOrEmpty(getAuthAcessToken))
                {
                    return(null);
                }                                                            //20160907 yao c
                IDictionary resultDic = TopUtils.ParseJson(getAuthAcessToken);
                context.Request.Cookies.Clear();
                context.Session.Clear();
                //获取卖家昵称
                string nick = HttpUtility.UrlDecode(resultDic["taobao_user_nick"].ToString(), Encoding.UTF8);
                //这里的SessionKey就是access_token
                string sessionKey = resultDic["access_token"].ToString();
                //获取刷新令牌,以便令牌过期时重新获取
                string     refresh_token = resultDic["refresh_token"].ToString();
                HttpCookie cookie        = new HttpCookie("Top");
                cookie["nick"] = CTCRM.Common.DES.Encrypt(nick);

                UserSellerGetResponse userRsp = null;
                UserSellerGetRequest  req     = null;
                try
                {
                    Sellers sellers = new Sellers();
                    sellers.Nick = nick;
                    try
                    {
                        ITopClient client = TBManager.GetClient();
                        req        = new UserSellerGetRequest();
                        req.Fields = "user_id,type";
                        userRsp    = client.Execute(req, sessionKey);
                    }
                    catch (Exception ex)
                    {
                        userRsp = null;
                    }
                    sellers.Seller_Creadit = 0;//short.Parse(userRsp.User.SellerCredit.Level.ToString());
                    sellers.Seller_Id      = userRsp.User == null? 0: userRsp.User.UserId;
                    sellers.shopType       = userRsp.User == null ? "B" : userRsp.User.Type;
                    sellers.Created        = DateTime.Now;
                    sellers.SessionKey     = sessionKey;
                    sellers.Refresh_token  = refresh_token;
                    sellers.SellerType     = "pay";
                    cookie["SellerId"]     = sellers.Seller_Id.ToString();

                    //获取卖家订购信息
                    ArticleUserSubscribe userSub = UserSubscribe.GetDeadLineDate("ts-1811102", nick);
                    if (userSub != null)
                    {
                        sellers.EndDate = userSub.Deadline.ToString();

                        #region 标准版一月送200条
                        if (userSub.ItemCode.Equals("ts-1811102-1"))
                        {
                            sellers.OrderVersion = "标准版一月送200条";
                        }
                        #endregion
                        #region 自动评价版
                        if (userSub.ItemCode.Equals("ts-1811102-2"))
                        {
                            sellers.OrderVersion = "自动评价版";
                        }
                        #endregion
                        #region 订单打印版
                        if (userSub.ItemCode.Equals("ts-1811102-3"))
                        {
                            sellers.OrderVersion = "订单打印版";
                        }
                        #endregion
                        #region 流量推广_6个广告位
                        if (userSub.ItemCode.Equals("ts-1811102-4"))
                        {
                            sellers.OrderVersion = "流量推广_6个广告位";
                        }
                        #endregion
                        #region 订购一年送3000条短信
                        if (userSub.ItemCode.Equals("ts-1811102-5"))
                        {
                            sellers.OrderVersion = "订购一年送3000条短信";
                        }
                        #endregion
                        cookie["Deadline"]     = userSub.Deadline.ToString();//比如:2016-07-04 00:00:00
                        cookie["OrderVersion"] = CTCRM.Common.DES.Encrypt(sellers.OrderVersion);
                    }

                    SellersDAL objDal = new SellersDAL();
                    if (!SellersDAL.GetList(sellers))
                    {
                        sellers.CreatedDate = DateTime.Now;//记录卖家的第一次登陆系统时间
                        sellers.OrderDate   = DateTime.Now.ToShortDateString();
                        objDal.Add(sellers);

                        if (!objDal.AddSellerRecords(sellers.Nick, sellers.OrderVersion, userSub.Deadline.ToString(), "新订"))
                        {
                            File.WriteAllText(@"D:\log\" + nick + "_订购.txt", "新订失败");
                        }
                    }
                    else
                    {
                        string sellerEndDate = SellersDAL.GetSellerEndDate(nick);
                        sellers.UpdateDate = DateTime.Now;//记录卖家最近一次登陆系统时间
                        File.WriteAllText(@"D:\log\" + nick + "_shijianOld.txt", sellerEndDate);
                        bool sss = SellersDAL.Update(sellers);
                        File.WriteAllText(@"D:\log\" + nick + "_更新.txt", sss.ToString());
                        //判断卖家是否续费软件
                        File.WriteAllText(@"D:\log\" + nick + "_shijianNew.txt", sellers.EndDate);
                        if (sellers.EndDate != sellerEndDate)
                        {
                            if (sellers.OrderVersion == "订购一年送3000条短信")
                            {
                                File.WriteAllText(@"D:\log\" + nick + "_dinggou.txt", sellers.OrderVersion);
                                MsgPackage obj = new MsgPackage();
                                obj.PackageName = "店铺管家短信套餐(淘宝)3000条";
                                obj.Type        = "永久有效";
                                obj.SellerNick  = nick;
                                obj.Price       = 0;
                                obj.PerPrice    = "0";
                                obj.Rank        = "短信套餐(赠送)";
                                obj.OrderDate   = DateTime.Now;
                                obj.PayStatus   = true;
                                bool dingg = MsgBLL.AddMsgPackage(obj);
                                File.WriteAllText(@"D:\log\" + nick + "_tianjia.txt", dingg.ToString());
                                DataTable dtDuanxin = MsgBLL.GetSellerMsgTrans(nick);
                                if (dtDuanxin != null && dtDuanxin.Rows.Count > 0)
                                {
                                    obj.MsgCanUseCount = 3000 + (dtDuanxin.Rows[0]["msgCanUseCount"] == DBNull.Value ? 0 : Convert.ToInt32(dtDuanxin.Rows[0]["msgCanUseCount"]));
                                    obj.MsgTotalCount  = 3000 + (dtDuanxin.Rows[0]["msgTotalCount"] == DBNull.Value ? 0 : Convert.ToInt32(dtDuanxin.Rows[0]["msgTotalCount"]));
                                }
                                else
                                {
                                    obj.MsgCanUseCount = 3000;
                                    obj.MsgTotalCount  = 3000;
                                }
                                obj.ServiceStatus   = true;
                                obj.CanUseStartDate = DateTime.Now;

                                MsgBLL.UpdateMsgTrans(obj);
                            }
                            else
                            {
                                File.WriteAllText(@"D:\log\" + nick + "_dinggou.txt", sellers.OrderVersion);
                                MsgPackage obj = new MsgPackage();
                                obj.PackageName = "店铺管家短信套餐(淘宝)200条";
                                obj.Type        = "永久有效";
                                obj.SellerNick  = nick;
                                obj.Price       = 0;
                                obj.PerPrice    = "0";
                                obj.Rank        = "短信套餐(赠送)";
                                obj.OrderDate   = DateTime.Now;
                                obj.PayStatus   = true;
                                bool dingg = MsgBLL.AddMsgPackage(obj);
                                File.WriteAllText(@"D:\log\" + nick + "_tianjia.txt", dingg.ToString());
                                DataTable dtDuanxin = MsgBLL.GetSellerMsgTrans(nick);
                                if (dtDuanxin != null && dtDuanxin.Rows.Count > 0)
                                {
                                    obj.MsgCanUseCount = 200 + (dtDuanxin.Rows[0]["msgCanUseCount"] == DBNull.Value ? 0 : Convert.ToInt32(dtDuanxin.Rows[0]["msgCanUseCount"]));
                                    obj.MsgTotalCount  = 200 + (dtDuanxin.Rows[0]["msgTotalCount"] == DBNull.Value ? 0 : Convert.ToInt32(dtDuanxin.Rows[0]["msgTotalCount"]));
                                }
                                else
                                {
                                    obj.MsgCanUseCount = 200;
                                    obj.MsgTotalCount  = 200;
                                }
                                obj.ServiceStatus   = true;
                                obj.CanUseStartDate = DateTime.Now;

                                MsgBLL.UpdateMsgTrans(obj);
                            }

                            if (!objDal.AddSellerRecords(sellers.Nick, sellers.OrderVersion, userSub.Deadline.ToString(), "续订"))
                            {
                                File.WriteAllText(@"D:\log\" + nick + "_订购.txt", "续订失败");
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    //ExceptionReporter.WriteLog(userRsp.ErrMsg, ex, ExceptionPostion.TopApi, ExceptionRank.urgency);
                }
                cookie["sess"] = sessionKey;
                cookie.Expires = DateTime.Now.AddDays(1d);
                context.Response.Cookies.Add(cookie);
                return("1");
            }
            else   //Code为空的情况下
            {
                return("0");
            }
            #endregion
        }
Exemple #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    var result = SellersBLL.CheckSeller();
                    if (result == "0")
                    {
                        //Response.Redirect("http://container.api.taobao.com/container/transform?appkey=21088197", false);
                        Response.Redirect("error_root.aspx");
                    }

                    userName     = Users.Nick == null ? "未登录的用户" : Users.Nick;
                    orderVersion = string.IsNullOrEmpty(Users.OrderVersion) ? "最高版本" : Users.OrderVersion.ToString();
                    deadline     = Users.Deadline == null ? "当前" : Users.Deadline.Substring(0, 10);
                    SellersBLL.UpdateUnUseDate(deadline, userName); //20161106 yao
                    var checkIsExit = MsgBLL.CheckSellerMsgTransIsExit(Users.Nick);
                    if (String.IsNullOrEmpty(checkIsExit))          //卖家第一次订购
                    {
                        MsgPackage obj = new MsgPackage();
                        if (Users.OrderVersion == "订购一年送3000条短信")
                        {
                            obj.PackageName = "店铺管家短信套餐(淘宝)3000条";
                            obj.Type        = "永久有效";
                            obj.SellerNick  = Users.Nick;
                            obj.Price       = 0;
                            obj.PerPrice    = "0";
                            obj.Rank        = "短信套餐(赠送)";
                            obj.OrderDate   = DateTime.Now;
                            obj.PayStatus   = true;
                            MsgBLL.AddMsgPackage(obj);
                            obj.ServiceStatus   = true;
                            obj.CanUseStartDate = DateTime.Now;
                            obj.MsgCanUseCount  = 3000;
                            obj.MsgTotalCount   = 3000;
                            MsgBLL.AddMsgTrans(obj);
                        }
                        else
                        {
                            TimeSpan sp = Convert.ToDateTime(deadline) - DateTime.Now;
                            if (sp.Days > 15)
                            {
                                obj.PackageName = "店铺管家短信套餐(淘宝)200条";
                                obj.Type        = "永久有效";
                                obj.SellerNick  = Users.Nick;
                                obj.Price       = 0;
                                obj.PerPrice    = "0";
                                obj.Rank        = "短信套餐(赠送)";
                                obj.OrderDate   = DateTime.Now;
                                obj.PayStatus   = true;
                                MsgBLL.AddMsgPackage(obj);
                                obj.ServiceStatus   = true;
                                obj.CanUseStartDate = DateTime.Now;
                                obj.MsgCanUseCount  = 200;
                                obj.MsgTotalCount   = 200;
                                MsgBLL.AddMsgTrans(obj);
                            }
                            else
                            {
                                obj.PackageName = "店铺管家短信套餐(淘宝)10条";
                                obj.Type        = "永久有效";
                                obj.SellerNick  = Users.Nick;
                                obj.Price       = 0;
                                obj.PerPrice    = "0";
                                obj.Rank        = "短信套餐(赠送)";
                                obj.OrderDate   = DateTime.Now;
                                obj.PayStatus   = true;
                                MsgBLL.AddMsgPackage(obj);
                                obj.ServiceStatus   = true;
                                obj.CanUseStartDate = DateTime.Now;
                                obj.MsgCanUseCount  = 10;
                                obj.MsgTotalCount   = 10;
                                MsgBLL.AddMsgTrans(obj);
                            }
                        }

                        OpenLogistics(obj.SellerNick);
                    }
                    DataTable tb = MsgBLL.GetSellerMsgStatus(Users.Nick);
                    if (tb != null && tb.Rows.Count > 0)
                    {
                        msgCount = tb.Rows[0]["msgCanUseCount"].ToString() + "条";
                    }
                    else
                    {
                        msgCount = "0条";
                    }
                    //string medo = @" <div><a href='{1}'><lable style='float: left'>{0}</lable><br /></a></div>";
                    //DataTable dt = SystemMessagesBLL.QueryShowMsg();
                    //if (dt == null || dt.Rows.Count <= 0)
                    //{ return; }
                    //systemMsg = "";
                    //for (int i = 0; i < dt.Rows.Count; i++)
                    //{

                    //    systemMsg += string.Format(medo, dt.Rows[i]["SystemMsg"].ToString(), dt.Rows[i]["SystemLink"].ToString());
                    //}
                }
                catch (Exception ex)
                {
                    ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI);
                }
                finally
                {
                    DataTable tb = MsgBLL.GetSellerMsgStatus(Users.Nick);
                    if (tb != null && tb.Rows.Count > 0)
                    {
                        msgCount = tb.Rows[0]["msgCanUseCount"].ToString() + "条";
                    }
                    else
                    {
                        msgCount = "0条";
                    }
                }
            }
        }