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
8a4c72c4
Commit
8a4c72c4
authored
Jun 10, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
995dabd5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
186 additions
and
2 deletions
+186
-2
TenantController.cs
Mall.WebApi/Controllers/User/TenantController.cs
+39
-1
MallHelper.cs
Test/Helper/MallHelper.cs
+84
-1
Category.cs
Test/Model/Category.cs
+63
-0
No files found.
Mall.WebApi/Controllers/User/TenantController.cs
View file @
8a4c72c4
...
...
@@ -844,6 +844,7 @@ namespace Mall.WebApi.Controllers.User
public
ApiResult
GetMenuList
()
{
List
<
object
>
resultList
=
new
List
<
object
>();
var
menuList
=
menuModule
.
GetMenuListModule
(
new
RB_Menu_Extend
()
{
});
var
list
=
new
List
<
RB_Menu_Extend
>();
if
(
RequestParm
.
EmpId
>
0
)
{
...
...
@@ -851,11 +852,48 @@ namespace Mall.WebApi.Controllers.User
if
(
roleList
!=
null
&&
roleList
.
Count
>
0
)
{
list
=
menuModule
.
GetMenuListModule
(
new
RB_Menu_Extend
()
{
QMenuIds
=
roleList
?.
FirstOrDefault
()?.
RoleAuth
});
var
superList
=
new
List
<
RB_Menu_Extend
>();
foreach
(
var
item
in
list
)
{
if
(
item
.
MenuLevel
==
3
)
{
var
secondMenuList
=
menuList
.
Where
(
qitem
=>
qitem
.
MenuId
==
item
.
ParentId
).
ToList
();
foreach
(
var
secondItem
in
secondMenuList
)
{
if
(!(
superList
.
Where
(
qitem
=>
qitem
.
MenuId
==
secondItem
.
MenuId
).
Count
()
>
0
))
{
superList
.
Add
(
secondItem
);
}
var
firstMenuList
=
menuList
.
Where
(
qitem
=>
qitem
.
MenuId
==
secondItem
.
ParentId
).
ToList
();
foreach
(
var
firstItem
in
firstMenuList
)
{
if
(!(
superList
.
Where
(
qitem
=>
qitem
.
MenuId
==
firstItem
.
MenuId
).
Count
()
>
0
))
{
superList
.
Add
(
firstItem
);
}
}
}
}
if
(
item
.
MenuLevel
==
2
)
{
var
firstMenuList
=
menuList
.
Where
(
qitem
=>
qitem
.
MenuId
==
item
.
ParentId
).
ToList
();
foreach
(
var
firstItem
in
firstMenuList
)
{
if
(!(
superList
.
Where
(
qitem
=>
qitem
.
MenuId
==
firstItem
.
MenuId
).
Count
()
>
0
))
{
superList
.
Add
(
firstItem
);
}
}
}
}
list
.
AddRange
(
superList
);
}
}
else
{
list
=
menu
Module
.
GetMenuListModule
(
new
RB_Menu_Extend
()
{
})
;
list
=
menu
List
;
}
var
rootList
=
list
.
Where
(
qitem
=>
qitem
.
MenuLevel
==
1
).
OrderBy
(
qitem
=>
qitem
.
SortNum
).
ToList
();
...
...
Test/Helper/MallHelper.cs
View file @
8a4c72c4
...
...
@@ -23,9 +23,92 @@ namespace Test.Helper
public
static
void
GetData
()
{
string
cookie
=
"__login_route=%2Fadmin%2Fpassport%2Flogin; __login_role=admin; HJ_SESSION_ID=4t7hlqga7scesoid63ln4gbv3n; _csrf=7e088e7a563fba6d8b51b65eebea11468c0c2ea43c8e99199be24320e3e86c94a%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22D9rE0_dOz8RHzW5y695GOQPTWJZgT8Sk%22%3B%7D"
;
Get
Templat
e
(
cookie
);
Get
Pag
e
(
cookie
);
}
public
static
void
GetPage
(
string
cookie
)
{
var
list
=
GetPageList
(
cookie
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
var
index
=
1
;
foreach
(
var
item
in
list
)
{
Console
.
WriteLine
(
index
+
"/"
+
list
.
Count
+
item
.
title
+
"分类Start"
);
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
" INSERT INTO RB_Miniprogram_Page_Templ(PageName,IsUse,IsShowNav,IsHome,TenantId,MallBaseId,CreateDate,CreateBy,Status)"
);
builder
.
AppendFormat
(
" VALUES('{0}',{1},{2},{3},1,1,'{4}',1,0);SELECT LAST_INSERT_ID()"
,
item
.
title
,
item
.
is_disable
,
item
.
show_navs
,
item
.
is_home_page
,
DateTime
.
Now
);
List
<
MySqlParameter
>
paramsList
=
new
List
<
MySqlParameter
>();
try
{
var
res
=
DBHelper
.
MySqlHelper
.
ExecuteScalar
(
DBHelper
.
MySqlHelper
.
defaultConnection
,
System
.
Data
.
CommandType
.
Text
,
builder
.
ToString
(),
paramsList
.
ToArray
());
if
(
res
!=
null
&&
Convert
.
ToInt32
(
res
)
>
0
)
{
string
updateSql
=
string
.
Format
(
"UPDATE RB_Miniprogram_Page_Templ SET Id={0} WHERE Id={1}"
,
item
.
id
,
Convert
.
ToInt32
(
res
));
var
res1
=
DBHelper
.
MySqlHelper
.
ExecuteScalar
(
DBHelper
.
MySqlHelper
.
defaultConnection
,
System
.
Data
.
CommandType
.
Text
,
updateSql
,
null
);
}
if
(
item
.
navs
!=
null
&&
item
.
navs
.
Count
>
0
)
{
foreach
(
var
subItem
in
item
.
navs
)
{
StringBuilder
builder2
=
new
StringBuilder
();
builder2
.
AppendFormat
(
" INSERT INTO rb_miniprogram_page_templ_details(PageTemplID,NavName,TemplateId,TemplateShowName)"
);
builder2
.
AppendFormat
(
" VALUES({0},'{1}',{2},'{3}');SELECT LAST_INSERT_ID()"
,
item
.
id
,
subItem
.
template
,
subItem
.
template_id
,
string
.
Format
(
"#{0}:{1}"
,
subItem
.
template_id
,
subItem
.
template
));
var
res2
=
DBHelper
.
MySqlHelper
.
ExecuteScalar
(
DBHelper
.
MySqlHelper
.
defaultConnection
,
System
.
Data
.
CommandType
.
Text
,
builder2
.
ToString
(),
null
);
}
}
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
index
+
"/"
+
ex
.
Message
);
}
index
++;
Console
.
WriteLine
(
index
+
"/"
+
list
.
Count
+
item
.
title
+
"分类End"
);
}
}
}
/// <summary>
/// 获取页面数据
/// </summary>
/// <param name="cookie"></param>
/// <returns></returns>
public
static
List
<
PageData
>
GetPageList
(
string
cookie
)
{
List
<
PageData
>
list
=
new
List
<
PageData
>();
string
ApiUrl
=
"https://wx.weibaoge.cn/web/index.php?r=plugin%2Fdiy%2Fmall%2Fpage%2Findex&page={0}"
;
string
url1
=
string
.
Format
(
ApiUrl
,
"1"
);
string
jsonData
=
HttpGet
(
url1
,
cookie
);
if
(
jsonData
!=
null
&&
!
string
.
IsNullOrEmpty
(
jsonData
))
{
JObject
obj
=
JObject
.
Parse
(
jsonData
);
JObject
dataObj
=
JObject
.
Parse
(
obj
[
"data"
].
ToString
());
list
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
List
<
PageData
>>(
dataObj
[
"list"
].
ToString
());
}
if
(
list
==
null
)
{
list
=
new
List
<
PageData
>();
}
Thread
.
Sleep
(
1000
*
5
);
string
url2
=
string
.
Format
(
ApiUrl
,
"2"
);
string
jsonData2
=
HttpGet
(
url2
,
cookie
);
if
(
jsonData2
!=
null
&&
!
string
.
IsNullOrEmpty
(
jsonData2
))
{
JObject
obj
=
JObject
.
Parse
(
jsonData2
);
JObject
dataObj
=
JObject
.
Parse
(
obj
[
"data"
].
ToString
());
var
list2
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
List
<
PageData
>>(
dataObj
[
"list"
].
ToString
());
if
(
list2
!=
null
&&
list2
.
Count
>
0
)
{
list
.
AddRange
(
list2
);
}
}
return
list
;
}
/// <summary>
/// 获取模板
/// </summary>
...
...
Test/Model/Category.cs
View file @
8a4c72c4
...
...
@@ -6,6 +6,69 @@ using System.Threading.Tasks;
namespace
Test.Model
{
/// <summary>
/// 页面实体类
/// </summary>
public
class
PageData
{
/// <summary>
/// 页面编号
/// </summary>
public
int
id
{
get
;
set
;
}
/// <summary>
/// 页面标题
/// </summary>
public
string
title
{
get
;
set
;}
/// <summary>
/// 是否显示导航
/// </summary>
public
int
show_navs
{
get
;
set
;
}
/// <summary>
/// 是否启用
/// </summary>
public
int
is_disable
{
get
;
set
;
}
/// <summary>
/// 是否首页
/// </summary>
public
int
is_home_page
{
get
;
set
;
}
/// <summary>
/// 导航模板
/// </summary>
public
List
<
navsData
>
navs
{
get
;
set
;
}
}
/// <summary>
/// 导航数据
/// </summary>
public
class
navsData
{
/// <summary>
/// 导航编号
/// </summary>
// public int navs { get; set; }
/// <summary>
/// 导航编号
/// </summary>
public
int
navs_id
{
get
;
set
;
}
/// <summary>
/// 模板名称
/// </summary>
public
string
template
{
get
;
set
;
}
/// <summary>
/// 模板编号
/// </summary>
public
int
template_id
{
get
;
set
;
}
}
/// <summary>
/// 模板实体类
/// </summary>
...
...
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