Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
ShopERP
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杜龙飞
ShopERP
Commits
28339605
Commit
28339605
authored
Sep 04, 2025
by
PC-20220610JUCQ\Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
<develop>:(Web 端)<无> ShopERP 项目 WebAPI 接口代码提交。
parent
24baaf06
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
243 additions
and
335 deletions
+243
-335
CoreCms.Net.IRepository/Order/ICoreOrderRepository.cs
+4
-0
CoreCms.Net.IServices/Order/ICoreOrderServices.cs
+4
-1
CoreCms.Net.Model/Entities/Order/CoreOrder.cs
+3
-12
CoreCms.Net.Model/ViewModels/DTO/OrderDTO.cs
+100
-36
CoreCms.Net.Repository/Order/CoreOrderRepository.cs
+19
-3
CoreCms.Net.Services/Order/CoreOrderServices.cs
+77
-1
CoreCms.Net.Utility/Consul/ConsulRegister.cs
+1
-1
CoreCms.Net.Web.WebApi/Controllers/CartController.cs
+0
-94
CoreCms.Net.Web.WebApi/Controllers/HealthController.cs
+17
-0
CoreCms.Net.Web.WebApi/Controllers/OrderController.cs
+10
-90
CoreCms.Net.Web.WebApi/Doc.xml
+4
-34
CoreCms.Net.Web.WebApi/Infrastructure/ConfigureHTTPipeline.cs
+1
-46
CoreCms.Net.Web.WebApi/Infrastructure/ServicesContainerExtend.cs
+1
-4
CoreCms.Net.Web.WebApi/appsettings.json
+2
-11
CoreCms.Net.Web.WebApi/obj/Debug/net8.0/staticwebassets.removed.txt
+0
-2
No files found.
CoreCms.Net.IRepository/Order/ICoreOrderRepository.cs
View file @
28339605
...
...
@@ -3,6 +3,7 @@ using System;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
CoreCms.Net.IRepository.Order
...
...
@@ -10,5 +11,8 @@ namespace CoreCms.Net.IRepository.Order
public
interface
ICoreOrderRepository
:
IBaseRepository
<
CoreOrder
>
{
Task
<
List
<
CoreOrder
>>
GetListAsync
();
Task
<
List
<
CoreOrder
>>
GetOrderInfoAsync
(
string
platOrderId
,
CancellationToken
cancellationToken
);
}
}
CoreCms.Net.IServices/Order/ICoreOrderServices.cs
View file @
28339605
using
CoreCms.Net.Model.Entities
;
using
CoreCms.Net.Model.ViewModels.DTO
;
using
CoreCms.Net.Model.ViewModels.UI
;
using
SqlSugar
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
CoreCms.Net.IServices.Order
{
public
interface
ICoreOrderServices
:
IBaseServices
<
CoreOrder
>
{
Task
<
WebApiCallBack
>
CreateOrderAsync
(
CreateOrder
input
,
CancellationToken
cancellationToken
);
}
}
CoreCms.Net.Model/Entities/Order/CoreOrder.cs
View file @
28339605
...
...
@@ -19,6 +19,9 @@ namespace CoreCms.Net.Model.Entities
[
SugarColumn
(
ColumnName
=
"orderId"
,
ColumnDataType
=
"varchar"
,
Length
=
20
,
IsPrimaryKey
=
true
,
IsNullable
=
false
,
ColumnDescription
=
"订单号"
)]
public
string
OrderId
{
get
;
set
;
}
[
SugarColumn
(
ColumnName
=
"platOrderID"
,
ColumnDataType
=
"varchar"
,
Length
=
20
,
IsPrimaryKey
=
true
,
IsNullable
=
false
,
ColumnDescription
=
"平台订单号"
)]
public
string
platOrderID
{
get
;
set
;
}
/// <summary>
/// 商品总价
/// </summary>
...
...
@@ -50,18 +53,6 @@ namespace CoreCms.Net.Model.Entities
public
int
?
StockStatus
{
get
;
set
;
}
/// <summary>
/// 支付状态
/// </summary>
[
SugarColumn
(
ColumnName
=
"payStatus"
,
ColumnDataType
=
"int"
,
IsNullable
=
false
,
ColumnDescription
=
"支付状态"
)]
public
int
PayStatus
{
get
;
set
;
}
/// <summary>
/// 发货状态
/// </summary>
[
SugarColumn
(
ColumnName
=
"shipStatus"
,
ColumnDataType
=
"int"
,
IsNullable
=
false
,
ColumnDescription
=
"发货状态"
)]
public
int
ShipStatus
{
get
;
set
;
}
/// <summary>
/// 订单状态
/// </summary>
[
SugarColumn
(
ColumnName
=
"status"
,
ColumnDataType
=
"int"
,
IsNullable
=
false
,
ColumnDescription
=
"订单状态"
)]
...
...
CoreCms.Net.Model/ViewModels/DTO/OrderDTO.cs
View file @
28339605
...
...
@@ -4,6 +4,7 @@ using System;
using
System.Collections.Generic
;
using
CoreCms.Net.Model.Entities
;
using
Newtonsoft.Json.Linq
;
using
SqlSugar
;
namespace
CoreCms.Net.Model.ViewModels.DTO
{
...
...
@@ -39,95 +40,158 @@ namespace CoreCms.Net.Model.ViewModels.DTO
/// </summary>
public
class
CreateOrder
{
public
string
platOrderID
{
get
;
set
;
}
/// <summary>
///
区域序列
///
商品总价
/// </summary>
public
int
areaId
{
get
;
set
;
}
public
decimal
GoodsAmount
{
get
;
set
;
}
/// <summary>
///
购物车货品数据
///
已支付的金额
/// </summary>
public
string
cartIds
{
get
;
set
;
}
public
decimal
PayedAmount
{
get
;
set
;
}
/// <summary>
///
优惠券码
///
订单实际销售总额
/// </summary>
public
string
couponCode
{
get
;
set
;
}
public
decimal
OrderAmount
{
get
;
set
;
}
/// <summary>
///
买家留言
///
币种
/// </summary>
public
string
memo
{
get
;
set
;
}
public
string
CurrencyCode
{
get
;
set
;
}
/// <summary>
///
积分
///
支付状态
/// </summary>
public
int
point
{
get
;
set
;
}
=
0
;
public
int
PayStatus
{
get
;
set
;
}
/// <summary>
///
收货方式,1快递物流,2同城配送,3门店自提
///
发货状态
/// </summary>
public
int
receiptType
{
get
;
set
;
}
=
1
;
public
int
ShipStatus
{
get
;
set
;
}
/// <summary>
///
来源平台
///
订单状态
/// </summary>
public
int
source
{
get
;
set
;
}
=
2
;
public
int
Status
{
get
;
set
;
}
/// <summary>
///
发票税务编号
///
订单类型
/// </summary>
public
string
taxCod
e
{
get
;
set
;
}
public
int
OrderTyp
e
{
get
;
set
;
}
/// <summary>
///
发票抬头
///
支付时间
/// </summary>
public
string
taxNa
me
{
get
;
set
;
}
public
DateTime
?
PaymentTi
me
{
get
;
set
;
}
/// <summary>
///
发票类型
///
物流方式ID
/// </summary>
public
int
taxType
{
get
;
set
;
}
=
1
;
public
int
LogisticsId
{
get
;
set
;
}
/// <summary>
///
用户地址库序列
///
配送方式名称
/// </summary>
public
int
ushipId
{
get
;
set
;
}
=
0
;
public
string
LogisticsName
{
get
;
set
;
}
/// <summary>
///
门店序列
///
配送费用
/// </summary>
public
int
storeId
{
get
;
set
;
}
=
0
;
public
decimal
CostFreight
{
get
;
set
;
}
/// <summary>
/// 店铺名称
/// </summary>
public
string
SellerId
{
get
;
set
;
}
/// <summary>
/// 收货人FirstName
/// </summary>
public
string
FirstName
{
get
;
set
;
}
/// <summary>
/// 收货人LastName
/// </summary>
public
string
LastName
{
get
;
set
;
}
/// <summary>
///
订单类型,1是普通订单,2是拼团订单
///
收货地址1
/// </summary>
public
int
orderType
{
get
;
set
;
}
=
1
;
public
string
Address1
{
get
;
set
;
}
/// <summary>
///
提货人姓名
///
收货地址2
/// </summary>
public
string
ladingName
{
get
;
set
;
}
public
string
Address2
{
get
;
set
;
}
/// <summary>
///
提货人联系方式
///
邮编
/// </summary>
public
string
ladingMobil
e
{
get
;
set
;
}
public
string
PostCod
e
{
get
;
set
;
}
/// <summary>
///
非普通订单关联营销对象序列
///
国家
/// </summary>
public
int
objectId
{
get
;
set
;
}
=
0
;
public
string
Country
{
get
;
set
;
}
/// <summary>
///
拼团订单分组序列
///
国家编码
/// </summary>
public
int
teamId
{
get
;
set
;
}
=
0
;
public
string
CountryCode
{
get
;
set
;
}
/// <summary>
///
场景值
///
州/省
/// </summary>
public
int
scene
{
get
;
set
;
}
=
0
;
public
string
Province
{
get
;
set
;
}
/// <summary>
/// 城市
/// </summary>
public
string
City
{
get
;
set
;
}
/// <summary>
/// 跟踪号
/// </summary>
public
string
TrackingNumber
{
get
;
set
;
}
/// <summary>
/// 邮箱
/// </summary>
public
string
Email
{
get
;
set
;
}
/// <summary>
/// 电话号码
/// </summary>
public
string
PhoneNO
{
get
;
set
;
}
/// <summary>
/// 商品总重量
/// </summary>
public
decimal
Weight
{
get
;
set
;
}
/// <summary>
/// 税号
/// </summary>
public
string
TaxCode
{
get
;
set
;
}
/// <summary>
/// 卖家备注
/// </summary>
public
string
Mark
{
get
;
set
;
}
/// <summary>
/// 用户id
/// </summary>
public
int
?
UserId
{
get
;
set
;
}
/// <summary>
/// 订单来源
/// </summary>
public
int
Source
{
get
;
set
;
}
}
/// <summary>
...
...
CoreCms.Net.Repository/Order/CoreOrderRepository.cs
View file @
28339605
using
CoreCms.Net.IRepository
;
using
Consul.Filtering
;
using
CoreCms.Net.IRepository
;
using
CoreCms.Net.IRepository.Order
;
using
CoreCms.Net.IRepository.UnitOfWork
;
using
CoreCms.Net.Model.Entities
;
using
DotLiquid
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
CoreCms.Net.Repository.Order
...
...
@@ -25,8 +28,21 @@ namespace CoreCms.Net.Repository.Order
return
await
DbClient
.
Queryable
<
CoreOrder
>().
ToListAsync
();
}
#
region
通过平台订单查询订单信息
/// <summary>
/// 通过平台订单查询订单信息
/// </summary>
/// <param name="supplierIds"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public
async
Task
<
List
<
CoreOrder
>>
GetOrderInfoAsync
(
string
platOrderId
,
CancellationToken
cancellationToken
)
{
var
items
=
await
DbClient
.
Queryable
<
CoreOrder
>()
.
Where
(
d
=>
d
.
platOrderID
==
platOrderId
)
.
ToListAsync
(
cancellationToken
);
return
items
;
}
#
endregion
}
...
...
CoreCms.Net.Services/Order/CoreOrderServices.cs
View file @
28339605
using
CoreCms.Net.IRepository
;
using
CoreCms.Net.Configuration
;
using
CoreCms.Net.IRepository
;
using
CoreCms.Net.IRepository.Order
;
using
CoreCms.Net.IServices
;
using
CoreCms.Net.IServices.Order
;
using
CoreCms.Net.Model.Entities
;
using
CoreCms.Net.Model.ViewModels.UI
;
using
CoreCms.Net.Utility.Helper
;
using
Newtonsoft.Json.Linq
;
using
Newtonsoft.Json
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading
;
using
CoreCms.Net.Model.ViewModels.DTO
;
using
static
CoreCms
.
Net
.
Configuration
.
GlobalEnumVars
;
namespace
CoreCms.Net.Services.Order
{
...
...
@@ -26,6 +34,74 @@ namespace CoreCms.Net.Services.Order
}
#
region
创建订单
/// <summary>
/// 创建订单
/// </summary>
/// <returns></returns>
public
async
Task
<
WebApiCallBack
>
CreateOrderAsync
(
CreateOrder
input
,
CancellationToken
cancellationToken
)
{
var
jm
=
new
WebApiCallBack
()
{
methodDescription
=
"创建订单"
};
var
existModel
=
await
_dal
.
GetOrderInfoAsync
(
input
.
platOrderID
,
cancellationToken
);
if
(
existModel
!=
null
&&
existModel
.
Count
>
0
)
{
jm
.
code
=
201
;
jm
.
msg
=
"平台订单号:"
+
input
.
platOrderID
+
",已经成功生成,无法重新生成!"
;
return
jm
;
}
string
strOrderID
=
CommonHelper
.
GetSerialNumberType
((
int
)
GlobalEnumVars
.
SerialNumberType
.
订单编号
);
CoreOrder
coreOrder
=
new
CoreOrder
();
coreOrder
.
OrderId
=
strOrderID
;
coreOrder
.
platOrderID
=
strOrderID
;
coreOrder
.
GoodsAmount
=
input
.
GoodsAmount
;
coreOrder
.
PayedAmount
=
input
.
PayedAmount
;
coreOrder
.
OrderAmount
=
input
.
OrderAmount
;
coreOrder
.
CurrencyCode
=
input
.
CurrencyCode
;
coreOrder
.
GoodsAmount
=
input
.
GoodsAmount
;
coreOrder
.
StockStatus
=
0
;
coreOrder
.
Status
=
(
int
)
GlobalEnumVars
.
OrderStatus
.
Normal
;
coreOrder
.
OrderType
=
input
.
OrderType
;
coreOrder
.
PaymentTime
=
input
.
PaymentTime
;
coreOrder
.
LogisticsId
=
input
.
LogisticsId
;
coreOrder
.
LogisticsName
=
input
.
LogisticsName
;
coreOrder
.
CostFreight
=
input
.
CostFreight
;
coreOrder
.
SellerId
=
input
.
SellerId
;
coreOrder
.
FirstName
=
input
.
FirstName
;
coreOrder
.
LastName
=
input
.
LastName
;
coreOrder
.
Address1
=
input
.
Address1
;
coreOrder
.
Address2
=
input
.
Address2
;
coreOrder
.
PostCode
=
input
.
PostCode
;
coreOrder
.
Country
=
input
.
Country
;
coreOrder
.
CountryCode
=
input
.
CountryCode
;
coreOrder
.
Province
=
input
.
Province
;
coreOrder
.
City
=
input
.
City
;
coreOrder
.
TrackingNumber
=
input
.
TrackingNumber
;
coreOrder
.
Email
=
input
.
Email
;
coreOrder
.
PhoneNO
=
input
.
PhoneNO
;
coreOrder
.
Weight
=
input
.
Weight
;
coreOrder
.
TaxCode
=
input
.
TaxCode
;
coreOrder
.
Mark
=
input
.
Mark
;
coreOrder
.
Source
=
input
.
Source
;
coreOrder
.
CreateTime
=
DateTime
.
Now
;
coreOrder
.
UpdateTime
=
DateTime
.
Now
;
var
result
=
await
_dal
.
InsertAsync
(
coreOrder
);
jm
.
status
=
result
>
1
;
//发送消息
//await _messageCenterServices.SendMessage(order.userId, GlobalEnumVars.PlatformMessageTypes.CreateOrder.ToString(), JObject.FromObject(order));
return
jm
;
}
#
endregion
}
}
CoreCms.Net.Utility/Consul/ConsulRegister.cs
View file @
28339605
...
...
@@ -61,7 +61,7 @@ namespace CoreCms.Net.Utility.Consul
Check
=
new
AgentServiceCheck
()
{
Interval
=
TimeSpan
.
FromSeconds
(
10
),
//多久检查一次心跳
HTTP
=
$"http://
{
ip
}
:
{
port
}
/Health"
,
//健康检查地址
HTTP
=
$"http://
{
ip
}
:
{
port
}
/Health
/Index
"
,
//健康检查地址
Timeout
=
TimeSpan
.
FromSeconds
(
5
),
//超时时间
DeregisterCriticalServiceAfter
=
TimeSpan
.
FromSeconds
(
5
)
//服务启动多久后注册
}
...
...
CoreCms.Net.Web.WebApi/Controllers/CartController.cs
deleted
100644 → 0
View file @
24baaf06
using
CoreCms.Net.Auth.HttpContextUser
;
using
CoreCms.Net.IServices
;
using
CoreCms.Net.Model.FromBody
;
using
CoreCms.Net.Model.ViewModels.UI
;
using
CoreCms.Net.Model.ViewModels.DTO
;
using
CoreCms.Net.Utility.Helper
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Mvc
;
using
System.Threading.Tasks
;
namespace
CoreCms.Net.Web.WebApi.Controllers
{
/// <summary>
/// 购物车操作
/// </summary>
[
Route
(
"api/[controller]/[action]"
)]
[
ApiController
]
public
class
CartController
:
ControllerBase
{
private
readonly
IHttpContextUser
_user
;
private
readonly
ICoreCmsCartServices
_cartServices
;
/// <summary>
/// 构造函数
/// </summary>
public
CartController
(
IHttpContextUser
user
,
ICoreCmsCartServices
cartServices
)
{
_user
=
user
;
_cartServices
=
cartServices
;
}
#
region
添加单个货品到购物车
/// <summary>
/// 添加单个货品到购物车
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[
HttpPost
]
[
Authorize
]
public
async
Task
<
WebApiCallBack
>
AddCart
([
FromBody
]
FMCartAdd
entity
)
{
var
jm
=
await
_cartServices
.
Add
(
_user
.
ID
,
entity
.
ProductId
,
entity
.
Nums
,
entity
.
type
,
entity
.
cartType
,
entity
.
objectId
);
return
jm
;
}
#
endregion
添加单个货品到购物车
#
region
获取购物车列表
======================================================================
/// <summary>
/// 获取购物车列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
Authorize
]
public
async
Task
<
WebApiCallBack
>
GetList
([
FromBody
]
FMCartGetList
entity
)
{
var
ids
=
CommonHelper
.
StringToIntArray
(
entity
.
ids
);
//判断免费运费
var
freeFreight
=
entity
.
receiptType
!=
1
;
//获取数据
var
jm
=
await
_cartServices
.
GetCartInfos
(
_user
.
ID
,
ids
,
entity
.
type
,
entity
.
areaId
,
entity
.
point
,
entity
.
couponCode
,
freeFreight
,
entity
.
receiptType
,
entity
.
objectId
);
return
jm
;
}
#
endregion
获取购物车列表
======================================================================
#
region
删除购物车信息
/// <summary>
/// 获取购物车列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
Authorize
]
public
async
Task
<
WebApiCallBack
>
DoDelete
([
FromBody
]
FMIntId
entity
)
{
var
jm
=
new
WebApiCallBack
();
if
(
entity
.
id
<=
0
)
{
jm
.
msg
=
"请提交要删除的货品"
;
return
jm
;
}
jm
=
await
_cartServices
.
DeleteByIdsAsync
(
entity
.
id
,
_user
.
ID
);
return
jm
;
}
#
endregion
删除购物车信息
}
}
\ No newline at end of file
CoreCms.Net.Web.WebApi/Controllers/HealthController.cs
0 → 100644
View file @
28339605
using
Microsoft.AspNetCore.Mvc
;
namespace
ShopERP.WebApi.Controllers
{
/// <summary>
/// 健康检查
/// </summary>
[
Route
(
"[controller]/[action]"
)]
public
class
HealthController
:
Controller
{
[
HttpGet
]
public
IActionResult
Index
()
{
return
Ok
();
}
}
}
CoreCms.Net.Web.WebApi/Controllers/OrderController.cs
View file @
28339605
...
...
@@ -16,6 +16,8 @@ using CoreCms.Net.Utility.Helper;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Mvc
;
using
SqlSugar
;
using
CoreCms.Net.IServices.Order
;
using
System.Threading
;
namespace
CoreCms.Net.Web.WebApi.Controllers
{
...
...
@@ -26,40 +28,14 @@ namespace CoreCms.Net.Web.WebApi.Controllers
[
ApiController
]
public
class
OrderController
:
ControllerBase
{
private
readonly
IHttpContextUser
_user
;
private
readonly
ICoreCmsOrderServices
_orderServices
;
private
readonly
ICoreCmsBillAftersalesServices
_aftersalesServices
;
private
readonly
ICoreCmsSettingServices
_settingServices
;
private
readonly
ICoreCmsAreaServices
_areaServices
;
private
readonly
ICoreCmsBillReshipServices
_reshipServices
;
private
readonly
ICoreCmsShipServices
_shipServices
;
private
readonly
ICoreCmsBillDeliveryServices
_billDeliveryServices
;
private
readonly
ICoreCmsLogisticsServices
_logisticsServices
;
private
readonly
ICoreCmsGoodsServices
_goodsServices
;
private
readonly
ICoreCmsStoreServices
_storeServices
;
private
readonly
ICoreOrderServices
_orderServices
;
/// <summary>
/// 构造函数
/// </summary>
public
OrderController
(
IHttpContextUser
user
,
ICoreCmsOrderServices
orderServices
,
ICoreCmsBillAftersalesServices
aftersalesServices
,
ICoreCmsSettingServices
settingServices
,
ICoreCmsAreaServices
areaServices
,
ICoreCmsBillReshipServices
reshipServices
,
ICoreCmsShipServices
shipServices
,
ICoreCmsBillDeliveryServices
billDeliveryServices
,
ICoreCmsLogisticsServices
logisticsServices
,
ICoreCmsGoodsServices
goodsServices
,
ICoreCmsStoreServices
storeServices
)
public
OrderController
(
ICoreOrderServices
orderServices
)
{
_user
=
user
;
_orderServices
=
orderServices
;
_aftersalesServices
=
aftersalesServices
;
_settingServices
=
settingServices
;
_areaServices
=
areaServices
;
_reshipServices
=
reshipServices
;
_shipServices
=
shipServices
;
_billDeliveryServices
=
billDeliveryServices
;
_logisticsServices
=
logisticsServices
;
_goodsServices
=
goodsServices
;
_storeServices
=
storeServices
;
}
#
region
创建订单
==================================================
...
...
@@ -68,79 +44,23 @@ namespace CoreCms.Net.Web.WebApi.Controllers
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
Authorize
]
public
async
Task
<
WebApiCallBack
>
CreateOrder
([
FromBody
]
CreateOrder
entity
)
public
async
Task
<
WebApiCallBack
>
CreateOrder
([
FromBody
]
CreateOrder
entity
,
CancellationToken
cancellationToken
)
{
var
jm
=
new
WebApiCallBack
();
var
type
=
entity
.
receiptType
;
if
(
type
==
(
int
)
GlobalEnumVars
.
OrderReceiptType
.
Logistics
||
type
==
(
int
)
GlobalEnumVars
.
OrderReceiptType
.
IntraCityService
)
{
//收货地址id
if
(
entity
.
ushipId
==
0
)
{
jm
.
data
=
13001
;
jm
.
msg
=
GlobalErrorCodeVars
.
Code13001
;
}
}
else
if
(
type
==
(
int
)
GlobalEnumVars
.
OrderReceiptType
.
SelfDelivery
)
{
//提货门店
if
(
entity
.
storeId
==
0
)
{
jm
.
data
=
13001
;
jm
.
msg
=
GlobalErrorCodeVars
.
Code13001
;
}
//提货人姓名 提货人电话
if
(
string
.
IsNullOrEmpty
(
entity
.
ladingName
))
{
jm
.
data
=
13001
;
jm
.
msg
=
"请输入姓名"
;
}
if
(
string
.
IsNullOrEmpty
(
entity
.
ladingMobile
))
{
jm
.
data
=
13001
;
jm
.
msg
=
"请输入电话"
;
}
}
else
{
jm
.
data
=
13001
;
jm
.
msg
=
"未查询到配送方式"
;
}
if
(
string
.
IsNullOrEmpty
(
entity
.
cartIds
))
if
(
string
.
IsNullOrEmpty
(
entity
.
platOrderID
))
{
jm
.
data
=
10000
;
jm
.
msg
=
GlobalErrorCodeVars
.
Code10000
;
jm
.
msg
=
"平台订单号不能为空!"
;
return
jm
;
}
jm
=
await
_orderServices
.
ToAdd
(
_user
.
ID
,
entity
.
orderType
,
entity
.
cartIds
,
entity
.
receiptType
,
entity
.
ushipId
,
entity
.
storeId
,
entity
.
ladingName
,
entity
.
ladingMobile
,
entity
.
memo
,
entity
.
point
,
entity
.
couponCode
,
entity
.
source
,
entity
.
scene
,
entity
.
taxType
,
entity
.
taxName
,
entity
.
taxCode
,
entity
.
objectId
,
entity
.
teamId
);
jm
.
otherData
=
entity
;
jm
=
await
_orderServices
.
CreateOrderAsync
(
entity
,
cancellationToken
);
return
jm
;
}
#
endregion
#
region
获取个人订单列表
=======================================================
/// <summary>
/// 获取个人订单列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
Authorize
]
public
async
Task
<
WebApiCallBack
>
GetOrderList
([
FromBody
]
GetOrderListPost
entity
)
{
var
jm
=
await
_orderServices
.
GetOrderList
(
entity
.
status
,
_user
.
ID
,
entity
.
page
,
entity
.
limit
);
return
jm
;
}
#
endregion
#
region
取消订单
====================================================
/// <summary>
/// 取消订单
/// </summary>
...
...
@@ -157,7 +77,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
return
jm
;
}
var
ids
=
entity
.
id
.
Split
(
","
);
jm
=
await
_orderServices
.
CancelOrder
(
ids
,
_user
.
ID
);
//
jm = await _orderServices.CancelOrder(ids, _user.ID);
return
jm
;
}
...
...
CoreCms.Net.Web.WebApi/Doc.xml
View file @
28339605
...
...
@@ -4,57 +4,27 @@
<name>
ShopERP.WebApi
</name>
</assembly>
<members>
<member
name=
"T:
CoreCms.Net.Web.WebApi.Controllers.Cart
Controller"
>
<member
name=
"T:
ShopERP.WebApi.Controllers.Health
Controller"
>
<summary>
购物车操作
健康检查
</summary>
</member>
<member
name=
"M:CoreCms.Net.Web.WebApi.Controllers.CartController.#ctor(CoreCms.Net.Auth.HttpContextUser.IHttpContextUser,CoreCms.Net.IServices.ICoreCmsCartServices)"
>
<summary>
构造函数
</summary>
</member>
<member
name=
"M:CoreCms.Net.Web.WebApi.Controllers.CartController.AddCart(CoreCms.Net.Model.FromBody.FMCartAdd)"
>
<summary>
添加单个货品到购物车
</summary>
<param
name=
"entity"
></param>
<returns></returns>
</member>
<member
name=
"M:CoreCms.Net.Web.WebApi.Controllers.CartController.GetList(CoreCms.Net.Model.FromBody.FMCartGetList)"
>
<summary>
获取购物车列表
</summary>
<returns></returns>
</member>
<member
name=
"M:CoreCms.Net.Web.WebApi.Controllers.CartController.DoDelete(CoreCms.Net.Model.FromBody.FMIntId)"
>
<summary>
获取购物车列表
</summary>
<returns></returns>
</member>
<member
name=
"T:CoreCms.Net.Web.WebApi.Controllers.OrderController"
>
<summary>
订单调用接口数据
</summary>
</member>
<member
name=
"M:CoreCms.Net.Web.WebApi.Controllers.OrderController.#ctor(CoreCms.Net.
Auth.HttpContextUser.IHttpContextUser,CoreCms.Net.IServices.ICoreCmsOrderServices,CoreCms.Net.IServices.ICoreCmsBillAftersalesServices,CoreCms.Net.IServices.ICoreCmsSettingServices,CoreCms.Net.IServices.ICoreCmsAreaServices,CoreCms.Net.IServices.ICoreCmsBillReshipServices,CoreCms.Net.IServices.ICoreCmsShipServices,CoreCms.Net.IServices.ICoreCmsBillDeliveryServices,CoreCms.Net.IServices.ICoreCmsLogisticsServices,CoreCms.Net.IServices.ICoreCmsGoodsServices,CoreCms.Net.IServices.ICoreCmsStore
Services)"
>
<member
name=
"M:CoreCms.Net.Web.WebApi.Controllers.OrderController.#ctor(CoreCms.Net.
IServices.Order.ICoreOrder
Services)"
>
<summary>
构造函数
</summary>
</member>
<member
name=
"M:CoreCms.Net.Web.WebApi.Controllers.OrderController.CreateOrder(CoreCms.Net.Model.ViewModels.DTO.CreateOrder)"
>
<member
name=
"M:CoreCms.Net.Web.WebApi.Controllers.OrderController.CreateOrder(CoreCms.Net.Model.ViewModels.DTO.CreateOrder
,System.Threading.CancellationToken
)"
>
<summary>
创建订单
</summary>
<returns></returns>
</member>
<member
name=
"M:CoreCms.Net.Web.WebApi.Controllers.OrderController.GetOrderList(CoreCms.Net.Model.ViewModels.DTO.GetOrderListPost)"
>
<summary>
获取个人订单列表
</summary>
<returns></returns>
</member>
<member
name=
"M:CoreCms.Net.Web.WebApi.Controllers.OrderController.CancelOrder(CoreCms.Net.Model.FromBody.FMStringId)"
>
<summary>
取消订单
...
...
CoreCms.Net.Web.WebApi/Infrastructure/ConfigureHTTPipeline.cs
View file @
28339605
...
...
@@ -54,42 +54,6 @@ namespace CoreCms.Net.Web.WebApi.Infrastructure
c
.
RoutePrefix
=
AppSettingsConstVars
.
SwaggerRoutePrefix
;
});
//Hangfire定时任务
//授权
var
filter
=
new
BasicAuthAuthorizationFilter
(
new
BasicAuthAuthorizationFilterOptions
{
SslRedirect
=
false
,
// Require secure connection for dashboard
RequireSsl
=
false
,
// Case sensitive login checking
LoginCaseSensitive
=
false
,
// Users
Users
=
new
[]
{
new
BasicAuthAuthorizationUser
{
Login
=
AppSettingsConstVars
.
HangFireLogin
,
PasswordClear
=
AppSettingsConstVars
.
HangFirePassWord
}
}
});
var
hangfireOptions
=
new
Hangfire
.
DashboardOptions
{
AppPath
=
"/"
,
//返回时跳转的地址
DisplayStorageConnectionString
=
false
,
//是否显示数据库连接信息
Authorization
=
new
[]
{
filter
},
IsReadOnlyFunc
=
_
=>
false
};
app
.
UseHangfireDashboard
(
"/job"
,
hangfireOptions
);
//可以改变Dashboard的url
HangfireDispose
.
HangfireService
();
//使用 Session
app
.
UseSession
();
...
...
@@ -113,8 +77,7 @@ namespace CoreCms.Net.Web.WebApi.Infrastructure
// 使用静态文件
app
.
UseStaticFiles
();
// 先开启认证
app
.
UseAuthentication
();
// 然后是授权中间件
app
.
UseAuthorization
();
...
...
@@ -122,14 +85,6 @@ namespace CoreCms.Net.Web.WebApi.Infrastructure
name
:
"default"
,
pattern
:
"{controller=Home}/{action=Index}/{id?}"
);
//设置默认起始页(如default.html)
//此处的路径是相对于wwwroot文件夹的相对路径
var
defaultFilesOptions
=
new
DefaultFilesOptions
();
defaultFilesOptions
.
DefaultFileNames
.
Clear
();
defaultFilesOptions
.
DefaultFileNames
.
Add
(
"index.html"
);
app
.
UseDefaultFiles
(
defaultFilesOptions
);
app
.
UseStaticFiles
();
}
#
endregion
...
...
CoreCms.Net.Web.WebApi/Infrastructure/ServicesContainerExtend.cs
View file @
28339605
...
...
@@ -46,7 +46,7 @@ namespace CoreCms.Net.Web.WebApi.Infrastructure
UserName
=
builder
.
Configuration
[
"Smtp:Username"
],
Password
=
builder
.
Configuration
[
"Smtp:Password"
],
FromAddress
=
builder
.
Configuration
[
"Smtp:FromAddress"
],
DisplayName
=
builder
.
Configuration
[
"Smtp:DisplayName"
]
??
"
My Application
"
DisplayName
=
builder
.
Configuration
[
"Smtp:DisplayName"
]
??
"
ShopERP
"
};
// 注册邮件服务
...
...
@@ -72,9 +72,6 @@ namespace CoreCms.Net.Web.WebApi.Infrastructure
//Swagger接口文档注入
builder
.
Services
.
AddClientSwaggerSetup
();
//注册Hangfire定时任务
builder
.
Services
.
AddHangFireSetup
();
//授权支持注入
builder
.
Services
.
AddAuthorizationSetupForClient
();
//上下文注入
...
...
CoreCms.Net.Web.WebApi/appsettings.json
View file @
28339605
...
...
@@ -5,14 +5,9 @@
},
"Consul"
:
{
"consulAddress"
:
"http://127.0.0.1:8500"
,
"serviceName"
:
"api"
,
"serviceName"
:
"api
_orderService
"
,
"currentIp"
:
"127.0.0.1"
,
"currentPort"
:
"5200"
},
//定时任务管理面板的账户密码
"HangFire"
:
{
"Login"
:
"admin"
,
"PassWord"
:
"oq9wfbdeasygj647v"
"currentPort"
:
"2015"
},
//Swagger授权访问设置
"SwaggerConfig"
:
{
...
...
@@ -27,10 +22,6 @@
"Password"
:
"co69W7xEZ6qjBo01"
,
"FromAddress"
:
"erpservice@geekbuy.com"
},
"AppConfig"
:
{
"AppUrl"
:
"https://admin.demo.shoperp.cn/"
,
//后端管理地址
"AppInterFaceUrl"
:
"https://api.demo.shoperp.cn/"
//接口请求地址
},
//redis为必须启动项,请保持redis为正常可用
"RedisConfig"
:
{
"UseCache"
:
true
,
//启用redis作为内存选择
...
...
CoreCms.Net.Web.WebApi/obj/Debug/net8.0/staticwebassets.removed.txt
View file @
28339605
F:\Git_Code\Shop.ERP\CoreCms.Net.Web.WebApi\wwwroot\favicon.ico
F:\Git_Code\Shop.ERP\CoreCms.Net.Web.WebApi\wwwroot\static\images\logo.png
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment