/// <summary> /// 产品编辑 /// </summary> /// <returns></returns> public ActionResult ProductEdit() { //判断是否是修改 int productid = QueryString.IntSafeQ("productid"); int siteid = QueryString.IntSafeQ("siteid"); if (siteid == 0 && productid == 0) { return(Redirect(SuperMarketWebUrl.GetSysSelectSiteIdUrl())); } int classid = 0; int brandid = 0; VWProductEntity _vwproductentity = new VWProductEntity(); if (productid > 0) { _vwproductentity = ProductBLL.Instance.GetProductVW(productid); _vwproductentity.ProductPics = ProductStylePicsBLL.Instance.GetListPicsByProductId(productid); //获取样式图片列表 _vwproductentity.ProductPropertys = ProductPropertyBLL.Instance.GetListByProductId(productid); //获取样式属性列表 ProductBLL.Instance.Assignment(ref _vwproductentity, productid); classid = _vwproductentity.ClassId; brandid = _vwproductentity.BrandId; siteid = _vwproductentity.SiteId; ClassesFoundEntity _classentity = ClassesFoundBLL.Instance.GetClassesFound(classid, false); BrandEntity _brandntity = BrandBLL.Instance.GetBrand(brandid, false); } else { classid = QueryString.IntSafeQ("classid"); brandid = QueryString.IntSafeQ("brandid"); } ViewBag.SiteId = siteid; ViewBag.Product = _vwproductentity; ViewBag.MemId = memid; return(View()); }
/// <summary> /// 询价订单供应商发送微信提醒 /// </summary> /// <returns></returns> public string WeChatInquiryOrderSend() { ResultObj result = new ResultObj(); string ordercode = FormString.SafeQ("ordercode"); string memids = FormString.SafeQ("memids"); memids = memids.Trim(','); string[] memidattr = memids.Split(','); InquiryOrderEntity orderentity = InquiryOrderBLL.Instance.GetInquiryOrderByCode(ordercode); if (orderentity != null && orderentity.Status == (int)OrderInquiryStatusEnum.Quoting) { string url = string.Format(WeiXinConfig.URL_FORMAT_SendMsg, WeiXinJsSdk.Instance.GetAccessToken()); string resulturl = SuperMarketWebUrl.InquiryOrderSendWeChat(ordercode); string redirecturl = SuperMarketWebUrl.InquiryOrderUrl(ordercode); result.Obj = resulturl; ////获取链接导航Id //int navid = WeChatNavigationBLL.Instance.GetIdByUrl(redirecturl); foreach (string memidstr in memidattr) { int memid = StringUtils.GetDbInt(memidstr); MemberEntity memen = MemberBLL.Instance.GetMember(memid); if (!string.IsNullOrEmpty(memen.WeChat)) { MemWeChatMsgEntity wecharmsg = MemWeChatMsgBLL.Instance.GetMsgByAppUnionId(WeiXinConfig.GetAppId(), memen.WeChat); if (wecharmsg != null && !string.IsNullOrEmpty(wecharmsg.OpenId)) { WeiXinSendMsgEntity send = new WeiXinSendMsgEntity(); send.touser = wecharmsg.OpenId; send.template_id = WeiXinTemplet.InquiryQuoteSend; send.url = resulturl; WeiXinInquiryEntity inq = new WeiXinInquiryEntity(); inq.first = new WeiXinUnitEntity() { value = "您有订单需要报价啦,赶紧抢单,订单编号:" + orderentity.Code }; inq.tradeDateTime = new WeiXinUnitEntity() { value = orderentity.CreateTime.ToString("yyyy-MM-dd HH:mm:ss") }; inq.orderType = new WeiXinUnitEntity() { value = "询价订单" }; inq.customerInfo = new WeiXinUnitEntity() { value = "易店心" }; //inq.orderItemName = new WeiXinUnitEntity() { value = "随机名称" }; //inq.orderItemData = new WeiXinUnitEntity() { value = "随机数据" }; inq.remark = new WeiXinUnitEntity() { value = orderentity.Remark }; send.data = inq; string json = JsonJC.ObjectToJson(send); WeChatMsgEntity msg = new WeChatMsgEntity(); msg.ParamStr = json; msg.WeChatOpenId = wecharmsg.OpenId; msg.RedirectUrl = redirecturl; msg.WeChatUrl = url; msg.TemplateIid = WeiXinTemplet.InquiryQuoteSend; msg.Id = WeChatMsgBLL.Instance.AddWeChatMsg(msg); string resultrowi = WebServiceClient.QueryPostWebServiceJson(url, json); WeiXinFailEntity resulten = JsonJC.JsonToObject <WeiXinFailEntity>(resultrowi); if (resulten.errmsg.ToLower() == "ok") { CGMemQuotedBLL.Instance.CGQuotedSend(memid, ordercode); } msg.Result = resultrowi; WeChatMsgBLL.Instance.UpdateWeChatMsg(msg); } } } } else { CGMemQuotedBLL.Instance.QuotedCloseByCode(ordercode); } result.Status = (int)CommonStatus.Success; return(JsonJC.ObjectToJson(result)); }