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
a65870ba
Commit
a65870ba
authored
Apr 30, 2020
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add transferCustomerService
parent
7ba523c3
Pipeline
#22600
passed with stage
in 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
wechat.js
app/service/course/v5/wechat.js
+16
-3
No files found.
app/service/course/v5/wechat.js
View file @
a65870ba
...
@@ -50,17 +50,30 @@ class WechatService extends Service {
...
@@ -50,17 +50,30 @@ class WechatService extends Service {
return
;
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'
,
};
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
;
}
async
sendText
(
data
)
{
async
sendText
(
data
)
{
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
if
(
ctx
.
isEmpty
(
data
)
||
ctx
.
isEmpty
(
data
.
Content
)
||
!
data
.
Content
.
includes
(
'在线课程编号:'
))
{
if
(
ctx
.
isEmpty
(
data
)
||
ctx
.
isEmpty
(
data
.
Content
)
||
!
data
.
Content
.
includes
(
'在线课程编号:'
))
{
ctx
.
logger
.
info
(
data
.
Content
);
await
this
.
transferCustomerService
(
data
);
ctx
.
logger
.
info
(
data
.
Content
.
includes
(
'在线课程编号:'
));
return
;
return
;
}
}
const
id
=
data
.
Content
.
replace
(
'在线课程编号:'
,
''
);
const
id
=
data
.
Content
.
replace
(
'在线课程编号:'
,
''
);
const
classInfo
=
await
ctx
.
classModel
.
V5
.
CourseOnlineClass
.
findOne
({
where
:
{
id
}
});
const
classInfo
=
await
ctx
.
classModel
.
V5
.
CourseOnlineClass
.
findOne
({
where
:
{
id
}
});
ctx
.
logger
.
info
(
'course_v4: '
+
JSON
.
stringify
(
classInfo
));
const
content
=
ctx
.
isEmpty
(
classInfo
)
||
ctx
.
isEmpty
(
classInfo
.
channel
)
?
''
:
classInfo
.
channel
;
const
content
=
ctx
.
isEmpty
(
classInfo
)
||
ctx
.
isEmpty
(
classInfo
.
channel
)
?
''
:
classInfo
.
channel
;
const
token
=
await
this
.
getAccessToken
();
const
token
=
await
this
.
getAccessToken
();
const
url
=
'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token='
+
token
;
const
url
=
'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token='
+
token
;
...
...
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