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
9acfd90b
Commit
9acfd90b
authored
Nov 25, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
34de3990
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
6 deletions
+79
-6
MallHelper.cs
Test/Helper/MallHelper.cs
+79
-6
No files found.
Test/Helper/MallHelper.cs
View file @
9acfd90b
...
...
@@ -24,8 +24,74 @@ namespace Test.Helper
public
static
void
GetData
()
{
string
cookie
=
"_identity=c964edefdd891bb281844324071fea4e2c1e7d2b21aef031ed81730f4e753d06a%3A2%3A%7Bi%3A0%3Bs%3A9%3A%22_identity%22%3Bi%3A1%3Bs%3A48%3A%22%5B19740%2C%22Cktp5k6Wf3lVS_yjQI_uTgEEE6_ANe-5%22%2C86400%5D%22%3B%7D; HJ_SESSION_ID=tnajne35hev8qdajddg9pkg2cu; _csrf=df6aaa8c5fdb2364e3cd74f8e1a6e3036d4553a3e2ad7df9e5934907a5beabd8a%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22URmzdlSexWftTrS829hdWnMLSiKhY0gP%22%3B%7D"
;
// GetGategoryImgList(cookie);
GetDestinationModel
(
cookie
);
//郍田cookie
cookie
=
@"__login_route=%2Fadmin%2Fpassport%2Flogin; __login_role=admin; search={'keyword':'','status':' - 1','sort_prop':'','sort_type':'','cats':[],'date_start':null,'date_end':null,'type':''}; HJ_SESSION_ID=etl0scvdtbq22ojjchjfrcbggr; _identity=b6807fdf0e70df610656375cc8efa2ffc4ade9bac5599b869db0bcbd49ccb534a%3A2%3A%7Bi%3A0%3Bs%3A9%3A%22_identity%22%3Bi%3A1%3Bs%3A45%3A%22%5B78%2C%22N10nBVpyiu6raLjfUNxJ-cfoS0OXQ339%22%2C86400%5D%22%3B%7D; _csrf=9a730e84d910aa90ff037478e4aced54615f3cccf97ccea0af1272f84ebd38ada%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22Ch2Q0PFkOxNuOQHF-WB95whwS_MF8fts%22%3B%7D"
;
//GetGategoryImgList(cookie);
//GetTemplate(cookie);
//GetDestinationModel(cookie);
CreateNewImage
();
}
public
static
void
CreateNewImage
()
{
string
goodsql
=
"select * from rb_goods where TenantId=16 "
;
var
res
=
DBHelper
.
MySqlHelper
.
ExecuteDataset
(
DBHelper
.
MySqlHelper
.
defaultConnection
,
System
.
Data
.
CommandType
.
Text
,
goodsql
,
null
);
if
(
res
!=
null
&&
res
.
Tables
[
0
]
!=
null
)
{
for
(
int
i
=
0
;
i
<
res
.
Tables
[
0
].
Rows
.
Count
;
i
++)
{
string
carouselImage
=
res
.
Tables
[
0
].
Rows
[
i
][
"CarouselImage"
].
ToString
();
if
(!
string
.
IsNullOrEmpty
(
carouselImage
))
{
var
imgList
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
List
<
string
>>(
carouselImage
);
foreach
(
var
item
in
imgList
)
{
string
newStr
=
item
.
Replace
(
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com"
,
"http://kydwx.oss-cn-hangzhou.aliyuncs.com/"
);
CreateImage
(
newStr
);
}
}
string
customShareImage
=
res
.
Tables
[
0
].
Rows
[
i
][
"CustomShareImage"
].
ToString
();
if
(!
string
.
IsNullOrEmpty
(
customShareImage
))
{
string
newStr
=
customShareImage
.
Replace
(
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com"
,
"http://kydwx.oss-cn-hangzhou.aliyuncs.com/"
);
CreateImage
(
newStr
);
}
Console
.
WriteLine
(
string
.
Format
(
"{0}/{1} 已完成"
,
i
+
1
,
res
.
Tables
[
0
].
Rows
.
Count
));
}
}
string
specvalueSql
=
"select * from rb_goods_specificationvalue where TenantId=16 "
;
var
res2
=
DBHelper
.
MySqlHelper
.
ExecuteDataset
(
DBHelper
.
MySqlHelper
.
defaultConnection
,
System
.
Data
.
CommandType
.
Text
,
specvalueSql
,
null
);
if
(
res2
!=
null
&&
res2
.
Tables
[
0
]
!=
null
)
{
for
(
int
i
=
0
;
i
<
res2
.
Tables
[
0
].
Rows
.
Count
;
i
++)
{
string
image
=
res2
.
Tables
[
0
].
Rows
[
i
][
"Image"
].
ToString
();
if
(!
string
.
IsNullOrEmpty
(
image
))
{
string
newStr
=
image
.
Replace
(
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com"
,
"http://kydwx.oss-cn-hangzhou.aliyuncs.com/"
);
CreateImage
(
newStr
);
Console
.
WriteLine
(
string
.
Format
(
"{0}/{1} 已完成"
,
i
+
1
,
res2
.
Tables
[
0
].
Rows
.
Count
));
}
}
}
string
sqlcateSql
=
"select * from rb_product_category where TenantId=16"
;
var
res3
=
DBHelper
.
MySqlHelper
.
ExecuteDataset
(
DBHelper
.
MySqlHelper
.
defaultConnection
,
System
.
Data
.
CommandType
.
Text
,
sqlcateSql
,
null
);
if
(
res3
!=
null
&&
res3
.
Tables
[
0
]
!=
null
)
{
for
(
int
i
=
0
;
i
<
res3
.
Tables
[
0
].
Rows
.
Count
;
i
++)
{
string
image
=
res3
.
Tables
[
0
].
Rows
[
i
][
"AdvertisingAddress"
].
ToString
();
if
(!
string
.
IsNullOrEmpty
(
image
))
{
string
newStr
=
image
.
Replace
(
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com"
,
"http://kydwx.oss-cn-hangzhou.aliyuncs.com/"
);
CreateImage
(
newStr
);
Console
.
WriteLine
(
string
.
Format
(
"{0}/{1} 已完成"
,
i
+
1
,
res3
.
Tables
[
0
].
Rows
.
Count
));
}
}
}
}
public
static
void
GetPage
(
string
cookie
)
...
...
@@ -82,6 +148,7 @@ namespace Test.Helper
{
List
<
PageData
>
list
=
new
List
<
PageData
>();
string
ApiUrl
=
"https://wx.weibaoge.cn/web/index.php?r=plugin%2Fdiy%2Fmall%2Fpage%2Findex&page={0}"
;
ApiUrl
=
"https://wx.kyd19.com/web/index.php?r=plugin%2Fdiy%2Fmall%2Fmodule%2Findex&page={0}"
;
string
url1
=
string
.
Format
(
ApiUrl
,
"1"
);
string
jsonData
=
HttpGet
(
url1
,
cookie
);
if
(
jsonData
!=
null
&&
!
string
.
IsNullOrEmpty
(
jsonData
))
...
...
@@ -125,7 +192,7 @@ namespace Test.Helper
Console
.
WriteLine
(
index
+
"/"
+
list
.
Count
+
item
.
name
+
"分类Start"
);
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
" INSERT INTO rb_miniprogram_template(TenantId,MallBaseId,TemplateName,TemplateData,CreateDate,CreateBy,Status)"
);
builder
.
AppendFormat
(
" VALUES(1
,1
,'{0}',@data,'{1}',1,0);SELECT LAST_INSERT_ID()"
,
item
.
name
,
DateTime
.
Now
);
builder
.
AppendFormat
(
" VALUES(1
6,6
,'{0}',@data,'{1}',1,0);SELECT LAST_INSERT_ID()"
,
item
.
name
,
DateTime
.
Now
);
List
<
MySqlParameter
>
paramsList
=
new
List
<
MySqlParameter
>();
paramsList
.
Add
(
new
MySqlParameter
()
{
...
...
@@ -160,7 +227,9 @@ namespace Test.Helper
{
List
<
TemplateData
>
list
=
new
List
<
TemplateData
>();
string
ApiUrl
=
"https://wx.weibaoge.cn/web/index.php?r=plugin%2Fdiy%2Fmall%2Ftemplate%2Findex&page={0}"
;
ApiUrl
=
"https://wx.kyd19.com/web/index.php?r=plugin%2Fdiy%2Fmall%2Fmodule%2Findex&page={0}"
;
string
url1
=
string
.
Format
(
ApiUrl
,
"1"
);
cookie
=
"_identity=b6807fdf0e70df610656375cc8efa2ffc4ade9bac5599b869db0bcbd49ccb534a%3A2%3A%7Bi%3A0%3Bs%3A9%3A%22_identity%22%3Bi%3A1%3Bs%3A45%3A%22%5B78%2C%22N10nBVpyiu6raLjfUNxJ-cfoS0OXQ339%22%2C86400%5D%22%3B%7D; HJ_SESSION_ID=ochob0fm2od7critkr3tksk5ht; _csrf=005c23b2e9776a81a7578311b626d6dfcd7106af3b5026fa7a874ff5f795940aa%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22tO5HycBW95P-BrljZlO5EnF4zCZ-dvwg%22%3B%7D"
;
string
jsonData
=
HttpGet
(
url1
,
cookie
);
if
(
jsonData
!=
null
&&
!
string
.
IsNullOrEmpty
(
jsonData
))
{
...
...
@@ -264,7 +333,7 @@ namespace Test.Helper
}
}
pageIndex
++;
var
ranDomNum
=
new
Random
().
Next
(
1
,
20
);
var
ranDomNum
=
new
Random
().
Next
(
1
,
5
);
Thread
.
Sleep
(
1000
*
ranDomNum
);
}
index
++;
...
...
@@ -361,7 +430,7 @@ namespace Test.Helper
/// <returns></returns>
public
static
string
GetFileUrl
(
string
path
)
{
return
path
.
Replace
(
"https://cdnimg.iotweixin.com"
,
""
);
return
path
.
Replace
(
"https://cdnimg.iotweixin.com"
,
""
)
.
Replace
(
"http://kydwx.oss-cn-hangzhou.aliyuncs.com"
,
""
)
;
}
/// <summary>
...
...
@@ -377,8 +446,9 @@ namespace Test.Helper
pageCount
=
0
;
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="
;
//郍田
imgApi
=
"https://wx.kyd19.com/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";
string
jsonData
=
HttpGet
(
newImaApi
,
cookie
);
if
(
jsonData
!=
null
&&
!
string
.
IsNullOrEmpty
(
jsonData
))
{
...
...
@@ -400,7 +470,10 @@ namespace Test.Helper
static
List
<
Category
>
GetCategoryList
(
string
cookie
)
{
List
<
Category
>
list
=
new
List
<
Category
>();
//微宝阁
string
ApiUrl
=
"https://wx.weibaoge.cn/web/index.php?r=common%2Fattachment%2Fgroup-list&is_recycle=0&type=image"
;
//郍田
ApiUrl
=
"https://wx.kyd19.com/web/index.php?r=common%2Fattachment%2Fgroup-list&is_recycle=0&type=image"
;
string
jsonData
=
HttpGet
(
ApiUrl
,
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