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
83406134
Commit
83406134
authored
Oct 30, 2020
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交优惠券
parent
6d869f63
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
710 additions
and
4 deletions
+710
-4
RB_Goods_Comment.cs
Mall.Model/Entity/Product/RB_Goods_Comment.cs
+7
-1
RB_Reserve_ServicePersonal_Extend.cs
...Model/Extend/Reserve/RB_Reserve_ServicePersonal_Extend.cs
+4
-0
ReserveModule.cs
Mall.Module.Reserve/ReserveModule.cs
+200
-1
RB_Reserve_ServicePersonalRepository.cs
...epository/Reserve/RB_Reserve_ServicePersonalRepository.cs
+60
-1
AppletStoresController.cs
Mall.WebApi/Controllers/Reserve/AppletStoresController.cs
+439
-1
No files found.
Mall.Model/Entity/Product/RB_Goods_Comment.cs
View file @
83406134
...
@@ -57,7 +57,7 @@ namespace Mall.Model.Entity.Product
...
@@ -57,7 +57,7 @@ namespace Mall.Model.Entity.Product
set
;
set
;
}
}
/// <summary>
/// <summary>
/// 客人名称
/// 客人名称
/// </summary>
/// </summary>
...
@@ -188,5 +188,11 @@ namespace Mall.Model.Entity.Product
...
@@ -188,5 +188,11 @@ namespace Mall.Model.Entity.Product
/// 来源订单id
/// 来源订单id
/// </summary>
/// </summary>
public
int
?
OrderDetailId
{
get
;
set
;
}
public
int
?
OrderDetailId
{
get
;
set
;
}
/// <summary>
/// 服务人员id
/// </summary>
public
int
ServicePersonalId
{
get
;
set
;
}
}
}
}
}
Mall.Model/Extend/Reserve/RB_Reserve_ServicePersonal_Extend.cs
View file @
83406134
...
@@ -23,6 +23,10 @@ namespace Mall.Model.Extend.Reserve
...
@@ -23,6 +23,10 @@ namespace Mall.Model.Extend.Reserve
/// 预约数
/// 预约数
/// </summary>
/// </summary>
public
int
OrderNum
{
get
;
set
;
}
public
int
OrderNum
{
get
;
set
;
}
/// <summary>
/// 评价数
/// </summary>
public
int
CommentNum
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 订单人数
/// 订单人数
...
...
Mall.Module.Reserve/ReserveModule.cs
View file @
83406134
...
@@ -19,7 +19,10 @@ namespace Mall.Module.Reserve
...
@@ -19,7 +19,10 @@ namespace Mall.Module.Reserve
/// 小程序
/// 小程序
/// </summary>
/// </summary>
private
readonly
RB_MiniProgramRepository
miniProgramRepository
=
new
RB_MiniProgramRepository
();
private
readonly
RB_MiniProgramRepository
miniProgramRepository
=
new
RB_MiniProgramRepository
();
/// <summary>
/// 会员信息
/// </summary>
private
readonly
RB_Member_UserRepository
member_UserRepository
=
new
RB_Member_UserRepository
();
#
region
套餐卡
#
region
套餐卡
private
readonly
RB_Reserve_CouponRepository
discountCouponRepository
=
new
RB_Reserve_CouponRepository
();
private
readonly
RB_Reserve_CouponRepository
discountCouponRepository
=
new
RB_Reserve_CouponRepository
();
private
readonly
RB_Reserve_CouponProductRepository
productRepository
=
new
RB_Reserve_CouponProductRepository
();
private
readonly
RB_Reserve_CouponProductRepository
productRepository
=
new
RB_Reserve_CouponProductRepository
();
...
@@ -224,6 +227,34 @@ namespace Mall.Module.Reserve
...
@@ -224,6 +227,34 @@ namespace Mall.Module.Reserve
}
}
/// <summary>
/// 套餐卡信息列表 订单数和商品数还未关联
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Reserve_ServicePersonal_Extend
>
GetMinServicePersonalList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Reserve_ServicePersonal_Extend
query
)
{
var
list
=
servicePersonalRepository
.
GetMinServicePersonalList
(
pageIndex
,
pageSize
,
out
rowCount
,
query
);
//if (list != null && list.Any())
//{
// string Ids = string.Join(",", list.Where(x => x.ServiceType == Common.Enum.Reserve.ServiceTypeEnum.Category || x.ServiceType == Common.Enum.Reserve.ServiceTypeEnum.Product).Select(x => x.ID));
// var listProduct = servicePersonalProductRepository.GetListByServicePersonalProductIds(query, Ids);
// foreach (var item in list)
// {
// item.ProductList = new List<RB_Reserve_ServicePersonalProduct_Extend>();
// item.ProductList = listProduct.Where(x => x.ServiceId == item.ID).ToList();
// }
//}
return
list
;
}
/// <summary>
/// <summary>
/// 服务人员信息列表
/// 服务人员信息列表
/// </summary>
/// </summary>
...
@@ -1055,5 +1086,173 @@ namespace Mall.Module.Reserve
...
@@ -1055,5 +1086,173 @@ namespace Mall.Module.Reserve
return
list
;
return
list
;
}
}
#
endregion
#
endregion
#
region
网课小程序个人中心
-
学习卡中心
/// <summary>
/// 领劵中心优惠券
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Reserve_Coupon_Extend
>
GetAllCouponList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Reserve_Coupon_Extend
query
)
{
var
list
=
discountCouponRepository
.
GetAllCouponList
(
pageIndex
,
pageSize
,
out
rowCount
,
query
);
//获取特定商品或者分类的数据
string
Ids
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
UseType
==
Common
.
Enum
.
MarketingCenter
.
UseTypeEnum
.
Category
).
Select
(
x
=>
x
.
ID
));
if
(!
string
.
IsNullOrWhiteSpace
(
Ids
))
{
query
.
UseType
=
Common
.
Enum
.
MarketingCenter
.
UseTypeEnum
.
Category
;
var
listProduct
=
productRepository
.
GetListByDiscountCouponIds
(
query
,
Ids
);
foreach
(
var
item
in
list
.
Where
(
x
=>
x
.
UseType
==
Common
.
Enum
.
MarketingCenter
.
UseTypeEnum
.
Category
))
{
item
.
ProductList
=
new
List
<
RB_Reserve_CouponProduct_Extend
>();
item
.
ProductList
=
listProduct
.
Where
(
x
=>
x
.
CouponId
==
item
.
ID
).
ToList
();
}
}
Ids
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
UseType
==
Common
.
Enum
.
MarketingCenter
.
UseTypeEnum
.
Product
).
Select
(
x
=>
x
.
ID
));
if
(!
string
.
IsNullOrWhiteSpace
(
Ids
))
{
query
.
UseType
=
Common
.
Enum
.
MarketingCenter
.
UseTypeEnum
.
Product
;
var
listProduct
=
productRepository
.
GetListByDiscountCouponIds
(
query
,
Ids
);
foreach
(
var
item
in
list
.
Where
(
x
=>
x
.
UseType
==
Common
.
Enum
.
MarketingCenter
.
UseTypeEnum
.
Product
))
{
item
.
ProductList
=
new
List
<
RB_Reserve_CouponProduct_Extend
>();
item
.
ProductList
=
listProduct
.
Where
(
x
=>
x
.
CouponId
==
item
.
ID
).
ToList
();
}
}
return
list
;
}
/// <summary>
/// 会员优惠券
/// </summary>
/// <returns></returns>
public
List
<
RB_Reserve_MemberCoupon_Extend
>
GetMemberDiscountCouponList
(
RB_Reserve_MemberCoupon_Extend
query
)
{
return
memberCouponRepository
.
GetList
(
query
);
}
#
endregion
#
region
自动发放给会员优惠券
/// <summary>
/// 自动给会员发放优惠券
/// </summary>
/// <param name="userId"></param>
/// <param name="getType">1-分享,2-购买并付款,3-新人领券</param>
/// <returns></returns>
public
RB_Reserve_Coupon_Extend
AutoEducationCoupon
(
RB_Reserve_Coupon_Extend
model
)
{
RB_Reserve_Coupon_Extend
resultModel
=
new
RB_Reserve_Coupon_Extend
();
//先查找会员是否存在
var
memberUserModel
=
member_UserRepository
.
GetEntity
(
model
.
UserId
);
if
(
memberUserModel
==
null
)
{
return
resultModel
;
}
//根据发放类型获取对应的优惠券信息
model
.
SmallShopId
=
memberUserModel
.
SmallShopId
;
if
(
model
.
TriggerType
==
4
)
{
model
.
RegisterDate
=
memberUserModel
.
CreateDate
;
}
var
couponList
=
discountCouponRepository
.
GetSelfmotionCouponList
(
model
);
if
(
couponList
!=
null
&&
couponList
.
Any
(
x
=>
x
.
TotalNum
==
-
1
||
x
.
TotalNum
>
0
))
//存在满足条件的优惠券可以发放
{
bool
isReceive
=
false
;
//查询已发放的优惠券信息
var
memberCouponList
=
memberCouponRepository
.
GetAutoMemberCouponPageList
(
new
RB_Reserve_MemberCoupon_Extend
{
UserId
=
model
.
UserId
,
GetType
=
model
.
TriggerType
,
TenantId
=
model
.
TenantId
,
MallBaseId
=
model
.
MallBaseId
});
foreach
(
var
item
in
couponList
.
Where
(
x
=>
x
.
TotalNum
==
-
1
||
x
.
TotalNum
>
0
))
//判断当前优惠券是否已超过领取数
{
int
membercouponCoun
=
memberCouponList
.
Where
(
x
=>
x
.
CouponId
==
item
.
ID
).
Count
();
if
(!
isReceive
&&
membercouponCoun
<
item
.
GrantNum
)
//此次没有领取,并且当前优惠券没有超过领取数量
{
var
trans
=
memberCouponRepository
.
DbTransaction
;
try
{
RB_Reserve_MemberCoupon
nowMemberCoupon
=
new
RB_Reserve_MemberCoupon
{
Id
=
0
,
TenantId
=
item
.
TenantId
,
MallBaseId
=
item
.
MallBaseId
,
Status
=
0
,
CreateDate
=
System
.
DateTime
.
Now
,
UserId
=
model
.
UserId
,
Description
=
item
.
TriggerType
==
1
?
"分享自动发放优惠券"
:
(
item
.
TriggerType
==
2
?
"购买并付款自动发放优惠券"
:
(
item
.
TriggerType
==
3
?
"新人领劵自动发放优惠券"
:
"新人购买并付款自动发放优惠券"
)),
Remarks
=
item
.
TriggerType
==
1
?
"分享"
:
(
item
.
TriggerType
==
2
?
"购买并付款"
:
(
item
.
TriggerType
==
3
?
"新人领劵"
:
"新人购买并付款"
)),
CouponId
=
item
.
ID
,
StartDate
=
item
.
IndateType
==
Common
.
Enum
.
MarketingCenter
.
IndateTypeEnum
.
DayHorizon
?
System
.
DateTime
.
Now
:
item
.
StartDate
,
EndDate
=
item
.
IndateType
==
Common
.
Enum
.
MarketingCenter
.
IndateTypeEnum
.
DayHorizon
?
System
.
DateTime
.
Now
.
AddDays
(
item
.
IndateDay
)
:
item
.
EndDate
,
GetType
=
item
.
TriggerType
,
UseType
=
item
.
UseType
,
Name
=
item
.
Name
,
HeXiao
=
item
.
HeXiao
,
UseHeXiao
=
0
};
isReceive
=
memberCouponRepository
.
Insert
(
nowMemberCoupon
,
trans
)
>
0
;
if
(
isReceive
)
//更新当前优惠券的领取数量
{
Dictionary
<
string
,
object
>
cols1
;
if
(
item
.
TotalNum
!=
-
1
)
{
cols1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Reserve_Coupon
.
ReceiveNum
),
item
.
ReceiveNum
+
1
},
{
nameof
(
RB_Reserve_Coupon
.
TotalNum
),
item
.
TotalNum
-
1
},
{
nameof
(
RB_Reserve_Coupon
.
UpdateDate
),
DateTime
.
Now
},
};
}
else
{
cols1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Reserve_Coupon
.
ReceiveNum
),
item
.
ReceiveNum
+
1
},
{
nameof
(
RB_Reserve_Coupon
.
UpdateDate
),
DateTime
.
Now
},
};
}
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Reserve_Coupon
.
ID
),
FiledValue
=
item
.
ID
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Reserve_Coupon
.
TenantId
),
FiledValue
=
item
.
TenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Reserve_Coupon
.
MallBaseId
),
FiledValue
=
item
.
MallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
discountCouponRepository
.
Update
(
cols1
,
wheres1
,
trans
);
}
memberCouponRepository
.
DBSession
.
Commit
();
return
item
;
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"AutoEducationCoupon"
);
memberCouponRepository
.
DBSession
.
Rollback
(
"AutoEducationCoupon"
);
return
resultModel
;
}
}
}
}
return
resultModel
;
}
#
endregion
}
}
}
}
Mall.Repository/Reserve/RB_Reserve_ServicePersonalRepository.cs
View file @
83406134
...
@@ -39,6 +39,59 @@ namespace Mall.Repository.Reserve
...
@@ -39,6 +39,59 @@ namespace Mall.Repository.Reserve
{
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Reserve_ServicePersonal_Extend
.
MallBaseId
)}
=
{
query
.
MallBaseId
}
"
);
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Reserve_ServicePersonal_Extend
.
MallBaseId
)}
=
{
query
.
MallBaseId
}
"
);
}
}
if
(
query
.
ServiceStatus
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Reserve_ServicePersonal_Extend
.
ServiceStatus
)}
=
{
query
.
ServiceStatus
}
"
);
}
if
(
query
.
StoreId
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Reserve_ServicePersonal_Extend
.
StoreId
)}
=
{
query
.
StoreId
}
"
);
}
if
(!
string
.
IsNullOrWhiteSpace
(
query
.
Name
))
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Reserve_ServicePersonal_Extend
.
Name
)}
like '%
{
query
.
Name
}
%'"
);
}
}
builder
.
Append
(
$" order by a.
{
nameof
(
RB_Reserve_ServicePersonal_Extend
.
ID
)}
desc"
);
return
GetPage
<
RB_Reserve_ServicePersonal_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
builder
.
ToString
()).
ToList
();
}
/// <summary>
///小程序端服务人员信息列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Reserve_ServicePersonal_Extend
>
GetMinServicePersonalList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Reserve_ServicePersonal_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
@
$" SELECT a.*,b.CommentNum FROM
{
TableName
}
as A
LEFT
JOIN
(
SELECT
ServicePersonalId
,
COUNT
(*)
as
CommentNum
from
rb_goods_comment
where
Is_Show
=
1
and
Status
=
0
GROUP
by
ServicePersonalId
)
as
b
on
a
.
ID
=
b
.
ServicePersonalId
WHERE
a
.{
nameof
(
RB_Reserve_ServicePersonal_Extend
.
Status
)}=
0
");
if
(
query
!=
null
)
{
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Reserve_ServicePersonal_Extend
.
TenantId
)}
=
{
query
.
TenantId
}
"
);
}
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Reserve_ServicePersonal_Extend
.
MallBaseId
)}
=
{
query
.
MallBaseId
}
"
);
}
if
(
query
.
ServiceStatus
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Reserve_ServicePersonal_Extend
.
ServiceStatus
)}
=
{
query
.
ServiceStatus
}
"
);
}
if
(
query
.
StoreId
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Reserve_ServicePersonal_Extend
.
StoreId
)}
=
{
query
.
StoreId
}
"
);
}
if
(!
string
.
IsNullOrWhiteSpace
(
query
.
Name
))
if
(!
string
.
IsNullOrWhiteSpace
(
query
.
Name
))
{
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Reserve_ServicePersonal_Extend
.
Name
)}
like '%
{
query
.
Name
}
%'"
);
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Reserve_ServicePersonal_Extend
.
Name
)}
like '%
{
query
.
Name
}
%'"
);
...
@@ -49,6 +102,7 @@ namespace Mall.Repository.Reserve
...
@@ -49,6 +102,7 @@ namespace Mall.Repository.Reserve
}
}
/// <summary>
/// <summary>
/// 服务人员信息列表
/// 服务人员信息列表
/// </summary>
/// </summary>
...
@@ -83,7 +137,12 @@ namespace Mall.Repository.Reserve
...
@@ -83,7 +137,12 @@ namespace Mall.Repository.Reserve
{
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Reserve_ServicePersonal_Extend
.
Name
)}
like '%
{
query
.
Name
}
%'"
);
builder
.
Append
(
$" AND
{
nameof
(
RB_Reserve_ServicePersonal_Extend
.
Name
)}
like '%
{
query
.
Name
}
%'"
);
}
}
if
(
query
.
ServiceStatus
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Reserve_ServicePersonal_Extend
.
ServiceStatus
)}
=
{
query
.
ServiceStatus
}
"
);
}
}
}
return
Get
<
RB_Reserve_ServicePersonal_Extend
>(
builder
.
ToString
()).
ToList
();
return
Get
<
RB_Reserve_ServicePersonal_Extend
>(
builder
.
ToString
()).
ToList
();
}
}
...
...
Mall.WebApi/Controllers/Reserve/AppletStoresController.cs
View file @
83406134
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
Mall.AOP
;
using
Mall.AOP
;
using
Mall.Common.API
;
using
Mall.Common.API
;
using
Mall.Common.Plugin
;
using
Mall.Common.Plugin
;
using
Mall.Model.Entity.User
;
using
Mall.Model.Entity.User
;
using
Mall.Model.Extend.Product
;
using
Mall.Model.Extend.Reserve
;
using
Mall.Module.Product
;
using
Mall.Module.Product
;
using
Mall.Module.Reserve
;
using
Mall.Module.User
;
using
Mall.Module.User
;
using
Mall.WebApi.Filter
;
using
Mall.WebApi.Filter
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Authorization
;
...
@@ -29,11 +33,16 @@ namespace Mall.WebApi.Controllers.Reserve
...
@@ -29,11 +33,16 @@ namespace Mall.WebApi.Controllers.Reserve
/// </summary>
/// </summary>
private
readonly
ContentModule
contentModule
=
AOPHelper
.
CreateAOPObject
<
ContentModule
>();
private
readonly
ContentModule
contentModule
=
AOPHelper
.
CreateAOPObject
<
ContentModule
>();
private
readonly
ReserveModule
reserveModule
=
new
ReserveModule
();
/// <summary>
/// <summary>
/// 线下服务商品处理类对象
/// 线下服务商品处理类对象
/// </summary>
/// </summary>
private
readonly
OfflineGoodsModule
offlineGoodsModule
=
AOPHelper
.
CreateAOPObject
<
OfflineGoodsModule
>();
private
readonly
OfflineGoodsModule
offlineGoodsModule
=
AOPHelper
.
CreateAOPObject
<
OfflineGoodsModule
>();
private
readonly
Module
.
User
.
UserModule
UserModule
=
new
Module
.
User
.
UserModule
();
/// <summary>
/// <summary>
/// 线下服务首页获取当前距离最近门店
/// 线下服务首页获取当前距离最近门店
/// </summary>
/// </summary>
...
@@ -132,12 +141,441 @@ namespace Mall.WebApi.Controllers.Reserve
...
@@ -132,12 +141,441 @@ namespace Mall.WebApi.Controllers.Reserve
storeAddress
=
storeModel
?.
Address
,
storeAddress
=
storeModel
?.
Address
,
storeTel
=
storeModel
?.
Tel
,
storeTel
=
storeModel
?.
Tel
,
distance
=
storeModel
?.
KM
,
distance
=
storeModel
?.
KM
,
storeScore
=
storeModel
?.
Score
,
storeScore
=
storeModel
?.
Score
,
storeCoverImg
=
storeModel
?.
CoverImg
,
storeCoverImg
=
storeModel
?.
CoverImg
,
storeNavImg
=
storeModel
?.
NavImg
storeNavImg
=
storeModel
?.
NavImg
},
},
};
};
return
ApiResult
.
Success
(
data
:
result
);
return
ApiResult
.
Success
(
data
:
result
);
}
}
#
region
获取设计师与套餐卡
#
region
设计师
/// <summary>
/// 获取服务人员列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
AllowAnonymous
]
public
ApiResult
GetServicePersonalList
()
{
var
parms
=
RequestParm
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
msg
.
ToString
());
RB_Reserve_ServicePersonal_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Reserve_ServicePersonal_Extend
>(
RequestParm
.
msg
.
ToString
());
demodel
.
TenantId
=
UserInfo
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
demodel
.
ServiceStatus
=
1
;
var
list
=
reserveModule
.
GetMinServicePersonalList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
ID
,
x
.
ServiceLogo
,
x
.
Name
,
Score
=
x
.
Score
==
0
?
"5"
:
x
.
Score
.
ToString
(),
x
.
OrderNum
,
CreateDateStr
=
x
.
CreateDate
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
x
.
ServiceStatus
,
x
.
Telephone
,
x
.
Major
,
x
.
WorkYears
,
x
.
Gender
,
ServiceTypeStr
=
x
.
ServiceType
.
GetEnumName
(),
x
.
ServiceType
,
x
.
FictitiousReserveNum
,
x
.
CommentNum
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
#
endregion
#
region
套餐卡
/// <summary>
/// 领劵中心
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetAllCouponPageList
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
req
.
msg
.
ToString
());
RB_Reserve_Coupon_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Reserve_Coupon_Extend
>(
req
.
msg
.
ToString
());
demodel
.
UserId
=
userInfo
.
UserId
;
demodel
.
TenantId
=
userInfo
.
TenantId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
demodel
.
SmallShopId
=
userInfo
.
UserSmallShopId
;
var
list
=
reserveModule
.
GetAllCouponList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Name
,
x
.
Describe
,
x
.
TotalNum
,
x
.
MemberNum
,
x
.
CouponIco
,
CouponId
=
x
.
ID
,
x
.
IndateDay
,
x
.
MaxDiscountsPrice
,
x
.
IndateType
,
StartDate
=
x
.
StartDate
.
HasValue
?
x
.
StartDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:ss:mm"
)
:
""
,
EndDate
=
x
.
EndDate
.
HasValue
?
x
.
EndDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:ss:mm"
)
:
""
,
IsReceive
=
x
.
MemberNum
>
0
?
1
:
0
,
UseTypeStr
=
((
int
)
x
.
UseType
==
3
||
(
int
)
x
.
UseType
==
4
)
?
x
.
UseType
.
GetEnumName
()
:
(
x
.
ProductList
!=
null
&&
x
.
ProductList
.
Any
()
?
string
.
Join
(
"、"
,
x
.
ProductList
.
Select
(
x
=>
x
.
Relevance
))
:
""
),
x
.
UseType
,
x
.
ProductList
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 领取套餐卡
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GrantCoupon
()
{
var
parms
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
var
query
=
JsonConvert
.
DeserializeObject
<
RB_Reserve_MemberCoupon_Extend
>(
RequestParm
.
msg
.
ToString
());
query
.
TenantId
=
userInfo
.
TenantId
;
query
.
MallBaseId
=
userInfo
.
MallBaseId
;
query
.
UserId
=
userInfo
.
UserId
;
if
(
query
==
null
)
{
return
ApiResult
.
Failed
(
"请传入套餐卡信息"
);
}
else
{
var
oldLogisticsModel
=
reserveModule
.
GetDiscountCouponList
(
new
RB_Reserve_Coupon_Extend
{
TenantId
=
query
.
TenantId
,
MallBaseId
=
query
.
MallBaseId
,
ID
=
query
.
CouponId
}).
FirstOrDefault
();
var
allMemberInfo
=
UserModule
.
GetMemberUserInfo
(
userInfo
.
UserId
);
if
(
oldLogisticsModel
==
null
||
oldLogisticsModel
.
ID
==
0
)
{
return
ApiResult
.
Failed
(
"套餐卡信息不存在,请核实后再操作"
);
}
if
(
allMemberInfo
.
SmallShopId
==
0
)
{
if
(
oldLogisticsModel
.
SmallShopId
>
0
)
{
return
ApiResult
.
Failed
(
"您不属于当前店铺"
);
}
}
else
{
if
(
oldLogisticsModel
.
SmallShopId
>
0
&&
oldLogisticsModel
.
SmallShopId
!=
allMemberInfo
.
SmallShopId
)
{
return
ApiResult
.
Failed
(
"领取套餐卡不属于当前店铺"
);
}
if
(
allMemberInfo
.
SmallShopId
>
0
&&
oldLogisticsModel
.
SmallShopId
==
0
&&
oldLogisticsModel
.
IsZanYangUse
==
1
)
{
return
ApiResult
.
Failed
(
"领取套餐卡不属于当前店铺"
);
}
}
if
(
oldLogisticsModel
.
TotalNum
!=
-
1
)
//判断套餐卡剩余数量是够足够
{
if
(
oldLogisticsModel
.
TotalNum
<
1
)
{
return
ApiResult
.
Failed
(
"套餐卡已领完"
);
}
}
//判断套餐卡是否已领取
var
receiveList
=
reserveModule
.
GetMemberDiscountCouponList
(
query
);
if
(
receiveList
!=
null
&&
receiveList
.
Any
())
{
return
ApiResult
.
Failed
(
"您已领取套餐卡"
);
}
if
(
oldLogisticsModel
.
IndateType
==
Common
.
Enum
.
MarketingCenter
.
IndateTypeEnum
.
TimeHorizon
)
{
if
(
oldLogisticsModel
.
EndDate
.
Value
<
System
.
DateTime
.
Now
)
{
return
ApiResult
.
Failed
(
"套餐卡时间已过期"
);
}
}
RB_Reserve_MemberCoupon_Extend
memberCoupon
=
new
RB_Reserve_MemberCoupon_Extend
();
memberCoupon
.
Id
=
0
;
memberCoupon
.
UserId
=
userInfo
.
UserId
;
memberCoupon
.
Description
=
oldLogisticsModel
.
Describe
;
memberCoupon
.
CreateDate
=
System
.
DateTime
.
Now
;
memberCoupon
.
TenantId
=
userInfo
.
TenantId
;
memberCoupon
.
MallBaseId
=
userInfo
.
MallBaseId
;
memberCoupon
.
Remarks
=
""
;
memberCoupon
.
CouponId
=
oldLogisticsModel
.
ID
;
memberCoupon
.
Name
=
oldLogisticsModel
.
Name
;
memberCoupon
.
HeXiao
=
oldLogisticsModel
.
HeXiao
;
memberCoupon
.
UseHeXiao
=
0
;
memberCoupon
.
UseType
=
oldLogisticsModel
.
UseType
;
if
(
oldLogisticsModel
.
IndateType
==
Common
.
Enum
.
MarketingCenter
.
IndateTypeEnum
.
DayHorizon
)
{
memberCoupon
.
StartDate
=
System
.
DateTime
.
Now
;
LogHelper
.
WriteInfo
(
userInfo
.
Name
+
"套餐卡领取时间:"
+
memberCoupon
.
StartDate
);
memberCoupon
.
EndDate
=
memberCoupon
.
StartDate
.
Value
.
AddDays
(
oldLogisticsModel
.
IndateDay
);
}
else
{
memberCoupon
.
StartDate
=
oldLogisticsModel
.
StartDate
;
memberCoupon
.
EndDate
=
oldLogisticsModel
.
EndDate
;
}
var
memberList
=
new
List
<
RB_Reserve_MemberCoupon_Extend
>();
memberList
.
Add
(
memberCoupon
);
bool
result
=
reserveModule
.
GrantCoupon
(
memberList
,
oldLogisticsModel
);
if
(
result
)
{
return
ApiResult
.
Success
(
"套餐卡信息领取成功"
);
}
else
{
return
ApiResult
.
Failed
(
"套餐卡信息领取成功"
);
}
}
}
/// <summary>
/// 我的套餐卡
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetMemberCouponPageList
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
req
.
msg
.
ToString
());
RB_Reserve_Coupon_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Reserve_Coupon_Extend
>(
req
.
msg
.
ToString
());
demodel
.
UserId
=
userInfo
.
UserId
;
demodel
.
TenantId
=
userInfo
.
TenantId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
var
list
=
reserveModule
.
GetMemberDisCouponList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Name
,
x
.
Describe
,
x
.
UseHeXiao
,
x
.
HeXiao
,
x
.
ID
,
x
.
MaxDiscountsPrice
,
x
.
CouponIco
,
x
.
MemberCouponId
,
StartDate
=
x
.
StartDate
.
HasValue
?
x
.
StartDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:ss:mm"
)
:
""
,
EndDate
=
x
.
EndDate
.
HasValue
?
x
.
EndDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:ss:mm"
)
:
""
,
UseTypeStr
=
((
int
)
x
.
UseType
==
3
||
(
int
)
x
.
UseType
==
4
)
?
x
.
UseType
.
GetEnumName
()
:
(
x
.
ProductList
!=
null
&&
x
.
ProductList
.
Any
()
?
string
.
Join
(
"、"
,
x
.
ProductList
.
Select
(
x
=>
x
.
Relevance
))
:
""
),
x
.
UseType
,
x
.
ProductList
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 分享领取套餐卡
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
ShareEducationCoupon
()
{
var
parms
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
var
query
=
JsonConvert
.
DeserializeObject
<
RB_Reserve_Coupon_Extend
>(
RequestParm
.
msg
.
ToString
());
query
.
TenantId
=
userInfo
.
TenantId
;
query
.
MallBaseId
=
userInfo
.
MallBaseId
;
query
.
UserId
=
userInfo
.
UserId
;
RB_Reserve_Coupon_Extend
resultModel
=
new
RB_Reserve_Coupon_Extend
();
if
(
query
.
TriggerType
==
2
)
{
query
.
TriggerType
=
4
;
resultModel
=
reserveModule
.
AutoEducationCoupon
(
query
);
if
(
resultModel
==
null
||
resultModel
.
ID
==
0
)
{
query
.
TriggerType
=
2
;
resultModel
=
reserveModule
.
AutoEducationCoupon
(
query
);
}
}
else
{
resultModel
=
reserveModule
.
AutoEducationCoupon
(
query
);
}
if
(
resultModel
!=
null
&&
resultModel
.
ID
>
0
)
{
return
ApiResult
.
CouponSuccess
(
ResultCode
.
Success
,
1
,
""
,
resultModel
.
Name
);
}
else
{
return
ApiResult
.
CouponFailed
(
ResultCode
.
Fail
,
1
,
""
,
""
);
}
}
/// <summary>
/// 获取用户未使用的套餐卡
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetNoUseCouponList
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
JObject
prams
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
var
query
=
JsonConvert
.
DeserializeObject
<
RB_Reserve_Coupon_Extend
>(
RequestParm
.
msg
.
ToString
());
query
.
TenantId
=
userInfo
.
TenantId
;
query
.
MallBaseId
=
userInfo
.
MallBaseId
;
query
.
UserId
=
userInfo
.
UserId
;
var
list
=
reserveModule
.
GetNoUseCouponList
(
query
);
//获取套餐卡对应的商品,或者分类
List
<
RB_Product_Category_Extend
>
categotyList
=
new
List
<
RB_Product_Category_Extend
>();
List
<
RB_Reserve_CouponProduct_Extend
>
productList
=
new
List
<
RB_Reserve_CouponProduct_Extend
>();
string
Ids
=
""
;
foreach
(
var
item
in
list
.
Where
(
x
=>
x
.
UseType
==
Common
.
Enum
.
MarketingCenter
.
UseTypeEnum
.
Category
))
{
productList
.
AddRange
(
item
.
ProductList
);
item
.
CategoryIds
=
item
.
ProductList
.
Select
(
x
=>
x
.
ProductId
).
ToList
().
ToArray
();
}
if
(
productList
!=
null
&&
productList
.
Any
())
{
Ids
=
string
.
Join
(
","
,
productList
.
Select
(
x
=>
x
.
ProductId
));
}
if
(!
string
.
IsNullOrWhiteSpace
(
Ids
))
{
categotyList
=
new
List
<
RB_Product_Category_Extend
>();
//productModule.GetCategoryListModule(new Model.Extend.Product.RB_Product_Category_Extend { TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId, CategoryIds = Ids });
}
if
(
categotyList
==
null
||
!
categotyList
.
Any
())
{
categotyList
=
new
List
<
RB_Product_Category_Extend
>();
}
List
<
RB_Goods_Extend
>
goodsList
=
new
List
<
RB_Goods_Extend
>();
productList
=
new
List
<
RB_Reserve_CouponProduct_Extend
>();
Ids
=
""
;
foreach
(
var
item
in
list
.
Where
(
x
=>
x
.
UseType
==
Common
.
Enum
.
MarketingCenter
.
UseTypeEnum
.
Product
))
{
productList
.
AddRange
(
item
.
ProductList
);
item
.
GoodsIds
=
item
.
ProductList
.
Select
(
x
=>
x
.
ProductId
).
ToList
().
ToArray
();
}
if
(
productList
!=
null
&&
productList
.
Any
())
{
Ids
=
string
.
Join
(
","
,
productList
.
Select
(
x
=>
x
.
ProductId
));
}
if
(!
string
.
IsNullOrWhiteSpace
(
Ids
))
{
goodsList
=
new
List
<
RB_Goods_Extend
>();
//productModule.GetProductGoodsList(new RB_Goods_Extend { TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId, GoodsIds = Ids });
}
if
(
goodsList
==
null
||
!
goodsList
.
Any
())
{
goodsList
=
new
List
<
RB_Goods_Extend
>();
}
var
result
=
list
.
Select
(
x
=>
new
{
id
=
x
.
MemberCouponId
,
mall_id
=
userInfo
.
MallBaseId
,
user_id
=
userInfo
.
UserId
,
coupon_id
=
x
.
ID
,
start_time
=
x
.
StartDate
.
HasValue
?
x
.
StartDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
end_time
=
x
.
EndDate
.
HasValue
?
x
.
EndDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
is_use
=
0
,
is_delete
=
0
,
created_at
=
x
.
CreateDate
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
updated_at
=
x
.
UpdateDate
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
deleted_at
=
"0000-00-00 00:00:00"
,
receive_type
=
""
,
discount_limit
=
x
.
MaxDiscountsPrice
,
usehexiao
=
x
.
HeXiao
-
x
.
UseHeXiao
,
couponIco
=
x
.
CouponIco
,
coupon_data
=
new
{
id
=
x
.
ID
,
mall_id
=
userInfo
.
MallBaseId
,
name
=
x
.
Name
,
pic_url
=
""
,
desc
=
""
,
total_count
=
x
.
TotalNum
+
x
.
ReceiveNum
,
expire_type
=
x
.
IndateType
,
expire_day
=
x
.
IndateDay
,
begin_time
=
x
.
StartDate
.
HasValue
?
x
.
StartDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
end_time
=
x
.
EndDate
.
HasValue
?
x
.
EndDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
appoint_type
=
(
int
)
x
.
UseType
,
rule
=
x
.
Describe
,
is_delete
=
0
,
deleted_at
=
"0000-00-00 00:00:00"
,
created_at
=
x
.
CreateDate
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
updated_at
=
x
.
UpdateDate
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
discount_limit
=
x
.
MaxDiscountsPrice
,
couponIco
=
x
.
CouponIco
,
usehexiao
=
x
.
HeXiao
-
x
.
UseHeXiao
,
car
=
categotyList
.
Where
(
y
=>
x
.
CategoryIds
.
Contains
(
x
.
ID
)).
Select
(
y
=>
new
{
id
=
y
.
Id
,
mall_id
=
userInfo
.
MallBaseId
,
mch_id
=
0
,
parent_id
=
y
.
ParentId
,
name
=
y
.
Name
,
pic_url
=
y
.
AdvertisingImagePath
,
sort
=
y
.
Sort
,
big_pic_url
=
y
.
BigIconPath
,
advert_pic
=
y
.
AdvertisingImage
,
advert_url
=
y
.
AdvertisingImagePath
,
status
=
y
.
Status
,
created_at
=
y
.
CreateDate
.
HasValue
?
y
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
updated_at
=
y
.
UpdateDate
.
HasValue
?
y
.
UpdateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
deleted_at
=
"0000-00-00 00:00:00"
,
is_delete
=
0
,
is_show
=
y
.
IsShow
,
advert_open_type
=
""
,
advert_params
=
""
}),
goods
=
goodsList
.
Where
(
y
=>
x
.
GoodsIds
.
Contains
(
x
.
ID
)).
Select
(
y
=>
new
{
id
=
y
.
Id
,
mall_id
=
userInfo
.
MallBaseId
,
name
=
y
.
Name
,
original_price
=
y
.
OriginalPrice
,
cost_price
=
y
.
CostPrice
,
detail
=
y
.
GoodsDetails
,
cover_pic
=
y
.
CoverImage
,
pic_url
=
""
,
video_url
=
y
.
VideoAddress
,
unit
=
y
.
Unit
,
created_at
=
y
.
CreateDate
.
HasValue
?
y
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
updated_at
=
y
.
UpdateDate
.
HasValue
?
y
.
UpdateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
deleted_at
=
"0000-00-00 00:00:00"
,
is_delete
=
0
,
}),
},
x
.
Name
,
x
.
Describe
,
x
.
MaxDiscountsPrice
,
x
.
UseType
});
return
ApiResult
.
Success
(
""
,
result
);
}
#
endregion
#
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