lmw
昨天 9904e5f900ba751c1fe719cdf889f00e9f1418e8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
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)
    }
}