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
7814ee30
Commit
7814ee30
authored
Jan 29, 2021
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
77b7acc7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1291 additions
and
2 deletions
+1291
-2
Config.cs
Mall.Common/Config.cs
+10
-1
RB_Member_PointBalance.cs
Mall.Model/Entity/Point/RB_Member_PointBalance.cs
+100
-0
RB_Point_Goods.cs
Mall.Model/Entity/Point/RB_Point_Goods.cs
+109
-0
RB_Point_Order.cs
Mall.Model/Entity/Point/RB_Point_Order.cs
+155
-0
RB_Member_User.cs
Mall.Model/Entity/User/RB_Member_User.cs
+6
-0
RB_MiniProgram.cs
Mall.Model/Entity/User/RB_MiniProgram.cs
+6
-0
RB_Member_PointBalance_Extend.cs
Mall.Model/Extend/Point/RB_Member_PointBalance_Extend.cs
+12
-0
RB_Point_Goods_Extend.cs
Mall.Model/Extend/Point/RB_Point_Goods_Extend.cs
+12
-0
RB_Point_Order_Extend.cs
Mall.Model/Extend/Point/RB_Point_Order_Extend.cs
+21
-0
PointModule.cs
Mall.Module.Education/PointModule.cs
+299
-0
RB_Member_PointBalanceRepository.cs
Mall.Repository/Point/RB_Member_PointBalanceRepository.cs
+78
-0
RB_Point_GoodsRepository.cs
Mall.Repository/Point/RB_Point_GoodsRepository.cs
+91
-0
RB_Point_OrderRepository.cs
Mall.Repository/Point/RB_Point_OrderRepository.cs
+81
-0
WeChatNotifyController.cs
...WebApi/Controllers/AppletWeChat/WeChatNotifyController.cs
+62
-0
WeChatPayController.cs
Mall.WebApi/Controllers/AppletWeChat/WeChatPayController.cs
+96
-1
PointController.cs
Mall.WebApi/Controllers/Education/PointController.cs
+153
-0
No files found.
Mall.Common/Config.cs
View file @
7814ee30
...
...
@@ -427,7 +427,16 @@ namespace Mall.Common
return
ReadConfigKey
(
"sTenpayRechargeNotify"
);
}
}
/// <summary>
/// 微信充值支付成功接口处理地址
/// </summary>
public
static
string
sTenpayPointNotify
{
get
{
return
ReadConfigKey
(
"sTenpayPointNotify"
);
}
}
/// <summary>
/// 微信购买支付成功接口处理地址
/// </summary>
...
...
Mall.Model/Entity/Point/RB_Member_PointBalance.cs
0 → 100644
View file @
7814ee30
using
VT.FW.DB
;
using
Mall.Common.Enum.MarketingCenter
;
using
Mall.Common.Enum.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.User
{
/// <summary>
/// 商户用户点数余额表实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Member_PointBalance
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 用户id
/// </summary>
public
int
?
UserId
{
get
;
set
;
}
/// <summary>
/// 类型 1增加 2减少
/// </summary>
public
RecordTypeEnum
?
Type
{
get
;
set
;
}
/// <summary>
/// 总点数
/// </summary>
public
int
PonitNum
{
get
;
set
;
}
/// <summary>
/// 描述
/// </summary>
public
string
Description
{
get
;
set
;
}
/// <summary>
/// CreateDate
/// </summary>
public
DateTime
?
CreateDate
{
get
;
set
;
}
/// <summary>
/// 商户号id
/// </summary>
public
int
TenantId
{
get
;
set
;
}
/// <summary>
/// 小程序id
/// </summary>
public
int
MallBaseId
{
get
;
set
;
}
/// <summary>
/// 备注
/// </summary>
public
string
Remarks
{
get
;
set
;
}
/// <summary>
/// 平台类型
/// </summary>
public
UserSourceEnum
?
PlatformType
{
get
;
set
;
}
/// <summary>
/// 订单来源(平台) 枚举
/// </summary>
public
UserSourceEnum
?
OrderSource
{
get
;
set
;
}
}
}
Mall.Model/Entity/Point/RB_Point_Goods.cs
0 → 100644
View file @
7814ee30
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
VT.FW.DB
;
namespace
Mall.Model.Entity.Point
{
/// <summary>
/// 点数产品
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Point_Goods
{
public
int
ID
{
get
;
set
;
}
/// <summary>
/// 排序
/// </summary>
public
int
?
Sort
{
get
;
set
;
}
/// <summary>
/// 售价
/// </summary>
public
decimal
?
SellingPrice
{
get
;
set
;
}
/// <summary>
/// 原价
/// </summary>
public
decimal
?
OriginalPrice
{
get
;
set
;
}
/// <summary>
/// 成本价格
/// </summary>
public
decimal
?
CostPrice
{
get
;
set
;
}
/// <summary>
/// 点数
/// </summary>
public
int
PonitNum
{
get
;
set
;
}
/// <summary>
/// 赠送点数 0-不赠送,>0赠送
/// </summary>
public
int
GivePoint
{
get
;
set
;
}
/// <summary>
/// 名称
/// </summary>
public
string
GoodsName
{
get
;
set
;
}
/// <summary>
/// 删除状态
/// </summary>
public
int
?
State
{
get
;
set
;
}
/// <summary>
/// 商户号
/// </summary>
public
int
TenantId
{
get
;
set
;
}
/// <summary>
/// 小程序id
/// </summary>
public
int
MallBaseId
{
get
;
set
;
}
/// <summary>
/// CreateDate
/// </summary>
public
DateTime
?
CreateDate
{
get
;
set
;
}
/// <summary>
/// UpdateDate
/// </summary>
public
DateTime
?
UpdateDate
{
get
;
set
;
}
}
}
Mall.Model/Entity/Point/RB_Point_Order.cs
0 → 100644
View file @
7814ee30
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Common.Enum.Goods
;
using
Mall.Common.Enum.User
;
using
VT.FW.DB
;
namespace
Mall.Model.Entity.Point
{
/// <summary>
/// 点数充值订单
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Point_Order
{
public
int
ID
{
get
;
set
;
}
/// <summary>
/// 订单号
/// </summary>
public
string
OrderNo
{
get
;
set
;
}
/// <summary>
/// 商户单号
/// </summary>
public
string
MerchantsNo
{
get
;
set
;
}
/// <summary>
/// 充值前点数
/// </summary>
public
int
OldPonitNum
{
get
;
set
;
}
/// <summary>
/// 充值点数
/// </summary>
public
int
PonitNum
{
get
;
set
;
}
/// <summary>
/// 赠送点数
/// </summary>
public
int
GivePoint
{
get
;
set
;
}
/// <summary>
/// 实收金额
/// </summary>
public
decimal
?
Income
{
get
;
set
;
}
/// <summary>
/// 支付类型 枚举 1微信 2支付宝 3银行卡
/// </summary>
public
Common
.
Enum
.
Goods
.
OrderPayTypeEnum
?
PayWay
{
get
;
set
;
}
/// <summary>
/// 支付方式 枚举
/// </summary>
public
OrderPaymentTypeEnum
?
PaymentWay
{
get
;
set
;
}
/// <summary>
/// 用户id
/// </summary>
public
int
?
UserId
{
get
;
set
;
}
/// <summary>
/// 订单状态 1-代付款,2-已付款
/// </summary>
public
int
OrderStatus
{
get
;
set
;
}
/// <summary>
/// 支付时间
/// </summary>
public
DateTime
?
PaymentTime
{
get
;
set
;
}
/// <summary>
/// 版本来源 0默认商城 1教育
/// </summary>
public
int
?
VersionSource
{
get
;
set
;
}
/// <summary>
/// 删除状态
/// </summary>
public
int
?
State
{
get
;
set
;
}
/// <summary>
/// 商户号
/// </summary>
public
int
TenantId
{
get
;
set
;
}
/// <summary>
/// 小程序id
/// </summary>
public
int
MallBaseId
{
get
;
set
;
}
/// <summary>
/// CreateDate
/// </summary>
public
DateTime
?
CreateDate
{
get
;
set
;
}
/// <summary>
/// 订单来源(平台) 枚举
/// </summary>
public
UserSourceEnum
?
OrderSource
{
get
;
set
;
}
}
}
Mall.Model/Entity/User/RB_Member_User.cs
View file @
7814ee30
...
...
@@ -235,5 +235,11 @@ namespace Mall.Model.Entity.User
/// 是否结算用户,1-是 2020-11-10 Addd By:w
/// </summary>
public
int
IsSettlement
{
get
;
set
;
}
/// <summary>
/// 教育点数(针对购买直播产品)
/// </summary>
public
int
PointNum
{
get
;
set
;
}
}
}
Mall.Model/Entity/User/RB_MiniProgram.cs
View file @
7814ee30
...
...
@@ -449,6 +449,12 @@ namespace Mall.Model.Entity.User
/// 评论关键字违规次数
/// </summary>
public
int
ViolationNum
{
get
;
set
;
}
/// <summary>
/// 点数0-未开启,1-开启
/// </summary>
public
int
PointStatus
{
get
;
set
;
}
}
...
...
Mall.Model/Extend/Point/RB_Member_PointBalance_Extend.cs
0 → 100644
View file @
7814ee30
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.User
;
namespace
Mall.Model.Extend.Point
{
public
class
RB_Member_PointBalance_Extend
:
RB_Member_PointBalance
{
}
}
Mall.Model/Extend/Point/RB_Point_Goods_Extend.cs
0 → 100644
View file @
7814ee30
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.Point
;
namespace
Mall.Model.Extend.Point
{
public
class
RB_Point_Goods_Extend
:
RB_Point_Goods
{
}
}
Mall.Model/Extend/Point/RB_Point_Order_Extend.cs
0 → 100644
View file @
7814ee30
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.Point
;
namespace
Mall.Model.Extend.Point
{
public
class
RB_Point_Order_Extend
:
RB_Point_Order
{
/// <summary>
/// 用户名称
/// </summary>
public
string
UserName
{
get
;
set
;
}
/// <summary>
/// 点数商品id
/// </summary>
public
int
PointGoodsId
{
get
;
set
;
}
}
}
Mall.Module.Education/PointModule.cs
0 → 100644
View file @
7814ee30
This diff is collapsed.
Click to expand it.
Mall.Repository/Point/RB_Member_PointBalanceRepository.cs
0 → 100644
View file @
7814ee30
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
Mall.Model.Entity.User
;
using
Mall.Model.Extend.Point
;
namespace
Mall.Repository.Point
{
public
class
RB_Member_PointBalanceRepository
:
BaseRepository
<
RB_Member_PointBalance
>
{
/// <summary>
/// 表名称
/// </summary>
public
string
TableName
{
get
{
return
nameof
(
RB_Member_PointBalance
);
}
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="where"></param>
/// <returns></returns>
public
List
<
RB_Member_PointBalance_Extend
>
GetPointBalanceList
(
RB_Member_PointBalance_Extend
where
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
Append
(
$@"SELECT * from RB_Member_PointBalance where state=0"
);
if
(
where
!=
null
)
{
if
(
where
.
TenantId
>
0
)
{
sb
.
AppendFormat
(
" and TenantId={0}"
,
where
.
TenantId
);
}
if
(
where
.
MallBaseId
>
0
)
{
sb
.
AppendFormat
(
" and MallBaseId={0}"
,
where
.
MallBaseId
);
}
if
(
where
.
UserId
>
0
)
{
sb
.
AppendFormat
(
" and ID={0}"
,
where
.
UserId
);
}
}
return
Get
<
RB_Member_PointBalance_Extend
>(
sb
.
ToString
()).
ToList
();
}
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="where"></param>
/// <returns></returns>
public
List
<
RB_Member_PointBalance_Extend
>
GetPointBalancePageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Member_PointBalance_Extend
where
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
Append
(
$@"SELECT * from RB_Member_PointBalance where state=0"
);
if
(
where
!=
null
)
{
if
(
where
.
TenantId
>
0
)
{
sb
.
AppendFormat
(
" and TenantId={0}"
,
where
.
TenantId
);
}
if
(
where
.
MallBaseId
>
0
)
{
sb
.
AppendFormat
(
" and MallBaseId={0}"
,
where
.
MallBaseId
);
}
if
(
where
.
UserId
>
0
)
{
sb
.
AppendFormat
(
" and ID={0}"
,
where
.
UserId
);
}
}
return
GetPage
<
RB_Member_PointBalance_Extend
>(
pageIndex
,
pageSize
,
out
rowsCount
,
sb
.
ToString
()).
ToList
();
}
}
}
Mall.Repository/Point/RB_Point_GoodsRepository.cs
0 → 100644
View file @
7814ee30
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
Mall.Model.Entity.Point
;
using
Mall.Model.Extend.Point
;
namespace
Mall.Repository.Point
{
/// <summary>
/// 点数产品仓储
/// </summary>
public
class
RB_Point_GoodsRepository
:
BaseRepository
<
RB_Point_Goods
>
{
/// <summary>
/// 表名称
/// </summary>
public
string
TableName
{
get
{
return
nameof
(
RB_Point_Goods
);
}
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="where"></param>
/// <returns></returns>
public
List
<
RB_Point_Goods_Extend
>
GetPointGoodsList
(
RB_Point_Goods_Extend
where
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
Append
(
$@"SELECT * from RB_Point_Goods where state=0"
);
if
(
where
!=
null
)
{
if
(
where
.
TenantId
>
0
)
{
sb
.
AppendFormat
(
" and TenantId={0}"
,
where
.
TenantId
);
}
if
(
where
.
MallBaseId
>
0
)
{
sb
.
AppendFormat
(
" and MallBaseId={0}"
,
where
.
MallBaseId
);
}
if
(
where
.
ID
>
0
)
{
sb
.
AppendFormat
(
" and ID={0}"
,
where
.
ID
);
}
if
(!
string
.
IsNullOrWhiteSpace
(
where
.
GoodsName
))
{
sb
.
AppendFormat
(
" and GoodsName like'%{0}%'"
,
where
.
GoodsName
);
}
}
return
Get
<
RB_Point_Goods_Extend
>(
sb
.
ToString
()).
ToList
();
}
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="where"></param>
/// <returns></returns>
public
List
<
RB_Point_Goods_Extend
>
GetPointGoodsPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Point_Goods_Extend
where
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
Append
(
$@"SELECT * from RB_Point_Goods where state=0"
);
if
(
where
!=
null
)
{
if
(
where
.
TenantId
>
0
)
{
sb
.
AppendFormat
(
" and TenantId={0}"
,
where
.
TenantId
);
}
if
(
where
.
MallBaseId
>
0
)
{
sb
.
AppendFormat
(
" and MallBaseId={0}"
,
where
.
MallBaseId
);
}
if
(
where
.
ID
>
0
)
{
sb
.
AppendFormat
(
" and ID={0}"
,
where
.
ID
);
}
if
(!
string
.
IsNullOrWhiteSpace
(
where
.
GoodsName
))
{
sb
.
AppendFormat
(
" and GoodsName like'%{0}%'"
,
where
.
GoodsName
);
}
}
return
GetPage
<
RB_Point_Goods_Extend
>(
pageIndex
,
pageSize
,
out
rowsCount
,
sb
.
ToString
()).
ToList
();
}
}
}
Mall.Repository/Point/RB_Point_OrderRepository.cs
0 → 100644
View file @
7814ee30
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
Mall.Model.Entity.Point
;
using
Mall.Model.Extend.Point
;
namespace
Mall.Repository.Point
{
public
class
RB_Point_OrderRepository
:
BaseRepository
<
RB_Point_Order
>
{
/// <summary>
/// 表名称
/// </summary>
public
string
TableName
{
get
{
return
nameof
(
RB_Point_Order
);
}
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="where"></param>
/// <returns></returns>
public
List
<
RB_Point_Order_Extend
>
GetPointOrderList
(
RB_Point_Order_Extend
where
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
Append
(
$@"SELECT * from RB_Point_Order where state=0"
);
if
(
where
!=
null
)
{
if
(
where
.
TenantId
>
0
)
{
sb
.
AppendFormat
(
" and TenantId={0}"
,
where
.
TenantId
);
}
if
(
where
.
MallBaseId
>
0
)
{
sb
.
AppendFormat
(
" and MallBaseId={0}"
,
where
.
MallBaseId
);
}
if
(
where
.
ID
>
0
)
{
sb
.
AppendFormat
(
" and ID={0}"
,
where
.
ID
);
}
}
return
Get
<
RB_Point_Order_Extend
>(
sb
.
ToString
()).
ToList
();
}
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="where"></param>
/// <returns></returns>
public
List
<
RB_Point_Order_Extend
>
GetPointOrderPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Point_Order_Extend
where
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
Append
(
$@"SELECT a.*,b.`Name` as UserName from RB_Point_order as a LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.state=0 "
);
if
(
where
!=
null
)
{
if
(
where
.
TenantId
>
0
)
{
sb
.
AppendFormat
(
" and a.TenantId={0}"
,
where
.
TenantId
);
}
if
(
where
.
MallBaseId
>
0
)
{
sb
.
AppendFormat
(
" and a.MallBaseId={0}"
,
where
.
MallBaseId
);
}
if
(
where
.
ID
>
0
)
{
sb
.
AppendFormat
(
" and a.ID={0}"
,
where
.
ID
);
}
if
(
where
.
OrderStatus
>
0
)
{
sb
.
AppendFormat
(
" and a.OrderStatus={0}"
,
where
.
OrderStatus
);
}
}
return
GetPage
<
RB_Point_Order_Extend
>(
pageIndex
,
pageSize
,
out
rowsCount
,
sb
.
ToString
()).
ToList
();
}
}
}
Mall.WebApi/Controllers/AppletWeChat/WeChatNotifyController.cs
View file @
7814ee30
...
...
@@ -30,6 +30,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
//public UserModule userModule = new UserModule();
Module
.
MarketingCenter
.
RechargeModule
rechargeModule
=
new
Module
.
MarketingCenter
.
RechargeModule
();
Module
.
Education
.
PointModule
pointModule
=
new
Module
.
Education
.
PointModule
();
private
IHttpContextAccessor
_accessor
;
/// <summary>
...
...
@@ -148,6 +149,67 @@ namespace Mall.WebApi.Controllers.AppletWeChat
}
/// <summary>
/// 会员点数购买回调
/// </summary>
/// <returns></returns>
[
HttpGet
]
[
HttpPost
]
public
string
PointNotify
()
{
var
req
=
new
RequestHandler
();
App_Code
.
PayUtil
PayUtil
=
new
App_Code
.
PayUtil
();
var
result
=
PayUtil
.
Notify
(
_accessor
);
if
(
result
.
IsSuccess
)
{
var
dic
=
((
Dictionary
<
string
,
string
>)
result
.
Data
);
//开始回写订单状态
lock
(
_lock
)
{
string
sOrderNo
=
dic
[
"sOrderNo"
];
//订单号 时间挫+OrderId
int
OrderId
=
Convert
.
ToInt32
(
sOrderNo
[
17.
.]);
decimal
dPaid
=
Convert
.
ToDecimal
(
dic
[
"dPrice"
])
/
100
;
string
sPayerOpenID
=
dic
[
"sPayerOpenID"
];
int
UserId
=
Convert
.
ToInt32
(
dic
[
"bIsRecharge"
]);
string
TransactionId
=
dic
[
"sTradeNo"
];
string
PayType
=
dic
[
"OrderPayType"
];
DateTime
PayDate
=
DateTime
.
ParseExact
(
dic
[
"PayDate"
],
"yyyyMMddHHmmss"
,
System
.
Globalization
.
CultureInfo
.
CurrentCulture
);
//转换时间
#
region
新增订单支付信息
// pointModule.UpdatePointOrder(UserId, OrderId, sOrderNo, TransactionId, Common.Enum.Goods.OrderPayTypeEnum.WeChatPay, PayType, dPaid, PayDate);
pointModule
.
UpdatePointOrder
(
new
Model
.
Extend
.
Point
.
RB_Point_Order_Extend
{
ID
=
OrderId
,
OrderNo
=
sOrderNo
,
Income
=
dPaid
,
MerchantsNo
=
TransactionId
,
PaymentTime
=
PayDate
});
#
endregion
}
//告诉微信我们已经处理成功,不需要再调用我们的接口了
req
.
SetParameter
(
"return_code"
,
"SUCCESS"
);
req
.
SetParameter
(
"return_msg"
,
"OK"
);
var
reqXml
=
req
.
ParseXml
();
return
reqXml
;
// return ApiResult.Success("", reqXml);
}
else
{
req
.
SetParameter
(
"return_code"
,
"FAIL"
);
req
.
SetParameter
(
"return_msg"
,
"订单失败"
);
var
reqXmlFAIL
=
req
.
ParseXml
();
LogHelper
.
Write
(
null
,
"Notify返回信息:"
+
reqXmlFAIL
);
return
reqXmlFAIL
;
// return ApiResult.Failed("", reqXmlFAIL);
}
}
/// <summary>
/// 订单支付回调
/// </summary>
...
...
Mall.WebApi/Controllers/AppletWeChat/WeChatPayController.cs
View file @
7814ee30
...
...
@@ -8,9 +8,12 @@ using Mall.Common.API;
using
Mall.Common.Pay.WeChatPat
;
using
Mall.Common.Pay.WeChatPat.Model
;
using
Mall.Common.Plugin
;
using
Mall.Model.Entity.Point
;
using
Mall.Model.Entity.User
;
using
Mall.Model.Extend.Point
;
using
Mall.Model.Extend.Product
;
using
Mall.Model.Extend.User
;
using
Mall.Module.Education
;
using
Mall.Module.MarketingCenter
;
using
Mall.Module.User
;
using
Mall.WebApi.Filter
;
...
...
@@ -48,6 +51,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
private
readonly
UserModule
userModule
=
new
UserModule
();
private
readonly
RechargeModule
rechargeModule
=
new
RechargeModule
();
private
readonly
UserVipModule
userVipModule
=
new
UserVipModule
();
private
readonly
PointModule
pointModule
=
new
PointModule
();
private
readonly
UserCommonModule
userCommonModule
=
new
UserCommonModule
();
#
region
商品支付
/// <summary>
...
...
@@ -94,7 +98,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
{
case
1
:
//微信支付 _accessor.HttpContext.Connection.RemoteIpAddress.ToString()
//(model.MallBaseId==6&&model.TenantId==16)? "https://mallapi.oytour.com/api/WeChatNotify/NotifyZhouTian" :
sPayInfo
=
App_Code
.
PayUtil
.
GetMinUnifiedOrder
(
sOrderNo
,
demodel
.
GoodsName
,
model
.
Income
.
Value
,
model
.
UserId
.
ToString
(),
demodel
.
OpenId
,
(
Config
.
sTenpayNotify
+
"/"
+
model
.
MallBaseId
+
"/"
+
model
.
TenantId
),
miniProgram
,
_accessor
,
System
.
Net
.
Dns
.
GetHostEntry
(
System
.
Net
.
Dns
.
GetHostName
()).
AddressList
.
FirstOrDefault
(
address
=>
address
.
AddressFamily
==
System
.
Net
.
Sockets
.
AddressFamily
.
InterNetwork
)?.
ToString
());
sPayInfo
=
App_Code
.
PayUtil
.
GetMinUnifiedOrder
(
sOrderNo
,
demodel
.
GoodsName
,
model
.
Income
.
Value
,
model
.
UserId
.
ToString
(),
demodel
.
OpenId
,
(
Config
.
sTenpayNotify
+
"/"
+
model
.
MallBaseId
+
"/"
+
model
.
TenantId
),
miniProgram
,
_accessor
,
System
.
Net
.
Dns
.
GetHostEntry
(
System
.
Net
.
Dns
.
GetHostName
()).
AddressList
.
FirstOrDefault
(
address
=>
address
.
AddressFamily
==
System
.
Net
.
Sockets
.
AddressFamily
.
InterNetwork
)?.
ToString
());
break
;
default
:
break
;
...
...
@@ -196,6 +200,97 @@ namespace Mall.WebApi.Controllers.AppletWeChat
#
region
点数充值
/// <summary>
/// 微信支付
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetPointPayInfo
()
{
var
request
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
if
(
userInfo
==
null
)
{
return
ApiResult
.
Failed
(
"请登录"
);
}
RB_Point_Order_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Point_Order_Extend
>(
request
.
msg
.
ToString
());
string
sPayInfo
=
string
.
Empty
;
if
(!
demodel
.
PayWay
.
HasValue
)
{
return
ApiResult
.
Failed
(
"请选择支付方式"
);
}
//查询充值信息
if
(!
demodel
.
Income
.
HasValue
)
{
return
ApiResult
.
Failed
(
"请传入点数购买金额"
);
}
//查询用户的openId
var
userModel
=
userModule
.
GetMemberUserEntityModule
(
new
RB_Member_User_Extend
{
MallBaseId
=
userInfo
.
MallBaseId
,
TenantId
=
userInfo
.
TenantId
,
Id
=
userInfo
.
UserId
});
if
(
userModel
==
null
)
{
return
ApiResult
.
Failed
(
"用户不存在"
);
}
string
payGoodsName
=
"购买点数"
;
var
rechargeRulesModel
=
pointModule
.
GetPointGoodsList
(
new
Model
.
Extend
.
Point
.
RB_Point_Goods_Extend
{
MallBaseId
=
userInfo
.
MallBaseId
,
TenantId
=
userInfo
.
TenantId
,
ID
=
demodel
.
PointGoodsId
}).
FirstOrDefault
();
if
(
rechargeRulesModel
==
null
)
{
return
ApiResult
.
Failed
(
"选择的点数产品不存在"
);
}
if
(
demodel
.
PointGoodsId
>
0
)
{
if
(
demodel
.
Income
.
Value
!=
Convert
.
ToDecimal
(
rechargeRulesModel
.
SellingPrice
.
Value
))
{
return
ApiResult
.
Failed
(
"购买点数金额与设定的金额不符"
);
}
demodel
.
PonitNum
=
rechargeRulesModel
.
PonitNum
;
demodel
.
OldPonitNum
=
userModel
.
PointNum
;
demodel
.
GivePoint
=
rechargeRulesModel
.
PonitNum
;
}
else
{
return
ApiResult
.
Failed
(
"点数产品不存在"
);
}
Random
R
=
new
Random
();
int
Rstr
=
R
.
Next
(
111
,
999
);
demodel
.
OrderNo
=
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
)
+
Rstr
;
demodel
.
State
=
0
;
demodel
.
CreateDate
=
System
.
DateTime
.
Now
;
demodel
.
PaymentWay
=
Common
.
Enum
.
Goods
.
OrderPaymentTypeEnum
.
OnlinePayment
;
demodel
.
OrderStatus
=
1
;
demodel
.
VersionSource
=
1
;
demodel
.
UserId
=
userInfo
.
UserId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
demodel
.
TenantId
=
userInfo
.
TenantId
;
//新增充值记录
int
rechargeId
=
pointModule
.
SetPointOrder
(
demodel
);
if
(
rechargeId
==
0
)
{
return
ApiResult
.
Failed
(
"购买点数失败"
);
}
string
sOrderNo
=
(
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
))
+
rechargeId
;
//根据订单号获取微信支付配置信息
RB_MiniProgram_Extend
miniProgram
=
new
RB_MiniProgram_Extend
();
//2020年5月26号新增
miniProgram
=
programModule
.
GetMiniProgramModule
(
new
RB_MiniProgram_Extend
{
MallBaseId
=
userInfo
.
MallBaseId
,
TenantId
=
userInfo
.
TenantId
});
App_Code
.
PayUtil
payUtil
=
new
App_Code
.
PayUtil
();
switch
((
int
)
demodel
.
PayWay
)
{
case
1
:
//微信支付
sPayInfo
=
App_Code
.
PayUtil
.
GetMinUnifiedOrder
(
sOrderNo
,
payGoodsName
,
Convert
.
ToDecimal
(
demodel
.
Income
),
userInfo
.
UserId
.
ToString
(),
userModel
.
OpenId
,
(
Config
.
sTenpayPointNotify
+
"/"
+
demodel
.
MallBaseId
+
"/"
+
demodel
.
TenantId
),
miniProgram
,
_accessor
,
System
.
Net
.
Dns
.
GetHostEntry
(
System
.
Net
.
Dns
.
GetHostName
()).
AddressList
.
FirstOrDefault
(
address
=>
address
.
AddressFamily
==
System
.
Net
.
Sockets
.
AddressFamily
.
InterNetwork
)?.
ToString
());
break
;
default
:
break
;
}
return
ApiResult
.
Success
(
""
,
sPayInfo
);
}
#
endregion
#
region
会员购买
/// <summary>
...
...
Mall.WebApi/Controllers/Education/PointController.cs
0 → 100644
View file @
7814ee30
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Mall.Common.API
;
using
Mall.Common.Plugin
;
using
Mall.Model.Extend.Point
;
using
Mall.Module.Education
;
using
Mall.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json.Linq
;
namespace
Mall.WebApi.Controllers.Education
{
[
Route
(
"api/[controller]/[action]"
)]
[
ApiExceptionFilter
]
[
ApiController
]
[
EnableCors
(
"AllowCors"
)]
public
class
PointController
:
BaseController
{
private
readonly
PointModule
pointModule
=
new
PointModule
();
#
region
点数商品
[
HttpPost
]
public
ApiResult
GetPointGoodsPageList
()
{
var
parms
=
RequestParm
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
msg
.
ToString
());
RB_Point_Goods_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Point_Goods_Extend
>(
RequestParm
.
msg
.
ToString
());
demodel
.
TenantId
=
UserInfo
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
//demodel.TeacherStatus = -1;
var
list
=
pointModule
.
GetPointGoodsPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
ID
,
x
.
GivePoint
,
x
.
GoodsName
,
x
.
PonitNum
,
x
.
SellingPrice
,
IsGive
=
(
x
.
GivePoint
>
0
)
?
1
:
0
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 获取详情
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetPointGoodsModel
()
{
var
parms
=
RequestParm
;
var
query
=
JsonConvert
.
DeserializeObject
<
RB_Point_Goods_Extend
>(
RequestParm
.
msg
.
ToString
());
query
.
TenantId
=
UserInfo
.
TenantId
;
query
.
MallBaseId
=
parms
.
MallBaseId
;
var
oldPointGoodsModel
=
pointModule
.
GetPointGoodsList
(
query
).
FirstOrDefault
();
if
(
oldPointGoodsModel
==
null
)
{
oldPointGoodsModel
=
new
RB_Point_Goods_Extend
();
}
return
ApiResult
.
Success
(
""
,
oldPointGoodsModel
);
}
/// <summary>
/// 保存点数产品信息
/// </summary>
/// <returns></returns>
public
ApiResult
SetPointGoods
()
{
var
parms
=
RequestParm
;
var
query
=
JsonConvert
.
DeserializeObject
<
RB_Point_Goods_Extend
>(
RequestParm
.
msg
.
ToString
());
query
.
TenantId
=
UserInfo
.
TenantId
;
query
.
MallBaseId
=
parms
.
MallBaseId
;
if
(
query
==
null
)
{
return
ApiResult
.
Failed
(
"请传入点数产品信息"
);
}
else
{
if
(
string
.
IsNullOrWhiteSpace
(
query
.
GoodsName
))
{
return
ApiResult
.
Failed
(
"请输入产品名称"
);
}
if
(
query
.
PonitNum
==
0
)
{
return
ApiResult
.
Failed
(
"请输入点数"
);
}
if
(
query
.
SellingPrice
==
0
)
{
return
ApiResult
.
Failed
(
"请输入价格"
);
}
if
(
query
.
ID
==
0
)
{
query
.
CreateDate
=
System
.
DateTime
.
Now
;
}
query
.
OriginalPrice
=
0
;
query
.
CostPrice
=
0
;
query
.
Sort
=
0
;
query
.
State
=
0
;
query
.
UpdateDate
=
System
.
DateTime
.
Now
;
bool
result
=
pointModule
.
SetPointGoods
(
query
);
if
(
result
)
{
return
ApiResult
.
Success
(
"点数产品信息保存成功"
);
}
else
{
return
ApiResult
.
Failed
(
"点数产品信息保存失败"
);
}
}
}
/// <summary>
/// 删除点数产品
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DeletePointGoods
()
{
var
parms
=
RequestParm
;
JObject
parmsJob
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
int
Id
=
parmsJob
.
GetInt
(
"Id"
,
0
);
if
(
Id
==
0
)
{
return
ApiResult
.
Failed
(
"请选择您要删除的点数信息"
);
}
bool
flag
=
pointModule
.
DeletePointGoods
(
new
RB_Point_Goods_Extend
{
ID
=
Id
,
TenantId
=
UserInfo
.
TenantId
,
MallBaseId
=
parms
.
MallBaseId
});
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
#
endregion
}
}
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