From 84fb9956a0e3736e9480e9095f5570046db93064 Mon Sep 17 00:00:00 2001
From: shanj <18996038927@163.com>
Date: Sat, 29 Oct 2022 12:49:47 +0800
Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=BA=97=E9=93=BA=E5=92=8C?=
=?UTF-8?q?=E9=83=A8=E9=97=A8=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=E4=B8=B4?=
=?UTF-8?q?=E6=97=B6=E9=89=B4=E6=9D=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
BBWY.Client/APIServices/ShopService.cs | 6 +++++-
BBWY.Server.API/Controllers/VenderController.cs | 8 +++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/BBWY.Client/APIServices/ShopService.cs b/BBWY.Client/APIServices/ShopService.cs
index 563472e6..ea8e5def 100644
--- a/BBWY.Client/APIServices/ShopService.cs
+++ b/BBWY.Client/APIServices/ShopService.cs
@@ -44,7 +44,11 @@ namespace BBWY.Client.APIServices
///
public ApiResponse> GetDepartmentList()
{
- return SendRequest>(globalContext.BBYWApiHost, "api/vender/GetDeparmentList", null, null, HttpMethod.Get);
+ return SendRequest>(globalContext.BBYWApiHost, "api/vender/GetDeparmentList", null,
+ new Dictionary()
+ {
+ { "bbwyTempKey", "21jfhayu27q" }
+ }, HttpMethod.Get);
}
diff --git a/BBWY.Server.API/Controllers/VenderController.cs b/BBWY.Server.API/Controllers/VenderController.cs
index a671c05e..d2a0c728 100644
--- a/BBWY.Server.API/Controllers/VenderController.cs
+++ b/BBWY.Server.API/Controllers/VenderController.cs
@@ -1,7 +1,9 @@
-using BBWY.Server.Business;
+using BBWY.Common.Models;
+using BBWY.Server.Business;
using BBWY.Server.Model.Dto;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
using NLog;
using System.Collections.Generic;
@@ -80,6 +82,10 @@ namespace BBWY.Server.API.Controllers
[HttpGet]
public IList GetDeparmentList()
{
+ if (!Request.Headers.TryGetValue("bbwyTempKey", out StringValues sv))
+ throw new BusinessException("非法请求");
+ if (sv.ToString() != "21jfhayu27q")
+ throw new BusinessException("非法请求");
return venderBusiness.GetDeparmentList();
}
}