Пример #1
0
        public JsonResult Orderrewire()
        {
            object retJson   = new { success = 0, msg = "操作失败" };
            string ordercode = string.IsNullOrEmpty(Request["code"]) ? "" : Request["code"];
            string ptime     = string.IsNullOrEmpty(Request["ptime"]) ? "" : Request["ptime"];
            bool   sess      = Convert.ToDateTime(Session["sendtime_" + ordercode]) > System.DateTime.Now.AddMinutes(-1) ? true : false;

            if (!string.IsNullOrEmpty(ordercode) && !string.IsNullOrEmpty(ptime))
            {
                if (DateTime.Parse(DateTime.Parse(ptime).ToString("yyyy-MM-dd")) > DateTime.Parse(DateTime.Now.AddDays(-3).ToString("yyyy-MM-dd")))
                {
                    if (sess)
                    {
                        retJson = new { success = 0, msg = "请间隔一分钟,再次发送!" };
                        return(Json(retJson));
                    }
                    else
                    {
                        JMP.BLL.jmp_order bll        = new JMP.BLL.jmp_order();
                        JMP.MDL.jmp_order morder     = new JMP.MDL.jmp_order();
                        string            tabalename = "dbo.jmp_order_" + JMP.TOOL.WeekDateTime.GetWeekFirstDayMon(DateTime.Parse(ptime)).ToString("yyyyMMdd");
                        morder = bll.SelectOrder(ordercode, tabalename);
                        if (morder != null)
                        {
                            if (morder.o_times > 8 && morder.o_times < 12)
                            {
                                JMP.MDL.jmp_queuelist quli = new JMP.MDL.jmp_queuelist();
                                JMP.BLL.jmp_queuelist bllq = new JMP.BLL.jmp_queuelist();
                                quli.q_address     = morder.o_address;
                                quli.q_sign        = new JMP.BLL.jmp_app().GetModel(morder.o_app_id).a_secretkey;
                                quli.q_noticestate = 0;
                                quli.q_times       = morder.o_times;
                                quli.q_noticetimes = DateTime.Now;
                                quli.q_tablename   = tabalename;
                                quli.q_o_id        = morder.o_id;
                                quli.trade_type    = Int32.Parse(morder.o_paymode_id);
                                quli.trade_time    = morder.o_ptime;
                                quli.trade_price   = morder.o_price;
                                quli.trade_paycode = morder.o_tradeno;
                                quli.trade_code    = morder.o_code;
                                quli.trade_no      = morder.o_bizcode;
                                quli.q_privateinfo = morder.o_privateinfo;
                                quli.q_uersid      = UserInfo.UserId;
                                int cg = bllq.Add(quli);
                                if (cg > 0)
                                {
                                    Session["sendtime_" + morder.o_code] = System.DateTime.Now;
                                    retJson = new { success = 1, msg = "已重发通知!手动通知次数剩余:" + (11 - morder.o_times) + "次" };
                                }
                                else
                                {
                                    Logger.OperateLog("商务平台手动重发通知失败", "订单号:" + morder.o_code + ",表名:" + tabalename); //写入报错日
                                    retJson = new { success = 0, msg = "操作失败!" };
                                }
                            }
                            else
                            {
                                retJson = new { success = 0, msg = "手动通知无效!" };
                            }
                        }
                    }
                }
                else
                {
                    retJson = new { success = 0, msg = "只能重发三天以内的数据!" };
                }
            }
            else
            {
                retJson = new { success = 0, msg = "数据异常!" };
            }
            return(Json(retJson));
        }