/** * Created by NICK on 15/6/17. * email:nick121212@126.com * qq:289412378 * copyright NICK */ import ref = require('ref'); export class PutongService { public static _name:string = 'PutongService'; public static factory:Array = ['$rootScope', '$q', '$http', 'config', ($rootScope, $q, $http, config):any=> { return { /* * 生成七牛上传token,有效期1小时,1小时内无限用 * */ gen_qiniu_upload_token: ()=> { var promise = $http({ method: 'GET', url: config.putong_api_url + '/putong/gen_qiniu_upload_token', needToken: true, }).success(function (data) { }); return promise; }, /* * 举报帖子 * */ report_a_post: (model:Dashboard.ReportModel)=> { var promise = $http({ method: 'POST', url: config.putong_api_url + '/putong/report_a_post', data: { report_type: model.reportType, post_type: model.postType, report_content: model.reportContent, post_id: model.postData && model.postData.postId, reply_id: model.replyData && model.replyData.postId }, needToken: true, }); return promise; }, show_a_post: (model:Dashboard.PostModel)=> { return $http({ method: 'GET', url: config.putong_api_url + '/putong/show_a_post', params: { post_id: model.postId, page: 1, is_only_show_louzhu: true }, needToken: false }); }, add_a_question: (model:Brave.QuestionModel)=> { return $http({ method: 'POST', url: config.putong_api_url + '/odw/add_a_question', data: { title: model.title, question: model.question, background_url: model.backgroundUrl, tower: model.tower, chapter_num: model.chapter, stage_num: model.stage, options: JSON.stringify(model.options) }, needToken: true }); } }; }]; } //serverModule.module.factory('PutongService', PutongService.factory);