package com.dollearn.student.network
|
|
import cn.sinata.xldutils.data.ResultData
|
import com.google.gson.JsonObject
|
import com.dollearn.student.DollearnApplication
|
import com.dollearn.student.network.entity.*
|
import com.dollearn.student.utils.pay.PayInfo
|
import com.google.gson.Gson
|
import io.reactivex.Flowable
|
|
object HttpManager {
|
|
/**
|
* 发起请求方法
|
*/
|
private fun request() =
|
RRetrofit.instance().create(ApiService::class.java)
|
|
/**
|
* 获取h5
|
* @param type 1=用户协议,2=隐私协议,3=注销
|
*/
|
fun getH5(type: Int): Flowable<ResultData<String>> {
|
return request().getH5(type)
|
}
|
|
/**
|
* 用户信息
|
*/
|
fun userDetails(): Flowable<ResultData<UserBean>> {
|
return request().userDetails()
|
}
|
|
|
/**
|
* 分享信息
|
*/
|
fun shareInfo(): Flowable<ResultData<ConfigBean>> {
|
return request().shareInfo()
|
}
|
|
/**
|
* 学习记录
|
*/
|
fun studyRecord(): Flowable<ResultData<StudyRecord>> {
|
return request().studyRecord()
|
}
|
|
|
/**
|
* 获取验证码
|
*/
|
fun getCode(phone: String): Flowable<ResultData<Any>> {
|
return request().getCode(phone)
|
}
|
|
/**
|
* 获取正确和错误语音
|
*/
|
fun promptVoice(): Flowable<ResultData<ConfigBean>> {
|
return request().promptVoice()
|
}
|
|
/**
|
* 商品推荐
|
*/
|
fun goodRecommend(): Flowable<ResultData<ArrayList<Goods>?>> {
|
return request().goodRecommend()
|
}
|
|
|
/**
|
* 根据季度获取周目列表
|
*/
|
fun weekList(season:Int,type: Int = 1): Flowable<ResultData<ArrayList<Week>?>> {
|
return request().weekList(season,type)
|
}
|
|
/**
|
* 用户学习进度
|
*/
|
fun studySchedule(week:Int,day:Int): Flowable<ResultData<Schedule>> {
|
return request().studySchedule(week,day)
|
}
|
|
/**
|
* 获取在线时间赠送积分信息(单位分钟)
|
*/
|
fun onlineDuration(): Flowable<ResultData<String>> {
|
return request().onlineDuration()
|
}
|
|
/**
|
* 获取在线时间赠送积分信
|
*/
|
fun giveIntegral(): Flowable<ResultData<Boolean>> {
|
return request().giveIntegral()
|
}
|
|
/**
|
* 验证码登录
|
*/
|
fun captchaLogin(code: String, phone: String): Flowable<ResultData<LoginBean?>> {
|
return request().captchaLogin(Gson().toJson(ReqLogin(phone,code)))
|
}
|
|
/**
|
* 获取String类型通用接口
|
*/
|
fun queryString(url: String, map: HashMap<String, Any>): Flowable<ResultData<String>> {
|
return request().queryString(url, map)
|
}
|
|
/**
|
* 保存进度
|
*/
|
fun exitLearning(schedule: Int,season: Int,studyTime: Int,answerNumber: Int,correctNumber: Int,day: Int,week: Int,type: Int,teamIds:String,topicIds:String): Flowable<ResultData<Any>> {
|
return request().exitLearning(Gson().toJson(ReqSaveProgress(schedule+1,season,answerNumber,correctNumber,day, week, studyTime,type, teamIds, topicIds)))
|
}
|
|
/**
|
* 保存游戏和故事时间
|
*/
|
fun exitGameOrStory(studyTime: Int): Flowable<ResultData<Any>> {
|
return request().exitGameOrStory(studyTime)
|
}
|
|
/**
|
* 重新开始答题
|
*/
|
fun restart(day: Int,week: Int,type: Int): Flowable<ResultData<Any>> {
|
return request().restart(Gson().toJson(ReqRestart(day,type,week)))
|
}
|
|
/**
|
* 保存当前题目记录
|
*/
|
fun answerQuestion(sortBean: SortBean): Flowable<ResultData<Any>> {
|
return request().answerQuestion(Gson().toJson(sortBean))
|
}
|
|
/**
|
* 完成学习
|
*/
|
fun completeLearning(rate: Int,time: Int,day: Int,week: Int,season: Int,type: Int,teamIds:String): Flowable<ResultData<Int?>> {
|
return request().completeLearning(Gson().toJson(ReqFinishStudy(rate,day,season,teamIds,time,type,week)))
|
}
|
|
/**
|
* 完成故事
|
*/
|
fun completeStory(rate: Int,type: Int,storyId:String,time: Int): Flowable<ResultData<Int?>> {
|
return request().completeStory(rate,storyId, type,time)
|
}
|
|
/**
|
* 完成游戏
|
*/
|
fun gameAchievement(rate: Int,difficulty: Int,gameId:String,gameName:String,useTime:Int): Flowable<ResultData<Int?>> {
|
return request().gameAchievement(Gson().toJson(ReqFinishGame(rate,difficulty,gameId,gameName, useTime)))
|
}
|
|
/**
|
* 获取可用游戏难度
|
*/
|
fun userGameDifficulty(week: Int): Flowable<ResultData<Int?>> {
|
return request().userGameDifficulty(week)
|
}
|
|
/**
|
* 题目二是否展示文字
|
*/
|
fun getIsOpen(): Flowable<ResultData<Boolean>> {
|
return request().getIsOpen()
|
}
|
|
/**
|
* 回复进度
|
*/
|
fun teamSchedule(day: Int,week: Int,type: Int): Flowable<ResultData<ProgressBean>> {
|
return request().teamSchedule(day, type, week)
|
}
|
|
/**
|
* 注销
|
*/
|
fun cancellation(): Flowable<ResultData<Any>> {
|
return request().cancellation()
|
}
|
|
/**
|
* 商品类型
|
*/
|
fun goodTypeStudy(): Flowable<ResultData<ArrayList<GoodsType>>> {
|
return request().goodTypeStudy()
|
}
|
|
/**
|
* 剩余分数
|
*/
|
fun getIntegralStudy(): Flowable<ResultData<Int?>> {
|
return request().getIntegralStudy()
|
}
|
|
/**
|
* 听音选图题
|
*/
|
fun listenSelectPicture(season: Int,week: Int,day: Int): Flowable<ResultData<SubjectBean>> {
|
return request().listenSelectPicture(day,season,week)
|
}
|
|
/**
|
* 看图选音题
|
*/
|
fun pictureSelectVoice(season: Int,week: Int,day: Int): Flowable<ResultData<SubjectBean>> {
|
return request().pictureSelectVoice(day,season,week)
|
}
|
|
/**
|
* 归纳排除
|
*/
|
fun induceExclude(season: Int,week: Int,day: Int): Flowable<ResultData<SubjectBean>> {
|
return request().induceExclude(day,season,week)
|
}
|
|
/**
|
* 音图配
|
*/
|
fun pictureMateVoice(season: Int,week: Int,day: Int): Flowable<ResultData<SubjectBean>> {
|
return request().pictureMateVoice(day,season,week)
|
}
|
|
/**
|
* 看图配音
|
*/
|
fun lookPictureDbu(season: Int,week: Int): Flowable<ResultData<StoryBean>> {
|
return request().lookPictureDbu(season,week)
|
}
|
|
/**
|
* 超级听力
|
*/
|
fun gameHearing(season: Int,week: Int,difficulty:Int): Flowable<ResultData<GameBean>> {
|
return request().gameHearing(season,week,difficulty)
|
}
|
|
/**
|
* 记忆
|
*/
|
fun gameMemory(season: Int,week: Int): Flowable<ResultData<MemoryBean>> {
|
return request().gameMemory(season,week)
|
}
|
|
/**
|
* 记忆
|
*/
|
fun frameworkMemory(season: Int,week: Int): Flowable<ResultData<StoryBean>> {
|
return request().frameworkMemory(season,week)
|
}
|
|
/**
|
* 又问又答
|
*/
|
fun questionsAndAnswers(season: Int,week: Int,day: Int): Flowable<ResultData<SubjectBean>> {
|
return request().questionsAndAnswers(day,season,week)
|
}
|
|
/**
|
* 立即兑换
|
*/
|
fun redeemNow(id:String): Flowable<ResultData<GoodsOrder>> {
|
return request().redeemNow(id)
|
}
|
|
/**
|
* 确认收货
|
*/
|
fun confirmStudy(id:String): Flowable<ResultData<Any>> {
|
return request().confirmStudy(id)
|
}
|
|
/**
|
* 设置默认地址
|
*/
|
fun setDefaultStudy(id:String): Flowable<ResultData<Any>> {
|
return request().setDefaultStudy(id)
|
}
|
|
/**
|
* 删除地址
|
*/
|
fun addressDelete(id:String): Flowable<ResultData<Any>> {
|
return request().addressDelete(id)
|
}
|
|
/**
|
* 积分明细
|
*/
|
fun integralDetail(page: Int,time: String?): Flowable<ResultData<ScoreRecordBean>> {
|
return request().integralDetail(page,time = time)
|
}
|
|
/**
|
* 省市
|
*/
|
fun addressTree(): Flowable<ResultData<List<Province>>> {
|
return request().addressTree()
|
}
|
|
/**
|
* 修改地址列表
|
*/
|
fun getOrderAddress(): Flowable<ResultData<List<Recipient>>> {
|
return request().getOrderAddress()
|
}
|
|
/**
|
* 地址列表
|
*/
|
fun shopAddress(): Flowable<ResultData<List<Recipient>>> {
|
return request().shopAddress()
|
}
|
|
/**
|
* 地址加 改
|
*/
|
fun addressSaveOrUpdate(address:String,cityCode: String,city:String,province:String,provinceCode: String,isDefault:Int,name:String,phone: String,id: String?): Flowable<ResultData<Any>> {
|
return request().addressSaveOrUpdate(Gson().toJson(ReqAddAddress(address,city,cityCode,isDefault,province,provinceCode,name,phone,id)))
|
}
|
|
/**
|
* 确认兑换
|
*/
|
fun goodExchangeStudy(id:String,number:Int,orderNumber:String,recipientId:String,remark:String): Flowable<ResultData<Any>> {
|
return request().goodExchangeStudy(Gson().toJson(ReqExchange(id,number, orderNumber, recipientId, remark)))
|
}
|
|
/**
|
* 修改地址
|
*/
|
fun updateOrderAddress(id:String,recipientId:String): Flowable<ResultData<Any>> {
|
return request().updateOrderAddress(id, recipientId)
|
}
|
|
/**
|
* 地址详情
|
*/
|
fun getAddressByIdStudy(id:String): Flowable<ResultData<Recipient>> {
|
return request().getAddressByIdStudy(id)
|
}
|
|
/**
|
* 商品列表
|
*/
|
fun goodListStudy(page: Int,search: String?,type: List<String>): Flowable<ResultData<GoodsList>> {
|
return request().goodListStudy(Gson().toJson(ReqGoodsList(search,page,16,type)))
|
}
|
|
/**
|
* 商品详情
|
*/
|
fun goodDetail(id: String): Flowable<ResultData<GoodsDetail>> {
|
return request().goodDetail(id)
|
}
|
|
|
/**
|
* 兑换记录
|
*/
|
fun exchangeRecord(page: Int): Flowable<ResultData<ExchangeRecordBean>> {
|
return request().exchangeRecord(page)
|
}
|
}
|