diff --git a/KJD_WebService/BLL/BXX/BXXProductManage.cs b/KJD_WebService/BLL/BXX/BXXProductManage.cs index 9211471..b1dc368 100644 --- a/KJD_WebService/BLL/BXX/BXXProductManage.cs +++ b/KJD_WebService/BLL/BXX/BXXProductManage.cs @@ -3180,6 +3180,43 @@ namespace KJD_Web.BLL.BXX return "{\"code\":19999,\"msg\":\"输入为空\"}"; } + public string WxApiGetSupplierList(string inputData) + { + if (!string.IsNullOrEmpty(inputData)) + { + if (!WXUserManage.GetSign(inputData)) + return "{\"code\":999,\"msg\":\"校验失败\"}"; + + var token = RegexUtils.GetStringQuery(ref inputData, "token", true)?.Replace("'", "\\'"); + var offset = (RegexUtils.GetStringQuery(ref inputData, "offset", true)?.Replace("'", "\\'")).ParseToInt(0); + var limit = (RegexUtils.GetStringQuery(ref inputData, "limit", true)?.Replace("'", "\\'")).ParseToInt(100); + string data = "{\"offset\":" + offset + ",\"limit\":" + limit + "}"; + return HttpUtils.WxApiPostResponse("https://api.weixin.qq.com/channels/ec/supplier/relation/get_supplier_list?access_token=" + token, data, ""); + } + return "{\"code\":19999,\"msg\":\"输入为空\"}"; + } + + /// + /// 申请关联供货商 + /// + /// + /// + public string WxApiInviteSupplier(string inputData) + { + if (!string.IsNullOrEmpty(inputData)) + { + if (!WXUserManage.GetSign(inputData)) + return "{\"code\":999,\"msg\":\"校验失败\"}"; + + var token = RegexUtils.GetStringQuery(ref inputData, "token", true)?.Replace("'", "\\'"); + var supplier_appid = (RegexUtils.GetStringQuery(ref inputData, "supplier_appid", true)?.Replace("'", "\\'")); + var service_id = (RegexUtils.GetStringQuery(ref inputData, "service_id", true)?.Replace("'", "\\'")); + string data = "{\"supplier_appid\": \"" + supplier_appid + "\",\"service_id\": " + service_id + ",\"remark\": \"服务商代发邀请\"}"; + return HttpUtils.WxApiPostResponse("https://api.weixin.qq.com/channels/ec/supplier/relation/invite_supplier?access_token=" + token, data, ""); + } + return "{\"code\":19999,\"msg\":\"输入为空\"}"; + } + public string WxApiDropshipSearch(string inputData) { if (!string.IsNullOrEmpty(inputData)) @@ -3197,6 +3234,23 @@ namespace KJD_Web.BLL.BXX return "{\"code\":19999,\"msg\":\"输入为空\"}"; } + + public string WxApiDropshipSearchDetail(string inputData) + { + if (!string.IsNullOrEmpty(inputData)) + { + if (!WXUserManage.GetSign(inputData)) + return "{\"code\":999,\"msg\":\"校验失败\"}"; + + string token = RegexUtils.GetStringQuery(ref inputData, "token", true)?.Replace("'", "\\'"); + string ds_order_id = RegexUtils.GetStringQuery(ref inputData, "ds_order_id", true)?.Replace("'", "\\'"); + //string data = "{\"search_condition\":{\"order_id\":\"37000204335323251\" },\"page_info\":{\"offset\": 0,\"limit\":10}}"; + string data = "{\"ds_order_id\":\"" + ds_order_id + "\"}"; + return HttpUtils.WxApiPostResponse("https://api.weixin.qq.com/channels/ec/order/dropship/get?access_token=" + token, data, ""); + } + return "{\"code\":19999,\"msg\":\"输入为空\"}"; + } + /// /// 微信小店分配订单代发 /// @@ -3210,6 +3264,7 @@ namespace KJD_Web.BLL.BXX return "{\"code\":999,\"msg\":\"校验失败\"}"; var token = RegexUtils.GetStringQuery(ref inputData, "token")?.Replace("'", "\\'"); var order_id = RegexUtils.GetStringQuery(ref inputData, "order_id")?.Replace("'", "\\'"); + var supplier_appid = RegexUtils.GetStringQuery(ref inputData, "supplier_appid")?.Replace("'", "\\'"); //var supplier_appid = RegexUtils.GetStringQuery(ref inputData, "supplier_appid")?.Replace("'", "\\'"); var dropship_product_list = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "dropship_product_list"))?.Replace("'", "\\'"); //{ @@ -3231,7 +3286,7 @@ namespace KJD_Web.BLL.BXX JObject obj = new JObject(); obj["order_id"] = order_id; - obj["supplier_appid"] = "wxfc630d60a1af6c6f"; + obj["supplier_appid"] = supplier_appid ?? "wxfc630d60a1af6c6f"; JArray array = JArray.Parse(dropship_product_list); obj["dropship_product_list"] = array; diff --git a/KJD_WebService/Controllers/WX/WXProductController.cs b/KJD_WebService/Controllers/WX/WXProductController.cs index e6c6449..72f466a 100644 --- a/KJD_WebService/Controllers/WX/WXProductController.cs +++ b/KJD_WebService/Controllers/WX/WXProductController.cs @@ -341,15 +341,44 @@ namespace KJD_Web.Controllers.WX return JsonString(result); } + /// + /// 搜索代发供应商 + /// + public IHttpActionResult wx_api_get_supplier_list() + { + string jsontext = GetRequestJsonString(); + var result = new BXXProductManage().WxApiGetSupplierList(jsontext); + + return JsonString(result); + } + + public IHttpActionResult wx_api_invite_supplier() + { + string jsontext = GetRequestJsonString(); + var result = new BXXProductManage().WxApiInviteSupplier(jsontext); + + return JsonString(result); + } + /// /// 搜索代发 /// public IHttpActionResult wx_api_dropship_search() { - string jsontext = GetRequestJsonString(); - var result = new BXXProductManage().WxApiDropshipSearch(jsontext); + string jsontext = GetRequestJsonString(); + var result = new BXXProductManage().WxApiDropshipSearch(jsontext); - return JsonString(result); + return JsonString(result); + } + /// + /// 查询代发详情 + /// + public IHttpActionResult wx_api_dropship_search_detail() + { + string jsontext = GetRequestJsonString(); + var result = new BXXProductManage().WxApiDropshipSearchDetail(jsontext); + + return JsonString(result); } ///