Exemple #1
0
        /// <summary>
        /// 添加卖家评价配置
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public bool AddRateConfig(RateConfig obj)
        {
            try
            {
                string query = @"
                    insert into RateConfig(sellerNick,isMiaoRate,isWaitBuyerRate,waitBuyerTimeDay,waitBuyerTimeHour,waitBuyerTimeFen,blackBuyerRatedIsRate,
                    blackBuyerNoRateQiangRateDay,blackBuyerNoRateQiangRateHour,blackBuyerNoRateQiangRateFen,isQiangRate,
                    qiangRateTimeDay,qiangRateTimeHour,qiangRateTimeFen,atuoAddBlackListBadRate,atuoAddBlackListTuiKuan,badRateContent,result,content1,content2,content3,contentChoice,
                    createDate,isAutoRating)
                    values(@sellerNick,@isMiaoRate,@isWaitBuyerRate,@waitBuyerTimeDay,@waitBuyerTimeHour,@waitBuyerTimeFen,@blackBuyerRatedIsRate,
                    @blackBuyerNoRateQiangRateDay,@blackBuyerNoRateQiangRateHour,@blackBuyerNoRateQiangRateFen,@isQiangRate,
                    @qiangRateTimeDay,@qiangRateTimeHour,@qiangRateTimeFen,@atuoAddBlackListBadRate,@atuoAddBlackListTuiKuan,@badRateContent,@result,@content1,@content2,@content3,@contentChoice,
                    getdate(),0)";
                // 设置SQL参数

                SqlParameter[] param = new SqlParameter[]
                {
                    new SqlParameter("@sellerNick", obj.SellerNick),
                    new SqlParameter("@isMiaoRate", obj.IsMiaoRate),
                    new SqlParameter("@isWaitBuyerRate", obj.IsWaitBuyerRate),
                    new SqlParameter("@waitBuyerTimeDay", obj.WaitBuyerTimeDay),
                    new SqlParameter("@waitBuyerTimeHour", obj.WaitBuyerTimeHour),
                    new SqlParameter("@waitBuyerTimeFen", obj.WaitBuyerTimeFen),
                    new SqlParameter("@blackBuyerRatedIsRate", obj.BlackBuyerRatedIsRate),
                    new SqlParameter("@blackBuyerNoRateQiangRateDay", obj.BlackBuyerNoRateQiangRateDay),
                    new SqlParameter("@blackBuyerNoRateQiangRateHour", obj.BlackBuyerNoRateQiangRateHour),
                    new SqlParameter("@blackBuyerNoRateQiangRateFen", obj.BlackBuyerNoRateQiangRateFen),
                    new SqlParameter("@isQiangRate", obj.IsQiangRate),
                    new SqlParameter("@qiangRateTimeDay", obj.QiangRateTimeDay),
                    new SqlParameter("@qiangRateTimeHour", obj.QiangRateTimeHour),
                    new SqlParameter("@qiangRateTimeFen", obj.QiangRateTimeFen),
                    new SqlParameter("@atuoAddBlackListBadRate", obj.AtuoAddBlackListBadRate),
                    new SqlParameter("@atuoAddBlackListTuiKuan", obj.AtuoAddBlackListTuiKuan),
                    new SqlParameter("@badRateContent", obj.BadRateContent == null ? "" : obj.BadRateContent),
                    new SqlParameter("@result", obj.Result == null ? "" : obj.Result),
                    new SqlParameter("@content1", obj.Content1 == null ? "" : obj.Content1),
                    new SqlParameter("@content2", obj.Content2 == null ? "" : obj.Content2),
                    new SqlParameter("@content3", obj.Content3 == null ? "" : obj.Content3),
                    new SqlParameter("@contentChoice", obj.ContentChoice)
                };
                DataTable dt = DataBase.ExecuteDt(query, param, CommandType.Text);
                return(true);
            }
            catch (Exception ex)
            {
                ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Data);
                return(false);
            }
        }
Exemple #2
0
 /// <summary>
 /// 调用API进行批量评价
 /// </summary>
 /// <param name="currentPage"></param>
 /// <param name="pagesize"></param>
 /// <param name="total"></param>
 /// <returns></returns>
 public TradeRate BuyerTradeRate(RateConfig rateObj, ref string content, string sesionKey)
 {
     try
     {
         ITopClient client           = TBManager.GetClient();
         TraderateListAddRequest req = new TraderateListAddRequest();
         req.Tid    = rateObj.Tid;
         req.Result = rateObj.Result;
         req.Role   = "seller";
         string[] strs = { rateObj.Content1, rateObj.Content2, rateObj.Content3 };//随机选择评价内容
         Random   rand = new Random(System.Guid.NewGuid().GetHashCode());
         req.Content = strs[rand.Next(0, strs.Length)];
         content     = req.Content;
         TraderateListAddResponse response = client.Execute(req, sesionKey);
         return(response.TradeRate);
     }
     catch (Exception ex)
     {
         ExceptionReporter.WriteLog(ex, ExceptionPostion.TopApi);
         return(null);
     }
 }
Exemple #3
0
        protected void btnSaveRateConfig_Click(object sender, ImageClickEventArgs e)
        {
            //DataRow orderDate = SellersBLL.GetSelerOrderDate(Users.Nick);
            //if (orderDate != null)
            //{
            //    if (orderDate["OrderVersion"].Equals("体验版"))
            //    {
            //        versionControl.Visible = true;
            //        return;
            //    }
            //}
            RateConfig rateObj = new RateConfig();

            rateObj.SellerNick = Users.Nick;
            RatingBLL objBll = new RatingBLL();

            if (rdoMiaoPing.Checked)
            {
                rateObj.IsMiaoRate = 1;
                //选择秒评,则自动开启主动通知授权
                ITopClient            client   = TBManager.GetClient();
                TmcUserPermitRequest  req      = new TmcUserPermitRequest();
                TmcUserPermitResponse response = client.Execute(req, Users.SessionKey);
                AppCustomer           appCus   = null;
                if (response.IsSuccess)
                {
                    appCus         = new AppCustomer();
                    appCus.Status  = "1";
                    appCus.Nick    = Users.Nick;
                    appCus.Created = DateTime.Now.ToShortDateString();
                    if (!objBll.CheckAppCusIsExit(Users.Nick))
                    {
                        objBll.AddAppCus(appCus);
                    }
                }
                else
                {
                    lberror2.Text = response.ErrMsg;
                    //Response.Write("<script>alert('" + response.ErrMsg + "');</script>");
                    lberror2.ForeColor = Color.Red;
                }
            }
            //else { //其它情况则关闭主动通知消息,删除的前提是用户没有开通差评自动拦截
            //    if (objBll.CheckAppCusIsExit(Users.Nick))
            //    {
            //        if (!objBll.CheckIsAutoCloseOrder(Users.Nick))
            //        {
            //            ITopClient client = TBManager.GetClient();
            //            TmcUserCancelRequest req = new TmcUserCancelRequest();
            //            req.Nick = Users.Nick;
            //            TmcUserCancelResponse response = client.Execute(req);
            //            if (response.IsSuccess)
            //            {
            //                objBll.DeleteSellerNifty(Users.Nick);
            //            }
            //            else
            //            {
            //                lberror2.Text = response.ErrMsg;
            //                Response.Write("<script>alert('" + response.ErrMsg + "');</script>");
            //                lberror2.ForeColor = Color.Red;
            //            }
            //        }
            //    }
            //}
            if (rdoBuyerRated.Checked)
            {
                rateObj.IsWaitBuyerRate   = 1;
                rateObj.WaitBuyerTimeDay  = Convert.ToInt32(drpFangAn2Day.SelectedValue);
                rateObj.WaitBuyerTimeHour = Convert.ToInt32(drpFangAn2Hour.SelectedValue);
                rateObj.WaitBuyerTimeFen  = Convert.ToInt32(drpFangAn2Minute.SelectedValue);
                if (rdoFangAn2NotAtuo.Checked)
                {
                    rateObj.BlackBuyerRatedIsRate = 1;
                }
                if (rdoFangAn2AtuoGoodRate.Checked)
                {
                    rateObj.BlackBuyerRatedIsRate = 2;
                }
                if (rdoFangAn2AtuoNureRate.Checked)
                {
                    rateObj.BlackBuyerRatedIsRate = 3;
                }
                if (rdoFangAn2AtuoPoolRate.Checked)
                {
                    rateObj.BlackBuyerRatedIsRate = 4;
                }
                rateObj.BlackBuyerNoRateQiangRateDay  = Convert.ToInt32(drpFangAn2BacklstDay.SelectedValue);
                rateObj.BlackBuyerNoRateQiangRateHour = Convert.ToInt32(drpFangAn2BacklstHour.SelectedValue);
                rateObj.BlackBuyerNoRateQiangRateFen  = Convert.ToInt32(drpFangAn2BacklstMinute.SelectedValue);
            }
            if (rdoAutoRate.Checked)
            {
                rateObj.IsQiangRate       = 1;
                rateObj.QiangRateTimeDay  = Convert.ToInt32(drpFangAn3Day.SelectedValue);
                rateObj.QiangRateTimeHour = Convert.ToInt32(drpFangAn3Hour.SelectedValue);
                rateObj.QiangRateTimeFen  = Convert.ToInt32(drpFangAn3Minute.SelectedValue);
            }
            if (cbBlakList.Checked)
            {
                rateObj.AtuoAddBlackListBadRate = 1;
            }
            if (cbAddBlacklstTuikuan.Checked)
            {
                rateObj.AtuoAddBlackListTuiKuan = 1;
            }
            rateObj.BadRateContent = txtPoolRateContent.Text.Trim();
            rateObj.Result         = "good";
            //rateObj.Result = "bad";
            if (!string.IsNullOrEmpty(txtRateTemp1.Text.Trim()))
            {
                rateObj.Content1 = txtRateTemp1.Text.Trim();
            }
            if (!string.IsNullOrEmpty(txtRateTemp2.Text.Trim()))
            {
                rateObj.Content2 = txtRateTemp2.Text.Trim();
            }
            if (!string.IsNullOrEmpty(txtRateTemp3.Text.Trim()))
            {
                rateObj.Content3 = txtRateTemp3.Text.Trim();
            }
            rateObj.ContentChoice = int.Parse(drpContentChoice.SelectedValue);
            if (!objBll.CheckRateConfigIsExit(Users.Nick))
            {
                try
                {
                    objBll.AddRateConfig(rateObj);
                    if (string.IsNullOrEmpty(lberror2.Text))
                    {
                        lberror2.Text = "评价条件设置保存成功!";
                        //Response.Write("<script>alert('评价条件设置保存成功,请确保开启自动评价开关!');</script>");
                        lberror2.ForeColor = Color.Blue;
                    }
                }
                catch (Exception ex)
                {
                    ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI);
                }
            }
            else
            { //更新评价配置策略
                objBll.UpdateRateConfig(rateObj);
                if (string.IsNullOrEmpty(lberror2.Text))
                {
                    lberror2.Text = "评价条件修改成功!";
                    //Response.Write("<script>alert('评价条件修改成功!');</script>");
                    lberror2.ForeColor = Color.Blue;
                }
            }
        }
Exemple #4
0
        public int funTraderUserRating(string sellerNick, string sesionKey)
        {
            try
            {
                //查询卖家对应的评价策略
                DataTable tbSellerRateConfig = AutoMsgDB.GetSellerWhichSetAtuoRate(sellerNick);
                DateTime  startDate          = DateTime.Now.AddMonths(-1);
                DateTime  endDate            = DateTime.Now;
                DataTable tbRateData         = AutoMsgDB.GetRateTradeData(sellerNick, tbSellerRateConfig.Rows[0], startDate, endDate, sesionKey);
                if (tbRateData != null && tbRateData.Rows.Count > 0)
                {
                    RateConfig objRate = null;
                    foreach (DataRow rw in tbRateData.Rows)
                    {
                        #region 开始评价
                        try
                        {
                            objRate = new RateConfig();
                            string tid = rw["tid"].ToString();
                            objRate.Tid = Convert.ToInt64(tid);
                            objRate.Oid = Convert.ToInt64(rw["oid"].ToString());
                            string badRattingContent = tbSellerRateConfig.Rows[0]["badRateContent"].ToString();
                            if (rw["blackBuyerRatedIsRate"].Equals("1"))//不自动评价
                            {
                                continue;
                            }
                            else if (rw["blackBuyerRatedIsRate"].Equals("3"))
                            {
                                objRate.Content1 = badRattingContent;
                                objRate.Content2 = badRattingContent;
                                objRate.Content3 = badRattingContent;
                                objRate.Result   = "neutral";
                            }
                            else if (rw["blackBuyerRatedIsRate"].Equals("4"))
                            {
                                objRate.Content1 = badRattingContent;
                                objRate.Content2 = badRattingContent;
                                objRate.Content3 = badRattingContent;
                                objRate.Result   = "bad";
                            }
                            else
                            {
                                objRate.Content1 = tbSellerRateConfig.Rows[0]["content1"].ToString();
                                objRate.Content2 = tbSellerRateConfig.Rows[0]["content2"].ToString();
                                objRate.Content3 = tbSellerRateConfig.Rows[0]["content3"].ToString();
                                objRate.Result   = "good";
                            }
                            objRate.SellerNick = sellerNick;
                            string   strContent = "";
                            TBRating objRateDal = new TBRating();
                            //新增单个评价,if faild, then list rate
                            TradeRate obj = null;
                            obj = objRateDal.BuyerTradeRateOneByOne(objRate, ref strContent, sesionKey);
                            if (obj == null)
                            {
                                obj = objRateDal.BuyerTradeRate(objRate, ref strContent, sesionKey);
                            }

                            if (obj != null)
                            {   //rating sucessfull
                                obj.Content = strContent;
                                obj.Nick    = objRate.SellerNick;
                                obj.Tid     = Convert.ToInt64(rw["tid"]);
                                obj.Created = obj.Created;
                                //Console.WriteLine("评价卖家:" + obj.Nick + " 评价日期:" + obj.Created);
                                AutoMsgDB.AddRateHisWithSeller(obj);
                            }
                        }
                        catch (Exception ex)
                        {
                            ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Data);
                            continue;
                        }
                        #endregion
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Data);
            }
            return(0);
        }
Exemple #5
0
        public bool AddRateConfig(RateConfig obj)
        {
            RatingDAL objDal = new RatingDAL();

            return(objDal.AddRateConfig(obj));
        }
Exemple #6
0
        public bool UpdateRateConfig(RateConfig obj)
        {
            RatingDAL objDal = new RatingDAL();

            return(objDal.UpdateRateConfig(obj));
        }
Exemple #7
0
        private void SendMessageDoTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            try
            {
                sendMessageDoTimer.Enabled = true;
                //查询同步过来的消息MESSAGE
                //查询主动通知信息从DB开始用于发送短信:只取交易完成的数据用于秒评
                DataTable tbTrade = DBUtil.GetTradeData("");
                //如果该卖家有消息推送
                if (!busySend && tbTrade != null && tbTrade.Rows.Count > 0)
                {
                    busySend = true;
                    foreach (DataRow row in tbTrade.Rows)//轮训通知消息
                    {
                        string   sellerNick = row["seller_nick"].ToString();
                        string   buyerNick  = row["buyer_nick"].ToString();
                        string   tid        = row["tid"].ToString();
                        DateTime createDate = Convert.ToDateTime(row["createDate"]);

                        // 获取卖家保存的自动评价策略
                        DataTable dtAutoConfig    = DBUtil.GetSellerAutoRateConfig(sellerNick);
                        int       isMiaoRate      = 0;
                        int       isWaitBuyerRate = 0;
                        int       isQiangRate     = 0;
                        if (dtAutoConfig == null || dtAutoConfig.Rows.Count == 0)
                        {
                            continue;
                        }

                        isMiaoRate      = Convert.ToInt32(dtAutoConfig.Rows[0]["isMiaoRate"]);
                        isWaitBuyerRate = Convert.ToInt32(dtAutoConfig.Rows[0]["isWaitBuyerRate"]);
                        isQiangRate     = Convert.ToInt32(dtAutoConfig.Rows[0]["isQiangRate"]);
                        //判断卖家是否开通秒评
                        if (isMiaoRate == 1)
                        {
                            #region 秒评

                            //评价开始
                            string sessionKey = DBUtil.GetSellerSessionKey(sellerNick);
                            if (!string.IsNullOrEmpty(sessionKey))
                            {
                                // 获取卖家保存的评价策略
                                DataTable tbSellerRateConfig = DBUtil.GetSellerRateConfig(sellerNick);
                                //检查商家设置:秒评:只检查该用户是否在黑名单
                                if (!DBUtil.CheckIsBlacklst(sellerNick, buyerNick))
                                {
                                    Trade objTrade = TBTrade.GetBuyerTrade(tid, sessionKey);
                                    if (objTrade != null && objTrade.Orders.Count > 0)
                                    {
                                        foreach (Order o in objTrade.Orders)
                                        {
                                            if (!o.SellerRate)
                                            {
                                                RateConfig objRate = new RateConfig();
                                                objRate.Tid        = Convert.ToInt64(tid);
                                                objRate.Oid        = o.Oid;
                                                objRate.Content1   = tbSellerRateConfig.Rows[0]["content1"].ToString();
                                                objRate.Content2   = tbSellerRateConfig.Rows[0]["content2"].ToString();
                                                objRate.Content3   = tbSellerRateConfig.Rows[0]["content3"].ToString();
                                                objRate.Result     = tbSellerRateConfig.Rows[0]["result"].ToString();
                                                objRate.SellerNick = sellerNick;
                                                string    strContent = "";
                                                TBRating  objRateDal = new TBRating();
                                                TradeRate obj        = null;
                                                //调用接口 新增单个评价
                                                obj = objRateDal.BuyerTradeRateOneByOne(objRate, ref strContent, sessionKey);
                                                if (obj == null)
                                                {
                                                    // 调用API进行批量评价
                                                    obj = objRateDal.BuyerTradeRate(objRate, ref strContent, sessionKey);
                                                }
                                                if (obj != null)
                                                {       //rating sucessfull
                                                    obj.Content = strContent;
                                                    obj.Nick    = objRate.SellerNick;
                                                    obj.Tid     = Convert.ToInt64(tid);
                                                    obj.Created = obj.Created;

                                                    // 添加卖家评价:秒评
                                                    //Console.WriteLine("评价卖家:" + obj.Nick + " 评价日期:" + obj.Created);
                                                    DBUtil.AddRateHisWithSeller(obj, "秒评");

                                                    Console.WriteLine("当前卖家:" + sellerNick + "评价时间:" + DateTime.Now.ToString());
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            #endregion
                        }

                        //判断卖家是否开通买家评价以后评价
                        if (isWaitBuyerRate == 1)
                        {
                            #region 方案二(买家评价以后评价)
                            string     sessionKey = DBUtil.GetSellerSessionKey(sellerNick);
                            RateConfig objRate    = new RateConfig();
                            TBRating   objRateDal = new TBRating();

                            objRate.Content1   = dtAutoConfig.Rows[0]["content1"].ToString();
                            objRate.Content2   = dtAutoConfig.Rows[0]["content2"].ToString();
                            objRate.Content3   = dtAutoConfig.Rows[0]["content3"].ToString();
                            objRate.SellerNick = sellerNick;
                            //默认好评
                            objRate.Result = dtAutoConfig.Rows[0]["result"].ToString();

                            //检查买家是否评论
                            List <TradeRate> sates   = objRateDal.GetTradeRate(sessionKey);
                            bool             isRated = false;
                            foreach (TradeRate trade in sates)
                            {
                                if (trade.Tid.ToString() == tid)
                                {
                                    isRated = true;
                                    break;
                                }
                            }
                            if (isRated) //买家已评价
                            {
                                //买家在黑名单
                                if (DBUtil.CheckIsBlacklst(sellerNick, buyerNick))
                                {
                                    int blackBuyerRatedIsRate = Convert.ToInt32(dtAutoConfig.Rows[0]["blackBuyerRatedIsRate"]);
                                    if (blackBuyerRatedIsRate == 1)
                                    {
                                        continue;
                                    }
                                    if (blackBuyerRatedIsRate == 3)
                                    {
                                        objRate.Result         = "neutral";
                                        objRate.BadRateContent = dtAutoConfig.Rows[0]["badRateContent"].ToString();
                                        objRate.Content1       = dtAutoConfig.Rows[0]["badRateContent"].ToString();
                                        objRate.Content2       = dtAutoConfig.Rows[0]["badRateContent"].ToString();
                                        objRate.Content3       = dtAutoConfig.Rows[0]["badRateContent"].ToString();
                                    }
                                    if (blackBuyerRatedIsRate == 4)
                                    {
                                        objRate.Result         = "bad";
                                        objRate.BadRateContent = dtAutoConfig.Rows[0]["badRateContent"].ToString();
                                        objRate.Content1       = dtAutoConfig.Rows[0]["badRateContent"].ToString();
                                        objRate.Content2       = dtAutoConfig.Rows[0]["badRateContent"].ToString();
                                        objRate.Content3       = dtAutoConfig.Rows[0]["badRateContent"].ToString();
                                    }
                                }
                            }
                            else //买家未评价
                            {
                                //买家在黑名单
                                if (DBUtil.CheckIsBlacklst(sellerNick, buyerNick))
                                {
                                    //检查是否到评论时间
                                    TimeSpan ts           = DateTime.Now - createDate;
                                    int      jiange       = (ts.Days * 24 * 60 * 60) + (ts.Hours * 60 * 60) + (ts.Minutes * 60) + (ts.Minutes);
                                    int      congigJiange = (Convert.ToInt32(dtAutoConfig.Rows[0]["blackBuyerNoRateQiangRateDay"]) * 24 * 60 * 60)
                                                            + (Convert.ToInt32(dtAutoConfig.Rows[0]["blackBuyerNoRateQiangRateHour"]) * 60 * 60) + (Convert.ToInt32(dtAutoConfig.Rows[0]["blackBuyerNoRateQiangRateFen"]) * 60);
                                    if (congigJiange < jiange)
                                    {
                                        continue;
                                    }
                                }
                                else //买家不在黑名单
                                {
                                    //检查是否到评论时间
                                    TimeSpan ts           = DateTime.Now - createDate;
                                    int      jiange       = (ts.Days * 24 * 60 * 60) + (ts.Hours * 60 * 60) + (ts.Minutes * 60) + (ts.Minutes);
                                    int      congigJiange = (Convert.ToInt32(dtAutoConfig.Rows[0]["waitBuyerTimeDay"]) * 24 * 60 * 60)
                                                            + (Convert.ToInt32(dtAutoConfig.Rows[0]["waitBuyerTimeHour"]) * 60 * 60) + (Convert.ToInt32(dtAutoConfig.Rows[0]["waitBuyerTimeFen"]) * 60);
                                    if (congigJiange < jiange)
                                    {
                                        continue;
                                    }
                                }
                            }

                            //评价开始
                            if (!string.IsNullOrEmpty(sessionKey))
                            {
                                // 获取卖家保存的评价策略
                                //DataTable tbSellerRateConfig = DBUtil.GetSellerRateConfig(sellerNick);

                                Trade objTrade = TBTrade.GetBuyerTrade(tid, sessionKey);
                                if (objTrade != null && objTrade.Orders.Count > 0)
                                {
                                    foreach (Order o in objTrade.Orders)
                                    {
                                        if (!o.SellerRate)
                                        {
                                            objRate.Tid = Convert.ToInt64(tid);
                                            objRate.Oid = o.Oid;
                                            string    strContent = "";
                                            TradeRate obj        = null;
                                            //调用接口 新增单个评价
                                            obj = objRateDal.BuyerTradeRateOneByOne(objRate, ref strContent, sessionKey);
                                            if (obj == null)
                                            {
                                                // 调用API进行批量评价
                                                obj = objRateDal.BuyerTradeRate(objRate, ref strContent, sessionKey);
                                            }
                                            if (obj != null)
                                            {       //rating sucessfull
                                                obj.Content = strContent;
                                                obj.Nick    = objRate.SellerNick;
                                                obj.Tid     = Convert.ToInt64(tid);
                                                obj.Created = obj.Created;

                                                // 添加卖家评价
                                                //Console.WriteLine("评价卖家:" + obj.Nick + " 评价日期:" + obj.Created);
                                                DBUtil.AddRateHisWithSeller(obj, "方案二");
                                                Console.WriteLine("当前卖家:" + sellerNick + "评价时间:" + DateTime.Now.ToString());
                                            }
                                        }
                                    }
                                }
                            }
                            #endregion
                        }

                        //判断卖家是否开通交易后多长时间评价
                        if (isQiangRate == 1)
                        {
                            #region 方案三(交易后多长时间评价)

                            //检查是否到评论时间
                            TimeSpan ts = DateTime.Now - createDate;
                            //当前时间到提单的时间间隔
                            int jiange = (ts.Days * 24 * 60 * 60) + (ts.Hours * 60 * 60) + (ts.Minutes * 60) + (ts.Minutes);
                            //评价配置的时间间隔
                            int congigJiange = (Convert.ToInt32(dtAutoConfig.Rows[0]["qiangRateTimeDay"]) * 24 * 60 * 60)
                                               + (Convert.ToInt32(dtAutoConfig.Rows[0]["qiangRateTimeHour"]) * 60 * 60) + (Convert.ToInt32(dtAutoConfig.Rows[0]["qiangRateTimeFen"]) * 60);
                            if (congigJiange < jiange)
                            {
                                continue;
                            }
                            //评价开始
                            string sessionKey = DBUtil.GetSellerSessionKey(sellerNick);
                            if (!string.IsNullOrEmpty(sessionKey))
                            {
                                //检查商家设置:秒评:只检查该用户是否在黑名单
                                if (!DBUtil.CheckIsBlacklst(sellerNick, buyerNick))
                                {
                                    Trade objTrade = TBTrade.GetBuyerTrade(tid, sessionKey);
                                    if (objTrade != null && objTrade.Orders.Count > 0)
                                    {
                                        foreach (Order o in objTrade.Orders)
                                        {
                                            if (!o.SellerRate)
                                            {
                                                RateConfig objRate = new RateConfig();
                                                objRate.Tid        = Convert.ToInt64(tid);
                                                objRate.Oid        = o.Oid;
                                                objRate.Content1   = dtAutoConfig.Rows[0]["content1"].ToString();
                                                objRate.Content2   = dtAutoConfig.Rows[0]["content2"].ToString();
                                                objRate.Content3   = dtAutoConfig.Rows[0]["content3"].ToString();
                                                objRate.Result     = dtAutoConfig.Rows[0]["result"].ToString();
                                                objRate.SellerNick = sellerNick;
                                                string    strContent = "";
                                                TBRating  objRateDal = new TBRating();
                                                TradeRate obj        = null;
                                                //调用接口 新增单个评价
                                                obj = objRateDal.BuyerTradeRateOneByOne(objRate, ref strContent, sessionKey);
                                                if (obj == null)
                                                {
                                                    // 调用API进行批量评价
                                                    obj = objRateDal.BuyerTradeRate(objRate, ref strContent, sessionKey);
                                                }
                                                if (obj != null)
                                                {   //rating sucessfull
                                                    obj.Content = strContent;
                                                    obj.Nick    = objRate.SellerNick;
                                                    obj.Tid     = Convert.ToInt64(tid);
                                                    obj.Created = obj.Created;

                                                    // 添加卖家评价:秒评
                                                    //Console.WriteLine("评价卖家:" + obj.Nick + " 评价日期:" + obj.Created);
                                                    DBUtil.AddRateHisWithSeller(obj, "方案三");

                                                    Console.WriteLine("当前卖家:" + sellerNick + "评价时间:" + DateTime.Now.ToString());
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            #endregion
                        }
                        //自动删除数据
                        DBUtil.DeleteValidTradeForMiaoRate(tid);
                    }
                    busySend = false;
                }
            }
            catch (Exception ex)
            {
                ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Data);
            }
            finally
            {
                sendMessageDoTimer.Enabled = true;
            }
        }
Exemple #8
0
 public RateQueryHandler(IConfiguration config)
 {
     _rateConfig = config.GetSection("Rate").Get <RateConfig>();
 }
Exemple #9
0
 /// <summary>
 /// 修改卖家评价配置
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public bool UpdateRateConfig(RateConfig obj)
 {
     try
     {
         string query = @"update RateConfig 
                         set isMiaoRate = @isMiaoRate,
                         isWaitBuyerRate = @isWaitBuyerRate,
                         waitBuyerTimeDay = @waitBuyerTimeDay,
                         waitBuyerTimeHour = @waitBuyerTimeHour,
                         waitBuyerTimeFen = @waitBuyerTimeFen,
                         blackBuyerRatedIsRate = @blackBuyerRatedIsRate,
                         blackBuyerNoRateQiangRateDay = @blackBuyerNoRateQiangRateDay,
                         blackBuyerNoRateQiangRateHour = @blackBuyerNoRateQiangRateHour,
                         blackBuyerNoRateQiangRateFen = @blackBuyerNoRateQiangRateFen,
                         isQiangRate = @isQiangRate,
                         qiangRateTimeDay = @qiangRateTimeDay,
                         qiangRateTimeHour = @qiangRateTimeHour,
                         qiangRateTimeFen = @qiangRateTimeFen,
                         atuoAddBlackListBadRate =@atuoAddBlackListBadRate,
                         atuoAddBlackListTuiKuan =@atuoAddBlackListTuiKuan,
                         badRateContent = @badRateContent,
                         content1 = @content1,
                         content2 = @content2,
                         content3 = @content3,
                         contentChoice = @contentChoice,
                         updateDate = getdate()
                         where sellerNick = @sellerNick";
         // 设置SQL参数
         SqlParameter[] param = new SqlParameter[]
         {
             new SqlParameter("@sellerNick", obj.SellerNick),
             new SqlParameter("@isMiaoRate", obj.IsMiaoRate),
             new SqlParameter("@isWaitBuyerRate", obj.IsWaitBuyerRate),
             new SqlParameter("@waitBuyerTimeDay", obj.WaitBuyerTimeDay),
             new SqlParameter("@waitBuyerTimeHour", obj.WaitBuyerTimeHour),
             new SqlParameter("@waitBuyerTimeFen", obj.WaitBuyerTimeFen),
             new SqlParameter("@blackBuyerRatedIsRate", obj.BlackBuyerRatedIsRate),
             new SqlParameter("@blackBuyerNoRateQiangRateDay", obj.BlackBuyerNoRateQiangRateDay),
             new SqlParameter("@blackBuyerNoRateQiangRateHour", obj.BlackBuyerNoRateQiangRateHour),
             new SqlParameter("@blackBuyerNoRateQiangRateFen", obj.BlackBuyerNoRateQiangRateFen),
             new SqlParameter("@isQiangRate", obj.IsQiangRate),
             new SqlParameter("@qiangRateTimeDay", obj.QiangRateTimeDay),
             new SqlParameter("@qiangRateTimeHour", obj.QiangRateTimeHour),
             new SqlParameter("@qiangRateTimeFen", obj.QiangRateTimeFen),
             new SqlParameter("@atuoAddBlackListBadRate", obj.AtuoAddBlackListBadRate),
             new SqlParameter("@atuoAddBlackListTuiKuan", obj.AtuoAddBlackListTuiKuan),
             new SqlParameter("@badRateContent", obj.BadRateContent == null ? "" : obj.BadRateContent),
             new SqlParameter("@content1", obj.Content1 == null ? "" : obj.Content1),
             new SqlParameter("@content2", obj.Content2 == null ? "" : obj.Content2),
             new SqlParameter("@content3", obj.Content3 == null ? "" : obj.Content3),
             new SqlParameter("@contentChoice", obj.ContentChoice)
         };
         DataBase.ExecuteSql(query, param);
         return(true);
     }
     catch (Exception ex)
     {
         ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Data);
         return(false);
     }
 }