123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- 'use strict';
- /**
- * cld接口模型
- *
- * @author EllisRan.
- * @date 2018/9/25
- * @version
- */
- const Request = require("request");
- const BaseModel = require("../../common/base/base_model");
- class CLDModel extends BaseModel {
- CLDUrl = 'http://cld.smartcost.com.cn';
- /**
- * 获取办事处人员信息
- *
- * @param cid
- * @return {Promise}
- */
- async getCategoryStaff(cid) {
- let postData = {
- url: this.CLDUrl + '/api/building/category/staff/' + cid,
- encoding: 'utf8'
- };
- return new Promise(function (resolve, reject) {
- try {
- // 请求接口
- Request.post(postData, function (err, postResponse, body) {
- if (err) {
- throw '请求错误';
- }
- if (postResponse.statusCode !== 200) {
- throw 'CLD通讯失败!';
- }
- resolve(body);
- });
- } catch (error) {
- reject([]);
- }
- });
- }
- }
- module.exports = CLDModel;
|