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
890e8ef5
Commit
890e8ef5
authored
Jun 12, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
b19220d5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
14 deletions
+33
-14
MallHelper.cs
Test/Helper/MallHelper.cs
+33
-14
No files found.
Test/Helper/MallHelper.cs
View file @
890e8ef5
...
...
@@ -22,8 +22,8 @@ namespace Test.Helper
/// </summary>
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
Page
(
cookie
);
string
cookie
=
"__login_route=%2Fadmin%2Fpassport%2Flogin; __login_role=admin; HJ_SESSION_ID=
7vk71fa0f18fbqh525spku825f; _csrf=a8195370a076c6ca402e1bcfe99202bab6fe6db797e12d3b3c962b8ab05858c6a%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22LKtJyYWEFsOkis_aatuA-fbrGZvhC3fp
%22%3B%7D"
;
Get
GategoryImgList
(
cookie
);
}
public
static
void
GetPage
(
string
cookie
)
...
...
@@ -205,6 +205,14 @@ namespace Test.Helper
builder
.
AppendFormat
(
" VALUES('{0}',{1},{2},1,0,1,1,'{3}','{4}');SELECT LAST_INSERT_ID()"
,
item
.
name
,
item
.
type
,
item
.
is_recycle
,
DateTime
.
Now
,
DateTime
.
Now
);
int
parentId
=
0
;
try
{
string
existsSql
=
string
.
Format
(
"SELECT Id FROM rb_material_group WHERE Name='{0}' "
,
item
.
name
.
Trim
());
var
existsObj
=
DBHelper
.
MySqlHelper
.
ExecuteScalar
(
DBHelper
.
MySqlHelper
.
defaultConnection
,
System
.
Data
.
CommandType
.
Text
,
existsSql
,
null
);
if
(
existsObj
!=
null
&&
Convert
.
ToInt32
(
existsObj
)
>
0
)
{
Int32
.
TryParse
(
existsObj
.
ToString
(),
out
parentId
);
}
else
{
var
res
=
DBHelper
.
MySqlHelper
.
ExecuteScalar
(
DBHelper
.
MySqlHelper
.
defaultConnection
,
System
.
Data
.
CommandType
.
Text
,
builder
.
ToString
(),
null
);
if
(
res
!=
null
&&
Convert
.
ToInt32
(
res
)
>
0
)
...
...
@@ -212,6 +220,8 @@ namespace Test.Helper
Int32
.
TryParse
(
res
.
ToString
(),
out
parentId
);
}
}
}
catch
(
Exception
ex
)
{
...
...
@@ -226,14 +236,22 @@ namespace Test.Helper
if
(
tempImgList
!=
null
&&
tempImgList
.
Count
>
0
)
{
foreach
(
var
subItem
in
tempImgList
)
{
string
existsSubSql
=
string
.
Format
(
"SELECT Id FROM rb_material_info WHERE Name='{0}' AND Type={1} AND GroupId={2} "
,
subItem
.
name
,
subItem
.
type
,
parentId
);
var
existsSubObj
=
DBHelper
.
MySqlHelper
.
ExecuteScalar
(
DBHelper
.
MySqlHelper
.
defaultConnection
,
System
.
Data
.
CommandType
.
Text
,
existsSubSql
,
null
);
if
(
existsSubObj
!=
null
&&
Convert
.
ToInt32
(
existsSubObj
)
>
0
)
{
// Int32.TryParse(existsSubObj.ToString(), out parentId);
}
else
{
try
{
CreateImage
(
subItem
.
url
);
string
path
=
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com"
+
GetFileUrl
(
subItem
.
url
);
StringBuilder
stringBuilder
=
new
StringBuilder
();
stringBuilder
.
AppendFormat
(
"INSERT INTO rb_material_info(Name,Type,GroupId,Path,Image,VideoTime,WithHeight,TenantId,MallBaseId,CreateDate,UpdateDate,Recycled,Status)"
);
stringBuilder
.
AppendFormat
(
" VALUES('{0}',{1},{2},'{3}','{4}',0,0,1,1,'{5}','{6}',1,0)"
,
subItem
.
name
,
subItem
.
type
,
parentId
,
path
,
""
,
DateTime
.
Now
,
DateTime
.
Now
);
try
{
var
newResult
=
DBHelper
.
MySqlHelper
.
ExecuteNonQuery
(
DBHelper
.
MySqlHelper
.
defaultConnection
,
System
.
Data
.
CommandType
.
Text
,
stringBuilder
.
ToString
(),
null
);
}
catch
(
Exception
ex
)
...
...
@@ -242,6 +260,7 @@ namespace Test.Helper
}
}
}
}
pageIndex
++;
var
ranDomNum
=
new
Random
().
Next
(
1
,
20
);
Thread
.
Sleep
(
1000
*
ranDomNum
);
...
...
@@ -307,7 +326,7 @@ namespace Test.Helper
List
<
CategoryImg
>
list
=
new
List
<
CategoryImg
>();
string
imgApi
=
"https://wx.weibaoge.cn/web/index.php?r=common%2Fattachment%2Flist&page={0}&attachment_group_id={1}&type=image&is_recycle=0&keyword="
;
string
newImaApi
=
string
.
Format
(
imgApi
,
pageIndex
,
Id
);
cookie
=
"__login_route=%2Fadmin%2Fpassport%2Flogin; __login_role=admin; search={'keyword':'','status':'-1','sort_prop':'','sort_type':'','cats':[],'date_start':null,'date_end':null}; HJ_SESSION_ID=kmmormovvm2u9qh5drkgsbj1ta; _csrf=7a980bb65eabe0ac3d77199092030044b17ae9779de00eaed628c8095ab2fe0ca%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22rsnZWVWkZkpfvVhLBXu8sGG3px0Dgcsx%22%3B%7D"
;
//
cookie = "__login_route=%2Fadmin%2Fpassport%2Flogin; __login_role=admin; search={'keyword':'','status':'-1','sort_prop':'','sort_type':'','cats':[],'date_start':null,'date_end':null}; HJ_SESSION_ID=kmmormovvm2u9qh5drkgsbj1ta; _csrf=7a980bb65eabe0ac3d77199092030044b17ae9779de00eaed628c8095ab2fe0ca%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22rsnZWVWkZkpfvVhLBXu8sGG3px0Dgcsx%22%3B%7D";
string
jsonData
=
HttpGet
(
newImaApi
,
cookie
);
if
(
jsonData
!=
null
&&
!
string
.
IsNullOrEmpty
(
jsonData
))
{
...
...
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