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
5c76ce9f
Commit
5c76ce9f
authored
Nov 07, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
1ce7fb4d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
3 deletions
+105
-3
TokenHelper.cs
Mall.Common/Pay/WeChatPat/TokenHelper.cs
+0
-2
WeChatMessageHelper.cs
Mall.Common/Plugin/WeChatMessageHelper.cs
+73
-0
WeiXinHelper.cs
Mall.Common/Plugin/WeiXinHelper.cs
+1
-1
AdapayController.cs
Mall.WebApi/Controllers/Adapay/AdapayController.cs
+31
-0
No files found.
Mall.Common/Pay/WeChatPat/TokenHelper.cs
View file @
5c76ce9f
...
...
@@ -91,6 +91,4 @@ namespace Mall.Common.Pay.WeChatPat
return
data
;
}
}
}
Mall.Common/Plugin/WeChatMessageHelper.cs
0 → 100644
View file @
5c76ce9f
using
Newtonsoft.Json.Linq
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Common.Plugin
{
/// <summary>
/// 推送客服消息
/// </summary>
public
class
WeChatMessageHelper
{
/// <summary>
/// 发送客服消息
/// </summary>
/// <param name="access_token">token</param>
/// <param name="touser">用户openId</param>
/// <param name="msgtype">消息类型。text表示文本消息;image表示图片消息;link表示图文链接;miniprogrampage表示小程序卡片。</param>
/// <param name="obj"></param>
public
static
bool
SendCustomerMessage
(
string
access_token
,
string
touser
,
string
targetUrl
,
out
string
message
)
{
message
=
""
;
bool
flag
=
false
;
string
responseStr
=
""
;
try
{
if
(
string
.
IsNullOrEmpty
(
access_token
))
{
flag
=
false
;
return
flag
;
}
//请求路径
string
url
=
string
.
Format
(
"https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}"
,
access_token
);
var
postData
=
new
{
touser
=
touser
,
msgtype
=
"text"
,
text
=
new
{
content
=
"您有一个新订单未支付,请点击链接地址进行支付 "
+
targetUrl
},
//link = new
//{
// title = "您有一个新订单代支付",
// description = "请打开浏览器支付",
// url = targetUrl,
// thumb_url = "",
//}
};
string
param
=
JsonHelper
.
Serialize
(
postData
);
responseStr
=
Common
.
Plugin
.
HttpHelper
.
HttpPost
(
url
,
param
,
contenttype
:
""
);
if
(
responseStr
!=
null
&&
!
string
.
IsNullOrEmpty
(
responseStr
))
{
JObject
jobj
=
JObject
.
Parse
(
responseStr
);
int
errcode
=
jobj
.
GetInt
(
"errcode"
);
if
(
errcode
==
0
)
{
flag
=
true
;
}
else
{
message
=
jobj
.
GetStringValue
(
"errmsg"
);
}
}
}
catch
(
Exception
ex
)
{
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
"SendCustomerMessage:result="
+
responseStr
);
}
return
flag
;
}
}
}
Mall.Common/Plugin/WeiXinHelper.cs
View file @
5c76ce9f
...
...
@@ -190,7 +190,7 @@ namespace Mall.Common.Plugin
}
/// <summary>
/// 获取用
心
信息帮助类
/// 获取用
户
信息帮助类
/// </summary>
public
class
GetUsersHelper
{
...
...
Mall.WebApi/Controllers/Adapay/AdapayController.cs
View file @
5c76ce9f
...
...
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using
System.Linq
;
using
AdapayCore
;
using
AdapaySDK
;
using
Mall.CacheManager.AppletWeChat
;
using
Mall.Common.API
;
using
Mall.Common.Plugin
;
using
Mall.Model.Extend.Product
;
...
...
@@ -28,6 +29,8 @@ namespace Mall.WebApi.Controllers.Adapay
private
readonly
UserCommonModule
userCommonModule
=
new
UserCommonModule
();
private
readonly
RB_Trade_ConfigRepository
trade_ConfigRepository
=
new
RB_Trade_ConfigRepository
();
private
readonly
MiniProgramModule
miniProgramModule
=
new
MiniProgramModule
();
/// <summary>
/// 获取支付信息
/// </summary>
...
...
@@ -94,6 +97,34 @@ namespace Mall.WebApi.Controllers.Adapay
}
}
/// <summary>
/// 发送客服消息
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SendMessage
()
{
var
jobj
=
JObject
.
Parse
(
base
.
RequestParm
.
msg
.
ToString
());
int
MallBaseId
=
17
;
string
toUser
=
""
;
string
targetUrl
=
""
;
toUser
=
"oyiQo5Gu34eaCeIAu8NG2NzM4ZIo"
;
targetUrl
=
"https://qr.alipay.com/bax00835y0gx4mzmeycd0020"
;
//toUser = base.AppletUserInfo.OpenId;
//targetUrl = jobj.GetStringValue("targetUrl");
string
postUrl
=
string
.
Format
(
"http://jj.kookaku.com/pages/pay/transition?aliuri={0}"
,
targetUrl
);
var
miniProgram
=
miniProgramModule
.
GetMiniProgramModule
(
new
Model
.
Extend
.
User
.
RB_MiniProgram_Extend
()
{
MallBaseId
=
MallBaseId
});
string
token
=
WeiXinReidsCache
.
Get
(
miniProgram
.
MiniAppId
);
if
(
string
.
IsNullOrEmpty
(
token
))
{
token
=
Mall
.
Common
.
Pay
.
WeChatPat
.
TokenHelper
.
GetLXYToken
(
token
,
miniProgram
.
MiniAppId
,
miniProgram
.
MiniAppSecret
);
System
.
Threading
.
Tasks
.
Task
.
Run
(()
=>
WeiXinReidsCache
.
Set
(
miniProgram
.
MiniAppId
,
token
));
}
bool
flag
=
Common
.
Plugin
.
WeChatMessageHelper
.
SendCustomerMessage
(
token
,
toUser
,
targetUrl
,
out
string
message
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
(
message
:
message
);
}
/// <summary>
/// 初始化
/// </summary>
...
...
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