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
aea910ad
Commit
aea910ad
authored
Apr 27, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增页面
parent
a704dfc6
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
243 additions
and
7 deletions
+243
-7
RB_MiniProgram_Page.cs
Mall.Model/Entity/User/RB_MiniProgram_Page.cs
+1
-1
RB_Miniprogram_PageManage_Extend.cs
Mall.Model/Extend/User/RB_Miniprogram_PageManage_Extend.cs
+10
-0
MiniProgramPageModule.cs
Mall.Module.User/MiniProgramPageModule.cs
+95
-1
RB_MiniProgram_PageRepository.cs
Mall.Repository/User/RB_MiniProgram_PageRepository.cs
+12
-0
RB_Miniprogram_PageManageRepository.cs
Mall.Repository/User/RB_Miniprogram_PageManageRepository.cs
+22
-0
TenantController.cs
Mall.WebApi/Controllers/User/TenantController.cs
+102
-4
ApiFilterAttribute.cs
Mall.WebApi/Filter/ApiFilterAttribute.cs
+1
-1
No files found.
Mall.Model/Entity/User/RB_MiniProgram_Page.cs
View file @
aea910ad
...
...
@@ -43,7 +43,7 @@ namespace Mall.Model.Entity.User
/// <summary>
/// 自定义页面名称
/// </summary>
public
string
Sel
e
PageName
public
string
Sel
f
PageName
{
get
;
set
;
...
...
Mall.Model/Extend/User/RB_Miniprogram_PageManage_Extend.cs
View file @
aea910ad
...
...
@@ -42,5 +42,15 @@ namespace Mall.Model.Extend.User
return
str
;
}
}
/// <summary>
/// 自定义页面标题
/// </summary>
public
string
SelfPageName
{
get
;
set
;
}
/// <summary>
/// 小程序页面表Id
/// </summary>
public
int
Id
{
get
;
set
;
}
}
}
Mall.Module.User/MiniProgramPageModule.cs
View file @
aea910ad
...
...
@@ -60,7 +60,7 @@ namespace Mall.Module.User
{
nameof
(
RB_MiniProgram_Page_Extend
.
Id
),
extModel
.
Id
},
{
nameof
(
RB_MiniProgram_Page_Extend
.
MallBaseId
),
extModel
.
MallBaseId
},
{
nameof
(
RB_MiniProgram_Page_Extend
.
PageId
),
extModel
.
PageId
},
{
nameof
(
RB_MiniProgram_Page_Extend
.
SelePageName
),
extModel
.
SelePageName
},
};
flag
=
miniProgram_PageRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_MiniProgram_Page_Extend
.
Id
),
extModel
.
Id
));
}
...
...
@@ -73,6 +73,80 @@ namespace Mall.Module.User
return
flag
;
}
/// <summary>
/// 判断小程序是否存在页面
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
int
CheckMiniProgram_Page
(
RB_MiniProgram_Page_Extend
query
)
{
List
<
WhereHelper
>
list
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(
nameof
(
RB_MiniProgram_Page_Extend
.
PageId
),
query
.
PageId
),
new
WhereHelper
(
nameof
(
RB_MiniProgram_Page_Extend
.
MallBaseId
),
query
.
MallBaseId
),
};
return
miniProgram_PageRepository
.
Exists
(
"Id"
,
list
);
}
/// <summary>
/// 批量添加页面到小程序
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public
bool
SetMiniProgram_Page_ByListModule
(
List
<
RB_MiniProgram_Page_Extend
>
list
)
{
bool
flag
=
false
;
foreach
(
var
item
in
list
)
{
var
Id
=
CheckMiniProgram_Page
(
item
);
item
.
Id
=
Id
;
if
(
item
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_MiniProgram_Page_Extend
.
Id
),
item
.
Id
},
{
nameof
(
RB_MiniProgram_Page_Extend
.
MallBaseId
),
item
.
MallBaseId
},
{
nameof
(
RB_MiniProgram_Page_Extend
.
PageId
),
item
.
PageId
},
};
flag
=
miniProgram_PageRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_MiniProgram_Page_Extend
.
Id
),
item
.
Id
));
}
else
{
int
NewId
=
miniProgram_PageRepository
.
Insert
(
item
);
item
.
Id
=
NewId
;
flag
=
NewId
>
0
;
}
}
return
flag
;
}
/// <summary>
/// 批量设置小程序页面标题
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public
bool
SetMiniProgram_PageTitle_ByListModule
(
List
<
RB_MiniProgram_Page_Extend
>
list
)
{
bool
flag
=
false
;
foreach
(
var
item
in
list
)
{
if
(
item
.
SelfPageName
==
null
)
{
item
.
SelfPageName
=
""
;
}
if
(
item
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_MiniProgram_Page_Extend
.
SelfPageName
),
item
.
SelfPageName
},
};
flag
=
miniProgram_PageRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_MiniProgram_Page_Extend
.
Id
),
item
.
Id
));
}
}
return
flag
;
}
/// <summary>
/// 根据小程序页面编号获取小程序页面实体(单个)
...
...
@@ -89,6 +163,26 @@ namespace Mall.Module.User
return
extModel
;
}
/// <summary>
/// 根据Id批量删除
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
public
bool
RemoveBeatchMiniprogram_Page_Module
(
string
Ids
)
{
return
miniProgram_PageRepository
.
RemoveBeatchMiniprogram_Page_Repository
(
Ids
);
}
/// <summary>
/// 根据条件获取小程序页面列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Miniprogram_PageManage_Extend
>
GetMiniprogram_Page_ListExtModule
(
RB_MiniProgram_Page_Extend
query
)
{
return
miniprogram_PageManageRepository
.
GetListExtRepository
(
query
);
}
/// <summary>
/// 根据查询条件获取小程序页面管理列表【管理页面】
/// </summary>
...
...
Mall.Repository/User/RB_MiniProgram_PageRepository.cs
View file @
aea910ad
...
...
@@ -52,5 +52,17 @@ namespace Mall.Repository.User
}
return
GetPage
<
RB_MiniProgram_Page_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 根据Id批量删除
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
public
bool
RemoveBeatchMiniprogram_Page_Repository
(
string
Ids
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
" DELETE FROM RB_MiniProgram_Page WHERE Id IN ({0}) "
,
Ids
);
return
base
.
Execute
(
builder
.
ToString
())
>
0
;
}
}
}
Mall.Repository/User/RB_Miniprogram_PageManageRepository.cs
View file @
aea910ad
...
...
@@ -70,5 +70,27 @@ namespace Mall.Repository.User
builder
.
Append
(
" ORDER BY PageSort "
);
return
GetPage
<
RB_Miniprogram_PageManage_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 根据条件获取小程序页面列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Miniprogram_PageManage_Extend
>
GetListExtRepository
(
RB_MiniProgram_Page_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
@"
SELECT B.PageId, B.PageName,B.PageType,B.PageUrl,B.PageSort,B.IsParameter,B.ParameterValue,IFNULL(A.SelfPageName,'') AS SelfPageName,A.Id
FROM rb_miniprogram_page AS A INNER JOIN rb_miniprogram_pagemanage AS B ON A.PageId = B.PageId
WHERE B.`Status`= 0 "
);
if
(
query
!=
null
)
{
if
(
query
.
MallBaseId
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_MiniProgram_Page_Extend
.
MallBaseId
),
query
.
MallBaseId
);
}
}
return
Get
<
RB_Miniprogram_PageManage_Extend
>(
builder
.
ToString
()).
ToList
();
}
}
}
Mall.WebApi/Controllers/User/TenantController.cs
View file @
aea910ad
...
...
@@ -185,7 +185,7 @@ namespace Mall.WebApi.Controllers.User
Int32
.
TryParse
(
RequestParm
.
uid
.
ToString
(),
out
int
TenantId
);
var
programNum
=
programModule
.
CheckMallNumModule
(
TenantId
);
var
createMiniPrograme
=
TenantModule
.
GetTenantModule
(
TenantId
)?.
CreateMiniPrograme
??
0
;
if
(
extModel
.
MallBaseId
==
0
&&
programNum
>=
createMiniPrograme
)
if
(
extModel
.
MallBaseId
==
0
&&
programNum
>=
createMiniPrograme
)
{
return
ApiResult
.
Failed
(
message
:
"只能创建"
+
createMiniPrograme
+
"个小程序"
);
}
...
...
@@ -219,8 +219,8 @@ namespace Mall.WebApi.Controllers.User
int
MallShopStyle
=
parms
.
GetInt
(
"MallShopStyle"
);
var
extModel
=
new
RB_MiniProgram_Extend
()
{
MallBaseId
=
MallBaseId
,
MallShopStyle
=
(
MallShopStyleEnum
)
MallShopStyle
MallBaseId
=
MallBaseId
,
MallShopStyle
=
(
MallShopStyleEnum
)
MallShopStyle
};
var
flag
=
programModule
.
SetMiniProgramMallShopStyleModule
(
extModel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
...
...
@@ -377,7 +377,7 @@ namespace Mall.WebApi.Controllers.User
#
endregion
#
region
小程序图标
/// <summary>
/// 获取小程序分页列表
/// </summary>
...
...
@@ -492,6 +492,104 @@ namespace Mall.WebApi.Controllers.User
return
ApiResult
.
Success
(
data
:
extModel
);
}
/// <summary>
/// 获取小程序菜单管理
/// </summary>
/// <returns></returns>
public
ApiResult
GetMiniProgramePageManageList
()
{
List
<
object
>
resultList
=
new
List
<
object
>();
var
list
=
programPageModule
.
GetMiniprogram_PageManage_ListModule
(
new
RB_Miniprogram_PageManage_Extend
()
{
Status
=
0
});
var
mimiPageList
=
programPageModule
.
GetMiniProgramPage_ListModule
(
new
RB_MiniProgram_Page_Extend
()
{
MallBaseId
=
UserInfo
.
MallBaseId
});
var
pageTypeList
=
Common
.
Plugin
.
EnumHelper
.
EnumToList
(
typeof
(
PageTypeEnum
));
foreach
(
var
item
in
pageTypeList
)
{
List
<
object
>
SubMenuList
=
new
List
<
object
>();
var
subList
=
list
.
Where
(
qitem
=>
qitem
.
PageType
==
(
PageTypeEnum
)
item
.
Id
).
OrderBy
(
qitem
=>
qitem
.
PageSort
).
ToList
();
foreach
(
var
subItem
in
subList
)
{
var
pageItem
=
mimiPageList
?.
Where
(
qitem
=>
qitem
.
PageId
==
subItem
.
PageId
)?.
FirstOrDefault
();
SubMenuList
.
Add
(
new
{
subItem
.
PageId
,
subItem
.
PageName
,
Id
=
pageItem
?.
Id
??
0
,
IsChecked
=
(
pageItem
?.
Id
??
0
)
>
0
,
});
}
resultList
.
Add
(
new
{
IsChecked
=
false
,
PageTypeName
=
item
.
Name
,
PageTypeId
=
item
.
Id
,
SubMenuList
});
}
return
ApiResult
.
Success
(
data
:
resultList
);
}
/// <summary>
/// 批量添加页面到小程序
/// </summary>
/// <returns></returns>
public
ApiResult
SetMiniProgram_Page
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
pageList
=
JsonConvert
.
DeserializeObject
<
List
<
RB_MiniProgram_Page_Extend
>>(
parms
.
GetStringValue
(
"setMsg"
));
var
deleteList
=
JsonConvert
.
DeserializeObject
<
List
<
RB_MiniProgram_Page_Extend
>>(
parms
.
GetStringValue
(
"delMsg"
));
if
(
deleteList
!=
null
&&
deleteList
.
Count
>
0
)
{
var
isDeleteFlag
=
programPageModule
.
RemoveBeatchMiniprogram_Page_Module
(
string
.
Join
(
","
,
deleteList
.
Select
(
qitem
=>
qitem
.
Id
)));
}
var
flag
=
programPageModule
.
SetMiniProgram_Page_ByListModule
(
pageList
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 获取根据小程序编号获取小程序页面列表
/// </summary>
/// <returns></returns>
public
ApiResult
GetMiniprogramPageListExt
()
{
List
<
object
>
resultList
=
new
List
<
object
>();
var
pageList
=
programPageModule
.
GetMiniprogram_Page_ListExtModule
(
new
RB_MiniProgram_Page_Extend
()
{
MallBaseId
=
RequestParm
.
MallBaseId
});
var
pageTypeList
=
Common
.
Plugin
.
EnumHelper
.
EnumToList
(
typeof
(
PageTypeEnum
));
foreach
(
var
item
in
pageTypeList
)
{
resultList
.
Add
(
new
{
PageTypeName
=
item
.
Name
,
PageTypeId
=
item
.
Id
,
SubMenuList
=
pageList
.
Where
(
qitem
=>
qitem
.
PageType
==
(
PageTypeEnum
)
item
.
Id
).
OrderBy
(
qitem
=>
qitem
.
PageSort
)
.
Select
(
qitem
=>
new
{
qitem
.
PageId
,
qitem
.
PageName
,
qitem
.
PageUrl
,
qitem
.
IsParameter
,
qitem
.
ParameterValue
,
qitem
.
Id
,
qitem
.
SelfPageName
})
.
ToList
()
});
}
return
ApiResult
.
Success
(
data
:
resultList
);
}
/// <summary>
/// 保存小程序页面自定义标题
/// </summary>
/// <returns></returns>
public
ApiResult
SetMiniprogramPageTitle
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
pageList
=
JsonConvert
.
DeserializeObject
<
List
<
RB_MiniProgram_Page_Extend
>>(
parms
.
GetStringValue
(
"setMsg"
));
var
flag
=
programPageModule
.
SetMiniProgram_PageTitle_ByListModule
(
pageList
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
#
endregion
}
...
...
Mall.WebApi/Filter/ApiFilterAttribute.cs
View file @
aea910ad
...
...
@@ -96,7 +96,7 @@ namespace Mall.WebApi.Filter
string
controllerName
=
actionContext
.
ActionDescriptor
.
RouteValues
[
"controller"
].
ToString
().
ToLower
();
string
actionName
=
actionContext
.
ActionDescriptor
.
RouteValues
[
"action"
].
ToString
().
ToLower
();
//string areaName = actionContext.ActionDescriptor.RouteValues["area"].ToString().ToLower();
if
(!
actionName
.
Contains
(
"get"
))
if
(!
actionName
.
ToLower
().
Contains
(
"get"
))
{
string
cachedKey
=
SecurityHelper
.
MD5
(
string
.
Format
(
"cmd={0}&token={1}"
,
controllerName
+
"/"
+
actionName
,
token
));
try
...
...
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