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
1748f3ea
Commit
1748f3ea
authored
Nov 07, 2022
by
liudong1993
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/Kui2/mall.oytour.com
parents
ea45a710
98511c35
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
13 deletions
+23
-13
WeChatMessageHelper.cs
Mall.Common/Plugin/WeChatMessageHelper.cs
+3
-1
MessageController.cs
Mall.WebApi/Controllers/Adapay/MessageController.cs
+20
-12
No files found.
Mall.Common/Plugin/WeChatMessageHelper.cs
View file @
1748f3ea
...
...
@@ -32,9 +32,11 @@ namespace Mall.Common.Plugin
return
flag
;
}
string
content
=
string
.
Format
(
"您有{0}个新订单未支付,请点击链接地址进行支付! "
,
pushUrlList
.
Count
);
int
index
=
1
;
foreach
(
var
item
in
pushUrlList
)
{
content
+=
item
+
" \r\n"
;
content
+=
string
.
Format
(
"订单{0}:"
+
item
+
" \n"
,
index
);
index
++;
}
//请求路径
string
url
=
string
.
Format
(
"https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}"
,
access_token
);
...
...
Mall.WebApi/Controllers/Adapay/MessageController.cs
View file @
1748f3ea
...
...
@@ -91,31 +91,39 @@ namespace Mall.WebApi.Controllers.Adapay
Request
.
Body
.
Position
=
0
;
}
#
endregion
Common
.
Plugin
.
LogHelper
.
Write
(
"请求参数:: responseData"
+
responseData
);
if
(!
string
.
IsNullOrEmpty
(
responseData
))
{
JObject
jobj
=
JObject
.
Parse
(
responseData
);
string
openId
=
jobj
.
GetStringValue
(
"FromUserName"
);
string
MsgType
=
jobj
.
GetStringValue
(
"MsgType"
);
string
Conten
=
jobj
.
GetStringValue
(
"Content"
);
if
(
MsgType
==
"text"
&&
string
.
IsNullOrEmpty
(
openId
)
&&
!
string
.
IsNullOrEmpty
(
"支付"
))
string
Content
=
jobj
.
GetStringValue
(
"Content"
);
Common
.
Plugin
.
LogHelper
.
Write
(
$"请求参数:: openId:
{
openId
}
MsgType:
{
MsgType
}
Content:
{
Content
}
"
);
if
(
MsgType
==
"text"
&&
!
string
.
IsNullOrEmpty
(
openId
)
&&
!
string
.
IsNullOrEmpty
(
Content
)
&&
Content
.
Contains
(
"支付"
))
{
Task
.
Run
(()
=>
{
Common
.
Plugin
.
LogHelper
.
WriteInfo
(
$"消息_推送客服消息:
{
openId
}
"
);
string
payInfoKey
=
CacheManager
.
DataStatistic
.
DataConstant
.
DATA_AliPay_Order
+
openId
;
Common
.
Plugin
.
LogHelper
.
WriteInfo
(
$"消息_推送客服消息:获取缓存"
);
var
zfbPayList
=
UserReidsCache
.
GetOrderPay
(
payInfoKey
);
List
<
string
>
pushUrlList
=
new
List
<
string
>();
foreach
(
var
item
in
zfbPayList
)
if
(
zfbPayList
!=
null
&&
zfbPayList
.
Count
>
0
)
{
if
(!
pushUrlList
.
Contains
(
item
.
PayInfo
))
Common
.
Plugin
.
LogHelper
.
WriteInfo
(
$"消息_推送客服缓存:
{
JsonHelper
.
Serialize
(
zfbPayList
)}
"
);
List
<
string
>
pushUrlList
=
new
List
<
string
>();
foreach
(
var
item
in
zfbPayList
)
{
pushUrlList
.
Add
(
item
.
PayInfo
);
if
(!
pushUrlList
.
Contains
(
item
.
PayInfo
))
{
pushUrlList
.
Add
(
item
.
PayInfo
);
}
}
Common
.
Plugin
.
LogHelper
.
WriteInfo
(
$"消息_删除缓存"
);
//删除缓存
UserReidsCache
.
DeleteMiniAppUsetOpenId
(
payInfoKey
);
SendMessage
(
openId
,
pushUrlList
);
Common
.
Plugin
.
LogHelper
.
WriteInfo
(
$"消息_推送客服消息:
{
openId
}
,地址:
{
JsonHelper
.
Serialize
(
pushUrlList
)}
"
);
}
//删除缓存
UserReidsCache
.
DeleteMiniAppUsetOpenId
(
payInfoKey
);
SendMessage
(
openId
,
pushUrlList
);
Common
.
Plugin
.
LogHelper
.
WriteInfo
(
$"消息_推送客服消息:
{
openId
}
,地址:
{
JsonHelper
.
Serialize
(
pushUrlList
)}
"
);
});
}
}
...
...
@@ -153,7 +161,7 @@ namespace Mall.WebApi.Controllers.Adapay
System
.
Threading
.
Tasks
.
Task
.
Run
(()
=>
WeiXinReidsCache
.
Set
(
miniProgram
.
MiniAppId
,
token
));
}
Common
.
Plugin
.
LogHelper
.
WriteInfo
(
$"SendMessage:
{
token
}
"
);
bool
flag
=
Common
.
Plugin
.
WeChatMessageHelper
.
SendCustomerMessage
(
token
,
toUser
,
targer
List
,
out
string
message
);
bool
flag
=
Common
.
Plugin
.
WeChatMessageHelper
.
SendCustomerMessage
(
token
,
toUser
,
push
List
,
out
string
message
);
}
}
}
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