lmw
2025-01-10 601f14db94013373df700e007095f7f2f5ecbe24
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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
package com.sinata.xqmuse.network
 
import cn.sinata.xldutils.data.ResultData
import com.google.gson.Gson
import com.google.gson.JsonObject
import com.sinata.xqmuse.network.entity.*
import com.sinata.xqmuse.network.entity.req.*
import com.sinata.xqmuse.ui.mine.WatchHisActivity
import com.sinata.xqmuse.utils.Const
import com.sinata.xqmuse.utils.pay.PayInfo
import io.reactivex.Flowable
import retrofit2.http.Field
 
object HttpManager {
 
    /**
     * 发起请求方法
     */
    private fun request() =
        RRetrofit.instance().create(ApiService::class.java)
 
    /**
     * 获取h5
     * @param type 1=用户协议,2=隐私协议 3=关于心泉 4=新手冥想指南 5=课程/冥想音频购买协议
     */
    fun getH5(type: Int): Flowable<ResultData<H5Bean>> {
        return request().getH5(type)
    }
 
    /**
     * 支付结果
     */
    fun success(
        id: String
    ): Flowable<ResultData<Coupon>> {
        return request().success(id)
    }
 
    /**
     * 体检报告
     */
    fun queryPhysical(id: String): Flowable<ResultData<Report>> {
        return request().queryPhysical(id)
    }
 
 
    /**
     * 打卡
     */
    fun clockIn(courseId: String): Flowable<ResultData<FinishBean>> {
        return request().clockIn(courseId)
    }
 
    /**
     * 课程列表
     */
    fun queryCourseList(
        page: Int,
        type: String? = null,
        search: String? = null
    ): Flowable<ResultData<CourseListBean>> {
        return request().queryCourseList(page,type,search)
    }
 
    /**
     * 导师
     */
    fun getCoursePageList(): Flowable<ResultData<TeacherBean>> {
        return request().getCoursePageList()
    }
 
    /**
     * 课程详情
     */
    fun getPayCourseInfoById(id: String): Flowable<ResultData<CourseDetail>> {
        return request().getPayCourseInfoById(id)
    }
 
 
    /**
     * 课程收藏
     */
    fun collectCourse(id: String): Flowable<ResultData<Any>> {
        return request().collectCourse(id)
    }
 
 
    /**
     * 我的动态
     */
    fun myFind(page: Int): Flowable<ResultData<ArrayList<Dynamic>>> {
        return request().myFind(page)
    }
 
    /**
     * 推广信息
     */
    fun shareInfo(): Flowable<ResultData<ShareInfo>> {
        return request().shareInfo()
    }
 
    /**
     * 我的课程列表
     */
    fun lookHistory(type: Int,page: Int,state:Int): Flowable<ResultData<List<CourseBean>>> {
        val url = if (type == WatchHisActivity.WATCH_HIS) Apis.lookHistory else if (type == WatchHisActivity.COLLECTED) Apis.myCollect else Apis.myOrderCourse
        val id = if (type == WatchHisActivity.WATCH_HIS) "361bdf123992fb" else if (type == WatchHisActivity.COLLECTED) "365e099bb9988b" else "365f4fc1b99030"
        return request().lookHistory(url,page,10,state,id)
    }
 
    fun getVipPrice(): Flowable<ResultData<VipPriceBean>> {
        return request().getVipPrice()
    }
 
 
    /**
     * @param type 1=会员权益介绍 2=会员用户协议 3=续费管理说明
     */
    fun getVipContent(type: Int): Flowable<ResultData<String>> {
        return request().getVipContent(type)
    }
 
    fun getQrCode(): Flowable<ResultData<String>> {
        return request().getQrCode()
    }
 
    fun commonQuestion(page: Int): Flowable<ResultData<QABean>> {
        return request().commonQuestion(page,10)
    }
 
    fun healingLevel(): Flowable<ResultData<LevelBean>> {
        return request().healingLevel()
    }
 
    fun queryNotice(): Flowable<ResultData<Boolean>> {
        return request().queryNotice()
    }
 
    fun balanceList(page: Int,state: Int): Flowable<ResultData<WalletDetailBean>> {
        return request().balanceList(page,state,Const.PAGE_SIZE)
    }
 
    fun energyDetail(page: Int,state: Int): Flowable<ResultData<List<PowerDetail>>> {
        return request().energyDetail(page,state,Const.PAGE_SIZE)
    }
 
    fun goodsList(page: Int): Flowable<ResultData<List<Gift>>> {
        return request().goodsList(page,Const.PAGE_SIZE)
    }
 
    fun exchangeRecordList(page: Int): Flowable<ResultData<List<Gift>>> {
        return request().exchangeRecordList(page,Const.PAGE_SIZE)
    }
 
    fun restart(): Flowable<ResultData<Any>> {
        return request().restart()
    }
 
    fun getTotalEnergyValue(): Flowable<ResultData<Int>> {
        return request().getTotalEnergyValue()
    }
 
    fun exchange(id: String): Flowable<ResultData<String>> {
        return request().exchange(id)
    }
 
    fun balanceDetail(id: String): Flowable<ResultData<BalanceDetail>> {
        return request().balanceDetail(id)
    }
 
    fun bankList(): Flowable<ResultData<List<BankInfo>>> {
        return request().bankList()
    }
 
    fun addBank(bank: String,name: String,phone: String,idCard:String,num: String,code: String): Flowable<ResultData<Any>> {
        return request().addBank(Gson().toJson(BankInfo(bank,num,name,phone,idCard,code)))
    }
 
    fun deleteBank(id: String): Flowable<ResultData<Any>> {
        return request().deleteBank(id)
    }
 
    fun withdraw(id: String,money: Double): Flowable<ResultData<Any>> {
        return request().withdraw(id,money)
    }
 
    fun noticeDetail(id: String): Flowable<ResultData<MsgDetail>> {
        return request().noticeDetail(id)
    }
 
    fun changePhone(code: String,phone: String): Flowable<ResultData<Any>> {
        return request().changePhone(code, phone)
    }
 
    fun deleteUser(): Flowable<ResultData<Any>> {
        return request().deleteUser()
    }
 
    fun studyPage(): Flowable<ResultData<StudyBean>> {
        return request().studyPage()
    }
 
    fun detailVersion(): Flowable<ResultData<Version>> {
        return request().detailVersion()
    }
 
    /**
     * 提现
     */
    fun withdrawal(money: Double): Flowable<ResultData<Any>> {
        return request().withdrawal(money)
    }
 
    fun bindVx(openid: String,wxName:String): Flowable<ResultData<Any>> {
        return request().bindVx(openid,wxName)
    }
 
    /**
     * 提现记录
     */
    fun withdrawalRecord(page: Int,year: Int?,month: Int?): Flowable<ResultData<List<Detail>>> {
        return request().withdrawalRecord(page,month, year)
    }
 
    /**
     * 获取验证码
     */
    fun getCode(phone: String, type: Int): Flowable<ResultData<Any>> {
        return request().getCode(phone, type)
    }
 
    /**
     * 验证验证码
     */
    fun verifyPhone(phone: String, code: String): Flowable<ResultData<VerifyBean>> {
        return request().verifyPhone("{\"captcha\":\"${code}\",\"cellPhone\":\"${phone}\"}")
    }
 
    /**
     * 保存个性设置
     */
    fun saveUserAnswers(answer: ReqAnswer): Flowable<ResultData<Any>> {
        return request().saveUserAnswers(Gson().toJson(answer))
    }
 
    /**
     * 引导音乐
     */
    fun getPlan(): Flowable<ResultData<String>> {
        return request().getPlan()
    }
 
    /**
     * 微信登录-绑定手机号
     */
    fun verifyCellPhone(token:String,phone: String,code: String,openid: String): Flowable<ResultData<LoginBean>> {
        return request().verifyCellPhone(" $token",Gson().toJson(ReqBindWxPhone(code,phone,openid)))
    }
 
    /**
     * 答案标签
     */
    fun getTagList(): Flowable<ResultData<ArrayList<TagBean>>> {
        return request().getTagList()
    }
 
    /**
     * 忘記密碼
     */
    fun forgetPassword(phone: String, pwd: String,secret:String): Flowable<ResultData<Any>> {
        return request().forgetPassword("{\"cellPhone\":\"${phone}\",\"password\":\"${pwd}\",\"secret\":\"${secret}\"}")
    }
 
    /**
     * 注册/忘记密码/修改密码
     * @param type 2:注册,3:修改密码,4:忘记密码,5:绑手机
     */
    fun register(type: Int, phone: String, pwd: String, code: String): Flowable<ResultData<LoginBean>> {
        val url = when (type) {
            4 -> Apis.forgetPassword
            5 -> Apis.bindWx
            else -> Apis.register
        }
        return request().register(url, Gson().toJson(ReqRegister(code,phone,pwd)))
    }
 
    /**
     * 注册/忘记密码/修改密码
     * @param type 2:注册,3:修改密码,4:忘记密码,5:绑手机
     */
    fun bindPhone(phone: String,  code: String, invitationCode: String?): Flowable<ResultData<String>> {
        return request().bindPhone(phone, code,invitationCode)
    }
 
    /**
     * 密码登录
     */
    fun userLogin(password: String, phone: String): Flowable<ResultData<LoginBean>> {
        return request().userLogin("{\"cellPhone\":\"${phone}\",\"password\":\"${password}\"}")
    }
 
    /**
     * 修改密码
     */
    fun updatePassword(password: String, newPassword: String, code: String): Flowable<ResultData<Any>> {
        return request().updatePassword(password,newPassword, code)
    }
 
    /**
     * 验证码登录
     */
    fun captchaLogin(device: String, code: String, phone: String): Flowable<ResultData<LoginBean>> {
        return request().captchaLogin("{\"device\":\"${device}\",\"cellPhone\":\"${phone}\",\"captcha\":\"${code}\"}")
    }
 
    /**
     * wx登录
     */
    fun wxLogin(device: String, openid: String?, name: String?,sex: Int?,avatar: String?): Flowable<ResultData<WxLoginBean>> {
        return request().wxLogin(Gson().toJson(ReqWxLogin(device,avatar,name,sex,openid)))
    }
 
    /**
     * 轮播
     */
    fun queryBanner(): Flowable<ResultData<ArrayList<Banner>>> {
        return request().queryBanner()
    }
 
    /**
     * 轮播
     */
    fun getCourseCategoryList(): Flowable<ResultData<ArrayList<CourseType>>> {
        return request().getCourseCategoryList()
    }
 
    /**
     * 菜单
     */
    fun getCategoryListByType(type: Int): Flowable<ResultData<ArrayList<Menu>>> {
        return request().getCategoryListByType(type)
    }
 
    /**
     * 今日冥想
     */
    fun getTodayMeditation(): Flowable<ResultData<HomeItem>> {
        return request().getTodayMeditation()
    }
 
    /**
     * 私人订制
     */
    fun getPersonalityPlan(): Flowable<ResultData<List<CommonItemBean>>> {
        return request().getPersonalityPlan()
    }
 
    /**
     * 动态列表
     */
    fun getMeditationAndCateList(): Flowable<ResultData<List<HomeListBean>>> {
        return request().getMeditationAndCateList()
    }
 
    /**
     * bgm
     */
    fun getHomeBackgroun(): Flowable<ResultData<List<BGMBean>>> {
        return request().getHomeBackgroun()
    }
 
    /**
     * 分类列表
     */
    fun getMeditationPageByCateId(typeId:String,page: Int): Flowable<ResultData<SearchResult>> {
        return request().getMeditationPageByCateId(typeId,page,Const.PAGE_SIZE)
    }
 
    /**
     * 音频详情
     */
    fun getMeditationDetails(id: String): Flowable<ResultData<VoiceDetail>> {
        return request().getMeditationDetails(id)
    }
 
    /**
     * 音频收藏
     */
    fun favorite(id: String): Flowable<ResultData<Any>> {
        return request().favorite(id)
    }
 
    /**
     * 评论列表
     */
    fun getMeditationQuestionPage(id: String,page: Int): Flowable<ResultData<VoiceCommentBean>> {
        return request().getMeditationQuestionPage(id,page,Const.PAGE_SIZE)
    }
 
    /**
     * 搜索
     */
    fun search(key:String,page: Int,size: Int): Flowable<ResultData<SearchResult>> {
        return request().search(key,page,size)
    }
 
    /**
     * 热搜列表
     */
    fun getHotWordList(): Flowable<ResultData<List<String>>> {
        return request().getHotWordList()
    }
 
    /**
     * 获取String类型通用接口
     */
    fun queryString(url: String, map: HashMap<String, Any>): Flowable<ResultData<String>> {
        return request().queryString(url, map)
    }
 
    /**
     * 券列表
     */
    fun queryCouponPackage(type: Int,page: Int): Flowable<ResultData<List<Coupon>>> {
        return request().queryCouponPackage(type, page)
    }
 
    /**
     * 用户查询
     */
    fun getUserByPhone(phone: String): Flowable<ResultData<UserInfo>> {
        return request().getUserByPhone(phone)
    }
 
    /**
     * 确认订单
     */
    fun confirmOrder(id: String): Flowable<ResultData<ConfirmOrder>> {
        return request().confirmOrder(id)
    }
 
    /**
     * 待支付订单
     */
    fun payOrder(id: String): Flowable<ResultData<ConfirmOrder>> {
        return request().payOrder(id)
    }
 
 
    /**
     * 取消订单
     */
    fun cancel(id: String): Flowable<ResultData<Any>> {
        return request().cancel(id)
    }
 
    /**
     * 确认订单
     */
    fun confirmOrderVoice(id: String): Flowable<ResultData<ConfirmOrder>> {
        return request().confirmOrderVoice(id)
    }
 
    /**
     * 余额支付订单
     */
    fun gvieCourse(id: String,type: Int,receiveId:String? = null): Flowable<ResultData<Any>> {
        return request().gvieCourse(id,type,receiveId)
    }
 
    fun saveViewingHistory(id: String,time: Int): Flowable<ResultData<Any>> {
        return request().saveViewingHistory(time,id)
    }
 
    fun saveUserHomeBackgroundMusic(id: String): Flowable<ResultData<Any>> {
        return request().saveUserHomeBackgroundMusic(id)
    }
 
    fun getHomeBackgroundMusicByUserId(): Flowable<ResultData<BGMBean>> {
        return request().getHomeBackgroundMusicByUserId()
    }
 
    /**
     * 支付成功
     */
    fun successOrder(id: String,isVoice:Boolean): Flowable<ResultData<List<CourseBean>>> {
        return request().successOrder(if (isVoice) Apis.successOrderVoice else Apis.successOrder, id,id)
    }
 
    /**
     * 课程学习
     */
    fun studyPageByChapterId(id: String): Flowable<ResultData<List<Chapter>>> {
        return request().studyPageByChapterId(id)
    }
 
    /**
     * 记录视频观看
     */
    fun saveCourseStudyHistory(id: String,isOver:Int,secondLook:Int): Flowable<ResultData<Any>> {
        return request().saveCourseStudyHistory(id,isOver,secondLook)
    }
 
    /**
     * 查询支付状态
     */
    fun queryPayment(id: String): Flowable<ResultData<String>> {
        return request().queryPayment(id)
    }
 
    fun isFirst(): Flowable<ResultData<Boolean>> {
        return request().isFirst()
    }
 
    fun getUserTree(): Flowable<ResultData<TreeInfo>> {
        return request().getUserTree()
    }
 
    fun watering(): Flowable<ResultData<WaterResult>> {
        return request().watering()
    }
 
    fun sign(): Flowable<ResultData<Any>> {
        return request().sign()
    }
 
    /**
     * 注销
     */
    fun cancellation(): Flowable<ResultData<Any>> {
        return request().cancellation()
    }
 
 
    /**
     * 反馈
     */
    fun feedBack(content: String,img: String?): Flowable<ResultData<Any>> {
        return request().feedBack(content, img)
    }
 
    /**
     * 常见问题
     */
    fun useGuide(search: String?): Flowable<ResultData<List<Guide>>> {
        return request().useGuide(search)
    }
 
    /**
     * 消息列表
     */
    fun messageList(page: Int): Flowable<ResultData<MsgListBean>> {
        return request().messageList(page,Const.PAGE_SIZE)
    }
 
    /**
     * 删除
     */
    fun deleteFind(id: String): Flowable<ResultData<Any>> {
        return request().deleteFind(id)
    }
 
    /**
     * 疗愈馆
     */
    fun getMeditationPage(page: Int,name: String?,lat:Double?,lon:Double?): Flowable<ResultData<PlaceListBean>> {
        return request().getMeditationPage(name,lat,lon,page,10)
    }
 
    /**
     * 疗愈馆
     */
    fun getMeditationInfo(id: String): Flowable<ResultData<Place>> {
        return request().getMeditationInfo(id)
    }
 
    /**
     * 公告详情
     */
    fun noticeDetail(id: String, type: Int): Flowable<ResultData<Notice>> {
        return request().noticeDetail(
            if (type == 1) Apis.noticeDetail else Apis.exceptionDetail,
            id,
            id
        )
    }
 
    /**
     * 更新用户信息
     */
    fun updateInfo(birthday: String?, company: String?,education: String?,email: String?,gender: Int?,hometown: String?,industry: String?,
                   location: String?,nickname: String?,occupation: String?, signature: String?,name: String?): Flowable<ResultData<Any>> {
        val req = ReqUpdateUser(birthday,company,education,email,gender,hometown,industry,location,nickname,occupation,name,signature)
        return request().updateInfo(Gson().toJson(req))
    }
 
    /**
     * 支付
     */
    fun placeOrder(orderFrom:Int,payType:Int,balanceFlag:Int,amount:Double?,receiverId:String?,targetId:String?,vipType:Int?,orderId:String? = null): Flowable<ResultData<ThirdPayInfo>> {
        return request().placeOrder(orderFrom, payType, balanceFlag, amount, receiverId, targetId, vipType,orderId)
    }
 
    /**
     * 更新用户头像
     */
    fun updateUserAvatar(avatar: String): Flowable<ResultData<Any>> {
        return request().updateUserAvatar(avatar)
    }
 
    /**
     * 钱包
     */
    fun wallet(): Flowable<ResultData<WalletBean>> {
        return request().wallet()
    }
 
    /**
     * 举报
     */
    fun report(id: String,content: String): Flowable<ResultData<Any>> {
        return request().report(id, content)
    }
 
    /**
     * 提问
     */
    fun addQuestion(id: String,content: String): Flowable<ResultData<Any>> {
        return request().addQuestion(id, content)
    }
 
    /**
     * 评论
     * @param pid 如果是评论的动态 pid传0 否则传一级评论的id
     * @param replyCommentId 回复的那条评论的评论id,不是回复评论就不传
     * @param replyUserId 回复的那条评论的用户id,不是回复就不传
     */
    fun addComment(findId:String,pid: String,content: String,replyCommentId:String?,replyUserId:String?): Flowable<ResultData<Any>> {
        return request().addComment(findId, content, pid, replyCommentId, replyUserId)
    }
 
    /**
     * 动态
     */
    fun findDetail(id: String): Flowable<ResultData<Dynamic>> {
        return request().findDetail(id)
    }
 
    /**
     * 點贊
     */
    fun doLike(id:String): Flowable<ResultData<Any>> {
        return request().doLike(id)
    }
 
    /**
     * 发布
     */
    fun addFind(title: String,content: String,img: String?,cover:String?,video:String?): Flowable<ResultData<Any>> {
        return request().addFind(title,content,img,cover,video)
    }
 
    /**
     *用户信息
     */
    fun getUserInfo(): Flowable<ResultData<MineInfo>> {
        return request().getUserInfo()
    }
 
    /**
     *资料
     */
    fun getUserDetail(): Flowable<ResultData<UserInfo>> {
        return request().getUserDetail()
    }
}