/// <summary> /// 修改帐号 /// Api.ashx?act=updatezh&zh=b帐号&status=已申请&ids=114964887,115371546,115365386 /// </summary> /// <param name="con"></param> /// <returns></returns> private ApiResult UpdateZh(HttpContext con) { BLL.plans bllplans = new BLL.plans(); DataSet ds = new DataSet(); ApiResult res = new ApiResult(); try { string ids = GetRequest(con, "ids"); string zh = GetRequest(con, "zh"); string status = GetRequest(con, "status"); ids = "," + ids + ","; int total = 0; var list = bllplans.GetList(1, int.MaxValue, ref total, m => ids.Contains("," + m.campaignId + ","), m => m.id, false); foreach (var model in list) { if (status == "已通过") { model.zhanghaos_ok += "#" + zh; model.zhanghaos_ok = model.zhanghaos_ok.Trim('#'); List <string> tmplist = new List <string>(); if (!string.IsNullOrEmpty(model.zhanghaos_doing)) { tmplist = new List <string>(model.zhanghaos_doing.Split(new string[] { "#" }, StringSplitOptions.RemoveEmptyEntries)); } model.zhanghaos_doing = string.Join("#", tmplist.Where(i => i != zh)); model.lastOkTime = DateTime.Now; } else if (status == "已申请") { model.zhanghaos_doing += "#" + zh; model.zhanghaos_doing = model.zhanghaos_doing.Trim('#'); List <string> tmplist = new List <string>(); if (!string.IsNullOrEmpty(model.zhanghaos_ok)) { tmplist = new List <string>(model.zhanghaos_ok.Split(new string[] { "#" }, StringSplitOptions.RemoveEmptyEntries)); } model.zhanghaos_ok = string.Join("#", tmplist.Where(i => i != zh)); } else if (status == "作废") { model.ifok = "作废"; } bllplans.Update(model); } res.message = ""; res.success = true; } catch (Exception e) { res.success = false; res.message = "操作失败," + e.Message; } return(res); }
protected void DataInfoBind() { ShowPager.PageSize = PageSize; int total = 0; Model.plansCondition con = condition(); var list = new List <Model.plans>(); if (ddlsort.SelectedValue == "2") { list = bllplans.GetList(ShowPager.CurrentPageIndex, ShowPager.PageSize, ref total, con, p => p.lastOkTime, false); } else if (ddlsort.SelectedValue == "3") { list = bllplans.GetList(ShowPager.CurrentPageIndex, ShowPager.PageSize, ref total, con, p => p.lastOkTime, false); } else { list = bllplans.GetList(ShowPager.CurrentPageIndex, ShowPager.PageSize, ref total, con, p => p.id, false); } ShowPager.RecordCount = total; this.rpData.DataSource = list; this.rpData.DataBind(); }
/// <summary> /// 获取高佣计划 /// Api.ashx?act=getplans&dt=1590940800 /// </summary> /// <param name="con"></param> /// <returns></returns> private ApiResult GetPlans(HttpContext con) { BLL.plans bllplans = new BLL.plans(); ApiResult res = new ApiResult(); try { string strGetOk = GetRequest(con, "getok"); string strDt = GetRequest(con, "dt"); DateTime dt = DateTimeHelper.GetTime(strDt); int total = 0; List <Model.plansInfo> listRes = new List <Model.plansInfo>(); List <Model.plans> list = new List <Model.plans>(); if (string.IsNullOrEmpty(strGetOk)) { list = bllplans.GetList(1, int.MaxValue, ref total, m => m.zctime >= dt && m.ifok == "正常", m => m.id, false); } else { list = bllplans.GetList(1, int.MaxValue, ref total, m => m.zctime >= dt && m.zhanghaos_ok != "" && m.ifok == "正常", m => m.lastOkTime, false); } foreach (var item in list) { listRes.Add(new Model.plansInfo { id = item.id, item_id = item.item_id, goodsname = item.item_id, shopname = item.shopname, PayMoney = item.PayMoney, planname = item.planname, planlink = item.planlink, campaignId = item.campaignId, userNumberId = item.userNumberId, shopkeeperId = item.shopkeeperId, zctime = item.zctime, zhanghaos_ok = item.zhanghaos_ok, ifok = item.ifok, coupon_url = item.coupon_url, coupon_price = item.coupon_price, commission_dx = item.commission_dx, commission_MKT = item.commission_MKT, pic = item.pic, intro = item.intro, tdRatio = item.tdRatio, tdCoupon = item.tdCoupon, tdCouponPrice = item.tdCouponPrice, detectionTime = item.detectionTime }); } string json = Newtonsoft.Json.JsonConvert.SerializeObject(listRes); res.message = json; res.success = true; } catch (Exception e) { res.success = false; res.message = "操作失败" + e.Message; } return(res); }
private ApiResult DealLink(dynamic json) { ApiResult res = new ApiResult(); try { BLL.plans bllPlans = new BLL.plans(); rootDto <Model.Api.message> dto = JsonConvert.DeserializeObject <rootDto <Model.Api.message> >(json.ToString()); DateTime dtNow = DateTime.Now; DateTime dtToDay = DateTime.Parse(dtNow.ToString("yyyy-MM-dd")); string strMsg = dto.Data.msg; string[] strArr = strMsg.Split(new string[] { "http" }, StringSplitOptions.None); List <string> aLink = new List <string>(); for (int i = 0; i < strArr.Length; i++) { if (i == 0 && string.IsNullOrEmpty(strArr[0])) { continue; } string strItem = strArr[i]; int index = PageFunc.getIndex(strItem); string strLink = string.Format("http{0}", strItem.Substring(0, index)); if (strLink.IndexOf("uland.taobao.com") != -1) { } else if (strLink.IndexOf("detail.tmall.com") != -1) { string itemId = PageFunc.GetQueryString("id", strLink); string strContent = HttpHelper.HttpGet("http://g5.vipdamai.net/hcapi.ashx?gid=" + itemId); hcRoot hc = JsonConvert.DeserializeObject <hcRoot>(strContent); if (hc.error == "0") { if (hc.data != null) { int total = 0; var list = bllPlans.GetList(1, int.MaxValue, ref total, p => p.userNumberId == hc.data.seller_id && EntityFunctions.CreateDateTime(p.zctime.Value.Year, p.zctime.Value.Month, p.zctime.Value.Day, 0, 0, 0) == dtToDay, p => p.id); if (total > 0) { foreach (var item in list) { item.item_id = hc.data.num_iid; item.goodsname = hc.data.title; item.shopname = hc.data.shop_title; if (!string.IsNullOrEmpty(hc.data.coupon_info)) { string couponPrice = hc.data.coupon_info.Substring(hc.data.coupon_info.IndexOf("减") + 1).Replace("元", ""); item.coupon_price = couponPrice; item.PayMoney = decimal.Parse(hc.data.zk_final_price) - decimal.Parse(couponPrice); } else { item.PayMoney = decimal.Parse(hc.data.zk_final_price); } bllPlans.Update(item); } } else { var item = new Model.plans(); item.item_id = itemId; item.goodsname = hc.data.title; item.shopname = hc.data.shop_title; item.pic = hc.data.pict_url; item.zctime = dtNow; //item.coupon_url = hc.data.coupon_click_url; item.userNumberId = hc.data.seller_id; item.ifok = "待补充"; bllPlans.Add(item); } } } } else if (strLink.IndexOf("pub.alimama.com") != -1) { string userNumberId = PageFunc.GetQueryString("userNumberId", strLink); var model = bllPlans.GetModel(p => p.userNumberId == userNumberId && EntityFunctions.CreateDateTime(p.zctime.Value.Year, p.zctime.Value.Month, p.zctime.Value.Day, 0, 0, 0) == dtToDay); if (model != null) { model.planname = "默认计划名"; model.planlink = strLink; model.ifok = "正常"; bllPlans.Update(model); } else { model = new Model.plans(); model.planname = "默认计划名"; model.userNumberId = userNumberId; model.planlink = strLink; model.zctime = dtNow; model.ifok = "正常"; bllPlans.Add(model); } } } res.message = ""; res.success = true; } catch (Exception e) { res.success = false; res.message = "请求失败" + e.Message; LogHelper.Error(res.message, e); } return(res); }
private OtherResult GetGoodsInfo(HttpContext con) { OtherResult res = new OtherResult(); string siteid = ""; string adzoneid = ""; string setname = ""; string appkeyid = ""; if (con.Request["id"] == null) { res.IsSuccess = false; res.Message = "商品ID为必须参数"; } string activityid = ""; if (con.Request["activityid"] != null) { activityid = con.Request["activityid"].ToString(); if (activityid.IndexOf("activityId") > 0) { activityid = activityid.Substring(activityid.IndexOf("activityId")); if (activityid.IndexOf("&") > 0) { activityid = activityid.Substring(0, activityid.IndexOf("&")); } activityid = "&" + activityid; } else { activityid = ""; } } if (con.Request["appkeyid"] != null) { appkeyid = con.Request["appkeyid"].ToString(); modelAppKey = bllappkey.GetModel(int.Parse(appkeyid)); //根据appkeyid 读取 三个基础参数 siteid = modelAppKey.SiteId; adzoneid = modelAppKey.AdzoneId; setname = modelAppKey.TbAccount; } string id = con.Request["id"].ToString(); if (id.IndexOf("http") != -1) { string link = id; Regex reg = new Regex("id=(.+)&?"); Match match = reg.Match(link); id = match.Groups[1].Value; } string strContent = HttpHelper.HttpGet("http://g5.vipdamai.net/ZhuanKouLin.aspx?moshi=jiance&keyword=https://detail.tmall.com/item.htm?id=" + id + "&siteid=" + siteid + "&adzoneid=" + adzoneid + "&setname=" + setname + activityid); strContent = strContent.TrimStart("\"".ToArray()).TrimEnd("\"".ToArray()); string temp = ""; temp += "<?xml version=\"1.0\" encoding=\"utf-16\"?>"; temp += "<goodsinfo xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"; strContent = temp + strContent + "</goodsinfo>"; var obj = XmlUtil.DeserializeXml <Model.goodsinfo>(strContent); int total = 0; DateTime zcTime = DateTime.Now.AddMonths(-1); var plansList = bllPlans.GetList(1, int.MaxValue, ref total, m => m.item_id != null && m.item_id == id && m.zctime >= zcTime, m => m.id); var plansListOk = plansList.Where(m => m.zhanghaos_ok != null && (m.zhanghaos_ok.StartsWith(modelAppKey.TbAccount) || m.zhanghaos_ok.EndsWith(modelAppKey.TbAccount) || m.zhanghaos_ok.Contains("#" + modelAppKey.TbAccount + "#")) && m.ifok == "正常").ToList(); if (plansListOk.Count > 0) { obj.campaignType = "DX"; } else if (total > 0) { obj.campaignType = "MKT"; } else { obj.campaignType = ""; } res.IsSuccess = true; res.Message = JsonHelper.JsonSerializer <object>(obj); return(res); }