-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 重构User - 更新request-promise
- Loading branch information
bubao
committed
Jul 22, 2020
1 parent
24144f1
commit ab6d752
Showing
5 changed files
with
113 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* @description: | ||
* @author: bubao | ||
* @Date: 2020-07-22 13:34:03 | ||
* @LastEditors: bubao | ||
* @LastEditTime: 2020-07-22 13:35:53 | ||
*/ | ||
const Base = require("../Base"); | ||
const API = require("../../config/api/index"); | ||
|
||
/** | ||
* @description 知乎专栏关注者 | ||
* @author bubao | ||
* @date 2020-07-21 | ||
* @class Followers | ||
* @extends {Base} | ||
*/ | ||
class Followers extends Base { | ||
/** | ||
*Creates an instance of Followers. | ||
* @author bubao | ||
* @date 2020-07-21 | ||
* @param {string} columnsId 专栏id | ||
* @param {headers} ReqOps request options | ||
* @memberof Articles | ||
*/ | ||
constructor (columnsId, ReqOps = {}) { | ||
super(); | ||
if (columnsId) { | ||
this.init(columnsId, ReqOps); | ||
} | ||
} | ||
|
||
/** | ||
* @description 初始化 | ||
* @author bubao | ||
* @date 2020-07-21 | ||
* @param {string} urlToken 专栏id | ||
* @param {headers} ReqOps request options | ||
* @memberof Articles | ||
*/ | ||
init (urlToken, ReqOps = {}) { | ||
this.ReqOps = { | ||
...this.ReqOps, | ||
...{ | ||
json: true, | ||
uri: API.user.followers({ url_token: urlToken }) | ||
}, | ||
...ReqOps | ||
}; | ||
this._next = this.ReqOps.uri; | ||
this.urlToken = urlToken; | ||
} | ||
} | ||
|
||
module.exports = Followers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* @description: | ||
* @author: bubao | ||
* @Date: 2020-07-22 13:38:18 | ||
* @LastEditors: bubao | ||
* @LastEditTime: 2020-07-22 13:39:23 | ||
*/ | ||
const { info, zhuanlansFocus } = require("./single"); | ||
const Followers = require("./Followers"); | ||
|
||
module.exports = { | ||
info, | ||
zhuanlansFocus, | ||
Followers | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @description: | ||
* @author: bubao | ||
* @Date: 2018-05-17 13:49:02 | ||
* @LastEditors: bubao | ||
* @LastEditTime: 2020-07-22 13:38:05 | ||
*/ | ||
|
||
const { request } = require("../../config/commonModules"); | ||
const API = require("../../config/api/index"); | ||
|
||
/** | ||
* @description user info | ||
* @author bubao | ||
* @date 2020-07-22 | ||
* @param {string} urlToken user id | ||
* @param {headers} [options={}] request options | ||
* @returns | ||
*/ | ||
function info (urlToken, options = {}) { | ||
options.uri = API.user.info({ url_token: urlToken }); | ||
return request(options); | ||
} | ||
|
||
/** | ||
* @description | ||
* @author bubao | ||
* @date 2020-07-22 | ||
* @param {string} urlToken user id | ||
* @param {headers} [options={}] request options | ||
* @returns | ||
*/ | ||
function zhuanlansFocus (urlToken, options = {}) { | ||
options.uri = API.user.zhuanlansFocus({ url_token: urlToken }); | ||
return request(options); | ||
} | ||
|
||
module.exports = { | ||
info, | ||
zhuanlansFocus | ||
}; |