|
@@ -221,6 +221,36 @@ class WeixinAuthService extends AxiosService {
|
|
|
data: JSON.stringify(requestData),
|
|
|
});
|
|
|
}
|
|
|
+ // openid绑定用户
|
|
|
+ async bindUser({ dock_id, role, openid }) {
|
|
|
+ if (role === '3') {
|
|
|
+ const url = 'http://127.0.0.1:9008/api/live/dock/' + dock_id;
|
|
|
+ const res = await this.ctx.curl(url, {
|
|
|
+ method: 'get',
|
|
|
+ headers: {
|
|
|
+ 'content-type': 'application/json',
|
|
|
+ },
|
|
|
+ dataType: 'json',
|
|
|
+ });
|
|
|
+ if (res.status === 200) {
|
|
|
+ if (res.data.errcode === 0) {
|
|
|
+ const data = res.data.data;
|
|
|
+ data.openid = openid;
|
|
|
+ console.log(data);
|
|
|
+ const ur = await this.ctx.curl(url, {
|
|
|
+ method: 'post',
|
|
|
+ headers: {
|
|
|
+ 'content-type': 'application/json',
|
|
|
+ },
|
|
|
+ dataType: 'json',
|
|
|
+ data: JSON.stringify(data),
|
|
|
+ });
|
|
|
+ if (ur.status === 200) return res.data;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
module.exports = WeixinAuthService;
|