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.ReqAnswer
|
import com.sinata.xqmuse.network.entity.req.ReqRegister
|
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 payCourse(
|
id: String?,
|
payType: Int,
|
buyType: Int,
|
couponId:String?,
|
orderMoney:Double? = null
|
): Flowable<ResultData<Order>> {
|
return request().order(id, buyType,payType, couponId,orderMoney)
|
}
|
|
/**
|
* 支付
|
*/
|
fun pay(
|
id: String,
|
payType: Int,
|
buyType: Int
|
): Flowable<ResultData<PayInfo>> {
|
return request().pay(id,payType, buyType)
|
}
|
|
/**
|
* 支付结果
|
*/
|
fun success(
|
id: String
|
): Flowable<ResultData<Coupon>> {
|
return request().success(id)
|
}
|
|
/**
|
* 省市
|
*/
|
fun getCity(id:String?): Flowable<ResultData<List<City>>> {
|
return if (id.isNullOrEmpty()) request().getProvince() else request().getCity(id)
|
}
|
|
/**
|
* 收件地址
|
*/
|
fun setAddress(address:String,provinceCode: String,province:String,cityCode: String,city:String,phone: String,name: String): Flowable<ResultData<Any>> {
|
return request().setAddress(address,city,cityCode,province,provinceCode,name,phone)
|
}
|
|
/**
|
* 收件地址
|
*/
|
fun getAddress(): Flowable<ResultData<ReceiverBean>> {
|
return request().getAddress()
|
}
|
|
/**
|
* 风险提示
|
*/
|
fun riskInfo(): Flowable<ResultData<RiskInfo>> {
|
return request().riskInfo()
|
}
|
|
/**
|
* 体检报告
|
*/
|
fun queryPhysical(id: String): Flowable<ResultData<Report>> {
|
return request().queryPhysical(id)
|
}
|
|
|
/**
|
* 开始训练
|
*/
|
fun startTrain(id: String): Flowable<ResultData<TrainInfo>> {
|
return request().startTrain(id)
|
}
|
|
/**
|
* 暂停训练
|
*/
|
fun exit(courseId: String,videoId:String,seekTo:Long,realTime:Int): Flowable<ResultData<Any>> {
|
return request().exit(courseId,videoId,seekTo,realTime)
|
}
|
|
/**
|
* 打卡
|
*/
|
fun clockIn(courseId: String): Flowable<ResultData<FinishBean>> {
|
return request().clockIn(courseId)
|
}
|
|
/**
|
* 完成训练
|
*/
|
fun completeInfo(courseId: String): Flowable<ResultData<FinishBean>> {
|
return request().completeInfo(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 queryCourseInfo(id: String): Flowable<ResultData<CourseDetail>> {
|
return request().queryCourseInfo(id)
|
}
|
|
/**
|
* 课程收藏
|
*/
|
fun collectCourse(id: String): Flowable<ResultData<Any>> {
|
return request().collectCourse(id)
|
}
|
|
|
/**
|
* 课程套餐详情
|
*/
|
fun buyCourseInfo(id: String): Flowable<ResultData<BuyInfo>> {
|
return request().buyCourseInfo(id)
|
}
|
|
/**
|
* 我的动态
|
*/
|
fun myFind(page: Int): Flowable<ResultData<ArrayList<Dynamic>>> {
|
return request().myFind(page)
|
}
|
|
/**
|
* 绑卡
|
*/
|
fun updateBankCard(name: String,phone: String,num: String,bank:String,photo:String): Flowable<ResultData<Any>> {
|
return request().updateBankCard(name,num,photo,bank,phone)
|
}
|
|
/**
|
* 绑邀请人
|
*/
|
fun binding(code: String): Flowable<ResultData<Any>> {
|
return request().binding(code)
|
}
|
|
/**
|
* 绑邀请人
|
*/
|
fun getBindingUserName(code: String): Flowable<ResultData<String>> {
|
return request().getBindingUserName(code)
|
}
|
|
/**
|
* 绑卡
|
*/
|
fun getBankInfo(): Flowable<ResultData<BankInfo>> {
|
return request().getBankInfo()
|
}
|
|
/**
|
* 推广信息
|
*/
|
fun shareInfo(): Flowable<ResultData<ShareInfo>> {
|
return request().shareInfo()
|
}
|
|
/**
|
* 我的课程列表
|
*/
|
fun lookHistory(type: Int,page: Int,state:Int): Flowable<ResultData<CourseListBean>> {
|
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 withdrawal(money: Double): Flowable<ResultData<Any>> {
|
return request().withdrawal(money)
|
}
|
|
/**
|
* 提现记录
|
*/
|
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 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(code: String, phone: String): Flowable<ResultData<LoginBean>> {
|
return request().captchaLogin("{\"cellPhone\":\"${phone}\",\"captcha\":\"${code}\"}")
|
}
|
|
/**
|
* wx登录
|
*/
|
fun wxLogin(openid: String?, phone: String?,name: String?,sex: Int?,avatar: String?): Flowable<ResultData<WxLoginBean>> {
|
return request().wxLogin(openid, phone,name,avatar,sex)
|
}
|
|
/**
|
* 轮播
|
*/
|
fun queryBanner(): Flowable<ResultData<ArrayList<Banner>>> {
|
return request().queryBanner()
|
}
|
|
/**
|
* 轮播
|
*/
|
fun getCourseCategoryList(): Flowable<ResultData<ArrayList<CourseType>>> {
|
return request().getCourseCategoryList()
|
}
|
|
/**
|
* 筛选项
|
*/
|
fun getList(): Flowable<ResultData<FilterBean>> {
|
return request().getList()
|
}
|
|
/**
|
* 菜单
|
*/
|
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 cancellation(): Flowable<ResultData<Any>> {
|
return request().cancellation()
|
}
|
|
|
/**
|
* 反馈
|
*/
|
fun feedBack(content: String,img: String?): Flowable<ResultData<Any>> {
|
return request().feedBack(content, img)
|
}
|
|
/**
|
* 设置单位
|
*/
|
fun setUnit(type: Int): Flowable<ResultData<Any>> {
|
return request().setUnit(type)
|
}
|
|
/**
|
* 设置手机
|
*/
|
fun updatePhone(phone: String,code: String): Flowable<ResultData<Any>> {
|
return request().updatePhone(code, phone)
|
}
|
|
/**
|
* 常见问题
|
*/
|
fun useGuide(search: String?): Flowable<ResultData<List<Guide>>> {
|
return request().useGuide(search)
|
}
|
|
/**
|
* 联系
|
*/
|
fun getPhone(): Flowable<ResultData<String>> {
|
return request().getPhone()
|
}
|
|
/**
|
* 消息列表
|
*/
|
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(headImg: String?, 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>> {
|
return request().updateInfo(headImg, birthday, company, education, email, gender, hometown, industry, location, nickname, occupation, signature, name)
|
}
|
|
/**
|
* 钱包
|
*/
|
fun wallet(page: Int,year: Int?=null,month:Int?=null,size:Int = Const.PAGE_SIZE): Flowable<ResultData<WalletBean>> {
|
return request().wallet(page,month, year,size)
|
}
|
|
/**
|
* 运势
|
*/
|
fun constellation(consName: String,type: String): Flowable<ResultData<LuckInfo>> {
|
return request().constellation(consName,type)
|
}
|
|
/**
|
* 动态列表
|
*/
|
fun findList(page: Int,search: String?): Flowable<ResultData<List<Dynamic>>> {
|
return request().findList(page, search)
|
}
|
|
/**
|
* 动态评论列表
|
*/
|
fun findCommentList(page: Int,id: String,size: Int): Flowable<ResultData<List<Comment>>> {
|
return request().findCommentList(id,page,size)
|
}
|
|
/**
|
* 评论回复列表
|
*/
|
fun findCommentListOne(page: Int,id: String,size: Int): Flowable<ResultData<List<ReplyComment>>> {
|
return request().findCommentListOne(id,page,size)
|
}
|
|
/**
|
* 举报
|
*/
|
fun report(id: String,content: String): Flowable<ResultData<Any>> {
|
return request().report(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()
|
}
|
|
/**
|
*公告消息
|
*/
|
fun getNotice(): Flowable<ResultData<Notice>> {
|
return request().getNotice()
|
}
|
|
/**
|
*设置体重
|
* @param type 1=设置目标体重 2=记录体重
|
*/
|
fun setWeight(type: Int,weight:String): Flowable<ResultData<Any>> {
|
return request().setWeight(type, weight)
|
}
|
|
/**
|
*设置星座
|
*/
|
fun changeConstellation(name:String): Flowable<ResultData<Any>> {
|
return request().changeConstellation(name)
|
}
|
}
|