/// <summary> /// 发货中转 /// </summary> /// <param name="sellerId"></param> /// <param name="dbId"></param> /// <param name="dispatchId"></param> /// <param name="dispatchInfo"></param> /// <returns></returns> public static IResultResponse DispatchSubmit(SysParameter para) { IResultResponse result = null; int sellerId = para.ToInt("FKId"); int dbId = para.ToInt("DBId"); string dispatchInfo = para.ToValue("DispatchInfo"); int dispatchId = para.ToInt("DispatchId"); int orderId = para.ToInt("OrderId"); int upBuyerId = para.ToInt("BuyerId"); string oddNumber = para.ToValue("OddNumber"); try { RelationMappingEntity productMappingEntity = new ProductRelationBusiness(para.dapperFactory).GetDownMappingEntity(sellerId, upBuyerId, dbId); if (productMappingEntity.GoodsMapping.Count == 0) { return(ResultResponse.ExceptionResult("没有找到商品映射关系")); } RelationMappingEntity orderMappingEntity = new OrderRelationBusiness(para.dapperFactory).GetDownOrder(sellerId, dbId, orderId, upBuyerId); if (!orderMappingEntity.OrderMapping.ContainsKey(orderId) || !orderMappingEntity.OrderOddNumberMapping.ContainsKey(oddNumber)) { return(ResultResponse.ExceptionResult("没有找到订单映射关系")); } //替换orderid dispatchInfo = ReplaceIds(orderMappingEntity.OrderMapping, dispatchInfo, "OrderId"); //替换商品oddnumbers dispatchInfo = ReplaceStr(orderMappingEntity.OrderOddNumberMapping, dispatchInfo, "OddNumber"); //替换product dispatchInfo = ReplaceIds(productMappingEntity.ProductMapping, dispatchInfo, "ProductId"); dispatchInfo = ReplaceIds(productMappingEntity.GoodsMapping, dispatchInfo, "GoodsId"); //发送 result = ApiRequest.GetResponse(productMappingEntity.ConnectorEntity.Domain, "order.dropshippingdispatch.submit", new Dictionary <string, string>() { { "OrderId", orderMappingEntity.OrderMapping[orderId].ToString() }, { "DispatchInfo", dispatchInfo } }); if (result.Success) { //入库 var orderDic = result.Content as Dictionary <string, object>; if (orderDic != null) { new DispatchRelationBusiness(para.dapperFactory).Insert(dispatchId, orderMappingEntity.OrderRelationEntity, orderDic); } return(ResultResponse.GetSuccessResult(dispatchId)); } else { return(result); } } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex)); } }
/// <summary> /// 授权登录 /// </summary> /// <param name="para"></param> /// <returns></returns> public static IResultResponse AuthLogin(SysParameter para) { try { string token = para.ToValue("exchange_token"); if (token.IndexOf("%") > -1) { token = HttpUtility.UrlDecode(token); } string sign = para.ToValue("exhange_sign"); string sign_new = Encrypt.MD532("rwxkj:" + token); if (sign_new != sign) { return(ResultResponse.ExceptionResult("参数被篡改")); } string tokenStr = AES.Decode(token); var dic = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, object> >(tokenStr); if (dic == null || dic.Count() == 0) { return(ResultResponse.ExceptionResult("交换token失败")); } int fk_id = dic.ToInt("fk_id", 0); int db_id = dic.ToInt("db_id", 0); IResultResponse resultResponse = new ConnectorBusiness(para.dapperFactory).ExchangeToken(fk_id, db_id); if (resultResponse.Success) { return(resultResponse); } else { string domain = dic.ToValue("domain"); string msg = string.Empty; resultResponse = ApiRequest.GetResponse(domain, "account.base.info", new Dictionary <string, string>() { { "exchange_token", HttpUtility.UrlEncode(token) }, { "exhange_sign", sign }, }); if (resultResponse.Success) { Dictionary <string, object> dic_content = resultResponse.Content as Dictionary <string, object>; resultResponse = new ConnectorBusiness(para.dapperFactory).Join(dic_content); if (!resultResponse.Success) { return(resultResponse); } resultResponse = new ConnectorBusiness(para.dapperFactory).ExchangeToken(fk_id, db_id); } } return(resultResponse); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse GetScmCode(SysParameter para) { string verifyCode = para.ToValue("verifyCode"); string codeToken = para.ToValue("codeToken"); int connectorId = para.ToInt("connectorId", 0); IResultResponse result = new RelationBusiness(para.dapperFactory).GetValidateCode(connectorId, codeToken, verifyCode); return(result); }
/// <summary> /// 代下单中转 /// </summary> /// <param name="para"></param> /// <returns></returns> public static IResultResponse OrderSubmit(SysParameter para) { try { int sellerId = para.ToInt("FKId"); int dbId = para.ToInt("DBId"); string orderInfo = para.ToValue("Order"); int orderId = para.ToInt("OrderId"); string oddNumber = para.ToValue("OddNumber"); decimal downPayables = para.ToDecimal("Payables"); IResultResponse result = null; if (String.IsNullOrEmpty(orderInfo) && sellerId != 0) { return(ResultResponse.ExceptionResult("订单信息为空")); } RelationMappingEntity relationMappingEntity = new ProductRelationBusiness(para.dapperFactory).GetUpMappingEntity(sellerId, dbId); if (relationMappingEntity.GoodsMapping.Count == 0) { return(ResultResponse.ExceptionResult("没有找到商品映射关系")); } //替换供应商ids orderInfo = ReplaceIds(relationMappingEntity.ConnectorMapping, orderInfo, "SupplierIds"); orderInfo = ReplaceIds(relationMappingEntity.ConnectorMapping, orderInfo, "SupplierId"); //替换商品ids orderInfo = ReplaceIds(relationMappingEntity.ProductMapping, orderInfo, "ProductIds"); //替换productinfo里面的 orderInfo = ReplaceIds(relationMappingEntity.ProductMapping, orderInfo, "ProductId"); orderInfo = ReplaceIds(relationMappingEntity.GoodsMapping, orderInfo, "GoodsId"); //发送 result = ApiRequest.GetResponse(relationMappingEntity.ConnectorEntity.Domain, "order.dropshipping.submit", new Dictionary <string, string>() { { "StoreId", relationMappingEntity.ConnectorEntity.UpBuyerId.ToString() }, { "Order", orderInfo } }); if (result.Success) { //入库 var orderDic = result.Content as Dictionary <string, object>; if (orderDic != null) { new OrderRelationBusiness(para.dapperFactory).Insert(orderId, oddNumber, downPayables, relationMappingEntity.ConnectorEntity, orderDic); } return(ResultResponse.GetSuccessResult(orderId)); } else { return(result); } } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse GetValidateCode(SysParameter para) { NetResponse response = null; string domain = para.ToValue("domain"); if (domain == null) { return(ResultResponse.ExceptionResult("域名为空")); } NetRequest request = new NetRequest(); request.SetTimeOut(8000); request.SetTryTimes(1); string url = domain + "/api/VerifyCode.axd?base64=1"; string msg = string.Empty; response = request.Get(url, string.Empty, out msg); string content = response.Content; string codeToken = response.Header["CodeToken"]; Dictionary <string, string> result = new Dictionary <string, string>() { { "content", content }, { "codeToken", codeToken }, }; return(ResultResponse.GetSuccessResult(result.ToJson())); }
public static IResultResponse OrderCheck(SysParameter para) { try { int sellerId = para.ToInt("FKId"); int dbId = para.ToInt("DBId"); string orderInfo = para.ToValue("ProductInfo"); int orderId = para.ToInt("OrderId"); bool result = false; if (!String.IsNullOrEmpty(orderInfo) && sellerId != 0) { var xml = new XmlDocument(); xml.LoadXml(orderInfo); //检测商品 var res = new ProductRelationBusiness(para.dapperFactory).CheckProduct(sellerId, dbId, xml); if (!res.Success) { return(res); } //检测订单 bool check = new OrderRelationBusiness(para.dapperFactory).CheckOrder(sellerId, dbId, orderId); if (check) { return(ResultResponse.ExceptionResult("你已经代下过单了")); } return(ResultResponse.GetSuccessResult(result)); } return(ResultResponse.ExceptionResult("订单信息不全")); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse ValidateCode(SysParameter para) { string verifyCode = para.ToValue("verifyCode"); int connectorId = para.ToInt("connectorId", 0); int upConnectorId = para.ToInt("upConnectorId", 0); IResultResponse result = new RelationBusiness(para.dapperFactory).ValidateCode(connectorId, upConnectorId, verifyCode); return(result); }
public static IResultResponse GetBrandList(SysParameter para) { try { int connectorId = para.ToInt("ConnectorId", 0); string firstSpell = para.ToValue("FirstSpell"); bool showAll = para.ToBool("ShowAll"); string keyword = para.ToValue("KeyWord"); ArrayList result = new AuthBrandBusiness(para.dapperFactory).GetAuthBrandList(connectorId, firstSpell, keyword, showAll); if (result == null) { return(ResultResponse.GetSuccessResult(new ArrayList())); } return(ResultResponse.GetSuccessResult(result)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse GetOrderInfo(SysParameter para) { try { int connectorId = para.ToInt("ConnectorId"); string oddNumber = para.ToValue("OddNumber"); return(new OrderRelationBusiness(para.dapperFactory).GetOrderInfo(connectorId, oddNumber)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse CheckDownConnector(SysParameter para) { string mobile = para.ToValue("Mobile"); int upConnectorId = para.ToInt("UpConnectorId", 0); if (string.IsNullOrWhiteSpace(mobile)) { return(ResultResponse.ExceptionResult("请输入正确手机号")); } IResultResponse result = new RelationBusiness(para.dapperFactory).CheckDownConnector(mobile, upConnectorId); return(result); }
public static IResultResponse AddAuth(SysParameter para) { try { int connectorId = para.ToInt("ConnectorId", 0); string ids = para.ToValue("CategoryIds"); int result = new AuthCategoryBusiness(para.dapperFactory).Insert(connectorId, ids); return(ResultResponse.GetSuccessResult(result)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse GetList(SysParameter para) { try { string mobile = para.ToValue("Mobile"); int connectorId = para.ToInt("ConnectorId", 0); IResultResponse result = new ConnectorBusiness(para.dapperFactory).search(connectorId, mobile); return(result); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse AddUpRelation(SysParameter para) { try { string mobile = para.ToValue("Mobile"); int connectorId = para.ToInt("ConnectorId"); int result = new RelationBusiness(para.dapperFactory).InsertUpConnectorRelation(mobile, connectorId); return(ResultResponse.GetSuccessResult(result)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse DeleteUnauthorized(SysParameter para) { try { string authProductIds = para.ToValue("AuthProductIds"); int connectorId = para.ToInt("ConnectorId", 0); int result = new AuthProductBusiness(para.dapperFactory).Delete(authProductIds, connectorId); return(ResultResponse.GetSuccessResult(result)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse AddAuth(SysParameter para) { try { string pageIds = para.ToValue("PageIds"); int connectorId = para.ToInt("ConnectorId"); int pageType = para.ToInt("PageType", 1); int result = new AuthSiteBusiness(para.dapperFactory).Insert(pageIds, connectorId, pageType); return(ResultResponse.GetSuccessResult(result)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse BatchImportProduct(SysParameter para) { try { int connectorId = para.ToInt("ConnectorId"); string productIds = para.ToValue("ProductIds"); int upConnectorId = para.ToInt("UpConnectorId"); IResultResponse result = new ProductRelationBusiness(para.dapperFactory).BatchImportProduct(connectorId, upConnectorId, productIds); return(result); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
/// <summary> /// 订单确认中转 /// </summary> /// <param name="para"></param> /// <returns></returns> public static IResultResponse OrderReceive(SysParameter para) { IResultResponse result = null; int sellerId = para.ToInt("FKId"); int dbId = para.ToInt("DBId"); int orderId = para.ToInt("OrderId"); string oddNumber = para.ToValue("OddNumber"); int dispatchId = para.ToInt("DispatchId"); try { RelationMappingEntity relationMappingEntity = new ProductRelationBusiness(para.dapperFactory).GetUpMappingEntity(sellerId, dbId); if (relationMappingEntity.GoodsMapping.Count == 0) { return(ResultResponse.ExceptionResult("没有找到商品映射关系")); } RelationMappingEntity orderMappingEntity = new OrderRelationBusiness(para.dapperFactory).GetUpOrder(sellerId, dbId, orderId); int replaceDispatchId = 0; if (dispatchId != 0) { if (!orderMappingEntity.DispatchMapping.ContainsKey(dispatchId)) { return(ResultResponse.GetSuccessResult("没有找到发货单id")); } replaceDispatchId = orderMappingEntity.DispatchMapping[dispatchId]; } //发送 result = ApiRequest.GetResponse(relationMappingEntity.ConnectorEntity.Domain, "order.dropshippingreceive.submit", new Dictionary <string, string>() { { "DispatchId", replaceDispatchId.ToString() }, { "OddNumber", orderMappingEntity.OrderOddNumberMapping[oddNumber] }, { "OrderId", orderMappingEntity.OrderMapping[orderId].ToString() } }); if (result.Success) { return(ResultResponse.GetSuccessResult(dispatchId)); } else { return(result); } } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex)); } }
/// <summary> /// 获得二维码内容 /// </summary> /// <param name="para"></param> /// <returns></returns> public static IResultResponse GetConnectorByQr(SysParameter para) { string qr = para.ToValue("qr"); string s = ECF.Security.AES.Decode(qr); if (string.IsNullOrEmpty(s)) { return(ResultResponse.ExceptionResult("该二维码无效")); } int connectorId = Utils.ToInt(s); Dictionary <string, object> dicInfo = new ConnectorBusiness(para.dapperFactory).GetConnectorById(connectorId); if (dicInfo == null || dicInfo.Count == 0) { return(ResultResponse.ExceptionResult("不存在该连接器对象")); } return(ResultResponse.GetSuccessResult(dicInfo)); }
public static IResultResponse CheckConnector(SysParameter para) { try { int id = para.ToInt("Id", 0); int status = para.ToInt("Status"); int connectorId = para.ToInt("ConnectorId", 0); string type = para.ToValue("Type"); if (type == "up") { return(new RelationBusiness(para.dapperFactory).CheckDownConnector(connectorId, id, status)); } else { return(new RelationBusiness(para.dapperFactory).CheckUpConnector(connectorId, id, status)); } } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }