123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- const Api = require('../net/Api');
- class HomeApi {
- /**
- * 获取目标用户的建筑
- * @param targetUid [long] 目标用户,当前用户就传自己的uid 的值
- * @param cityId [long] 城市 id
- */
- static getUserBuildings(targetUid, cityId, success, fail) {
- let url = "/building/getUserBuildings.do";
- let data = {
- targetUid: targetUid,
- cityId: cityId,
- };
- Api.httpGet(this.setRequestBody(url, data, success, fail));
- }
- /**
- * 升级建筑
- * @param buildingId [int] 建筑Id
- * @param cityId [int] 城市id
- * @param grossIncome [int] 当前总金币数
- * @param grossRate [int] 自动收入金额
- * @param level [int] 建筑等级
- * @param stars [int] 星星数
- *
- * */
- static buildingUpGrade(formmInfoJson, success, fail) {
- let url = "/building/upGrade.do";
- let data = {
- formInfo: formmInfoJson,
- };
- Api.httpPost(this.setRequestBody(url, data, success, fail));
- }
- /**
- * 获取首页好友列表
- * */
- static getFriends(success, fail) {
-
- let url = "/friend/getIndexList.do";
- Api.httpGet(this.setRequestBody(url, {}, success, fail));
- }
- /**
- * 主界面艺人管理列表
- */
- static getFriendManageList(success, fail) {
- let url = "/friend/getManageList.do";
- Api.httpGet(this.setRequestBody(url, {}, success, fail));
- }
- /**
- * 上报接口
- * @param {*} reportFormInfo {"grossIncome":1000,"grossRate":10000,"stars":1}
- * @param {*} success
- * @param {*} fail
- */
- static userReportGross(reportFormInfo, success, fail) {
- let url = "/building/report.do";
- let data = {
- reportFormInfo: reportFormInfo,
- };
- Api.httpPost(this.setRequestBody(url, data, success, fail));
- }
- /**
- * 获取好友艺人列表
- * @param {int} fid 好友uid
- * @param {*} success
- * @param {*} fail
- */
- static friendGetArtists(fid, success, fail) {
- let url = "/friend/getArtists.do";
- let data = {
- fid: fid,
- };
- Api.httpGet(this.setRequestBody(url, data, success, fail));
- }
- /**
- * 获取好友艺人列表
- * @param {int} buildingId 建筑对应的 buildingId
- * @param {*} success
- * @param {*} fail
- */
- static friendGetArtistsByBuildingId(targetUid, buildingId, success, fail) {
- let url = "/friend/station/getArtists.do";
- let data = {
- targetUid: targetUid,
- buildingId: buildingId,
- };
- Api.httpGet(this.setRequestBody(url, data, success, fail));
- }
- /**
- * 艺人入驻
- * @param {*} formmInfoJson
- * @param {*} success
- * @param {*} fail
- */
- static friendStation(formmInfoJson, success, fail) {
- let url = "/friend/station.do";
- let data = {
- form: formmInfoJson,
- };
- Api.httpPost(this.setRequestBody(url, data, success, fail));
- }
- /**
- * 艺人的驱赶召回
- * @param {*} formmInfoJson
- * @param {*} success
- * @param {*} fail
- */
- static friendExpelRecall(artistUid, success, fail) {
- let url = "/friend/expelRecall.do";
- let data = {
- artistUid: artistUid,
- };
- Api.httpPost(this.setRequestBody(url, data, success, fail));
- }
- /**
- * 获取用户对应建筑入驻的艺人列表
- * @param {*} targetUid 目标用户(是谁的家园,目标用户就是谁)
- * @param {*} buildingId 建筑id
- * @param {*} success
- * @param {*} fail
- */
- static friendGetArtistsInBuilding(targetUid, buildingId, success, fail) {
- let url = "/friend/getArtistsInBuilding.do";
- let data = {
- targetUid: targetUid,
- buildingId: buildingId
- };
- Api.httpGet(this.setRequestBody(url, data, success, fail));
- }
- /**
- * 入驻艺人收益
- * @param {*} formmInfoJson
- * @param {*} success
- * @param {*} fail
- */
- static friendGetBenefit(artistUid, success, fail) {
- let url = "/friend/getBenefit.do";
- let data = {
- artistUid: artistUid,
- };
- Api.httpPost(this.setRequestBody(url, data, success, fail));
- }
- /**
- * 举报艺人
- * @param {*} formmInfoJson
- * @param {*} success
- * @param {*} fail
- */
- static friendReportArtist(artistUid, success, fail) {
- let url = "/friend/reportArtist.do";
- let data = {
- artistUid: artistUid,
- };
- Api.httpPost(this.setRequestBody(url, data, success, fail));
- }
- // 生成一个 RequestBody, 总是要写重复代码, 太恶心了
- static setRequestBody(url, data, success, fail) {
- let requestBody = {
- url: url,
- data: data,
- success: success,
- fail: fail,
- complete: () => {
- }
- };
- return requestBody;
- }
- }
- module.exports = HomeApi;
|