import {Injectable} from "@angular/core";
import {HttpClient} from "@angular/common/http";
import {Http} from "@angular/http";
import {Observable} from "rxjs/Observable";
import {AppGlobal} from "../../service/http.service";
import {CommonService} from "../../provide/common.service";

@Injectable()
export class TabsService{
    constructor(
        private http:HttpClient,   //该请求 将结果转为json
        private commonSer:CommonService,
        private https:Http,    //该请求不转json
    ){}

    //获取权限
    getRoles(): Observable<any>{
        return this.http.get(AppGlobal.domain +'/wisdomgroup/app/getRoles', );
    }

    //获取参加活动的日期
    appOrderCal(): Observable<any>{
        return this.http.get(AppGlobal.domain +'/wisdomgroup/modules/order/appOrderCal');
    }

    //获取离沪日期
    appPreCal(): Observable<any>{
        return this.http.get(AppGlobal.domain +'/wisdomgroup/modules/userpre/appPreCal');
    }

    //每月值班信息
    getMyScheduleOnMonth(data): Observable<any>{
        return this.http.get(AppGlobal.domain +'/wisdomgroup/schedule/app/getMyScheduleOnMonth?'+this.commonSer.toQuery(data));
    }

    //获取节假日
    getFestivalAboutMonth(data): Observable<any>{
        return this.http.get(AppGlobal.domain +'/wisdomgroup/workCalendar/getFestivalAboutMonth?'+this.commonSer.toQuery(data));
    }

    //获取是否有新的活动
    hasNewActivity(): Observable<any>{
        return this.http.get(AppGlobal.domain +'/wisdomgroup/modules/activity/hasNewActivity');
    }

    //获取是否有新的通知
    hasNewNotice(): Observable<any>{
        return this.http.get(AppGlobal.domain +'/wisdomgroup/modules/notice/hasNewNotice');
    }

    //获取是否有新信息
    hasNewMessage(): Observable<any>{
        return this.http.get(AppGlobal.domain +'/wisdomgroup/modules/message/hasNewMessage');
    }

    //获取是否有新信息
    hasNewPremanager(): Observable<any>{
        return this.http.get(AppGlobal.domain +'/wisdomgroup/modules/premanager/hasNewPremanager');
    }

    //获取是否有新的问卷
    hasNewTest(): Observable<any>{
        return this.http.get(AppGlobal.domain +'/wisdomgroup/modules/learnTest/hasNewTest');
    }

    //问卷已读
    testAddRecodings(): Observable<any>{
        return this.https.get(AppGlobal.domain +'/wisdomgroup/modules/learnTest/addRecodings');
    }

    //活动已读
    activityAddRecodings(): Observable<any>{
        return this.https.get(AppGlobal.domain +'/wisdomgroup/modules/activity/addRecodings');
    }

    //下载文件
    downFile(data): Observable<any>{
        return this.http.get(AppGlobal.domain +'/wisdomgroup/modules/common/file/download/'+data,{responseType: 'blob'});
    }

}