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
1d129701
Commit
1d129701
authored
Dec 18, 2020
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
f6398106
17a4853e
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
242 additions
and
34 deletions
+242
-34
MiniProgramModule.cs
Mall.Module.User/MiniProgramModule.cs
+10
-7
SupplierModule.cs
Mall.Module.User/SupplierModule.cs
+3
-1
UserModule.cs
Mall.Module.User/UserModule.cs
+16
-7
PayUtil.cs
Mall.WebApi/App_Code/PayUtil.cs
+88
-0
PublishController.cs
Mall.WebApi/Controllers/AppletWeChat/PublishController.cs
+41
-8
WeChatPayController.cs
Mall.WebApi/Controllers/AppletWeChat/WeChatPayController.cs
+1
-1
MallController.cs
Mall.WebApi/Controllers/Mall/MallController.cs
+2
-2
UserController.cs
Mall.WebApi/Controllers/User/UserController.cs
+1
-1
App.config
Test/App.config
+1
-1
MallHelper.cs
Test/Helper/MallHelper.cs
+79
-6
No files found.
Mall.Module.User/MiniProgramModule.cs
View file @
1d129701
...
...
@@ -484,14 +484,17 @@ namespace Mall.Module.User
{
extModel
.
NavMoreList
=
JsonConvert
.
DeserializeObject
<
List
<
MenuNavMoreModel
>>(
extModel
.
MenuNavJson
);
}
else
{
extModel
.
NavMoreList
=
new
List
<
MenuNavMoreModel
>()
{
new
MenuNavMoreModel
(){
else
{
extModel
.
NavMoreList
=
new
List
<
MenuNavMoreModel
>()
{
new
MenuNavMoreModel
()
{
Sort
=
1
,
MenuNavTitle
=
""
,
MenuNavStyle
=
0
,
TitleStyle
=
1
,
MeunList
=
new
List
<
RB_MiniProgram_UserCenterMenu
>()
MenuNavTitle
=
""
,
MenuNavStyle
=
0
,
TitleStyle
=
1
,
MeunList
=
new
List
<
RB_MiniProgram_UserCenterMenu
>()
}
};
}
...
...
Mall.Module.User/SupplierModule.cs
View file @
1d129701
...
...
@@ -91,6 +91,7 @@ namespace Mall.Module.User
if
(
model
.
ClientBankAccount
.
ID
==
0
)
{
model
.
Status
=
(
int
)
Common
.
Enum
.
DateStateEnum
.
Normal
;
model
.
ClientBankAccount
.
AccountHolder
=
model
.
ClientBankAccount
.
AccountAlias
;
var
id
=
clientBankAccountRepository
.
Insert
(
model
.
ClientBankAccount
);
model
.
BankAccountId
=
id
;
flag
=
id
>
0
;
...
...
@@ -103,7 +104,7 @@ namespace Mall.Module.User
{
nameof
(
RB_ClientBankAccount
.
ObjID
),
model
.
ClientBankAccount
.
ObjID
},
{
nameof
(
RB_ClientBankAccount
.
BankId
),
model
.
ClientBankAccount
.
BankId
},
{
nameof
(
RB_ClientBankAccount
.
OpenBankName
),
model
.
ClientBankAccount
.
OpenBankName
},
{
nameof
(
RB_ClientBankAccount
.
AccountHolder
),
model
.
ClientBankAccount
.
Account
Holder
},
{
nameof
(
RB_ClientBankAccount
.
AccountHolder
),
model
.
ClientBankAccount
.
Account
Alias
},
{
nameof
(
RB_ClientBankAccount
.
CardNum
),
model
.
ClientBankAccount
.
CardNum
},
{
nameof
(
RB_ClientBankAccount
.
AccountAlias
),
model
.
ClientBankAccount
.
AccountAlias
},
{
nameof
(
RB_ClientBankAccount
.
Status
),
model
.
ClientBankAccount
.
Status
},
...
...
@@ -180,6 +181,7 @@ namespace Mall.Module.User
else
{
model
.
Status
=
(
int
)
Common
.
Enum
.
DateStateEnum
.
Normal
;
model
.
ClientBankAccount
.
AccountHolder
=
model
.
ClientBankAccount
.
AccountAlias
;
var
id
=
clientBankAccountRepository
.
Insert
(
model
.
ClientBankAccount
);
if
(
id
>
0
)
{
...
...
Mall.Module.User/UserModule.cs
View file @
1d129701
...
...
@@ -4472,7 +4472,7 @@ namespace Mall.Module.User
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
object
GetAppletUserCenterStatistics
(
string
openId
)
public
object
GetAppletUserCenterStatistics
(
string
openId
,
RB_MiniProgram_Extend
miniConfig
=
null
)
{
var
objData
=
new
object
();
var
umodel
=
member_UserRepository
.
GetMemberUserEntityRepository
(
new
RB_Member_User_Extend
()
{
OpenId
=
openId
});
...
...
@@ -4537,19 +4537,28 @@ namespace Mall.Module.User
var
couponList
=
memberCouponRepository
.
GetAllMemberCouponPageList
(
new
RB_Member_DiscountCoupon_Extend
{
TenantId
=
umodel
.
TenantId
,
MallBaseId
=
umodel
.
MallBaseId
,
UseState
=
0
,
UserId
=
umodel
.
Id
});
var
MemberGrade
=
"普通用户"
;
string
MemberGradeIcon
=
""
;
if
(
umodel
.
MemberGrade
>
0
)
if
(
IsHpFX
==
1
)
{
var
mgModel
=
member_GradeRepository
.
GetEntity
(
umodel
.
MemberGrade
);
if
(
mgModel
!=
null
)
if
(
umodel
.
MemberGrade
>
0
)
{
MemberGrade
=
mgModel
.
Name
;
if
(
mgModel
.
Icon
>
0
)
var
mgModel
=
member_GradeRepository
.
GetEntity
(
umodel
.
MemberGrade
)
;
if
(
mgModel
!=
null
)
{
MemberGradeIcon
=
material_InfoRepository
.
GetEntity
(
mgModel
.
Icon
)?.
Path
??
""
;
MemberGrade
=
mgModel
.
Name
;
if
(
mgModel
.
Icon
>
0
)
{
MemberGradeIcon
=
material_InfoRepository
.
GetEntity
(
mgModel
.
Icon
)?.
Path
??
""
;
}
}
}
}
else
{
MemberGradeIcon
=
miniConfig
?.
MemberBgImg
??
""
;
}
objData
=
new
{
//昵称
...
...
Mall.WebApi/App_Code/PayUtil.cs
View file @
1d129701
...
...
@@ -197,6 +197,94 @@ namespace Mall.WebApi.App_Code
}
/// <summary>
/// 支付
/// </summary>
/// <returns></returns>
public
BaseResult
NotifyZhouTian
(
IHttpContextAccessor
accessor
)
{
try
{
var
res
=
new
ResponseHandler
(
accessor
);
var
tradeType
=
res
.
GetParameter
(
"trade_type"
);
LogHelper
.
WriteInfo
(
"Notify支付回调:res-"
+
res
.
ToString
());
RB_MiniProgram_Extend
model
=
new
RB_MiniProgram_Extend
();
model
=
programModule
.
GetMiniProgramModule
(
new
RB_MiniProgram_Extend
{
MallBaseId
=
6
,
TenantId
=
16
});
res
.
SetKey
(
model
.
WeChatApiSecret
);
//判断签名
if
(
res
.
IsWXsign
(
out
string
error
))
{
#
region
参数
var
returnCode
=
res
.
GetParameter
(
"return_code"
);
//返回信息,如非空,为错误原因签名失败参数格式校验错误
var
returnMsg
=
res
.
GetParameter
(
"return_msg"
);
var
appid
=
res
.
GetParameter
(
"appid"
);
//以下字段在 return_code 为 SUCCESS 的时候有返回--------------------------------
var
mchId
=
res
.
GetParameter
(
"mch_id"
);
var
deviceInfo
=
res
.
GetParameter
(
"device_info"
);
var
nonceStr
=
res
.
GetParameter
(
"nonce_str"
);
var
resultCode
=
res
.
GetParameter
(
"result_code"
);
var
errCode
=
res
.
GetParameter
(
"err_code"
);
var
errCodeDes
=
res
.
GetParameter
(
"err_code_des"
);
//以下字段在 return_code 和 result_code 都为 SUCCESS 的时候有返回---------------
var
openid
=
res
.
GetParameter
(
"openid"
);
//Y-关注,N-未关注,仅在公众账号类型支付有效
var
isSubscribe
=
res
.
GetParameter
(
"is_subscribe"
);
//银行类型,采用字符串类型的银行标识
var
bankType
=
res
.
GetParameter
(
"bank_type"
);
var
totalFee
=
res
.
GetParameter
(
"total_fee"
);
//货币类型,符合 ISO 4217 标准的三位字母代码,默认人民币:CNY
var
feeType
=
res
.
GetParameter
(
"fee_type"
);
//微信支付订单号
var
transactionId
=
res
.
GetParameter
(
"transaction_id"
);
//商户系统的订单号,与请求一致。
var
outTradeNo
=
res
.
GetParameter
(
"out_trade_no"
);
var
attach
=
res
.
GetParameter
(
"attach"
);
//格 式 为yyyyMMddhhmmss
var
timeEnd
=
res
.
GetParameter
(
"time_end"
);
#
endregion
//支付成功
if
(!
outTradeNo
.
Equals
(
""
)
&&
returnCode
.
Equals
(
"SUCCESS"
)
&&
resultCode
.
Equals
(
"SUCCESS"
))
{
return
new
BaseResult
()
{
IsSuccess
=
true
,
Data
=
new
Dictionary
<
string
,
string
>
{
{
"sOrderNo"
,
outTradeNo
},
{
"sTradeNo"
,
transactionId
},
{
"dPrice"
,
totalFee
},
{
"sPayerOpenID"
,
openid
},
{
"bIsRecharge"
,
attach
},
{
"OrderPayType"
,
tradeType
},
{
"PayDate"
,
timeEnd
}
}
};
}
else
{
LogHelper
.
WriteInfo
(
"Notify支付回调:returnMsg-"
+
returnMsg
);
}
}
else
{
LogHelper
.
Write
(
null
,
"Notify签名验证失败:"
);
}
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"Notify支付错误:"
);
}
return
new
BaseResult
()
{
IsSuccess
=
false
};
}
/// <summary>
/// 退款 传入订单号OrderNumber,RefundNumber,总金额total_fee(分),RefundFee退款金额(分),
/// </summary>
...
...
Mall.WebApi/Controllers/AppletWeChat/PublishController.cs
View file @
1d129701
...
...
@@ -37,15 +37,21 @@ namespace Mall.WebApi.Controllers.AppletWeChat
};
//读取小程序的配置文件
string
path
=
projectUrl
+
"/miniProject/common/vendor.js"
;
string
basePath
=
projectUrl
+
"/vendorbase.js"
;
string
jsonpath
=
projectUrl
+
"/miniProject/project.config.json"
;
string
basePath
=
projectUrl
+
"/vendorbase.js"
;
string
jsonbasePath
=
projectUrl
+
"/project.configbase.json"
;
var
model
=
appletWeChatModule
.
GetTenantListModule
(
query
).
FirstOrDefault
();
if
(
System
.
IO
.
File
.
Exists
(
path
)
&&
System
.
IO
.
File
.
Exists
(
jsonpath
))
{
try
{
if
(
model
.
LivePlayerPlugin
==
1
)
{
path
=
projectUrl
+
"/miniProjectLive/common/vendor.js"
;
jsonpath
=
projectUrl
+
"/miniProjectLive/project.config.json"
;
}
string
txtStr
=
System
.
IO
.
File
.
ReadAllText
(
basePath
);
string
newStr
=
txtStr
.
Replace
(
"$MallBaseId$"
,
query
.
MallBaseId
.
ToString
()).
Replace
(
"$TenantId$"
,
query
.
TenantId
.
ToString
()).
Replace
(
"$MiniAppId$"
,
model
.
MiniAppId
);
System
.
IO
.
File
.
WriteAllText
(
path
,
newStr
);
...
...
@@ -115,9 +121,32 @@ namespace Mall.WebApi.Controllers.AppletWeChat
[
HttpPost
]
public
ApiResult
GetPreviewAppletWeChat
()
{
var
parms
=
RequestParm
;
var
query
=
new
RB_MiniProgram_Extend
{
TenantId
=
UserInfo
.
TenantId
,
MallBaseId
=
parms
.
MallBaseId
};
var
model
=
appletWeChatModule
.
GetTenantListModule
(
query
).
FirstOrDefault
();
if
(
model
==
null
)
{
return
ApiResult
.
Failed
(
"您还未配置微信小程序基础信息"
);
}
try
{
string
URL
=
$"http://127.0.0.1:
{
developerKitsPort
}
/v2/preview?project=
{
Mall
.
Common
.
Plugin
.
StringHelper
.
UrlEncode
(
projectUrl
+
"/miniProject"
)}
&qr-format=base64"
;
string
path
=
projectUrl
+
"/miniProject"
;
if
(
string
.
IsNullOrWhiteSpace
(
model
.
Version
))
{
query
.
Version
=
"1.0.00"
;
}
if
(
model
.
LivePlayerPlugin
==
1
)
{
path
=
projectUrl
+
"/miniProjectLive"
;
}
string
URL
=
$"http://127.0.0.1:
{
developerKitsPort
}
/v2/preview?project=
{
Mall
.
Common
.
Plugin
.
StringHelper
.
UrlEncode
(
path
)}
&qr-format=base64"
;
// string URL = $"http://127.0.0.1:{developerKitsPort}/v2/preview?project={Mall.Common.Plugin.StringHelper.UrlEncode(projectUrl + "/miniProject")}&qr-format=base64";
string
result
=
Mall
.
Common
.
Plugin
.
HttpHelper
.
HttpGet
(
URL
,
Encoding
.
UTF8
,
""
);
if
(
result
.
Length
>
200
&&
!
result
.
Contains
(
"data:image/png;base64,"
))
{
...
...
@@ -162,16 +191,20 @@ namespace Mall.WebApi.Controllers.AppletWeChat
try
{
string
path
=
projectUrl
+
"/miniProject"
;
if
(
string
.
IsNullOrWhiteSpace
(
model
.
Version
))
{
query
.
Version
=
"1.0.00"
;
//1111
}
if
(
model
.
LivePlayerPlugin
==
1
)
{
path
=
projectUrl
+
"/miniProjectLive"
;
}
int
version
=
Convert
.
ToInt32
(
model
.
Version
.
Replace
(
"."
,
""
));
version
+=
1
;
model
.
Version
=
version
.
ToString
().
Substring
(
0
,
version
.
ToString
().
Length
-
3
)
+
"."
+
version
.
ToString
().
Substring
(
version
.
ToString
().
Length
-
3
,
1
)
+
"."
+
version
.
ToString
().
Substring
(
version
.
ToString
().
Length
-
2
,
2
);
string
URL
=
$"http://127.0.0.1:
{
developerKitsPort
}
/v2/upload?project=
{
Mall
.
Common
.
Plugin
.
StringHelper
.
UrlEncode
(
projectUrl
+
"/miniProject"
)}
&version=V
{
model
.
Version
}
&desc=微信开发者工具HTTP上传&appid=
{
model
.
MiniAppId
}
"
;
string
URL
=
$"http://127.0.0.1:
{
developerKitsPort
}
/v2/upload?project=
{
Mall
.
Common
.
Plugin
.
StringHelper
.
UrlEncode
(
path
)}
&version=V
{
model
.
Version
}
&desc=微信开发者工具HTTP上传&appid=
{
model
.
MiniAppId
}
"
;
//
string URL = $"http://127.0.0.1:{developerKitsPort}/v2/upload?project={Mall.Common.Plugin.StringHelper.UrlEncode(projectUrl + "/miniProject")}&version=V{model.Version}&desc=微信开发者工具HTTP上传&appid={model.MiniAppId}";
string
result
=
Mall
.
Common
.
Plugin
.
HttpHelper
.
HttpGet
(
URL
,
Encoding
.
UTF8
,
""
);
JObject
parmsJob
=
JObject
.
Parse
(
result
);
if
(
parmsJob
.
ContainsKey
(
"code"
))
...
...
@@ -576,8 +609,8 @@ namespace Mall.WebApi.Controllers.AppletWeChat
{
var
parms
=
RequestParm
;
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Live_HouseExtension_Extend
>(
RequestParm
.
msg
.
ToString
());
bool
flag
=
appletWeChatModule
.
SetLiveQrCodeModule
(
extModel
)
;
return
flag
?
ApiResult
.
Success
():
ApiResult
.
Failed
();
bool
flag
=
appletWeChatModule
.
SetLiveQrCodeModule
(
extModel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
...
...
Mall.WebApi/Controllers/AppletWeChat/WeChatPayController.cs
View file @
1d129701
...
...
@@ -93,7 +93,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
switch
((
int
)
demodel
.
OrderPayType
)
{
case
1
:
//微信支付 _accessor.HttpContext.Connection.RemoteIpAddress.ToString()
sPayInfo
=
App_Code
.
PayUtil
.
GetMinUnifiedOrder
(
sOrderNo
,
demodel
.
GoodsName
,
model
.
Income
.
Value
,
model
.
UserId
.
ToString
(),
demodel
.
OpenId
,
Config
.
sTenpayNotify
,
miniProgram
,
_accessor
,
System
.
Net
.
Dns
.
GetHostEntry
(
System
.
Net
.
Dns
.
GetHostName
()).
AddressList
.
FirstOrDefault
(
address
=>
address
.
AddressFamily
==
System
.
Net
.
Sockets
.
AddressFamily
.
InterNetwork
)?.
ToString
());
sPayInfo
=
App_Code
.
PayUtil
.
GetMinUnifiedOrder
(
sOrderNo
,
demodel
.
GoodsName
,
model
.
Income
.
Value
,
model
.
UserId
.
ToString
(),
demodel
.
OpenId
,
(
model
.
MallBaseId
==
6
&&
model
.
TenantId
==
16
)?
"http://mallapi.oytour.com/api/WeChatNotify/NotifyZhouTian"
:
Config
.
sTenpayNotify
,
miniProgram
,
_accessor
,
System
.
Net
.
Dns
.
GetHostEntry
(
System
.
Net
.
Dns
.
GetHostName
()).
AddressList
.
FirstOrDefault
(
address
=>
address
.
AddressFamily
==
System
.
Net
.
Sockets
.
AddressFamily
.
InterNetwork
)?.
ToString
());
break
;
default
:
break
;
...
...
Mall.WebApi/Controllers/Mall/MallController.cs
View file @
1d129701
...
...
@@ -385,6 +385,7 @@ namespace Mall.WebApi.Controllers.MallBase
{
id
=
miniProgram
.
MallBaseId
,
name
=
miniProgram
.
MallName
,
livePlayerPlugin
=
miniProgram
.
LivePlayerPlugin
,
user_id
=
0
,
created_at
=
miniProgram
.
CreateDate
.
HasValue
?
miniProgram
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
updated_at
=
miniProgram
.
CreateDate
.
HasValue
?
miniProgram
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
...
...
@@ -535,7 +536,7 @@ namespace Mall.WebApi.Controllers.MallBase
var
user_info
=
new
object
();
if
(
RequestParm
.
OpenId
!=
null
&&
!
string
.
IsNullOrWhiteSpace
(
RequestParm
.
OpenId
))
{
var
memberModel
=
userModule
.
GetAppletUserCenterStatistics
(
RequestParm
.
OpenId
);
var
memberModel
=
userModule
.
GetAppletUserCenterStatistics
(
RequestParm
.
OpenId
,
miniProgram
);
user_info
=
memberModel
;
}
...
...
@@ -595,7 +596,6 @@ namespace Mall.WebApi.Controllers.MallBase
link_url
=
qitem
.
MenuUrl
.
Trim
(),
open_type
=
"navigate"
,
@params
=
""
,
}),
nar_menus
=
miniProgram
?.
NavMoreList
?.
Select
(
x
=>
new
{
x
.
Sort
,
...
...
Mall.WebApi/Controllers/User/UserController.cs
View file @
1d129701
...
...
@@ -242,7 +242,7 @@ namespace Mall.WebApi.Controllers.User
{
var
parms
=
RequestParm
;
RB_Member_User_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Member_User_Extend
>(
parms
.
msg
.
ToString
());
string
ExcelName
=
"
用户列表
"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
".xls"
;
string
ExcelName
=
"
班级收支明细
"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
".xls"
;
List
<
ExcelDataSource
>
slist
=
new
List
<
ExcelDataSource
>();
if
(
demodel
.
ExcelEnumIds
==
null
||
!
demodel
.
ExcelEnumIds
.
Any
())
{
...
...
Test/App.config
View file @
1d129701
...
...
@@ -4,7 +4,7 @@
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.6"
/>
</
startup
>
<
connectionStrings
>
<
add
name
=
"DefaultConnection"
providerName
=
"MySql.Data.MySqlClient"
connectionString
=
"server=192.168.
2
.214;user id=reborn;password=Reborn@2018;database=reborn_mall;CharSet=utf8; Convert Zero Datetime=true; "
/>
<
add
name
=
"DefaultConnection"
providerName
=
"MySql.Data.MySqlClient"
connectionString
=
"server=192.168.
1
.214;user id=reborn;password=Reborn@2018;database=reborn_mall;CharSet=utf8; Convert Zero Datetime=true; "
/>
</
connectionStrings
>
<
system
.
data
>
<
DbProviderFactories
>
...
...
Test/Helper/MallHelper.cs
View file @
1d129701
...
...
@@ -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