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
2ab772a8
Commit
2ab772a8
authored
May 14, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/Kui2/mall.oytour.com
parents
ce606472
d6589bf3
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
2153 additions
and
61 deletions
+2153
-61
Config.cs
Mall.Common/Config.cs
+10
-1
StringHelper.cs
Mall.Common/Plugin/StringHelper.cs
+16
-14
WeiXinHelper.cs
Mall.Common/Plugin/WeiXinHelper.cs
+1
-1
RB_Live_House.cs
Mall.Model/Entity/AppletWeChat/RB_Live_House.cs
+70
-0
RB_Miniprogram_Page_Templ.cs
...Model/Entity/MarketingCenter/RB_Miniprogram_Page_Templ.cs
+107
-0
RB_Miniprogram_Page_Templ_Details.cs
...tity/MarketingCenter/RB_Miniprogram_Page_Templ_Details.cs
+52
-0
RB_Miniprogram_Template.cs
Mall.Model/Entity/MarketingCenter/RB_Miniprogram_Template.cs
+88
-0
RB_Member_Subscription.cs
Mall.Model/Entity/User/RB_Member_Subscription.cs
+64
-0
RB_MiniProgram.cs
Mall.Model/Entity/User/RB_MiniProgram.cs
+6
-0
RB_Live_House_Extend.cs
Mall.Model/Extend/AppletWeChat/RB_Live_House_Extend.cs
+26
-0
RB_Miniprogram_Page_Templ_Details_Extend.cs
...rketingCenter/RB_Miniprogram_Page_Templ_Details_Extend.cs
+21
-0
RB_Miniprogram_Page_Templ_Extend.cs
...xtend/MarketingCenter/RB_Miniprogram_Page_Templ_Extend.cs
+21
-0
RB_Miniprogram_Template_Extend.cs
.../Extend/MarketingCenter/RB_Miniprogram_Template_Extend.cs
+39
-0
RB_Member_Subscription_Extend.cs
Mall.Model/Extend/User/RB_Member_Subscription_Extend.cs
+21
-0
Mall.Model.csproj
Mall.Model/Mall.Model.csproj
+0
-2
CouponModule.cs
Mall.Module.MarketingCenter/CouponModule.cs
+23
-11
MiniprogramPageTemplModule.cs
Mall.Module.MarketingCenter/MiniprogramPageTemplModule.cs
+170
-0
MiniprogramTemplateModule.cs
Mall.Module.MarketingCenter/MiniprogramTemplateModule.cs
+111
-0
MiniProgramModule.cs
Mall.Module.User/MiniProgramModule.cs
+430
-11
RB_Live_HouseRepository.cs
Mall.Repository/AppletWeChat/RB_Live_HouseRepository.cs
+68
-0
Mall.Repository.csproj
Mall.Repository/Mall.Repository.csproj
+0
-4
RB_Miniprogram_Page_TemplRepository.cs
...ry/MarketingCenter/RB_Miniprogram_Page_TemplRepository.cs
+109
-0
RB_Miniprogram_Page_Templ_DetailsRepository.cs
...tingCenter/RB_Miniprogram_Page_Templ_DetailsRepository.cs
+34
-0
RB_Miniprogram_TemplateRepository.cs
...tory/MarketingCenter/RB_Miniprogram_TemplateRepository.cs
+73
-0
RB_Member_CouponRepository.cs
Mall.Repository/User/RB_Member_CouponRepository.cs
+4
-4
RB_Member_SubscriptionRepository.cs
Mall.Repository/User/RB_Member_SubscriptionRepository.cs
+62
-0
PublishController.cs
Mall.WebApi/Controllers/AppletWeChat/PublishController.cs
+316
-6
TemplateController.cs
....WebApi/Controllers/MarketingCenter/TemplateController.cs
+197
-0
TenantController.cs
Mall.WebApi/Controllers/User/TenantController.cs
+0
-5
Mall.WebApi.csproj
Mall.WebApi/Mall.WebApi.csproj
+4
-0
mall.oytour.com.pubxml.user
...pi/Properties/PublishProfiles/mall.oytour.com.pubxml.user
+5
-0
appsettings.json
Mall.WebApi/appsettings.json
+2
-1
web.config
Mall.WebApi/web.config
+3
-1
No files found.
Mall.Common/Config.cs
View file @
2ab772a8
...
...
@@ -308,6 +308,15 @@ namespace Mall.Common
return
new
ConfigurationBuilder
().
Add
(
new
JsonConfigurationSource
{
Path
=
"appsettings.json"
}).
Build
().
GetSection
(
"DeveloperKitsPort"
).
Value
;
}
}
/// <summary>
/// 小程序生成二维码跳转地址
/// </summary>
public
static
string
FirstPage
{
get
{
return
new
ConfigurationBuilder
().
Add
(
new
JsonConfigurationSource
{
Path
=
"appsettings.json"
}).
Build
().
GetSection
(
"FirstPage"
).
Value
;
}
}
}
}
\ No newline at end of file
Mall.Common/Plugin/StringHelper.cs
View file @
2ab772a8
...
...
@@ -194,6 +194,7 @@ namespace Mall.Common.Plugin
}
}
/// <summary>
/// 获取年份月份中的最后一天
/// </summary>
...
...
@@ -510,7 +511,8 @@ namespace Mall.Common.Plugin
{
TotalDay
=
Saturday
+
Sunday
+
2
;
}
else
{
else
{
TotalDay
=
Saturday
+
Sunday
+
1
;
}
}
...
...
@@ -567,22 +569,22 @@ namespace Mall.Common.Plugin
}
}
#
endregion
#
endregion
#
region
字符转换
#
region
字符转换
/// <summary>
/// 为字符串左边填充字符
/// <example>
/// 111 LPAD(,'0',8) --> 00000111
/// </example>
/// </summary>
/// <param name="str">字符串</param>
/// <param name="swap">替换的字符</param>
/// <param name="length">长度</param>
/// <returns></returns>
public
static
string
LPAD
(
object
str
,
string
swap
,
int
length
)
/// <summary>
/// 为字符串左边填充字符
/// <example>
/// 111 LPAD(,'0',8) --> 00000111
/// </example>
/// </summary>
/// <param name="str">字符串</param>
/// <param name="swap">替换的字符</param>
/// <param name="length">长度</param>
/// <returns></returns>
public
static
string
LPAD
(
object
str
,
string
swap
,
int
length
)
{
string
s
=
str
.
ToString
();
...
...
Mall.Common/Plugin/WeiXinHelper.cs
View file @
2ab772a8
...
...
@@ -6,7 +6,7 @@ namespace Mall.Common.Plugin
{
public
class
WeiXinHelper
{
}
/// <summary>
...
...
Mall.Model/Entity/AppletWeChat/RB_Live_House.cs
0 → 100644
View file @
2ab772a8
using
Mall.Common.AOP
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.AppletWeChat
{
/// <summary>
/// 直播房间信息
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Live_House
{
/// <summary>
/// 房间号
/// </summary>
public
int
ID
{
get
;
set
;
}
/// <summary>
/// 商户id
/// </summary>
public
int
TenantId
{
get
;
set
;
}
/// <summary>
/// 小程序id
/// </summary>
public
int
MallBaseId
{
get
;
set
;
}
public
DateTime
CreateDate
{
get
;
set
;
}
/// <summary>
/// 房间名
/// </summary>
public
string
name
{
get
;
set
;
}
/// <summary>
/// 房间id
/// </summary>
public
string
roomid
{
get
;
set
;
}
/// <summary>
/// 直播间背景墙
/// </summary>
public
string
cover_img
{
get
;
set
;
}
/// <summary>
/// 直播状态
/// </summary>
public
string
live_status
{
get
;
set
;
}
/// <summary>
/// 直播计划开始时间
/// </summary>
public
string
start_time
{
get
;
set
;
}
/// <summary>
/// 直播计划结束时间
/// </summary>
public
string
end_time
{
get
;
set
;
}
/// <summary>
/// 主播名
/// </summary>
public
string
anchor_name
{
get
;
set
;
}
/// <summary>
/// 主播图片
/// </summary>
public
string
anchor_img
{
get
;
set
;
}
}
}
Mall.Model/Entity/MarketingCenter/RB_Miniprogram_Page_Templ.cs
0 → 100644
View file @
2ab772a8
using
Mall.Common.AOP
;
using
Mall.Common.Enum.MarketingCenter
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.MarketingCenter
{
/// <summary>
/// 小程序自定义页面实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Miniprogram_Page_Templ
{
/// <summary>
/// 主键
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 页面名称
/// </summary>
public
string
PageName
{
get
;
set
;
}
/// <summary>
/// 启用1,禁用0
/// </summary>
public
int
?
IsUse
{
get
;
set
;
}
/// <summary>
/// 是否显示导航条(0-不显示,1-显示)
/// </summary>
public
int
?
IsShowNav
{
get
;
set
;
}
/// <summary>
/// 是否为首页(0-否,1-是)
/// </summary>
public
int
?
IsHome
{
get
;
set
;
}
/// <summary>
/// 商户号Id
/// </summary>
public
int
?
TenantId
{
get
;
set
;
}
/// <summary>
/// 小程序Id
/// </summary>
public
int
?
MallBaseId
{
get
;
set
;
}
/// <summary>
/// 创建日期
/// </summary>
public
DateTime
?
CreateDate
{
get
;
set
;
}
/// <summary>
/// 创建人
/// </summary>
public
int
?
CreateBy
{
get
;
set
;
}
/// <summary>
/// 状态
/// </summary>
public
int
?
Status
{
get
;
set
;
}
}
}
Mall.Model/Entity/MarketingCenter/RB_Miniprogram_Page_Templ_Details.cs
0 → 100644
View file @
2ab772a8
using
Mall.Common.AOP
;
using
Mall.Common.Enum.MarketingCenter
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.MarketingCenter
{
/// <summary>
/// 小程序自定义页面导航实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Miniprogram_Page_Templ_Details
{
/// <summary>
/// 主键编号
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 主表编号
/// </summary>
public
int
?
PageTemplID
{
get
;
set
;
}
/// <summary>
/// 导航名称
/// </summary>
public
string
NavName
{
get
;
set
;
}
/// <summary>
/// 模板编号
/// </summary>
public
int
?
TemplateId
{
get
;
set
;
}
}
}
Mall.Model/Entity/MarketingCenter/RB_Miniprogram_Template.cs
0 → 100644
View file @
2ab772a8
using
Mall.Common.AOP
;
using
Mall.Common.Enum.MarketingCenter
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.MarketingCenter
{
/// <summary>
/// 小程序模板实体表
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Miniprogram_Template
{
/// <summary>
/// 主键
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 商户号Id
/// </summary>
public
int
?
TenantId
{
get
;
set
;
}
/// <summary>
/// 小程序Id
/// </summary>
public
int
?
MallBaseId
{
get
;
set
;
}
/// <summary>
/// 模板名称
/// </summary>
public
string
TemplateName
{
get
;
set
;
}
/// <summary>
/// 模板数据[JSON]格式
/// </summary>
public
string
TemplateData
{
get
;
set
;
}
/// <summary>
/// 创建日期
/// </summary>
public
DateTime
?
CreateDate
{
get
;
set
;
}
/// <summary>
/// 创建人
/// </summary>
public
int
?
CreateBy
{
get
;
set
;
}
/// <summary>
/// 状态
/// </summary>
public
int
?
Status
{
get
;
set
;
}
}
}
Mall.Model/Entity/User/RB_Member_Subscription.cs
0 → 100644
View file @
2ab772a8
using
Mall.Common.AOP
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.User
{
/// <summary>
/// 会员订阅消息实体表
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Member_Subscription
{
/// <summary>
/// 编号
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 会员id
/// </summary>
public
int
?
UserId
{
get
;
set
;
}
/// <summary>
/// 订阅模板id
/// </summary>
public
string
TempleteId
{
get
;
set
;
}
/// <summary>
/// OpenId
/// </summary>
public
string
OpenId
{
get
;
set
;
}
/// <summary>
/// 类型 1赞羊
/// </summary>
public
int
?
Type
{
get
;
set
;
}
/// <summary>
/// 删除
/// </summary>
public
int
Status
{
get
;
set
;
}
/// <summary>
/// 次数
/// </summary>
public
int
?
Count
{
get
;
set
;
}
/// <summary>
/// 商户号id
/// </summary>
public
int
TenantId
{
get
;
set
;
}
/// <summary>
/// 小程序id
/// </summary>
public
int
MallBaseId
{
get
;
set
;
}
}
}
Mall.Model/Entity/User/RB_MiniProgram.cs
View file @
2ab772a8
...
...
@@ -365,5 +365,11 @@ namespace Mall.Model.Entity.User
/// </summary>
public
string
JumpAppId
{
get
;
set
;
}
#
endregion
/// <summary>
///小程序直播组件 0-否,1-是
/// </summary>
public
int
LivePlayerPlugin
{
get
;
set
;
}
}
}
Mall.Model/Extend/AppletWeChat/RB_Live_House_Extend.cs
0 → 100644
View file @
2ab772a8
using
Mall.Model.Entity.AppletWeChat
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Extend.AppletWeChat
{
public
class
RB_Live_House_Extend
{
/// <summary>
/// errcode = 0 代表成功;errcode = 1 代表未创建直播房间
/// </summary>
public
string
errcode
{
get
;
set
;
}
public
string
errmsg
{
get
;
set
;
}
public
List
<
RB_Live_House
>
room_info
{
get
;
set
;
}
/// <summary>
/// 房间总数
/// </summary>
public
string
total
{
get
;
set
;
}
}
}
Mall.Model/Extend/MarketingCenter/RB_Miniprogram_Page_Templ_Details_Extend.cs
0 → 100644
View file @
2ab772a8
using
Mall.Common.AOP
;
using
Mall.Common.Enum.MarketingCenter
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.MarketingCenter
{
/// <summary>
/// 小程序自定义页面导航扩展实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Miniprogram_Page_Templ_Details_Extend
:
RB_Miniprogram_Page_Templ_Details
{
/// <summary>
/// 页面模板编号【逗号分割】
/// </summary>
public
string
QPageTemplIDs
{
get
;
set
;
}
}
}
\ No newline at end of file
Mall.Model/Extend/MarketingCenter/RB_Miniprogram_Page_Templ_Extend.cs
0 → 100644
View file @
2ab772a8
using
Mall.Common.AOP
;
using
Mall.Common.Enum.MarketingCenter
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.MarketingCenter
{
/// <summary>
/// 小程序自定义页面扩展实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Miniprogram_Page_Templ_Extend
:
Model
.
Entity
.
MarketingCenter
.
RB_Miniprogram_Page_Templ
{
/// <summary>
/// 页面导航列表
/// </summary>
public
List
<
RB_Miniprogram_Page_Templ_Details_Extend
>
DetailsList
{
get
;
set
;
}
}
}
\ No newline at end of file
Mall.Model/Extend/MarketingCenter/RB_Miniprogram_Template_Extend.cs
0 → 100644
View file @
2ab772a8
using
Mall.Common.AOP
;
using
Mall.Model.Entity.MarketingCenter
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Extend.MarketingCenter
{
/// <summary>
/// 小程序模板扩展实体表
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Miniprogram_Template_Extend
:
Model
.
Entity
.
MarketingCenter
.
RB_Miniprogram_Template
{
/// <summary>
/// 创建时间字符串
/// </summary>
public
string
CreateDateStr
{
get
{
string
str
=
""
;
if
(
this
.
CreateDate
!=
null
)
{
str
=
Convert
.
ToDateTime
(
this
.
CreateDate
).
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
}
return
str
;
}
}
/// <summary>
/// 前端组件
/// </summary>
public
List
<
object
>
ComponentDataList
{
get
;
set
;
}
}
}
Mall.Model/Extend/User/RB_Member_Subscription_Extend.cs
0 → 100644
View file @
2ab772a8
using
Mall.Common.AOP
;
using
Mall.Model.Entity.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Extend.User
{
/// <summary>
/// 订阅消息扩展表
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Member_Subscription_Extend
:
RB_Member_Subscription
{
/// <summary>
/// 模板ids
/// </summary>
public
List
<
string
>
TempleteIdList
{
get
;
set
;
}
}
}
Mall.Model/Mall.Model.csproj
View file @
2ab772a8
...
...
@@ -10,8 +10,6 @@
<ItemGroup>
<Folder Include="CacheEntity\" />
<Folder Include="Entity\AppletWeChat\" />
<Folder Include="Extend\AppletWeChat\" />
</ItemGroup>
<ItemGroup>
...
...
Mall.Module.MarketingCenter/CouponModule.cs
View file @
2ab772a8
...
...
@@ -191,23 +191,35 @@ namespace Mall.Module.MarketingCenter
{
id
=
model
.
ID
;
flag
=
discountCouponRepository
.
Update
(
model
,
trans
);
var
listProduct
=
productRepository
.
GetCouponProductList
(
new
RB_DiscountCoupon_Product
{
TenantId
=
model
.
TenantId
,
MallBaseId
=
model
.
MallBaseId
,
DiscountCouponId
=
id
});
if
(
listProduct
!=
null
&&
listProduct
.
Any
())
{
foreach
(
var
item
in
model
.
ProductList
)
{
IDictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
IDictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_DiscountCoupon_Product
.
Status
),
1
},
{
nameof
(
RB_DiscountCoupon_Product
.
UpdateDate
),
model
.
UpdateDate
},
};
IList
<
WhereHelper
>
whereHelpers
=
new
List
<
WhereHelper
>()
IList
<
WhereHelper
>
whereHelpers
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_DiscountCoupon_Product
.
ID
),
FiledValue
=
item
.
ID
,
OperatorEnum
=
OperatorEnum
.
Equal
}
new
WhereHelper
(){
FiledName
=
nameof
(
RB_DiscountCoupon_Product
.
DiscountCouponId
),
FiledValue
=
id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
flag
=
productRepository
.
Update
(
fileds
,
whereHelpers
,
trans
);
}
}
productRepository
.
Update
(
fileds
,
whereHelpers
,
trans
);
////var listProduct = productRepository.GetCouponProductList(new RB_DiscountCoupon_Product { TenantId = model.TenantId, MallBaseId = model.MallBaseId, DiscountCouponId = id });
////if (listProduct != null && listProduct.Any())
////{
//// foreach (var item in listProduct)
//// {
//// IDictionary<string, object> fileds = new Dictionary<string, object>()
//// {
//// { nameof(RB_DiscountCoupon_Product.Status),1},
//// { nameof(RB_DiscountCoupon_Product.UpdateDate),model.UpdateDate},
//// };
//// IList<WhereHelper> whereHelpers = new List<WhereHelper>()
//// {
//// new WhereHelper (){ FiledName=nameof(RB_DiscountCoupon_Product.ID),FiledValue=item.ID,OperatorEnum=OperatorEnum.Equal}
//// };
//// flag = productRepository.Update(fileds, whereHelpers, trans);
//// }
////}
if
(
model
.
ProductList
!=
null
&&
model
.
ProductList
.
Any
())
{
...
...
Mall.Module.MarketingCenter/MiniprogramPageTemplModule.cs
0 → 100644
View file @
2ab772a8
using
Mall.Common.Plugin
;
using
Mall.Model.Entity.MarketingCenter
;
using
Mall.Model.Entity.User
;
using
Mall.Model.Extend.MarketingCenter
;
using
Mall.Model.Extend.User
;
using
Mall.Model.Query
;
using
Mall.Repository
;
using
Mall.Repository.MarketingCenter
;
using
MySqlX.XDevAPI.Relational
;
using
Org.BouncyCastle.Crypto.Tls
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Mall.Module.MarketingCenter
{
/// <summary>
/// 小程序自定义页面处理类
/// </summary>
public
class
MiniprogramPageTemplModule
{
/// <summary>
/// 小程序自定义页面导航仓储层对象
/// </summary>
private
readonly
RB_Miniprogram_Page_Templ_DetailsRepository
detailsRepository
=
new
RB_Miniprogram_Page_Templ_DetailsRepository
();
/// <summary>
/// 小程序自定义页面仓储层对象
/// </summary>
private
readonly
RB_Miniprogram_Page_TemplRepository
pageRepository
=
new
RB_Miniprogram_Page_TemplRepository
();
/// <summary>
/// 小程序自定义页面分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Miniprogram_Page_Templ_Extend
>
GetMiniprogramPageTemplPageListModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Miniprogram_Page_Templ_Extend
query
)
{
var
list
=
pageRepository
.
GetMiniprogramPageTemplPageListRepository
(
pageIndex
,
pageSize
,
out
rowCount
,
query
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
string
pageIds
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
Id
));
List
<
RB_Miniprogram_Page_Templ_Details_Extend
>
details_Extends
=
GetMiniprogramPageTemplDetailsListModule
(
new
RB_Miniprogram_Page_Templ_Details_Extend
()
{
QPageTemplIDs
=
pageIds
});
foreach
(
var
item
in
list
)
{
item
.
DetailsList
=
details_Extends
?.
Where
(
qitem
=>
qitem
.
PageTemplID
==
item
.
Id
)?.
ToList
();
}
}
return
list
;
}
/// <summary>
/// 小程序自定义页面列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Miniprogram_Page_Templ_Extend
>
GetMiniprogramPageTemplListModule
(
RB_Miniprogram_Page_Templ_Extend
query
)
{
var
list
=
pageRepository
.
GetMiniprogramPageTemplListRepository
(
query
);
return
list
;
}
/// <summary>
/// 小程序自定义页面导航列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Miniprogram_Page_Templ_Details_Extend
>
GetMiniprogramPageTemplDetailsListModule
(
RB_Miniprogram_Page_Templ_Details_Extend
query
)
{
return
detailsRepository
.
GetMiniprogramPageTemplDetailsListRepository
(
query
);
}
/// <summary>
/// 小程序自定义页面实体
/// </summary>
/// <param name="query">查询条件</param>
/// <param name="isGetHome">是否查询首页页面</param>
/// <returns></returns>
public
RB_Miniprogram_Page_Templ_Extend
GetMiniprogramPageTemplModule
(
RB_Miniprogram_Page_Templ_Extend
query
,
bool
isGetHome
=
false
)
{
var
extModel
=
pageRepository
.
GetMiniprogramPageTemplRepository
(
query
,
isGetHome
:
isGetHome
);
if
(
extModel
==
null
)
{
extModel
=
new
RB_Miniprogram_Page_Templ_Extend
();
}
if
(
extModel
.
Id
>
0
)
{
extModel
.
DetailsList
=
GetMiniprogramPageTemplDetailsListModule
(
new
RB_Miniprogram_Page_Templ_Details_Extend
()
{
QPageTemplIDs
=
extModel
.
Id
.
ToString
()
});
}
return
extModel
;
}
/// <summary>
/// 新增修改自定义页面
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public
bool
SetMiniprogramPageTemplModule
(
RB_Miniprogram_Page_Templ_Extend
extModel
)
{
bool
flag
=
false
;
if
(
extModel
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
PageName
),
extModel
.
PageName
}
};
fileds
.
Add
(
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
IsUse
),
extModel
.
IsUse
);
fileds
.
Add
(
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
IsShowNav
),
extModel
.
IsShowNav
);
fileds
.
Add
(
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
IsHome
),
extModel
.
IsHome
);
flag
=
pageRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
Id
),
extModel
.
Id
));
}
else
{
var
newId
=
pageRepository
.
Insert
(
extModel
);
extModel
.
Id
=
newId
;
flag
=
newId
>
0
;
}
if
(
flag
&&
extModel
.
DetailsList
!=
null
&&
extModel
.
DetailsList
.
Count
>
0
)
{
foreach
(
var
subItem
in
extModel
.
DetailsList
)
{
subItem
.
PageTemplID
=
extModel
.
Id
;
if
(
subItem
.
Id
>
0
)
{
flag
=
detailsRepository
.
Update
(
subItem
);
}
else
{
flag
=
detailsRepository
.
Insert
(
subItem
)
>
0
;
}
}
}
return
flag
;
}
/// <summary>
/// 更新自定义页面状态
/// </summary>
/// <param name="Id">编号</param>
/// <param name="Status">状态</param>
/// <returns></returns>
public
bool
RemoveMiniprogramPageTemplModule
(
object
Id
,
int
Status
)
{
bool
flag
=
false
;
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
Status
),
Status
}
};
flag
=
pageRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
Id
),
Id
));
return
flag
;
}
/// <summary>
/// 根据Id删除小程序自定义页面导航
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public
bool
RemoveMiniprogramPageTemplDetailsModule
(
object
Id
)
{
bool
flag
=
false
;
flag
=
detailsRepository
.
Delete
(
Id
)>
0
;
return
flag
;
}
}
}
Mall.Module.MarketingCenter/MiniprogramTemplateModule.cs
0 → 100644
View file @
2ab772a8
using
Mall.Common.Plugin
;
using
Mall.Model.Entity.MarketingCenter
;
using
Mall.Model.Entity.User
;
using
Mall.Model.Extend.MarketingCenter
;
using
Mall.Model.Extend.User
;
using
Mall.Model.Query
;
using
Mall.Repository
;
using
Mall.Repository.MarketingCenter
;
using
MySqlX.XDevAPI.Relational
;
using
Org.BouncyCastle.Crypto.Tls
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Mall.Module.MarketingCenter
{
/// <summary>
/// 小程序模板处理类
/// </summary>
public
class
MiniprogramTemplateModule
{
/// <summary>
/// 小程序模板仓储层对象
/// </summary>
private
readonly
RB_Miniprogram_TemplateRepository
miniprogram_TemplateRepository
=
new
RB_Miniprogram_TemplateRepository
();
/// <summary>
/// 小程序模板分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Miniprogram_Template_Extend
>
GetMiniprogramTemplatePageListModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Miniprogram_Template_Extend
query
)
{
return
miniprogram_TemplateRepository
.
GetMiniprogramTemplatePageListRepository
(
pageIndex
,
pageSize
,
out
rowCount
,
query
);
}
/// <summary>
/// 小程序模板列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Miniprogram_Template_Extend
>
GetMiniprogramTemplateListModule
(
RB_Miniprogram_Template_Extend
query
)
{
return
miniprogram_TemplateRepository
.
GetMiniprogramTemplateListRepository
(
query
);
}
/// <summary>
/// 新增修改小程序模板
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public
bool
SetMiniprogramTemplateModule
(
RB_Miniprogram_Template_Extend
extModel
)
{
bool
flag
=
false
;
if
(
extModel
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Miniprogram_Template_Extend
.
Id
),
extModel
.
Id
}
};
fileds
.
Add
(
nameof
(
RB_Miniprogram_Template_Extend
.
TemplateName
),
extModel
.
TemplateName
);
fileds
.
Add
(
nameof
(
RB_Miniprogram_Template_Extend
.
TemplateData
),
extModel
.
TemplateData
);
flag
=
miniprogram_TemplateRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Miniprogram_Template_Extend
.
Id
),
extModel
.
Id
));
}
else
{
var
newId
=
miniprogram_TemplateRepository
.
Insert
(
extModel
);
extModel
.
Id
=
newId
;
flag
=
newId
>
0
;
}
return
flag
;
}
/// <summary>
/// 获取小程序模板实体
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public
RB_Miniprogram_Template_Extend
GetMiniprogramTemplateModule
(
object
Id
)
{
RB_Miniprogram_Template_Extend
extModel
=
miniprogram_TemplateRepository
.
GetEntity
<
RB_Miniprogram_Template_Extend
>(
Id
);
if
(
extModel
==
null
)
{
extModel
=
new
RB_Miniprogram_Template_Extend
();
}
return
extModel
;
}
/// <summary>
/// 删除小程序模板
/// </summary>
/// <param name="Id"></param>
/// <param name="Status"></param>
/// <returns></returns>
public
bool
RemoveMiniprogramTemplateModule
(
object
Id
,
int
Status
)
{
bool
flag
=
false
;
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Miniprogram_Template_Extend
.
Status
),
Status
}
};
flag
=
miniprogram_TemplateRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Miniprogram_Template_Extend
.
Id
),
Id
));
return
flag
;
}
}
}
Mall.Module.User/MiniProgramModule.cs
View file @
2ab772a8
...
...
@@ -9,6 +9,7 @@ using Mall.CacheManager.AppletWeChat;
using
Newtonsoft.Json.Linq
;
using
Newtonsoft.Json
;
using
Mall.Common.Plugin
;
using
NPOI.SS.Formula.Functions
;
namespace
Mall.Module.User
{
...
...
@@ -32,6 +33,20 @@ namespace Mall.Module.User
/// </summary>
private
Repository
.
User
.
RB_MiniProgram_UserCenterMenuRepository
centerMenuRepository
=
new
Repository
.
User
.
RB_MiniProgram_UserCenterMenuRepository
();
/// <summary>
/// 会员订阅消息仓储层对象
/// </summary>
private
Repository
.
User
.
RB_Member_SubscriptionRepository
subscriptionRepository
=
new
Repository
.
User
.
RB_Member_SubscriptionRepository
();
/// <summary>
/// 会员仓储层对象
/// </summary>
private
Repository
.
User
.
RB_Member_UserRepository
userRepository
=
new
Repository
.
User
.
RB_Member_UserRepository
();
/// <summary>
/// 直播房间仓储层对象
/// </summary>
private
Repository
.
AppletWeChat
.
RB_Live_HouseRepository
liveHouseRepository
=
new
Repository
.
AppletWeChat
.
RB_Live_HouseRepository
();
#
region
小程序
/// <summary>
/// 根据查询条件获取小程序列表
...
...
@@ -205,7 +220,7 @@ namespace Mall.Module.User
/// <param name="isGetNav">是否获取顶部底部配置+底部标签导航(0-不获取,1-获取)</param>
/// <param name="isGetUserCenterMenu">是否获取用户中心菜单</param>
/// <returns></returns>
public
RB_MiniProgram_Extend
GetMiniProgramModule
(
object
MallBaseId
,
int
isGetNav
=
0
,
bool
isGetUserCenterMenu
=
false
)
public
RB_MiniProgram_Extend
GetMiniProgramModule
(
object
MallBaseId
,
int
isGetNav
=
0
,
bool
isGetUserCenterMenu
=
false
)
{
RB_MiniProgram_Extend
extModel
=
programRepository
.
GetEntity
<
RB_MiniProgram_Extend
>(
MallBaseId
);
if
(
extModel
==
null
)
...
...
@@ -490,6 +505,8 @@ namespace Mall.Module.User
#
endregion
#
region
微信小程序基础配置
...
...
@@ -518,6 +535,83 @@ namespace Mall.Module.User
#
region
发送小程序订阅信息
/// <summary>
/// 用户订阅消息
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
bool
SetMemberSubscribe
(
RB_Member_Subscription_Extend
demodel
)
{
var
gmodel
=
userRepository
.
GetEntity
(
demodel
.
UserId
);
if
(
gmodel
==
null
)
{
return
false
;
}
var
trans
=
subscriptionRepository
.
DbTransaction
;
try
{
foreach
(
var
item
in
demodel
.
TempleteIdList
)
{
var
list
=
subscriptionRepository
.
GetList
(
new
RB_Member_Subscription_Extend
()
{
OpenId
=
demodel
.
OpenId
,
Type
=
1
,
TempleteId
=
item
,
MallBaseId
=
demodel
.
MallBaseId
,
TenantId
=
demodel
.
TenantId
});
if
(!
list
.
Any
())
{
subscriptionRepository
.
Insert
(
new
RB_Member_Subscription
()
{
UserId
=
demodel
.
UserId
,
Id
=
0
,
OpenId
=
demodel
.
OpenId
,
Status
=
0
,
TempleteId
=
item
,
Type
=
1
,
Count
=
1
,
MallBaseId
=
gmodel
.
MallBaseId
,
TenantId
=
gmodel
.
TenantId
},
trans
);
}
else
{
// 增加订阅次数
var
model
=
list
.
FirstOrDefault
();
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_Subscription
.
Count
),
model
.
Count
++}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_Subscription
.
Id
),
FiledValue
=
model
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
subscriptionRepository
.
Update
(
files
,
wheres
,
trans
);
}
}
subscriptionRepository
.
DBSession
.
Commit
();
return
true
;
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"SetLXYGuestSubscribe"
);
subscriptionRepository
.
DBSession
.
Rollback
();
return
false
;
}
}
/// <summary>
/// 获取订阅模板数量
/// </summary>
/// <param name="openId"></param>
/// <param name="groupId"></param>
/// <returns></returns>
public
List
<
RB_Member_Subscription_Extend
>
GetLXYSubscribeCountList
(
string
openId
,
int
MallBaseId
,
int
TenantId
)
{
return
subscriptionRepository
.
GetList
(
new
RB_Member_Subscription_Extend
()
{
OpenId
=
openId
,
Type
=
1
,
MallBaseId
=
MallBaseId
,
TenantId
=
TenantId
});
}
/// <summary>
/// 下单成功发送订阅消息
/// </summary>
...
...
@@ -570,7 +664,8 @@ namespace Mall.Module.User
{
value
=
GoodsName
}
}
},
miniprogram_state
=
"developer"
};
wenXinResult
=
HttpHelper
.
HttpPost
(
Url
,
JsonHelper
.
Serialize
(
postdata
),
""
);
...
...
@@ -578,7 +673,24 @@ namespace Mall.Module.User
JObject
jo
=
(
JObject
)
JsonConvert
.
DeserializeObject
(
wenXinResult
);
int
errcode
=
Convert
.
ToInt32
(
jo
[
"errcode"
].
ToString
());
if
(
errcode
==
0
)
{
{
//成功
var
list
=
subscriptionRepository
.
GetList
(
new
RB_Member_Subscription_Extend
()
{
OpenId
=
OpenId
,
Type
=
1
,
TempleteId
=
appletWeChatModel
.
OrderSuccessTpl
,
MallBaseId
=
MallBaseId
,
TenantId
=
TenantId
});
if
(
list
.
Any
())
{
// 减少订阅次数
var
model
=
list
.
FirstOrDefault
();
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_Subscription
.
Count
),
model
.
Count
>
0
?(
model
.
Count
--):
0
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_Subscription
.
Id
),
FiledValue
=
model
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
subscriptionRepository
.
Update
(
files
,
wheres
);
}
return
true
;
}
else
...
...
@@ -650,7 +762,24 @@ namespace Mall.Module.User
JObject
jo
=
(
JObject
)
JsonConvert
.
DeserializeObject
(
wenXinResult
);
int
errcode
=
Convert
.
ToInt32
(
jo
[
"errcode"
].
ToString
());
if
(
errcode
==
0
)
{
{
//成功
var
list
=
subscriptionRepository
.
GetList
(
new
RB_Member_Subscription_Extend
()
{
OpenId
=
OpenId
,
Type
=
1
,
TempleteId
=
appletWeChatModel
.
OrderCancelTpl
,
MallBaseId
=
MallBaseId
,
TenantId
=
TenantId
});
if
(
list
.
Any
())
{
// 减少订阅次数
var
model
=
list
.
FirstOrDefault
();
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_Subscription
.
Count
),
model
.
Count
>
0
?(
model
.
Count
--):
0
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_Subscription
.
Id
),
FiledValue
=
model
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
subscriptionRepository
.
Update
(
files
,
wheres
);
}
return
true
;
}
else
...
...
@@ -724,7 +853,24 @@ namespace Mall.Module.User
JObject
jo
=
(
JObject
)
JsonConvert
.
DeserializeObject
(
wenXinResult
);
int
errcode
=
Convert
.
ToInt32
(
jo
[
"errcode"
].
ToString
());
if
(
errcode
==
0
)
{
{
//成功
var
list
=
subscriptionRepository
.
GetList
(
new
RB_Member_Subscription_Extend
()
{
OpenId
=
OpenId
,
Type
=
1
,
TempleteId
=
appletWeChatModel
.
OrderDeliverGoodsTpl
,
MallBaseId
=
MallBaseId
,
TenantId
=
TenantId
});
if
(
list
.
Any
())
{
// 减少订阅次数
var
model
=
list
.
FirstOrDefault
();
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_Subscription
.
Count
),
model
.
Count
>
0
?(
model
.
Count
--):
0
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_Subscription
.
Id
),
FiledValue
=
model
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
subscriptionRepository
.
Update
(
files
,
wheres
);
}
return
true
;
}
else
...
...
@@ -796,7 +942,24 @@ namespace Mall.Module.User
JObject
jo
=
(
JObject
)
JsonConvert
.
DeserializeObject
(
wenXinResult
);
int
errcode
=
Convert
.
ToInt32
(
jo
[
"errcode"
].
ToString
());
if
(
errcode
==
0
)
{
{
//成功
var
list
=
subscriptionRepository
.
GetList
(
new
RB_Member_Subscription_Extend
()
{
OpenId
=
OpenId
,
Type
=
1
,
TempleteId
=
appletWeChatModel
.
RefundTpl
,
MallBaseId
=
MallBaseId
,
TenantId
=
TenantId
});
if
(
list
.
Any
())
{
// 减少订阅次数
var
model
=
list
.
FirstOrDefault
();
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_Subscription
.
Count
),
model
.
Count
>
0
?(
model
.
Count
--):
0
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_Subscription
.
Id
),
FiledValue
=
model
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
subscriptionRepository
.
Update
(
files
,
wheres
);
}
return
true
;
}
else
...
...
@@ -863,7 +1026,24 @@ namespace Mall.Module.User
JObject
jo
=
(
JObject
)
JsonConvert
.
DeserializeObject
(
wenXinResult
);
int
errcode
=
Convert
.
ToInt32
(
jo
[
"errcode"
].
ToString
());
if
(
errcode
==
0
)
{
{
//成功
var
list
=
subscriptionRepository
.
GetList
(
new
RB_Member_Subscription_Extend
()
{
OpenId
=
OpenId
,
Type
=
1
,
TempleteId
=
appletWeChatModel
.
ActiveStateTpl
,
MallBaseId
=
MallBaseId
,
TenantId
=
TenantId
});
if
(
list
.
Any
())
{
// 减少订阅次数
var
model
=
list
.
FirstOrDefault
();
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_Subscription
.
Count
),
model
.
Count
>
0
?(
model
.
Count
--):
0
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_Subscription
.
Id
),
FiledValue
=
model
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
subscriptionRepository
.
Update
(
files
,
wheres
);
}
return
true
;
}
else
...
...
@@ -933,7 +1113,24 @@ namespace Mall.Module.User
JObject
jo
=
(
JObject
)
JsonConvert
.
DeserializeObject
(
wenXinResult
);
int
errcode
=
Convert
.
ToInt32
(
jo
[
"errcode"
].
ToString
());
if
(
errcode
==
0
)
{
{
//成功
var
list
=
subscriptionRepository
.
GetList
(
new
RB_Member_Subscription_Extend
()
{
OpenId
=
OpenId
,
Type
=
1
,
TempleteId
=
appletWeChatModel
.
AuditResultTpl
,
MallBaseId
=
MallBaseId
,
TenantId
=
TenantId
});
if
(
list
.
Any
())
{
// 减少订阅次数
var
model
=
list
.
FirstOrDefault
();
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_Subscription
.
Count
),
model
.
Count
>
0
?(
model
.
Count
--):
0
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_Subscription
.
Id
),
FiledValue
=
model
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
subscriptionRepository
.
Update
(
files
,
wheres
);
}
return
true
;
}
else
...
...
@@ -1004,7 +1201,24 @@ namespace Mall.Module.User
JObject
jo
=
(
JObject
)
JsonConvert
.
DeserializeObject
(
wenXinResult
);
int
errcode
=
Convert
.
ToInt32
(
jo
[
"errcode"
].
ToString
());
if
(
errcode
==
0
)
{
{
//成功
var
list
=
subscriptionRepository
.
GetList
(
new
RB_Member_Subscription_Extend
()
{
OpenId
=
OpenId
,
Type
=
1
,
TempleteId
=
appletWeChatModel
.
ReflectSuccessTpl
,
MallBaseId
=
MallBaseId
,
TenantId
=
TenantId
});
if
(
list
.
Any
())
{
// 减少订阅次数
var
model
=
list
.
FirstOrDefault
();
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_Subscription
.
Count
),
model
.
Count
>
0
?(
model
.
Count
--):
0
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_Subscription
.
Id
),
FiledValue
=
model
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
subscriptionRepository
.
Update
(
files
,
wheres
);
}
return
true
;
}
else
...
...
@@ -1065,7 +1279,24 @@ namespace Mall.Module.User
JObject
jo
=
(
JObject
)
JsonConvert
.
DeserializeObject
(
wenXinResult
);
int
errcode
=
Convert
.
ToInt32
(
jo
[
"errcode"
].
ToString
());
if
(
errcode
==
0
)
{
{
//成功
var
list
=
subscriptionRepository
.
GetList
(
new
RB_Member_Subscription_Extend
()
{
OpenId
=
OpenId
,
Type
=
1
,
MallBaseId
=
MallBaseId
,
TempleteId
=
appletWeChatModel
.
ReflectFailTpl
,
TenantId
=
TenantId
});
if
(
list
.
Any
())
{
// 减少订阅次数
var
model
=
list
.
FirstOrDefault
();
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_Subscription
.
Count
),
model
.
Count
>
0
?(
model
.
Count
--):
0
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_Subscription
.
Id
),
FiledValue
=
model
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
subscriptionRepository
.
Update
(
files
,
wheres
);
}
return
true
;
}
else
...
...
@@ -1126,7 +1357,24 @@ namespace Mall.Module.User
JObject
jo
=
(
JObject
)
JsonConvert
.
DeserializeObject
(
wenXinResult
);
int
errcode
=
Convert
.
ToInt32
(
jo
[
"errcode"
].
ToString
());
if
(
errcode
==
0
)
{
{
//成功
var
list
=
subscriptionRepository
.
GetList
(
new
RB_Member_Subscription_Extend
()
{
OpenId
=
OpenId
,
Type
=
1
,
TempleteId
=
appletWeChatModel
.
MembersLevelChangeTpl
,
MallBaseId
=
MallBaseId
,
TenantId
=
TenantId
});
if
(
list
.
Any
())
{
// 减少订阅次数
var
model
=
list
.
FirstOrDefault
();
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_Subscription
.
Count
),
model
.
Count
>
0
?(
model
.
Count
--):
0
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_Subscription
.
Id
),
FiledValue
=
model
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
subscriptionRepository
.
Update
(
files
,
wheres
);
}
return
true
;
}
else
...
...
@@ -1167,7 +1415,178 @@ namespace Mall.Module.User
/// <summary>
/// 检查是否返回图片路径
/// </summary>
/// <param name="picStr"></param>
/// <param name="TCID"></param>
/// <param name="ConfigId"></param>
/// <returns></returns>
public
string
CheckWeiXinShareImg
(
string
picStr
,
RB_MiniProgram_Extend
model
,
string
jumpUrl
)
{
if
(
string
.
IsNullOrWhiteSpace
(
picStr
))
{
string
token
=
WeiXinReidsCache
.
Get
(
model
.
MiniAppId
);
if
(
string
.
IsNullOrEmpty
(
token
))
{
token
=
GetLXYToken
(
token
,
model
);
System
.
Threading
.
Tasks
.
Task
.
Run
(()
=>
WeiXinReidsCache
.
Set
(
model
.
MiniAppId
,
token
));
}
if
(
string
.
IsNullOrEmpty
(
token
))
{
return
""
;
}
picStr
=
GetWeiXinShare
(
model
,
jumpUrl
);
}
return
picStr
;
}
/// <summary>
/// 获取微信小程序分享
/// </summary>
/// <returns></returns>
public
string
GetWeiXinShare
(
RB_MiniProgram_Extend
model
,
string
jumpUrl
)
{
string
access_TokenStr
=
WeiXinReidsCache
.
Get
(
model
.
MiniAppId
);
if
(
string
.
IsNullOrEmpty
(
access_TokenStr
))
{
access_TokenStr
=
GetLXYToken
(
access_TokenStr
,
model
);
System
.
Threading
.
Tasks
.
Task
.
Run
(()
=>
WeiXinReidsCache
.
Set
(
model
.
MiniAppId
,
access_TokenStr
));
}
string
picStr
=
string
.
Empty
;
if
(!
string
.
IsNullOrWhiteSpace
(
access_TokenStr
))
{
string
GetImageUrl
=
"https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token="
+
access_TokenStr
;
var
postData
=
new
{
scene
=
""
,
page
=
jumpUrl
,
width
=
"100"
,
is_hyaline
=
true
};
picStr
=
HttpHelper
.
HttpPost
(
GetImageUrl
,
JsonHelper
.
Serialize
(
postData
));
//if (string.IsNullOrWhiteSpace(picStr))
//{
// picStr = CheckWeiXinShareImg(picStr, model, jumpUrl);
//}
}
return
picStr
;
}
#
endregion
#
region
小程序直播房间信息
/// <summary>
/// 获取直播房间信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
GetLiveInfo
(
RB_MiniProgram_Extend
model
)
{
string
token
=
WeiXinReidsCache
.
Get
(
model
.
MiniAppId
);
if
(
string
.
IsNullOrEmpty
(
token
))
{
token
=
GetLXYToken
(
token
,
model
);
System
.
Threading
.
Tasks
.
Task
.
Run
(()
=>
WeiXinReidsCache
.
Set
(
model
.
MiniAppId
,
token
));
}
if
(
string
.
IsNullOrEmpty
(
token
))
{
return
false
;
}
string
wenXinResult
=
string
.
Empty
;
if
(!
string
.
IsNullOrWhiteSpace
(
token
))
{
string
Url
=
" http://api.weixin.qq.com/wxa/business/getliveinfo?access_token="
+
token
;
var
postdata
=
new
{
start
=
0
,
limit
=
100
};
wenXinResult
=
HttpHelper
.
HttpPost
(
Url
,
JsonHelper
.
Serialize
(
postdata
),
""
);
var
newLiveHouse
=
JsonConvert
.
DeserializeObject
<
Model
.
Extend
.
AppletWeChat
.
RB_Live_House_Extend
>(
wenXinResult
);
//JObject jo = (JObject)JsonConvert.DeserializeObject(wenXinResult);
//int errcode = Convert.ToInt32(jo["errcode"].ToString());
if
(
newLiveHouse
.
errcode
==
"0"
)
{
newLiveHouse
.
room_info
.
ForEach
(
x
=>
x
.
TenantId
=
model
.
TenantId
??
0
);
newLiveHouse
.
room_info
.
ForEach
(
x
=>
x
.
MallBaseId
=
model
.
MallBaseId
);
newLiveHouse
.
room_info
.
ForEach
(
x
=>
x
.
CreateDate
=
System
.
DateTime
.
Now
);
AddLiveHouse
(
newLiveHouse
.
room_info
,
new
Model
.
Entity
.
AppletWeChat
.
RB_Live_House
{
TenantId
=
model
.
TenantId
??
0
,
MallBaseId
=
model
.
MallBaseId
});
return
true
;
}
else
{
LogHelper
.
Write
(
string
.
Format
(
"SendMemberLevelMsg:wenXinResult:{0}"
,
wenXinResult
));
}
}
return
false
;
}
/// <summary>
/// 获取直播房间
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
Model
.
Entity
.
AppletWeChat
.
RB_Live_House
>
GetLiveHouseListRepository
(
Model
.
Entity
.
AppletWeChat
.
RB_Live_House
query
)
{
return
liveHouseRepository
.
GetLiveHouseListRepository
(
query
);
}
/// <summary>
/// 获取直播房间
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
Model
.
Entity
.
AppletWeChat
.
RB_Live_House
>
GetLiveHousePageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
Model
.
Entity
.
AppletWeChat
.
RB_Live_House
query
)
{
return
liveHouseRepository
.
GetLiveHousePageList
(
pageIndex
,
pageSize
,
out
rowCount
,
query
);
}
/// <summary>
/// 获取直播房间信息
/// </summary>
/// <param name="list"></param>
/// <param name="query"></param>
/// <returns></returns>
public
bool
AddLiveHouse
(
List
<
Model
.
Entity
.
AppletWeChat
.
RB_Live_House
>
list
,
Model
.
Entity
.
AppletWeChat
.
RB_Live_House
query
)
{
try
{
var
oldList
=
liveHouseRepository
.
GetLiveHouseListRepository
(
query
);
//获取之前的
if
(
oldList
!=
null
&&
oldList
.
Any
())
{
liveHouseRepository
.
DeleteBatch
(
oldList
);
}
if
(
list
!=
null
&&
list
.
Any
())
{
liveHouseRepository
.
InsertBatch
(
list
);
}
return
true
;
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"AddLiveHouse"
);
return
false
;
}
}
#
endregion
}
}
Mall.Repository/AppletWeChat/RB_Live_HouseRepository.cs
0 → 100644
View file @
2ab772a8
using
Mall.Model.Entity.AppletWeChat
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Mall.Repository.AppletWeChat
{
/// <summary>
/// 直播房间仓储层
/// </summary>
public
class
RB_Live_HouseRepository
:
RepositoryBase
<
RB_Live_House
>
{
/// <summary>
/// 表名称
/// </summary>
public
string
TableName
{
get
{
return
nameof
(
RB_Live_House
);
}
}
/// <summary>
/// 获取直播房间
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Live_House
>
GetLiveHouseListRepository
(
RB_Live_House
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
$" SELECT * FROM
{
TableName
}
WHERE 1=1"
);
if
(
query
!=
null
)
{
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Live_House
.
TenantId
)}
=
{
query
.
TenantId
}
"
);
}
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Live_House
.
MallBaseId
)}
=
{
query
.
MallBaseId
}
"
);
}
}
return
Get
<
RB_Live_House
>(
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 获取直播房间
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Live_House
>
GetLiveHousePageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Live_House
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
$" SELECT * FROM
{
TableName
}
WHERE 1=1"
);
if
(
query
!=
null
)
{
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Live_House
.
TenantId
)}
=
{
query
.
TenantId
}
"
);
}
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Live_House
.
MallBaseId
)}
=
{
query
.
MallBaseId
}
"
);
}
}
return
GetPage
<
RB_Live_House
>(
pageIndex
,
pageSize
,
out
rowCount
,
builder
.
ToString
()).
ToList
();
}
}
}
Mall.Repository/Mall.Repository.csproj
View file @
2ab772a8
...
...
@@ -21,8 +21,4 @@
<ProjectReference Include="..\Mall.Model\Mall.Model.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="AppletWeChat\" />
</ItemGroup>
</Project>
Mall.Repository/MarketingCenter/RB_Miniprogram_Page_TemplRepository.cs
0 → 100644
View file @
2ab772a8
using
Mall.Model.Entity.MarketingCenter
;
using
Mall.Model.Extend.MarketingCenter
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Mall.Repository.MarketingCenter
{
/// <summary>
/// 小程序自定义页面仓储层
/// </summary>
public
class
RB_Miniprogram_Page_TemplRepository
:
RepositoryBase
<
RB_Miniprogram_Page_Templ
>
{
/// <summary>
/// 小程序自定义页面分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Miniprogram_Page_Templ_Extend
>
GetMiniprogramPageTemplPageListRepository
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Miniprogram_Page_Templ_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
$" SELECT * FROM RB_Miniprogram_Page_Templ WHERE Status=0 "
);
if
(
query
!=
null
)
{
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
TenantId
)}
=
{
query
.
TenantId
}
"
);
}
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
MallBaseId
)}
=
{
query
.
MallBaseId
}
"
);
}
if
(
query
.
PageName
!=
null
&&
!
string
.
IsNullOrWhiteSpace
(
query
.
PageName
.
Trim
()))
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
PageName
)}
like '%
{
query
.
PageName
.
Trim
()}
%'"
);
}
}
return
GetPage
<
RB_Miniprogram_Page_Templ_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 小程序自定义页面列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Miniprogram_Page_Templ_Extend
>
GetMiniprogramPageTemplListRepository
(
RB_Miniprogram_Page_Templ_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
$" SELECT * FROM RB_Miniprogram_Page_Templ WHERE Status=0 "
);
if
(
query
!=
null
)
{
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
TenantId
)}
=
{
query
.
TenantId
}
"
);
}
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
MallBaseId
)}
=
{
query
.
MallBaseId
}
"
);
}
if
(
query
.
PageName
!=
null
&&
!
string
.
IsNullOrWhiteSpace
(
query
.
PageName
.
Trim
()))
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
PageName
)}
like '%
{
query
.
PageName
.
Trim
()}
%'"
);
}
}
return
Get
<
RB_Miniprogram_Page_Templ_Extend
>(
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 小程序自定义页面实体
/// </summary>
/// <param name="query">查询条件</param>
/// <param name="isGetHome">是否查询首页页面</param>
/// <returns></returns>
public
RB_Miniprogram_Page_Templ_Extend
GetMiniprogramPageTemplRepository
(
RB_Miniprogram_Page_Templ_Extend
query
,
bool
isGetHome
=
false
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
$" SELECT * FROM RB_Miniprogram_Page_Templ WHERE 1=1 "
);
if
(
query
!=
null
)
{
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
TenantId
)}
=
{
query
.
TenantId
}
"
);
}
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
MallBaseId
)}
=
{
query
.
MallBaseId
}
"
);
}
if
(
query
.
PageName
!=
null
&&
!
string
.
IsNullOrWhiteSpace
(
query
.
PageName
.
Trim
()))
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
PageName
)}
like '%
{
query
.
PageName
.
Trim
()}
%'"
);
}
if
(
query
.
Id
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
Id
)}
=
{
query
.
Id
}
"
);
}
if
(
isGetHome
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Page_Templ_Extend
.
IsHome
)}
=1 "
);
}
}
return
Get
<
RB_Miniprogram_Page_Templ_Extend
>(
builder
.
ToString
()).
FirstOrDefault
();
}
}
}
Mall.Repository/MarketingCenter/RB_Miniprogram_Page_Templ_DetailsRepository.cs
0 → 100644
View file @
2ab772a8
using
Mall.Model.Entity.MarketingCenter
;
using
Mall.Model.Extend.MarketingCenter
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Mall.Repository.MarketingCenter
{
/// <summary>
/// 小程序自定义页面导航仓储层
/// </summary>
public
class
RB_Miniprogram_Page_Templ_DetailsRepository
:
RepositoryBase
<
RB_Miniprogram_Page_Templ_Details
>
{
/// <summary>
/// 小程序自定义页面导航列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Miniprogram_Page_Templ_Details_Extend
>
GetMiniprogramPageTemplDetailsListRepository
(
RB_Miniprogram_Page_Templ_Details_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
$" SELECT * FROM RB_Miniprogram_Page_Templ_Details WHERE 1=1 "
);
if
(
query
!=
null
)
{
if
(
query
.
QPageTemplIDs
!=
null
&&
!
string
.
IsNullOrWhiteSpace
(
query
.
QPageTemplIDs
.
Trim
()))
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Page_Templ_Details_Extend
.
PageTemplID
)}
IN (
{
query
.
QPageTemplIDs
.
Trim
()}
) "
);
}
}
return
Get
<
RB_Miniprogram_Page_Templ_Details_Extend
>(
builder
.
ToString
()).
ToList
();
}
}
}
Mall.Repository/MarketingCenter/RB_Miniprogram_TemplateRepository.cs
0 → 100644
View file @
2ab772a8
using
Mall.Model.Entity.MarketingCenter
;
using
Mall.Model.Extend.MarketingCenter
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Mall.Repository.MarketingCenter
{
/// <summary>
/// 小程序模板仓储层
/// </summary>
public
class
RB_Miniprogram_TemplateRepository
:
RepositoryBase
<
RB_Miniprogram_Template
>
{
/// <summary>
/// 小程序模板分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Miniprogram_Template_Extend
>
GetMiniprogramTemplatePageListRepository
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Miniprogram_Template_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
$" SELECT * FROM RB_Miniprogram_Template WHERE Status=0 "
);
if
(
query
!=
null
)
{
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Template_Extend
.
TenantId
)}
=
{
query
.
TenantId
}
"
);
}
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Template_Extend
.
MallBaseId
)}
=
{
query
.
MallBaseId
}
"
);
}
if
(
query
.
TemplateName
!=
null
&&
!
string
.
IsNullOrWhiteSpace
(
query
.
TemplateName
))
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Template_Extend
.
TemplateName
)}
like '%
{
query
.
TemplateName
.
Trim
()}
%'"
);
}
}
return
GetPage
<
RB_Miniprogram_Template_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 小程序模板列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Miniprogram_Template_Extend
>
GetMiniprogramTemplateListRepository
(
RB_Miniprogram_Template_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
$" SELECT * FROM RB_Miniprogram_Template WHERE Status=0 "
);
if
(
query
!=
null
)
{
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Template_Extend
.
TenantId
)}
=
{
query
.
TenantId
}
"
);
}
if
(
query
.
TenantId
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Template_Extend
.
MallBaseId
)}
=
{
query
.
MallBaseId
}
"
);
}
if
(
query
.
TemplateName
!=
null
&&
!
string
.
IsNullOrWhiteSpace
(
query
.
TemplateName
))
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Miniprogram_Template_Extend
.
TemplateName
)}
like '%
{
query
.
TemplateName
.
Trim
()}
%'"
);
}
}
return
Get
<
RB_Miniprogram_Template_Extend
>(
builder
.
ToString
()).
ToList
();
}
}
}
Mall.Repository/User/RB_Member_CouponRepository.cs
View file @
2ab772a8
...
...
@@ -97,7 +97,7 @@ namespace Mall.Repository.User
}
if
(
query
.
PlatformType
>
0
)
{
builder
.
Append
(
$" AND
b.
{
nameof
(
RB_Member_User
.
Sourc
e
)}
=
{
query
.
PlatformType
}
"
);
builder
.
Append
(
$" AND
a.
{
nameof
(
RB_Member_DiscountCoupon_Extend
.
PlatformTyp
e
)}
=
{
query
.
PlatformType
}
"
);
}
if
(
query
.
UserId
>
0
)
{
...
...
@@ -112,7 +112,7 @@ namespace Mall.Repository.User
builder
.
Append
(
$" AND DATE_FORMAT(c.
{
nameof
(
RB_DiscountCoupon
.
CreateDate
)}
,'%Y-%m-%d' )<= DATE_FORMAT('
{
query
.
EndDate
}
','%Y-%m-%d' )"
);
}
}
string
sql
=
@
$" select *
from
FROM
string
sql
=
@
$" select * FROM
{
TableName
}
AS
a
LEFT
JOIN
{
MemberTableName
}
AS
b
ON
a
.
UserId
=
b
.
Id
LEFT
JOIN
{
DiscountCouponTableName
}
as
c
on
c
.
ID
=
a
.
CouponId
where
1
=
1
{
builder
.
ToString
()}
";
...
...
@@ -143,7 +143,7 @@ LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where 1=1 {builder
}
if
(
query
.
PlatformType
>
0
)
{
builder
.
Append
(
$" AND
b.
{
nameof
(
RB_Member_User
.
Sourc
e
)}
=
{
query
.
PlatformType
}
"
);
builder
.
Append
(
$" AND
a.
{
nameof
(
RB_Member_DiscountCoupon_Extend
.
PlatformTyp
e
)}
=
{
query
.
PlatformType
}
"
);
}
if
(!
string
.
IsNullOrWhiteSpace
(
query
.
StartDate
))
{
...
...
@@ -209,7 +209,7 @@ LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.EndDate<NO
}
if
(
query
.
PlatformType
>
0
)
{
builder
.
Append
(
$" AND
b.
{
nameof
(
RB_Member_User
.
Sourc
e
)}
=
{
query
.
PlatformType
}
"
);
builder
.
Append
(
$" AND
a.
{
nameof
(
RB_Member_DiscountCoupon_Extend
.
PlatformTyp
e
)}
=
{
query
.
PlatformType
}
"
);
}
if
(!
string
.
IsNullOrWhiteSpace
(
query
.
StartDate
))
{
...
...
Mall.Repository/User/RB_Member_SubscriptionRepository.cs
0 → 100644
View file @
2ab772a8
using
Mall.Model.Entity.User
;
using
Mall.Model.Extend.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Mall.Repository.User
{
/// <summary>
/// 会员订阅微信消息仓储层
/// </summary>
public
class
RB_Member_SubscriptionRepository
:
RepositoryBase
<
RB_Member_Subscription
>
{
/// <summary>
/// 表名称
/// </summary>
public
string
TableName
{
get
{
return
nameof
(
RB_Member_Subscription
);
}
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="where"></param>
/// <returns></returns>
public
List
<
RB_Member_Subscription_Extend
>
GetList
(
RB_Member_Subscription_Extend
where
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
Append
(
$@"SELECT * from
{
TableName
}
where Status=0"
);
if
(
where
!=
null
)
{
if
(
where
.
MallBaseId
>
0
)
{
sb
.
AppendFormat
(
" and MallBaseId={0}"
,
where
.
MallBaseId
);
}
if
(
where
.
TenantId
>
0
)
{
sb
.
AppendFormat
(
" and TenantId={0}"
,
where
.
TenantId
);
}
if
(
where
.
UserId
>
0
)
{
sb
.
AppendFormat
(
" and UserId={0}"
,
where
.
UserId
);
}
if
(
where
.
Type
>
0
)
{
sb
.
AppendFormat
(
" and Type={0}"
,
where
.
Type
);
}
if
(!
string
.
IsNullOrEmpty
(
where
.
TempleteId
))
{
sb
.
AppendFormat
(
" and TempleteId ='{0}'"
,
where
.
TempleteId
);
}
if
(!
string
.
IsNullOrEmpty
(
where
.
OpenId
))
{
sb
.
AppendFormat
(
" and OpenId ='{0}'"
,
where
.
OpenId
);
}
}
return
Get
<
RB_Member_Subscription_Extend
>(
sb
.
ToString
()).
ToList
();
}
}
}
Mall.WebApi/Controllers/AppletWeChat/PublishController.cs
View file @
2ab772a8
...
...
@@ -3,12 +3,16 @@ using System.Collections.Generic;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
Google.Protobuf.WellKnownTypes
;
using
Mall.CacheManager.AppletWeChat
;
using
Mall.Common.API
;
using
Mall.Common.Plugin
;
using
Mall.Model.Extend.User
;
using
Mall.Module.User
;
using
Mall.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json.Linq
;
namespace
Mall.WebApi.Controllers.AppletWeChat
...
...
@@ -23,7 +27,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
private
MiniProgramModule
appletWeChatModule
=
new
MiniProgramModule
();
string
projectUrl
=
Mall
.
Common
.
Config
.
ProjectUrl
;
string
developerKitsPort
=
Mall
.
Common
.
Config
.
DeveloperKitsPort
;
string
FirstPage
=
Mall
.
Common
.
Config
.
FirstPage
;
/// <summary>
/// 发布微信小程序获取登录二维码
...
...
@@ -71,14 +75,17 @@ namespace Mall.WebApi.Controllers.AppletWeChat
{
string
URL
=
$"http://127.0.0.1:
{
developerKitsPort
}
/v2/preview?project=
{
Mall
.
Common
.
Plugin
.
StringHelper
.
UrlEncode
(
projectUrl
)}
&qr-format=base64"
;
string
result
=
Mall
.
Common
.
Plugin
.
HttpHelper
.
HttpGet
(
URL
,
Encoding
.
UTF8
,
""
);
JObject
parmsJob
=
JObject
.
Parse
(
result
);
if
(
parmsJob
.
ContainsKey
(
"code"
))
if
(
result
.
Length
>
200
&&
!
result
.
Contains
(
"data:image/png;base64,"
))
{
re
turn
ApiResult
.
Failed
(
parmsJob
.
GetValue
(
"message"
).
ToString
())
;
re
sult
=
"data:image/png;base64,"
+
result
;
}
if
(!
result
.
Contains
(
"data:image/png;base64,"
))
else
{
result
=
"data:image/png;base64,"
+
result
;
JObject
parmsJob
=
JObject
.
Parse
(
result
);
if
(
parmsJob
.
ContainsKey
(
"code"
))
{
return
ApiResult
.
Failed
(
parmsJob
.
GetValue
(
"message"
).
ToString
());
}
}
return
ApiResult
.
Success
(
"获取成功"
,
result
);
}
...
...
@@ -122,5 +129,308 @@ namespace Mall.WebApi.Controllers.AppletWeChat
return
ApiResult
.
Failed
(
"上传失败"
);
}
}
/// <summary>
/// 获取微信小程序分享
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
HttpPost
]
public
virtual
ApiResult
GetWeiXinShare
()
{
var
parms
=
RequestParm
;
var
query
=
new
RB_MiniProgram_Extend
();
query
.
TenantId
=
UserInfo
.
TenantId
;
query
.
MallBaseId
=
parms
.
MallBaseId
;
var
appletWeChatModel
=
appletWeChatModule
.
GetTenantListModule
(
query
).
FirstOrDefault
();
string
imgBase64
=
appletWeChatModule
.
GetWeiXinShare
(
appletWeChatModel
,
FirstPage
);
return
ApiResult
.
Success
(
""
,
imgBase64
);
}
/// <summary>
/// 订阅消息推送
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetLXYSubscribeSend
()
{
var
parmsInfo
=
RequestParm
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
string
code
=
parms
.
GetStringValue
(
"code"
);
if
(
string
.
IsNullOrWhiteSpace
(
code
))
{
return
ApiResult
.
Failed
(
"请传递code参数"
);
}
var
appletWeChatModel
=
appletWeChatModule
.
GetTenantListModule
(
new
RB_MiniProgram_Extend
{
TenantId
=
Convert
.
ToInt32
(
parmsInfo
.
uid
),
MallBaseId
=
parmsInfo
.
MallBaseId
}).
FirstOrDefault
();
string
OpenId
=
"ow_7I5XC1-RGwwk8QANBmWKYKmOc"
;
//GetHelpByWx(code, appletWeChatModel);
bool
flag
=
appletWeChatModule
.
SendOrderSucceedMsg
(
Convert
.
ToInt32
(
parmsInfo
.
uid
),
parmsInfo
.
MallBaseId
,
OpenId
,
"1176"
,
"2020-05-12 14:01:12"
,
"微信"
,
"测试商品请勿购买"
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 设置客户订阅信息
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetGuestSubscribe
()
{
RB_Member_Subscription_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Member_Subscription_Extend
>(
RequestParm
.
msg
.
ToString
());
if
((
demodel
.
UserId
??
0
)
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递会员id"
);
}
if
(
string
.
IsNullOrEmpty
(
demodel
.
OpenId
))
{
return
ApiResult
.
ParamIsNull
(
"请传递微信openid"
);
}
if
(
demodel
.
TempleteIdList
==
null
||
!
demodel
.
TempleteIdList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请传递会员订阅的模板id"
);
}
bool
flag
=
appletWeChatModule
.
SetMemberSubscribe
(
demodel
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 获取订阅模块列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetSubscribeTempleteList
(
RequestParm
request
)
{
List
<
object
>
tlist
=
GetTempleteList
();
return
ApiResult
.
Success
(
""
,
tlist
);
}
/// <summary>
/// 获取templete
/// </summary>
/// <returns></returns>
private
static
List
<
object
>
GetTempleteList
()
{
return
new
List
<
object
>()
{
new
{
TempleteId
=
"WPELErDfYO3JnizA5Zikta6Y8qrBBAgecuj2aLoucuY"
,
Name
=
"下单成功提醒"
},
new
{
TempleteId
=
"pCmTJwvTqNpyRREo7vvqIYBcrATNWoitfbLS61fLhzU"
,
Name
=
"订单取消通知"
},
new
{
TempleteId
=
"i6QPsaOHgfNwlIRMwmvFGSCqX28g0cRa8XaLZ5_gpgc"
,
Name
=
"订单发货通知"
},
new
{
TempleteId
=
"o_zwbbXqC5nJLEzXVVvgCT3LUHnBCkxWxkT6D1HhQXU"
,
Name
=
"退款通知"
},
new
{
TempleteId
=
"nwYnuXeMF-XuUHkf_MgJFdfy9Gic1jnj6lYR6W9KOnQ"
,
Name
=
"活动状态通知"
},
new
{
TempleteId
=
"mUcV9nOOZ-MrcUmXH157YRdnFEh8_Tcz8lWhjgeHhHE"
,
Name
=
"审核结果通知"
},
new
{
TempleteId
=
"STLsTw3R86aMtVbcYgU_UZbxj_Tn0h3rIJwZRSrLmGQ"
,
Name
=
"提现成功通知"
},
new
{
TempleteId
=
"fqwGB0769qgJYQOaqqE1uKC6PS3Vp47J3jGMW3BXBrw"
,
Name
=
"提现失败通知"
},
new
{
TempleteId
=
"8QhIQmzdDXDxKWMnE6aa_t3VPxah0EGTmLhA-JQcSwc"
,
Name
=
"会员等级变更通知"
}
};
}
/// <summary>
/// 订阅剩余次数
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetSubscribeCountList
()
{
var
parms
=
RequestParm
;
JObject
parmsJob
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
string
OpenId
=
parmsJob
.
GetStringValue
(
"OpenId"
);
var
query
=
new
RB_Member_Subscription_Extend
();
query
.
TenantId
=
UserInfo
.
TenantId
;
query
.
MallBaseId
=
parms
.
MallBaseId
;
if
(
string
.
IsNullOrEmpty
(
OpenId
))
{
return
ApiResult
.
Failed
();
}
var
tlist
=
GetTempleteList
();
var
list
=
appletWeChatModule
.
GetLXYSubscribeCountList
(
OpenId
,
query
.
MallBaseId
,
query
.
TenantId
);
List
<
object
>
robj
=
new
List
<
object
>();
foreach
(
var
item
in
tlist
)
{
JObject
parm
=
JObject
.
Parse
(
JsonConvert
.
SerializeObject
(
item
));
string
TempleteId
=
parm
.
GetStringValue
(
"TempleteId"
);
string
Name
=
parm
.
GetStringValue
(
"Name"
);
var
model
=
list
.
Where
(
x
=>
x
.
TempleteId
==
TempleteId
).
FirstOrDefault
();
robj
.
Add
(
new
{
Name
,
TempleteId
,
Count
=
model
?.
Count
??
0
,
});
}
return
ApiResult
.
Success
(
""
,
robj
);
}
#
region
微信获取
openid
//微信也不给个c#调用的例子
/// <summary>
/// 根据code 获取微信信息
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public
string
GetHelpByWx
(
string
code
,
RB_MiniProgram_Extend
model
)
{
string
Appid
=
model
.
MiniAppId
;
string
Secret
=
model
.
MiniAppSecret
;
string
grant_type
=
"authorization_code"
;
//向微信服务端 使用登录凭证 code 获取 session_key 和 openid
string
url
=
"https://api.weixin.qq.com/sns/jscode2session?appid="
+
Appid
+
"&secret="
+
Secret
+
"&js_code="
+
code
+
"&grant_type="
+
grant_type
;
string
type
=
"utf-8"
;
GetUsersHelper
GetUsersHelper
=
new
GetUsersHelper
();
string
wenXinResult
=
string
.
Empty
;
JObject
jo
=
null
;
result
res
=
new
result
();
try
{
wenXinResult
=
GetUsersHelper
.
GetUrltoHtml
(
url
,
type
);
//获取微信服务器返回字符串
jo
=
(
JObject
)
JsonConvert
.
DeserializeObject
(
wenXinResult
);
//将字符串转换为json格式
//微信服务器验证成功
res
.
openid
=
jo
[
"openid"
].
ToString
();
res
.
session_key
=
jo
[
"session_key"
].
ToString
();
}
catch
(
Exception
ex
)
{
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
string
.
Format
(
"GetWx:wenXinResult:{0},code:{1}"
,
wenXinResult
,
code
));
//微信服务器验证失败
res
.
errcode
=
jo
[
"errcode"
].
ToString
();
res
.
errmsg
=
jo
[
"errmsg"
].
ToString
();
}
return
res
.
openid
;
}
#
endregion
#
region
获取微信直播房间信息
/// <summary>
/// 获取直播房间列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetLiveInfo
()
{
var
parmsInfo
=
RequestParm
;
var
appletWeChatModel
=
appletWeChatModule
.
GetTenantListModule
(
new
RB_MiniProgram_Extend
{
TenantId
=
Convert
.
ToInt32
(
parmsInfo
.
uid
),
MallBaseId
=
parmsInfo
.
MallBaseId
}).
FirstOrDefault
();
bool
flag
=
appletWeChatModule
.
GetLiveInfo
(
appletWeChatModel
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
[
HttpPost
]
public
ApiResult
GetLiveHousePageList
()
{
var
parms
=
RequestParm
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
msg
.
ToString
());
Model
.
Entity
.
AppletWeChat
.
RB_Live_House
demodel
=
JsonConvert
.
DeserializeObject
<
Model
.
Entity
.
AppletWeChat
.
RB_Live_House
>(
RequestParm
.
msg
.
ToString
());
demodel
.
TenantId
=
UserInfo
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
appletWeChatModule
.
GetLiveHousePageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
ID
,
x
.
roomid
,
x
.
name
,
x
.
anchor_img
,
x
.
anchor_name
,
x
.
cover_img
,
x
.
live_status
,
start_time
=
GetTime
(
x
.
start_time
),
end_time
=
GetTime
(
x
.
end_time
),
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 时间戳转为C#格式时间
/// </summary>
/// <param name="timeStamp">Unix时间戳格式</param>
/// <returns>C#格式时间</returns>
public
static
string
GetTime
(
string
timeStamp
)
{
try
{
DateTime
dtStart
=
TimeZone
.
CurrentTimeZone
.
ToLocalTime
(
new
DateTime
(
1970
,
1
,
1
));
long
lTime
=
long
.
Parse
(
timeStamp
+
"0000000"
);
TimeSpan
toNow
=
new
TimeSpan
(
lTime
);
return
dtStart
.
Add
(
toNow
).
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
}
catch
(
Exception
)
{
return
""
;
}
}
#
endregion
}
}
\ No newline at end of file
Mall.WebApi/Controllers/MarketingCenter/TemplateController.cs
0 → 100644
View file @
2ab772a8
using
System.Linq
;
using
Mall.Common.API
;
using
Microsoft.AspNetCore.Mvc
;
using
Mall.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
using
Mall.Module.MarketingCenter
;
using
Newtonsoft.Json
;
using
Mall.Model.Query
;
using
System
;
using
Mall.Common.Plugin
;
using
System.Collections.Generic
;
using
Mall.Model.Extend.MarketingCenter
;
using
Newtonsoft.Json.Linq
;
using
Mall.Model.Entity.MarketingCenter
;
namespace
Mall.WebApi.Controllers.MarketingCenter
{
[
Route
(
"api/[controller]/[action]"
)]
[
ApiExceptionFilter
]
[
ApiController
]
[
EnableCors
(
"AllowCors"
)]
public
class
TemplateController
:
BaseController
{
/// <summary>
/// 模板处理类
/// </summary>
private
readonly
Module
.
MarketingCenter
.
MiniprogramTemplateModule
templateModule
=
new
MiniprogramTemplateModule
();
/// <summary>
/// 自定义页面处理类
/// </summary>
private
readonly
MiniprogramPageTemplModule
miniprogramPageTemplModule
=
new
MiniprogramPageTemplModule
();
#
region
模板管理
/// <summary>
/// 新增修改小程序模板
/// </summary>
/// <returns></returns>
public
ApiResult
SetMiniTemplate
()
{
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Miniprogram_Template_Extend
>(
RequestParm
.
msg
.
ToString
());
extModel
.
TenantId
=
RequestParm
.
TenantId
;
extModel
.
MallBaseId
=
RequestParm
.
MallBaseId
;
if
(
extModel
.
ComponentDataList
!=
null
&&
extModel
.
ComponentDataList
.
Count
>
0
)
{
extModel
.
TemplateData
=
JsonConvert
.
SerializeObject
(
extModel
.
ComponentDataList
);
}
Int32
.
TryParse
(
RequestParm
.
uid
,
out
int
Uid
);
extModel
.
CreateBy
=
Uid
;
extModel
.
CreateDate
=
DateTime
.
Now
;
extModel
.
Status
=
0
;
var
flag
=
templateModule
.
SetMiniprogramTemplateModule
(
extModel
);
return
flag
?
ApiResult
.
Success
(
data
:
extModel
.
Id
)
:
ApiResult
.
Failed
();
}
/// <summary>
/// 获取小程序模板实体
/// </summary>
/// <returns></returns>
public
ApiResult
GetMiniTemplate
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
Id
=
parms
.
GetInt
(
"Id"
);
var
result
=
templateModule
.
GetMiniprogramTemplateModule
(
Id
);
return
ApiResult
.
Success
(
data
:
result
);
}
/// <summary>
/// 删除小程序模板
/// </summary>
/// <returns></returns>
public
ApiResult
RemoveMiniTemplate
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
Id
=
parms
.
GetInt
(
"Id"
,
0
);
var
Status
=
parms
.
GetInt
(
"Status"
,
1
);
var
flag
=
templateModule
.
RemoveMiniprogramTemplateModule
(
Id
,
Status
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 小程序模板分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetMiniTemplatePageList
()
{
var
parms
=
RequestParm
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
parms
.
msg
.
ToString
());
var
query
=
JsonConvert
.
DeserializeObject
<
RB_Miniprogram_Template_Extend
>(
parms
.
msg
.
ToString
());
query
.
TenantId
=
Convert
.
ToInt32
(
parms
.
uid
);
query
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
templateModule
.
GetMiniprogramTemplatePageListModule
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
query
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
;
return
ApiResult
.
Success
(
""
,
pagelist
);
}
#
endregion
#
region
自定义页面管理
/// <summary>
/// 小程序自定义页面分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetMiniprogramPageTemplPageList
()
{
var
parms
=
RequestParm
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
parms
.
msg
.
ToString
());
var
query
=
JsonConvert
.
DeserializeObject
<
RB_Miniprogram_Page_Templ_Extend
>(
parms
.
msg
.
ToString
());
query
.
TenantId
=
Convert
.
ToInt32
(
parms
.
uid
);
query
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
miniprogramPageTemplModule
.
GetMiniprogramPageTemplPageListModule
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
query
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
;
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 小程序自定义页面列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetMiniprogramPageTemplList
()
{
var
parms
=
RequestParm
;
var
query
=
JsonConvert
.
DeserializeObject
<
RB_Miniprogram_Page_Templ_Extend
>(
parms
.
msg
.
ToString
());
query
.
TenantId
=
Convert
.
ToInt32
(
parms
.
uid
);
query
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
miniprogramPageTemplModule
.
GetMiniprogramPageTemplListModule
(
query
);
return
ApiResult
.
Success
(
""
,
list
);
}
/// <summary>
/// 小程序自定义页面实体
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetMiniprogramPageTempl
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
query
=
JsonConvert
.
DeserializeObject
<
RB_Miniprogram_Page_Templ_Extend
>(
RequestParm
.
msg
.
ToString
());
query
.
TenantId
=
Convert
.
ToInt32
(
RequestParm
.
uid
);
query
.
MallBaseId
=
RequestParm
.
MallBaseId
;
bool
isGetHome
=
parms
.
GetBoolValue
(
"isGetHome"
);
var
extModel
=
miniprogramPageTemplModule
.
GetMiniprogramPageTemplModule
(
query
,
isGetHome
:
isGetHome
);
return
ApiResult
.
Success
(
""
,
extModel
);
}
/// <summary>
/// 新增修改自定义页面
/// </summary>
/// <returns></returns>
public
ApiResult
SetMiniprogramPageTempl
()
{
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Miniprogram_Page_Templ_Extend
>(
RequestParm
.
msg
.
ToString
());
extModel
.
TenantId
=
RequestParm
.
TenantId
;
extModel
.
MallBaseId
=
RequestParm
.
MallBaseId
;
Int32
.
TryParse
(
RequestParm
.
uid
,
out
int
Uid
);
extModel
.
CreateBy
=
Uid
;
extModel
.
CreateDate
=
DateTime
.
Now
;
extModel
.
Status
=
0
;
var
flag
=
miniprogramPageTemplModule
.
SetMiniprogramPageTemplModule
(
extModel
);
return
flag
?
ApiResult
.
Success
(
data
:
extModel
.
Id
)
:
ApiResult
.
Failed
();
}
/// <summary>
/// 更新自定义页面状态
/// </summary>
/// <returns></returns>
public
ApiResult
RemoveMiniprogramPageTempl
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
Id
=
parms
.
GetInt
(
"Id"
,
0
);
var
Status
=
parms
.
GetInt
(
"Status"
,
1
);
var
flag
=
miniprogramPageTemplModule
.
RemoveMiniprogramPageTemplModule
(
Id
,
Status
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 更新自定义页面状态
/// </summary>
/// <returns></returns>
public
ApiResult
RemoveMiniprogramPageTemplDetails
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
Id
=
parms
.
GetInt
(
"Id"
,
0
);
var
flag
=
miniprogramPageTemplModule
.
RemoveMiniprogramPageTemplDetailsModule
(
Id
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
#
endregion
}
}
\ No newline at end of file
Mall.WebApi/Controllers/User/TenantController.cs
View file @
2ab772a8
...
...
@@ -908,10 +908,5 @@ namespace Mall.WebApi.Controllers.User
return
ApiResult
.
Success
(
data
:
resultList
);
}
}
}
\ No newline at end of file
Mall.WebApi/Mall.WebApi.csproj
View file @
2ab772a8
...
...
@@ -4,6 +4,10 @@
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Content Remove="web.config" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="JWT" Version="5.3.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
...
...
Mall.WebApi/Properties/PublishProfiles/mall.oytour.com.pubxml.user
View file @
2ab772a8
...
...
@@ -8,4 +8,9 @@
<TimeStampOfAssociatedLegacyPublishXmlFile
/>
<_PublishTargetUrl>
E:\LDWork\LiuDongWork\MallFB
</_PublishTargetUrl>
</PropertyGroup>
<ItemGroup>
<File
Include=
"run.cmd"
>
<publishTime>
04/22/2020 10:26:33
</publishTime>
</File>
</ItemGroup>
</Project>
\ No newline at end of file
Mall.WebApi/appsettings.json
View file @
2ab772a8
...
...
@@ -22,7 +22,8 @@
"Mongo"
:
"mongodb://192.168.2.214:27017"
,
"MongoDBName"
:
"Mall"
,
"ProjectUrl"
:
"D:/project/GitProject/tripfriend"
,
"DeveloperKitsPort"
:
"54333"
,
"DeveloperKitsPort"
:
"63994"
,
"FirstPage"
:
"pages/index/index.html"
,
"RedisSetting"
:
{
"RedisServer"
:
"192.168.2.214"
,
"RedisPort"
:
"6379"
,
...
...
Mall.WebApi/web.config
View file @
2ab772a8
...
...
@@ -5,9 +5,11 @@
<
handlers
>
<
add
name
=
"aspNetCore"
path
=
"*"
verb
=
"*"
modules
=
"AspNetCoreModuleV2"
resourceType
=
"Unspecified"
/>
</
handlers
>
<
aspNetCore
processPath
=
"
.\Mall.WebApi.exe"
arguments
=
".\Mall.WebApi.dll"
stdoutLogEnabled
=
"false"
stdoutLogFile
=
".\logs\stdout"
hostingModel
=
"OutOf
Process"
>
<
aspNetCore
processPath
=
"
%LAUNCHER_PATH%"
arguments
=
"%LAUNCHER_ARGS%"
stdoutLogEnabled
=
"false"
stdoutLogFile
=
".\logs\stdout"
hostingModel
=
"In
Process"
>
<
environmentVariables
>
<
environmentVariable
name
=
"ASPNETCORE_ENVIRONMENT"
value
=
"Development"
/>
<
environmentVariable
name
=
"ASPNETCORE_HTTPS_PORT"
value
=
"44370"
/>
<
environmentVariable
name
=
"COMPLUS_ForceENC"
value
=
"1"
/>
</
environmentVariables
>
</
aspNetCore
>
</
system
.
webServer
>
...
...
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