Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
5
51business
Project
Project
Details
Activity
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
方斌
51business
Commits
1d732172
Commit
1d732172
authored
Apr 30, 2020
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add transferCustomerService
parent
a65870ba
Pipeline
#22607
passed with stage
in 12 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
17 deletions
+10
-17
wechat.js
app/service/course/v5/wechat.js
+10
-17
No files found.
app/service/course/v5/wechat.js
View file @
1d732172
...
...
@@ -39,29 +39,23 @@ class WechatService extends Service {
}
ctx
.
logger
.
info
(
data
.
MsgType
);
let
flag
=
true
;
if
(
data
.
MsgType
===
'miniprogrampage'
)
{
ctx
.
logger
.
info
(
'------------miniprogrampage---------'
);
await
this
.
sendImage
(
data
);
}
else
if
(
data
.
MsgType
===
'text'
)
{
ctx
.
logger
.
info
(
'------------sendText------'
);
await
this
.
sendText
(
data
);
flag
=
await
this
.
sendText
(
data
);
}
return
;
}
async
transferCustomerService
(
data
)
{
const
{
ctx
}
=
this
;
const
token
=
await
this
.
getAccessToken
();
const
url
=
'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token='
+
token
;
const
params
=
{
access_token
:
token
,
touser
:
data
.
FromUserName
,
msgtype
:
'transfer_customer_service'
,
if
(
!
flag
)
{
return
{
MsgType
:
'transfer_customer_service'
,
ToUserName
:
data
.
FromUserName
,
FromUserName
:
data
.
ToUserName
,
CreateTime
:
parseInt
(
new
Date
()
/
1000
),
};
ctx
.
logger
.
info
(
'course_wechat_v5_param: '
+
JSON
.
stringify
(
params
));
const
resp
=
await
ctx
.
helper
.
send_request
(
url
,
params
,
{
method
:
'POST'
});
ctx
.
logger
.
info
(
'course_wechat_v5_resp: '
+
JSON
.
stringify
(
resp
));
}
return
;
}
...
...
@@ -69,8 +63,7 @@ class WechatService extends Service {
const
{
ctx
}
=
this
;
if
(
ctx
.
isEmpty
(
data
)
||
ctx
.
isEmpty
(
data
.
Content
)
||
!
data
.
Content
.
includes
(
'在线课程编号:'
))
{
await
this
.
transferCustomerService
(
data
);
return
;
return
false
;
}
const
id
=
data
.
Content
.
replace
(
'在线课程编号:'
,
''
);
const
classInfo
=
await
ctx
.
classModel
.
V5
.
CourseOnlineClass
.
findOne
({
where
:
{
id
}
});
...
...
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