Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
c868afd6
Commit
c868afd6
authored
May 28, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支付对接
parent
c8cc6923
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
195 additions
and
50 deletions
+195
-50
OrderModule.cs
Mall.Module.Product/OrderModule.cs
+44
-16
UserModule.cs
Mall.Module.User/UserModule.cs
+25
-27
PayUtil.cs
Mall.WebApi/App_Code/PayUtil.cs
+1
-1
OrderController.cs
Mall.WebApi/Controllers/Product/OrderController.cs
+54
-2
ProductController.cs
Mall.WebApi/Controllers/Product/ProductController.cs
+0
-4
UserController.cs
Mall.WebApi/Controllers/User/UserController.cs
+71
-0
No files found.
Mall.Module.Product/OrderModule.cs
View file @
c868afd6
...
...
@@ -165,6 +165,10 @@ namespace Mall.Module.Product
/// 小程序
/// </summary>
private
readonly
RB_MiniProgramRepository
miniProgramRepository
=
new
RB_MiniProgramRepository
();
/// <summary>
/// 订单支付
/// </summary>
private
readonly
RB_Goods_Online_TradeRepository
goods_Online_TradeRepository
=
new
RB_Goods_Online_TradeRepository
();
#
region
购物车
...
...
@@ -3748,6 +3752,36 @@ namespace Mall.Module.Product
return
ApiResult
.
Failed
();
}
/// <summary>
/// 获取售后订单实体
/// </summary>
/// <param name="reOrderId"></param>
/// <returns></returns>
public
RB_Goods_OrderAfterSale
GetOrderAfterSaleEntity
(
int
reOrderId
)
{
return
goods_OrderAfterSaleRepository
.
GetEntity
(
reOrderId
);
}
/// <summary>
/// 获取订单已退款次数
/// </summary>
/// <param name="OrderId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
int
GetOrderRefundOnlineTradeNum
(
int
OrderId
,
int
tenantId
,
int
mallBaseId
)
{
var
ReList
=
goods_Online_TradeRepository
.
GetList
(
new
RB_Goods_Online_Trade_Extend
()
{
OrderId
=
OrderId
,
Type
=
2
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
return
ReList
.
Count
();
}
/// <summary>
/// 获取小程序信息
/// </summary>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
RB_MiniProgram_Extend
GetMiniProgramExtend
(
int
mallBaseId
)
{
return
miniProgramRepository
.
GetEntity
<
RB_MiniProgram_Extend
>(
mallBaseId
);
}
/// <summary>
/// 售后订单退款
/// </summary>
...
...
@@ -3756,20 +3790,9 @@ namespace Mall.Module.Product
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
ApiResult
SetOrderAfterSaleForRefunds
(
int
reOrderId
,
decimal
refund
,
int
tenantId
,
int
mallBaseId
)
public
bool
SetOrderAfterSaleForRefunds
(
int
reOrderId
,
decimal
refund
,
int
tenantId
,
int
mallBaseId
)
{
var
model
=
goods_OrderAfterSaleRepository
.
GetEntity
(
reOrderId
);
if
(
model
==
null
)
{
return
ApiResult
.
Failed
(
"售后订单不存在"
);
}
if
(
model
.
ReOrderStatus
!=
OrderAfterSaleStatusEnum
.
RefundedBySeller
)
{
return
ApiResult
.
Failed
(
"状态不正确"
);
}
if
(
model
.
Refund
<
refund
)
{
return
ApiResult
.
Failed
(
"退款金额不能大于"
+
model
.
Refund
);
}
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_OrderAfterSale
.
ReOrderStatus
),
OrderAfterSaleStatusEnum
.
Completed
},
{
nameof
(
RB_Goods_OrderAfterSale
.
RefundActual
),
refund
},
...
...
@@ -3795,7 +3818,12 @@ namespace Mall.Module.Product
bool
flag
=
goods_OrderAfterSaleRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
{
//操作原路退款
#
region
操作原路退款
//var OrderModel = goods_OrderRepository.GetEntity(model.OrderId);
//var ReList = goods_Online_TradeRepository.GetList(new RB_Goods_Online_Trade_Extend() { OrderId = model.OrderId, Type = 2, TenantId = tenantId, MallBaseId = mallBaseId });
//int Num = ReList.Count() + 1;
//string RefundOrderNo = OrderModel.OrderNo + Num;
#
endregion
goods_OrderAfterSaleLogRepository
.
Insert
(
new
RB_Goods_OrderAfterSaleLog
()
{
...
...
@@ -3807,9 +3835,9 @@ namespace Mall.Module.Product
TenantId
=
tenantId
,
Type
=
2
});
return
ApiResult
.
Success
()
;
return
true
;
}
return
ApiResult
.
Failed
()
;
return
false
;
}
/// <summary>
...
...
Mall.Module.User/UserModule.cs
View file @
c868afd6
...
...
@@ -96,6 +96,10 @@ namespace Mall.Module.User
/// 足迹
/// </summary>
private
readonly
RB_Member_FootmarkRepository
member_FootmarkRepository
=
new
RB_Member_FootmarkRepository
();
/// <summary>
/// 小程序
/// </summary>
private
readonly
RB_MiniProgramRepository
miniProgramRepository
=
new
RB_MiniProgramRepository
();
/// <summary>
...
...
@@ -1522,6 +1526,25 @@ namespace Mall.Module.User
return
list
;
}
/// <summary>
/// 获取分销提现实体
/// </summary>
/// <param name="remitId"></param>
/// <returns></returns>
public
RB_Distributor_Remit_Extend
GetDistributorEntity
(
int
remitId
)
{
return
distributor_RemitRepository
.
GetEntity
<
RB_Distributor_Remit_Extend
>(
remitId
);
}
/// <summary>
/// 获取小程序信息
/// </summary>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
RB_MiniProgram_Extend
GetMiniProgramExtend
(
int
mallBaseId
)
{
return
miniProgramRepository
.
GetEntity
<
RB_MiniProgram_Extend
>(
mallBaseId
);
}
/// <summary>
/// 分销提现审核
/// </summary>
...
...
@@ -1533,26 +1556,9 @@ namespace Mall.Module.User
/// <returns></returns>
public
string
SetDistributorRemitAudit
(
int
remitId
,
int
type
,
string
remark
,
string
uid
,
int
mallBaseId
)
{
var
model
=
distributor_RemitRepository
.
GetEntity
(
remitId
);
if
(
model
==
null
)
{
return
"该提现不存在,请核实后再试"
;
}
if
(
model
.
TenantId
!=
Convert
.
ToInt32
(
uid
))
{
return
"未查询到提现信息"
;
}
if
(
model
.
MallBaseId
!=
mallBaseId
)
{
return
"未查询到提现信息"
;
}
if
(
type
==
1
)
{
if
(
model
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
Auditing
)
{
return
"状态不对,请核实后再试"
;
}
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Remit
.
AuditStatus
),
(
int
)
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
ToPlayWith
},
{
nameof
(
RB_Distributor_Remit
.
AuditDate
),
DateTime
.
Now
},
...
...
@@ -1569,10 +1575,6 @@ namespace Mall.Module.User
}
else
if
(
type
==
2
)
{
if
(
model
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
ToPlayWith
)
{
return
"状态不对,请核实后再试"
;
}
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Remit
.
AuditStatus
),
(
int
)
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
HaveMoney
},
{
nameof
(
RB_Distributor_Remit
.
RemitDate
),
DateTime
.
Now
},
...
...
@@ -1588,11 +1590,7 @@ namespace Mall.Module.User
distributor_RemitRepository
.
Update
(
keyValues
,
wheres
);
}
else
if
(
type
==
3
)
{
if
(
model
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
Auditing
&&
model
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
ToPlayWith
)
{
return
"状态不对,请核实后再试"
;
}
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Remit
.
AuditStatus
),
(
int
)
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
Reject
},
{
nameof
(
RB_Distributor_Remit
.
RejectDate
),
DateTime
.
Now
},
...
...
Mall.WebApi/App_Code/PayUtil.cs
View file @
c868afd6
...
...
@@ -300,7 +300,7 @@ namespace Mall.WebApi.App_Code
/// <param name="CustomerId"></param>
/// <param name="openid"></param>
/// <returns></returns>
p
rivate
static
bool
GetTransfersOrder
(
string
sOrderNo
,
decimal
dPrice
,
string
CustomerId
,
string
openid
,
RB_MiniProgram_Extend
model
,
IHttpContextAccessor
_accessor
)
p
ublic
static
bool
GetTransfersOrder
(
string
sOrderNo
,
decimal
dPrice
,
string
CustomerId
,
string
openid
,
RB_MiniProgram_Extend
model
,
IHttpContextAccessor
_accessor
)
{
var
req
=
new
Common
.
Pay
.
WeChatPat
.
RequestHandler
();
...
...
Mall.WebApi/Controllers/Product/OrderController.cs
View file @
c868afd6
...
...
@@ -16,6 +16,7 @@ using Newtonsoft.Json.Linq;
using
Mall.Common
;
using
Mall.Module.Product
;
using
Mall.Common.Enum.Goods
;
using
Microsoft.AspNetCore.Http
;
namespace
Mall.WebApi.Controllers.MallBase
{
...
...
@@ -26,6 +27,18 @@ namespace Mall.WebApi.Controllers.MallBase
public
class
OrderController
:
BaseController
{
private
readonly
IHttpContextAccessor
_accessor
;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="accessor"></param>
public
OrderController
(
IHttpContextAccessor
accessor
)
{
_accessor
=
accessor
;
}
private
readonly
OrderModule
orderModule
=
new
OrderModule
();
#
region
订单列表
...
...
@@ -1344,8 +1357,47 @@ namespace Mall.WebApi.Controllers.MallBase
if
(
Refund
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递金额"
);
}
return
orderModule
.
SetOrderAfterSaleForRefunds
(
ReOrderId
,
Refund
,
req
.
TenantId
,
req
.
MallBaseId
);
var
ReModel
=
orderModule
.
GetOrderAfterSaleEntity
(
ReOrderId
);
if
(
ReModel
==
null
)
{
return
ApiResult
.
Failed
(
"未查询到售后订单信息"
);
}
if
(
ReModel
==
null
)
{
return
ApiResult
.
Failed
(
"售后订单不存在"
);
}
if
(
ReModel
.
ReOrderStatus
!=
OrderAfterSaleStatusEnum
.
RefundedBySeller
)
{
return
ApiResult
.
Failed
(
"状态不正确"
);
}
if
(
ReModel
.
Refund
<
Refund
)
{
return
ApiResult
.
Failed
(
"退款金额不能大于"
+
ReModel
.
Refund
);
}
var
orderModel
=
orderModule
.
GetOrderInfo
(
ReModel
.
OrderId
??
0
);
if
(
orderModel
==
null
)
{
return
ApiResult
.
Failed
(
"未查询到订单信息"
);
}
//获取小程序信息
var
mallModel
=
orderModule
.
GetMiniProgramExtend
(
req
.
MallBaseId
);
int
RefundNum
=
orderModule
.
GetOrderRefundOnlineTradeNum
(
ReModel
.
OrderId
??
0
,
req
.
TenantId
,
req
.
MallBaseId
);
string
RefundOrderNo
=
orderModel
.
OrderNo
+
(
RefundNum
+
1
);
var
pram
=
new
Common
.
Pay
.
WeChatPat
.
PayParam
()
{
TotalFee
=
Convert
.
ToInt32
(
Refund
*
100
),
RefundFee
=
Refund
,
OrderNumber
=
orderModel
.
MerchantsNo
,
RefundNumber
=
RefundOrderNo
};
var
Robj
=
new
App_Code
.
PayUtil
().
Refund
(
pram
,
mallModel
,
_accessor
);
if
(
Robj
.
IsSuccess
)
{
bool
flag
=
orderModule
.
SetOrderAfterSaleForRefunds
(
ReOrderId
,
Refund
,
req
.
TenantId
,
req
.
MallBaseId
);
if
(
flag
==
false
)
{
//日志记录
LogHelper
.
Write
(
"售后订单:"
+
ReOrderId
+
",金额:"
+
Refund
+
" 退款记录失败"
);
}
return
ApiResult
.
Success
(
""
);
}
return
ApiResult
.
Failed
();
}
/// <summary>
...
...
Mall.WebApi/Controllers/Product/ProductController.cs
View file @
c868afd6
...
...
@@ -1608,10 +1608,6 @@ namespace Mall.WebApi.Controllers.MallBase
{
return
ApiResult
.
ParamIsNull
(
"分销佣金"
+
item
.
Name
+
"列表不存在"
);
}
if
(
gradeList
.
Count
()
!=
TotalNum
)
{
return
ApiResult
.
ParamIsNull
(
"分销佣金"
+
item
.
Name
+
"列表数量不正确"
);
}
var
gcmodel
=
gradeList
.
Where
(
x
=>
x
.
SpecificationSort
==
""
).
FirstOrDefault
();
if
(
gcmodel
==
null
)
...
...
Mall.WebApi/Controllers/User/UserController.cs
View file @
c868afd6
...
...
@@ -15,6 +15,7 @@ using Mall.CacheManager.User;
using
Newtonsoft.Json.Linq
;
using
Mall.Common
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Http
;
namespace
Mall.WebApi.Controllers.User
{
...
...
@@ -24,6 +25,16 @@ namespace Mall.WebApi.Controllers.User
[
EnableCors
(
"AllowCors"
)]
public
class
UserController
:
BaseController
{
private
readonly
IHttpContextAccessor
_accessor
;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="accessor"></param>
public
UserController
(
IHttpContextAccessor
accessor
)
{
_accessor
=
accessor
;
}
private
readonly
UserModule
userModule
=
new
UserModule
();
...
...
@@ -1773,6 +1784,66 @@ namespace Mall.WebApi.Controllers.User
{
return
ApiResult
.
ParamIsNull
(
"请传递分销提现id"
);
}
var
model
=
userModule
.
GetDistributorEntity
(
RemitId
);
if
(
model
==
null
)
{
return
ApiResult
.
Failed
(
"该提现不存在,请核实后再试"
);
}
if
(
model
.
TenantId
!=
Convert
.
ToInt32
(
re
.
uid
))
{
return
ApiResult
.
Failed
(
"未查询到提现信息"
);
}
if
(
model
.
MallBaseId
!=
re
.
MallBaseId
)
{
return
ApiResult
.
Failed
(
"未查询到提现信息"
);
}
if
(
Type
==
1
)
{
if
(
model
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
Auditing
)
{
return
ApiResult
.
Failed
(
"状态不对,请核实后再试"
);
}
}
else
if
(
Type
==
2
)
{
if
(
model
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
ToPlayWith
)
{
return
ApiResult
.
Failed
(
"状态不对,请核实后再试"
);
}
//执行发放金额
if
(
model
.
WithdrawalWay
==
DistrbutorWithdrawWayEnum
.
ZDDK
)
{
var
mallModel
=
userModule
.
GetMiniProgramExtend
(
re
.
MallBaseId
);
var
umodel
=
userModule
.
GetMemberUserInfo
(
model
.
UserId
??
0
);
var
flag
=
App_Code
.
PayUtil
.
GetTransfersOrder
(
model
.
OrderNum
,
model
.
RemitMoney
??
0
,
(
model
.
UserId
??
0
).
ToString
(),
umodel
.
OpenId
,
mallModel
,
_accessor
);
if
(
flag
)
{
string
msg1
=
userModule
.
SetDistributorRemitAudit
(
RemitId
,
Type
,
Remark
,
re
.
uid
,
re
.
MallBaseId
);
if
(
msg1
!=
""
)
{
LogHelper
.
Write
(
"提现:"
+
RemitId
+
",失败"
);
}
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
(
"支付失败"
);
}
}
else
{
return
ApiResult
.
Failed
(
"暂不支持该类型打款"
);
}
}
else
if
(
Type
==
3
)
{
if
(
model
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
Auditing
&&
model
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
ToPlayWith
)
{
return
ApiResult
.
Failed
(
"状态不对,请核实后再试"
);
}
}
else
{
return
ApiResult
.
Failed
(
"暂不支持该类型"
);
}
string
msg
=
userModule
.
SetDistributorRemitAudit
(
RemitId
,
Type
,
Remark
,
re
.
uid
,
re
.
MallBaseId
);
if
(
msg
==
""
)
...
...
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