| | |
| | | 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.network.entity.req.* |
| | | import com.sinata.xqmuse.ui.mine.WatchHisActivity |
| | | import com.sinata.xqmuse.utils.Const |
| | | import com.sinata.xqmuse.utils.pay.PayInfo |
| | |
| | | } |
| | | |
| | | /** |
| | | * 课程报名,充值下单 |
| | | */ |
| | | 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 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 queryCourseInfo(id: String): Flowable<ResultData<CourseDetail>> { |
| | | return request().queryCourseInfo(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 lookHistory(type: Int,page: Int,state:Int): Flowable<ResultData<CourseListBean>> { |
| | | 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) |
| | |
| | | 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 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 captchaLogin(code: String, phone: String): Flowable<ResultData<LoginBean>> { |
| | | return request().captchaLogin("{\"cellPhone\":\"${phone}\",\"captcha\":\"${code}\"}") |
| | | fun captchaLogin(device: String, code: String, phone: String): Flowable<ResultData<LoginBean>> { |
| | | return request().captchaLogin("{\"device\":\"${device}\",\"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 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 getCourseCategoryList(): Flowable<ResultData<ArrayList<CourseType>>> { |
| | | return request().getCourseCategoryList() |
| | | } |
| | | |
| | | /** |
| | | * 筛选项 |
| | | */ |
| | | fun getList(): Flowable<ResultData<FilterBean>> { |
| | | return request().getList() |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 待支付订单 |
| | | */ |
| | | 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>> { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 设置单位 |
| | | */ |
| | | 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 updateInfo(headImg: String?, birthday: String?, company: String?,education: String?,email: String?,gender: Int?,hometown: String?,industry: String?, |
| | | 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>> { |
| | | return request().updateInfo(headImg, birthday, company, education, email, gender, hometown, industry, location, nickname, occupation, signature, name) |
| | | 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(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 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) |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | 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) |
| | | } |
| | | } |