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
fcbde506
Commit
fcbde506
authored
Jul 22, 2022
by
liudong1993
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/Kui2/mall.oytour.com
into sdzq-ld
parents
1ce30ea1
a964fe06
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
37 deletions
+88
-37
RB_Assess_CategoryRepository.cs
Mall.Repository/Assess/RB_Assess_CategoryRepository.cs
+8
-1
MySqlHelper.cs
Test/DBHelper/MySqlHelper.cs
+1
-0
HuiMaiHelper.cs
Test/Helper/HuiMaiHelper.cs
+79
-36
No files found.
Mall.Repository/Assess/RB_Assess_CategoryRepository.cs
View file @
fcbde506
...
...
@@ -4,6 +4,7 @@ using System.Text;
using
Mall.Model.Entity.Assess
;
using
Mall.Model.Extend.Assess
;
using
System.Linq
;
using
VT.FW.DB.Dapper
;
namespace
Mall.Repository.Assess
{
...
...
@@ -23,6 +24,7 @@ namespace Mall.Repository.Assess
/// <returns></returns>
public
List
<
RB_Assess_Category_Extend
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Assess_Category_Extend
dmodel
)
{
var
parameters
=
new
DynamicParameters
();
string
where
=
$" 1=1 and e.
{
nameof
(
RB_Assess_Category_Extend
.
Status
)}
=0 "
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and e.
{
nameof
(
RB_Assess_Category_Extend
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
...
...
@@ -39,8 +41,13 @@ namespace Mall.Repository.Assess
{
where
+=
$@" and e.
{
nameof
(
RB_Assess_Category_Extend
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Name
))
{
where
+=
$@" and e.
{
nameof
(
RB_Assess_Category_Extend
.
Name
)}
like @Name"
;
parameters
.
Add
(
"Name"
,
"%"
+
dmodel
.
Name
+
"%"
);
}
string
sql
=
$@"select * from RB_Assess_Category e where
{
where
}
order by e.Id desc"
;
return
GetPage
<
RB_Assess_Category_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
).
ToList
();
return
GetPage
<
RB_Assess_Category_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
,
parameters
).
ToList
();
}
/// <summary>
...
...
Test/DBHelper/MySqlHelper.cs
View file @
fcbde506
...
...
@@ -46,6 +46,7 @@ namespace Test.DBHelper
PrepareCommand
(
cmd
,
connection
,
null
,
cmdType
,
cmdText
,
commandParameters
);
//Execute the command
int
val
=
cmd
.
ExecuteNonQuery
();
cmd
.
Parameters
.
Clear
();
return
val
;
...
...
Test/Helper/HuiMaiHelper.cs
View file @
fcbde506
using
Newtonsoft.Json.Linq
;
using
MySql.Data.MySqlClient
;
using
Newtonsoft.Json.Linq
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
...
...
@@ -6,7 +7,7 @@ using System.Linq;
using
System.Net
;
using
System.Text
;
using
System.Threading.Tasks
;
using
Test.DBHelper
;
namespace
Test.Helper
{
...
...
@@ -25,11 +26,18 @@ namespace Test.Helper
public
static
void
GetCategoryList
()
{
string
url
=
ApiUrl
+
"/apiv1/Category/get_category_list"
;
string
jsonData
=
Http
Get
(
url
,
cookie
);
string
jsonData
=
Http
Post
(
url
,
cookie
,
""
);
var
list
=
ParseCategoryList
(
jsonData
);
List
<
brandItem
>
brandList
=
new
List
<
brandItem
>();
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
//string deleteSql = " TRUNCATE TABLE RB_Assess_Category; ";
//Test.DBHelper.MySqlHelper.ExecuteNonQuery(Test.DBHelper.MySqlHelper.defaultConnection, System.Data.CommandType.Text, deleteSql, null);
}
foreach
(
var
item
in
list
)
{
//string sql = string.Format("INSERT INTO RB_Assess_Category(Id, Name,Image,CreateDate,UpdateDate) VALUES({0},'{1}','{2}','{3}','{3}')", item.id, item.name, item.logo, DateTime.Now);
//Test.DBHelper.MySqlHelper.ExecuteNonQuery(Test.DBHelper.MySqlHelper.defaultConnection, System.Data.CommandType.Text, sql, null);
GetBrandList
(
item
,
brandList
);
}
string
str
=
""
;
...
...
@@ -73,7 +81,8 @@ namespace Test.Helper
{
category_id
=
rootItem
.
id
};
string
jsonData
=
HttpPost
(
newImaApi
,
cookie
,
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
data
));
var
postMsg
=
new
{
data
};
string
jsonData
=
HttpPost
(
newImaApi
,
cookie
,
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
postMsg
));
var
list
=
ParseCategory
(
jsonData
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
...
...
@@ -109,17 +118,65 @@ namespace Test.Helper
if
(!
string
.
IsNullOrEmpty
(
jsonData
))
{
JObject
rootObj
=
JObject
.
Parse
(
jsonData
);
if
(
rootObj
!=
null
&&
!
string
.
IsNullOrEmpty
(
rootObj
[
"
data
"
].
ToString
()))
if
(
rootObj
!=
null
&&
!
string
.
IsNullOrEmpty
(
rootObj
[
"
result
"
].
ToString
()))
{
JObject
resultObj
=
JObject
.
Parse
(
rootObj
[
"data"
].
ToString
());
if
(
resultObj
!=
null
)
JObject
resultObj
=
JObject
.
Parse
(
rootObj
[
"result"
].
ToString
());
if
(
resultObj
!=
null
&&!
string
.
IsNullOrEmpty
(
resultObj
[
"data"
].
ToString
()))
{
JArray
imgArray
=
JArray
.
Parse
(
resultObj
[
"img_array"
].
ToString
());
string
upload_remark
=
resultObj
[
"upload_remark"
].
ToString
();
string
remark
=
resultObj
[
"remark"
].
ToString
();
string
bottom_remark
=
resultObj
[
"bottom_remark"
].
ToString
();
JObject
dataObj
=
JObject
.
Parse
(
resultObj
[
"data"
].
ToString
());
if
(
dataObj
!=
null
)
{
JArray
imgArray
=
JArray
.
Parse
(
dataObj
[
"img_array"
].
ToString
());
List
<
object
>
imgList
=
new
List
<
object
>();
if
(
imgArray
!=
null
&&
imgArray
.
Count
>
0
)
{
foreach
(
var
jItem
in
imgArray
)
{
JObject
imgObj
=
JObject
.
Parse
(
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
jItem
));
string
sort
=
imgObj
[
"sort"
].
ToString
();
Int32
.
TryParse
(
sort
,
out
int
newSort
);
imgList
.
Add
(
new
{
Name
=
imgObj
[
"name"
].
ToString
(),
Path
=
imgObj
[
"full_image"
].
ToString
(),
Sort
=
newSort
,
});
}
}
string
upload_remark
=
dataObj
[
"upload_remark"
].
ToString
();
string
remark
=
dataObj
[
"remark"
].
ToString
();
string
bottom_remark
=
dataObj
[
"bottom_remark"
].
ToString
();
string
selectSql
=
"SELECT Id FROM rb_assess_brand WHERE Id="
+
item
.
id
;
var
obj
=
Test
.
DBHelper
.
MySqlHelper
.
ExecuteScalar
(
Test
.
DBHelper
.
MySqlHelper
.
defaultConnection
,
System
.
Data
.
CommandType
.
Text
,
selectSql
,
null
);
int
Id
=
0
;
if
(
obj
!=
null
&&
Convert
.
ToInt32
(
obj
.
ToString
())
>
0
)
{
Id
=
Convert
.
ToInt32
(
obj
.
ToString
());
}
if
(
Id
<=
0
)
{
string
sql
=
@" INSERT INTO rb_assess_brand(Id,CategoryId,Name,Logo,PinYin,IsHot,BrandImg,CreateDate,UpdateDate,MoreDesc,RemarkDesc) "
;
sql
+=
string
.
Format
(
@" VALUES(@Id,@CategoryId,@Name,@Logo,@PinYin,@IsHot,@BrandImg,@CreateDate,@UpdateDate,@MoreDesc,@RemarkDesc) "
);
var
parameters
=
new
List
<
MySqlParameter
>();
parameters
.
Add
(
new
MySqlParameter
()
{
ParameterName
=
"Id"
,
Value
=
item
.
id
});
parameters
.
Add
(
new
MySqlParameter
()
{
ParameterName
=
"CategoryId"
,
Value
=
item
.
category_id
});
parameters
.
Add
(
new
MySqlParameter
()
{
ParameterName
=
"Name"
,
Value
=
item
.
brand_name
});
parameters
.
Add
(
new
MySqlParameter
()
{
ParameterName
=
"Logo"
,
Value
=
item
.
logo
});
parameters
.
Add
(
new
MySqlParameter
()
{
ParameterName
=
"PinYin"
,
Value
=
item
.
initial
});
parameters
.
Add
(
new
MySqlParameter
()
{
ParameterName
=
"IsHot"
,
Value
=
item
.
ishot
});
parameters
.
Add
(
new
MySqlParameter
()
{
ParameterName
=
"BrandImg"
,
Value
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
imgList
)
});
parameters
.
Add
(
new
MySqlParameter
()
{
ParameterName
=
"CreateDate"
,
Value
=
DateTime
.
Now
});
parameters
.
Add
(
new
MySqlParameter
()
{
ParameterName
=
"UpdateDate"
,
Value
=
DateTime
.
Now
});
parameters
.
Add
(
new
MySqlParameter
()
{
ParameterName
=
"MoreDesc"
,
Value
=
bottom_remark
});
parameters
.
Add
(
new
MySqlParameter
()
{
ParameterName
=
"RemarkDesc"
,
Value
=
remark
});
var
res
=
Test
.
DBHelper
.
MySqlHelper
.
ExecuteNonQuery
(
Test
.
DBHelper
.
MySqlHelper
.
defaultConnection
,
System
.
Data
.
CommandType
.
Text
,
sql
,
parameters
.
ToArray
());
}
else
{
string
str
=
""
;
}
}
}
}
}
...
...
@@ -145,6 +202,10 @@ namespace Test.Helper
var
hotList
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
List
<
brandItem
>>(
hotListStr
);
if
(
hotList
!=
null
&&
hotList
.
Count
>
0
)
{
foreach
(
var
item
in
hotList
)
{
item
.
ishot
=
1
;
}
list
.
AddRange
(
hotList
);
}
}
...
...
@@ -173,29 +234,6 @@ namespace Test.Helper
return
list
;
}
/// <summary>
/// Get获取数据
/// </summary>
/// <param name="url">url地址</param>
/// <param name="encode">编码方式</param>
/// <param name="Source">来源</param>
/// <returns></returns>
static
string
HttpGet
(
string
url
,
string
cookie
)
{
HttpWebRequest
myRequest
=
(
HttpWebRequest
)
WebRequest
.
Create
(
url
);
myRequest
.
Headers
.
Add
(
"Cookie"
,
cookie
);
myRequest
.
Headers
.
Add
(
"X-Requested-With"
,
"XMLHttpRequest"
);
myRequest
.
Method
=
"GET"
;
HttpWebResponse
myResponse
=
(
HttpWebResponse
)
myRequest
.
GetResponse
();
StreamReader
reader
=
new
StreamReader
(
myResponse
.
GetResponseStream
(),
Encoding
.
UTF8
);
string
content
=
reader
.
ReadToEnd
();
reader
.
Close
();
return
content
;
}
/// <summary>
/// Post提交数据
/// </summary>
...
...
@@ -274,5 +312,10 @@ namespace Test.Helper
public
string
name
{
get
;
set
;
}
/// <summary>
/// 是否热门
/// </summary>
public
int
ishot
{
get
;
set
;
}
}
}
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