package com.igo.user.network import cn.sinata.xldutils.data.ResultData import cn.sinata.xldutils.utils.LanguageUtil import cn.sinata.xldutils.utils.SPUtils import com.google.gson.JsonObject import com.igo.user.IGoApplication import com.igo.user.data.HomeDatas import com.igo.user.network.entity.Anchor import com.igo.user.network.entity.AutoCompleteBean import com.igo.user.network.entity.CarPrice import com.igo.user.network.entity.City import com.igo.user.network.entity.Coupon import com.igo.user.network.entity.DriverInfo import com.igo.user.network.entity.EmailBean import com.igo.user.network.entity.Evaluation import com.igo.user.network.entity.Function import com.igo.user.network.entity.GeoBean import com.igo.user.network.entity.Goods import com.igo.user.network.entity.GoogleToken import com.igo.user.network.entity.InviteHis import com.igo.user.network.entity.InvokeHis import com.igo.user.network.entity.Line import com.igo.user.network.entity.LogisticProgress import com.igo.user.network.entity.Message import com.igo.user.network.entity.MyBankCard import com.igo.user.network.entity.OpenCity import com.igo.user.network.entity.Order import com.igo.user.network.entity.Phone import com.igo.user.network.entity.PlaceDetailBean import com.igo.user.network.entity.Point import com.igo.user.network.entity.RealName import com.igo.user.network.entity.RouteBean import com.igo.user.network.entity.SearchBean import com.igo.user.network.entity.SeatInfo import com.igo.user.network.entity.ServiceRecord import com.igo.user.network.entity.Shift import com.igo.user.network.entity.TrippingInfo import com.igo.user.network.entity.UserInfo import com.igo.user.network.entity.VersionData import com.igo.user.network.entity.WalletRecord import com.igo.user.network.entity.WalletRecordBean import com.igo.user.utils.Const import io.reactivex.Flowable import okhttp3.MediaType import okhttp3.MultipartBody import okhttp3.RequestBody import java.io.File object HttpManager { private const val PAGE_SIZE = 20 private val service: ApiService = RRetrofit.instance().create(ApiService::class.java) /** * 发起请求方法 */ private fun request() = service private fun getAppId() = SPUtils.instance().getString(Const.User.APP_ID) /** * 获取h5 * @param type 1:隐私协议,2:用户协议,3:用户指南,4:法律条款,5:关于我们 */ fun getH5(type: Int, language: String? = null): Flowable> { val language = language ?: LanguageUtil.getLanguage() return request().getH5(language,type) } /** * 上传图片 */ fun uploadFile(file: File): Flowable> { val requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file) val part = MultipartBody.Part.createFormData("file", file.name, requestFile) return request().uploadFile(part) } /** * 获取首页电话 * @param code 行政区域编号 */ fun getPhone(lat:Double,lon:Double): Flowable>> { return request().getPhone(lat,lon) } /** * 包车获取首页电话 * @param code 行政区域编号 */ fun queryPhones(lat:String,lon:String): Flowable>> { return request().queryPhones(lat,lon) } /** * 获取首页轮播消息 * @param type 1:轮播消息 */ fun queryNotices(type: Int): Flowable>> { return request().queryNotices(type) } /** * 获取首页广告 * @param type 1:弹窗广告,2:底部广告 */ fun getAds(type: Int,lat:String,lon:String): Flowable>> { return request().getAds(type,lat,lon) } /** * 发送验证码 * @param type 1=身份验证,2=登录确认,3=用户注册,4=修改密码 */ fun sendSms(phone: String,kaptcha: String,type: Int,token:String): Flowable> { return request().getCode(phone,kaptcha,type) } /** * 发送验证码 */ fun sedEmail(mail: String): Flowable> { return request().sedEmail(mail) } /** * 绑邮箱 */ fun bindingEmail(mail: String,code: String,type: Int): Flowable> { return request().bindingEmail(mail,code, type) } /** * 验证码登录 */ fun codeLogin(phoneOperator: String,phone: String,code: String,ip: String? = null): Flowable> { return request().codeLogin(phoneOperator,phone,code,ip) } /** * 密码登录 */ fun pwdLogin(phone: String,code: String): Flowable> { return request().pwdLogin(phone,code) } /** * 微信登录 */ fun wxLogin(openid: String?, unionid: String?, avatar: String?,nickName: String?,sex: Int?): Flowable> { return request().wxLogin(openid, unionid,avatar,nickName, sex) } /** * fb登录 */ fun facebookLogin(uid: String, avatar: String?,nickName: String?): Flowable> { return request().facebookLogin(uid,nickName,avatar) } /** * x登录 */ fun twitterLogin(uid: String, name: String?,mail: String?): Flowable> { return request().twitterLogin(uid,name,mail) } /** * 一键登录 */ fun oneClickLogin(token: String): Flowable> { return request().oneClickLogin(token) } /** * 微信登录绑定手机 */ fun bindingPhone(phoneOperator: String,code:String,phone: String): Flowable> { val map = HashMap() map["phoneOperator"] = phoneOperator map["code"] = code map["phone"] = phone map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.bindingPhone,map) } /** * 注销 */ fun unregister(): Flowable> { val map = HashMap() map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.cancellation,map) } /** * 忘记密码 */ fun forgetPassword(code: String,password: String,phone: String): Flowable> { return request().forgetPassword(code, password, phone) } /** * 城市是否开通 */ fun isOpenCity(lat:String,lon:String): Flowable> { return request().isOpenCity(lat,lon) } /** * 是否输入紧急联系人 */ fun isEnterEmergencyContact(): Flowable> { return request().isEnterEmergencyContact() } /** * 定位城市功能 */ fun queryBusiness(lat:String,lon:String): Flowable>> { return request().queryBusiness(lat,lon) } /** * 选择城市功能 */ fun queryBusinessById(id: Int): Flowable>> { return request().queryBusinessById(id) } /** * 开通城市列表 */ fun queryOpenCity(): Flowable>> { return request().queryOpenCity() } /** * 附近司机数量 * @param type:1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车 */ fun getDriverNum(lat:Double,lon:Double,type: Int): Flowable> { return request().getDriverNum(lat, lon, type) } /** * 查询价格和车型 * @param type:1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车 */ fun queryServerCarModel(start:String,end:String,type: Int): Flowable>> { return request().queryServerCarModel(start, end, type) } /** * 出租车和专车下单 * @param orderSource:1:APP下单,2:扫码下单 * @param orderType:1=普通,2=预约 * @param substitute:是否是代下单(0:否,1:是) * @param type:订单类型(1=普通订单,2=摆渡订单) * @param businessType:业务类型 */ fun addTaxiOrder(endAddress: String,endLat: Double,endLon:Double, orderSource:Int,orderType :Int,placementLat :Double, placementLon:Double,startAddress :String,startLat:Double, startLon :Double,substitute :Int,tipMoney:Int, travelTime:String,driverId:Int?, passengers:String?,passengersPhone:String?,serverCarModelId: Int? = 0,type: Int = 1, businessType: Int = Const.OrderType.TYPE_TAXI, useCoupon: Boolean = false ): Flowable> { val map = HashMap() map["endAddress"] = endAddress map["endLat"] = endLat map["endLon"] = endLon map["orderSource"] = orderSource map["orderType"] = orderType map["placementLat"] = placementLat map["placementLon"] = placementLon map["startAddress"] = startAddress map["startLat"] = startLat map["startLon"] = startLon map["substitute"] = substitute map["tipMoney"] = tipMoney map["type"] = type map["travelTime"] = travelTime map["isUseCoupon"] = useCoupon if (businessType == Const.OrderType.TYPE_SPECIAL&&serverCarModelId!=null) //专车要选车型 map["serverCarModelId"] = serverCarModelId if (driverId!=null) map["driverId"] = driverId if (passengers!=null) map["passengers"] = passengers if (passengersPhone!=null) map["passengersPhone"] = passengersPhone map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(if (businessType == Const.OrderType.TYPE_TAXI) Apis.addTaxiOrder else Apis.createOrder,map) } /** * 专车修改终点 */ fun updateEndAddress(endAddress: String,endLat: Double,endLon:Double, orderId:Int, orderType:Int): Flowable> { val map = HashMap() map["endAddress"] = endAddress map["endLat"] = endLat map["endLon"] = endLon map["orderId"] = orderId map["orderId"] = orderId map["orderType"] = orderType map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.updateEndAddress,map) } /** * 摆渡车下单 * @param orderSource:1:APP下单,2:扫码下单 */ fun saveOrderFerry(endAddress: String,endLat: Double,endLon:Double, orderSource:Int,placementLat :Double, placementLon:Double,startAddress :String,startLat:Double, startLon :Double, travelTime:String, serverCarModelIds:String, crossCityOrderId:Int, place:Int): Flowable> { val map = HashMap() map["endAddress"] = endAddress map["endLat"] = endLat map["endLon"] = endLon map["orderSource"] = orderSource map["placementLat"] = placementLat map["placementLon"] = placementLon map["startAddress"] = startAddress map["startLat"] = startLat map["startLon"] = startLon map["travelTime"] = travelTime map["serverCarModelIds"] = serverCarModelIds map["crossCityOrderId"] = crossCityOrderId map["place"] = place map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.saveOrderFerry,map) } /** * 获取行政区域三级联动数据 */ fun queryRegions(id:Int = 0): Flowable>> { return request().queryRegions(id) } /** * 获取物流单价 */ fun queryLogisticsUnitPrice(endAddress: String,startLonLat: String,type: Int): Flowable> { val map = HashMap() map["endAddress"] = endAddress map["startLonLat"] = startLonLat map["type"] = type map["appid"] = getAppId() return request().queryLogisticsUnitPrice(endAddress, startLonLat, type,SignUtil.getSign(map), getAppId()) } /** * 获取物流单价 */ fun queryPayMoney(startLonLat: String,endLonLat: String,type: Int): Flowable>> { return request().queryPayMoney(startLonLat,endLonLat,type) } /** * 我的订单 * @param type 订单类型(1=专车,2=出租车,3=跨城出行) */ fun myOrderList(page:Int,type: Int,size:Int = PAGE_SIZE): Flowable>> { val map = HashMap() map["pageNum"] = page map["size"] = size map["type"] = type map["appid"] = getAppId() return request().myOrderList(page,size, type,SignUtil.getSign(map), getAppId()) } /** * 订单详情 * @param type 订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车) */ fun queryOrderInfo(id:Int,type: Int): Flowable> { val map = HashMap() map["orderId"] = id map["orderType"] = type map["appid"] = getAppId() return request().queryOrderInfo(id, type,SignUtil.getSign(map), getAppId()) } /** * 取消费用 */ fun cancelMoney(id:Int,type: Int): Flowable> { val map = HashMap() map["id"] = id map["orderType"] = type map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.cancelMoney,map) } /** * 继续等待 * @param orderType 订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车) */ fun pushOrderTaxi(id:Int,orderType:Int): Flowable> { val map = HashMap() map["id"] = id map["orderType"] = orderType map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.pushOrderTaxi,map) } /** * 取消订单 * @param orderType 订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车) */ fun cancelOrder(lat:Double,lon:Double,id:Int, orderType:Int, reason:String?=null, remark:String?=null): Flowable> { val map = HashMap() map["id"] = id map["lon"] = lon map["lat"] = lat map["orderType"] = orderType if (reason!=null) map["reason"] = reason if (!remark.isNullOrEmpty()) map["remark"] = remark map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.cancelTaxi,map) } /** * 投诉司机 */ fun complaintService(driverId:Int,description:String,reason:String): Flowable> { val map = HashMap() map["driverId"] = driverId if (description.isNotEmpty()) map["description"] = description map["reason"] = reason map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.complaintService,map) } /** * 余额和优惠券数量 */ fun queryBalance(orderId:Int,orderType:Int): Flowable> { val map = HashMap() map["orderId"] = orderId map["orderType"] = orderType map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.queryBalance,map) } /** * 行程中信息 * @param orderType 订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车) */ fun trippingInfo(id:Int,orderType:Int): Flowable> { val map = HashMap() map["orderId"] = id map["orderType"] = orderType map["appid"] = getAppId() return request().trippingInfo(id,orderType,SignUtil.getSign(map),getAppId()) } /** * 是否有司机接单 * @param orderType 订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车) */ fun queryEndPush(id:Int,orderType:Int): Flowable> { val map = HashMap() map["orderId"] = id map["orderType"] = orderType map["appid"] = getAppId() return request().queryEndPush(id,orderType,SignUtil.getSign(map),getAppId()) } /** * 司机详情 */ fun queryDriverInfo(id:Int): Flowable> { val map = HashMap() map["id"] = id map["appid"] = getAppId() return request().queryDriverInfo(id,SignUtil.getSign(map),getAppId()) } /** * 司机详情 */ fun queryDriverEvaluate(id:Int,page: Int,size: Int = Const.PAGE_SIZE): Flowable>> { val map = HashMap() map["id"] = id map["pageNum"] = page map["size"] = size map["appid"] = getAppId() return request().queryDriverEvaluate(id,page,size,SignUtil.getSign(map),getAppId()) } /** * 用户详情 */ fun queryUserInfo(): Flowable> { val map = HashMap() map["appid"] = getAppId() return request().queryUserInfo(SignUtil.getSign(map)?:"",getAppId()) } /** * 修改用户详情 */ fun updateInfo(avatar:String?,birthday:String?,nickname:String?,sex:String?,email:String? = null,firstName:String? = null,lastName:String? = null): Flowable> { val map = HashMap() if (avatar!=null) map["avatar"] = avatar if (birthday!=null) map["birthday"] = birthday if (nickname!=null) map["nickname"] = nickname if (sex!=null) map["sex"] = sex if (email!=null) map["email"] = email if (firstName!=null) map["firstName"] = firstName if (lastName!=null) map["lastName"] = lastName map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.updateInfo,map) } /** * 行程支付 * @param payType 1=微信,2=支付宝,3=余额 */ fun payTaxiOrder(id:Int,payType:Int,orderType:Int,couponId:Int?=null,bankCardId:String?=null,redDeduction:Int?=null): Flowable> { val map = HashMap() map["orderId"] = id map["payType"] = payType map["type"] = 1 map["orderType"] = orderType if (couponId!=null) map["couponId"] = couponId if (bankCardId!=null) map["bankCardId"] = bankCardId if (redDeduction!=null) map["redDeduction"] = redDeduction map["appid"] = getAppId() return request().payTaxiOrder(id,payType,1,orderType,couponId,redDeduction,bankCardId,SignUtil.getSign(map),getAppId()) } /** * 小件物流补差价支付 * @param payType 1=微信,2=支付宝,3=余额 */ fun payOrderLogisticsSpread(id:Int,payType:Int): Flowable> { val map = HashMap() map["orderId"] = id map["payType"] = payType map["type"] = 1 map["appid"] = getAppId() return request().payOrderLogisticsSpread(id,payType,1,SignUtil.getSign(map),getAppId()) } /** * 取消支付 * @param payType 1=微信,2=支付宝,3=余额 */ fun cancleOrderTaxi(id:Int,payType:Int,cancleId:Int,orderType:Int,bankCardId:String?): Flowable> { val map = HashMap() map["id"] = id map["payType"] = payType map["type"] = 1 map["cancleId"] = cancleId map["orderType"] = orderType if (!bankCardId.isNullOrEmpty()) map["bankCardId"] = bankCardId map["appid"] = getAppId() return request().cancleOrderTaxi(id,payType,1,orderType,cancleId,bankCardId,SignUtil.getSign(map),getAppId()) } /** * 评价 */ fun orderEvaluate(orderId:Int,fraction:Int,orderType:Int,content:String): Flowable> { val map = HashMap() map["orderId"] = orderId map["fraction"] = fraction map["orderType"] = orderType map["content"] = content map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.orderEvaluate,map) } /** * 评价后获取红包金额 */ fun queryRedMoney(orderId:Int,orderType:Int): Flowable> { val map = HashMap() map["orderId"] = orderId map["orderType"] = orderType map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.queryRedMoney,map) } /** * 车载端线下支付 */ fun completeOrder(orderId:Int,orderType:Int): Flowable> { val map = HashMap() map["orderId"] = orderId map["orderType"] = orderType map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.completeOrder,map) } /** * 查询进行中的订单 */ fun queryServingOrder(): Flowable>> { val map = HashMap() map["appid"] = getAppId() return request().queryTripping(SignUtil.getSign(map),getAppId()) } /** * 查询可用优惠券 */ fun queryCoupon(orderId: Int,orderType: Int,page: Int): Flowable>> { val map = HashMap() map["orderId"] = orderId map["orderType"] = orderType map["pageNum"] = page map["size"] = PAGE_SIZE map["appid"] = getAppId() return request().queryCoupon(orderId,orderType,page, PAGE_SIZE,SignUtil.getSign(map),getAppId()) } /** * 查询行程路径 */ fun queryTrack(orderId: Int,orderType: Int): Flowable>> { val map = HashMap() map["orderId"] = orderId map["orderType"] = orderType map["appid"] = getAppId() return request().queryTrack(orderId,orderType,SignUtil.getSign(map),getAppId()) } /** * 查询行程路径 */ fun querySite(orderId: Int,orderType: Int): Flowable>> { val map = HashMap() map["orderId"] = orderId map["orderType"] = orderType map["appid"] = getAppId() return request().queryTrack(orderId,orderType,SignUtil.getSign(map),getAppId()) } /** * 查询优惠券 */ fun queryMyCoupons(page: Int,state: Int): Flowable>> { val map = HashMap() map["pageNum"] = page map["size"] = PAGE_SIZE map["state"] = state map["appid"] = getAppId() return request().queryMyCoupons(page,PAGE_SIZE,state,SignUtil.getSign(map),getAppId()) } /** * 实名认证提交 */ fun realName(idcode:String,img1:String,img2:String,name:String): Flowable> { val map = HashMap() map["idcode"] = idcode map["img1"] = img1 map["img2"] = img2 map["name"] = name map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.realName,map) } /** * 实名认证信息 */ fun queryRealName(): Flowable> { val map = HashMap() map["appid"] = getAppId() return request().queryRealName(SignUtil.getSign(map),getAppId()) } /** * 删除优惠券 */ fun delMyCoupon(id:Int): Flowable> { val map = HashMap() map["id"] = id map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.delMyCoupon,map) } /** * 赠送优惠券 */ fun giveCoupon(id:Int,userId:Int): Flowable> { val map = HashMap() map["id"] = id map["userId"] = userId map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.giveCoupon,map) } /** * 设置紧急联系人 */ fun setEmergency(name:String,phone:String): Flowable> { val map = HashMap() map["name"] = name map["phone"] = phone map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.setEmergency,map) } /** * 根据手机号查询用户信息(赠送优惠券) */ fun queryUser(phone:String): Flowable> { val map = HashMap() map["phone"] = phone map["appid"] = getAppId() return request().queryUser(phone,SignUtil.getSign(map), getAppId()) } /** * 消费记录、提现记录、红包使用记录、积分兑换记录 */ fun walletRecord(url:String,page: Int,state:Int? = null,size: Int = PAGE_SIZE): Flowable>> { val map = HashMap() map["pageNum"] = page map["size"] = size if (state!= null) map["state"] = state map["appid"] = getAppId() return request().walletRecord(url,page,size,state,SignUtil.getSign(map), getAppId()) } /** * 开票订单 */ fun queryInvoiceOrder(page: Int,orderType: Int=1,size: Int=Const.PAGE_SIZE,type: Int=1): Flowable>> { val map = HashMap() map["pageNum"] = page map["size"] = size map["orderType"] = orderType map["type"] = type map["appid"] = getAppId() return request().queryInvoiceOrder(page,size,orderType,type,SignUtil.getSign(map), getAppId()) } /** * 开票 */ fun invoicing(name: String,type: Int,address:String,bank:String,code:String,content:String,money:Double, remark:String,order:String): Flowable> { val map = HashMap() map["name"] = name map["type"] = type map["money"] = money if (address.isNotEmpty()) map["address"] = address if (bank.isNotEmpty()) map["bank"] = bank if (code.isNotEmpty()) map["code"] = code if (content.isNotEmpty()) map["content"] = content if (remark.isNotEmpty()) map["remark"] = remark map["type"] = type map["order"] = order map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.invoicing,map) } /** * 红包列表 */ fun queryMyInvoice(page: Int,size: Int = PAGE_SIZE): Flowable>> { val map = HashMap() map["pageNum"] = page map["size"] = size map["appid"] = getAppId() return request().queryMyInvoice(page,size,SignUtil.getSign(map), getAppId()) } /** * 邀请列表 */ fun getInviteList(page: Int,size: Int = PAGE_SIZE,type: Int = 1): Flowable>> { val map = HashMap() map["pageNum"] = page map["size"] = size map["type"] = type map["appid"] = getAppId() return request().getInviteList(page,size,type,SignUtil.getSign(map), getAppId()) } /** * 红包列表 */ fun queryMyRedEnvelope(page: Int,size: Int = PAGE_SIZE): Flowable>> { val map = HashMap() map["pageNum"] = page map["size"] = size map["appid"] = getAppId() return request().queryRedEnvelope(page,size,SignUtil.getSign(map), getAppId()) } /** * 提现申请 */ fun withdrawal(remark:String,money:Double): Flowable> { val map = HashMap() map["money"] = money map["remark"] = remark map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.withdrawal,map) } /** * 反馈 */ fun feedback(content:String): Flowable> { val map = HashMap() map["content"] = content map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.feedback,map) } /** * 留言 */ fun leaveMessage(content:String): Flowable> { val map = HashMap() map["content"] = content map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.leaveMessage,map) } /** * 留言记录 */ fun queryProblems(page: Int,size: Int = PAGE_SIZE): Flowable>> { val map = HashMap() map["pageNum"] = page map["size"] = size map["appid"] = getAppId() return request().queryProblems(page,size,SignUtil.getSign(map), getAppId()) } /** * 消息中心列表 * @param type 1=公告,2=系统消息 */ fun msgNotice(type: Int,page: Int,size: Int = PAGE_SIZE): Flowable>> { val map = HashMap() map["pageNum"] = page map["size"] = size map["type"] = type map["appid"] = getAppId() return request().msgNotice(page,size,type,SignUtil.getSign(map), getAppId()) } /** * 客服电话 */ fun queryCustomerPhone(lat: Double,lon: Double): Flowable> { val map = HashMap() map["lat"] = lat map["lnt"] = lon map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.queryCustomerPhone,map) } /** * 未读数量 */ fun queryUnReadNum(): Flowable> { val map = HashMap() map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.queryUnReadNum,map) } /** * 验证短信 */ fun checkCode(code:String,phone: String): Flowable> { val map = HashMap() map["code"] = code map["phone"] = phone map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.checkCaptcha,map) } /** * 修改密码 */ fun updatePassword(password:String): Flowable> { val map = HashMap() map["password"] = password map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.updatePassword,map) } /** * 修改手机号 */ fun updatePhone(code:String,phone: String,operator: String): Flowable> { val map = HashMap() map["code"] = code map["phone"] = phone map["phoneOperator"] = operator map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.updatePhone,map) } /** * 清空消息 */ fun clearSystemNotice(): Flowable> { val map = HashMap() map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.clearSystemNotice,map) } /** * 删除消息 */ fun delSystemNotice(id:Int): Flowable> { val map = HashMap() map["id"] = id map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.delSystemNotice,map) } /** * 阅读消息 */ fun readSystemNotice(id:Int): Flowable> { val map = HashMap() map["id"] = id map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.readSystemNotice,map) } /** * 分享得红包 */ fun shareRedEnvelope(id:Int,type: Int): Flowable> { val map = HashMap() map["orderId"] = id map["orderType"] = type map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.shareRedEnvelope,map) } /** * 余额充值 * @param payType 1=微信,2=支付宝 * @param type 1=用户APP端 */ fun depositBalance(payType:Int,money:Double,bankCardId:String? = null,type:Int = 1): Flowable> { val map = HashMap() map["payType"] = payType map["money"] = money map["type"] = type if (!bankCardId.isNullOrEmpty()) map["bankCardId"] = bankCardId map["appid"] = getAppId() return request().depositBalance(money,payType,bankCardId,type,SignUtil.getSign(map), getAppId()) } /** * 检查版本 */ fun queryNewData(): Flowable> { return request().queryNewData() } /** * 预获取TripId */ fun getNewTripId(): Flowable> { return request().getNewTripId() } /** * 银行卡列表 */ fun getBindCardList(): Flowable>> { return request().getBindCardList() } /** * 邮件列表 */ fun getEmailList(): Flowable>> { return request().getEmailList() } /** * 充值记录 */ fun queryRechargeRecord(page: Int): Flowable> { return request().queryRechargeRecord(page, PAGE_SIZE) } /** * 加卡 */ fun addBankCard(name: String,lastName: String,bank: String,cardNo:String): Flowable> { return request().addBankCard(bank,cardNo,name,lastName) } /** * 删卡 */ fun deleteBindCard(id: String): Flowable> { return request().deleteBindCard(id) } /** * 起终点站点 */ fun querySite(startId:Int? = null): Flowable>> { return request().querySite(startId) } /** * 线路搜索 */ fun queryLines(startId:Int,endId:Int): Flowable>> { return request().queryLines(startId,endId) } /** * 班次搜索 */ fun queryDriver(day:String,lineId:Int,driverId:Int? = null): Flowable>> { return request().queryDriver(day,lineId,driverId) } /** * 搜索座位 */ fun querySeat(id: Int): Flowable> { return request().querySeat(id) } /** * 站点范围 */ fun queryLocation(id: Int): Flowable>> { return request().queryLocation(id) } /** * 站点是否在范围内 * */ fun areaMonitoring(id: Int,code: String,lonLat:String): Flowable> { return request().areaMonitoring(id,code, lonLat) } /** * 查询预估价格 */ fun queryOrderMoney(lineId:Int,startLonLat:String,endLonLat:String,peopleNumber:Int, seatNumber:String, travelMode:Int, serverCarModelId:Int, totalSeat:Int): Flowable> { return request().queryOrderMoney(lineId, startLonLat, endLonLat, peopleNumber, seatNumber, travelMode, serverCarModelId, totalSeat) } /** * 跨城下单 * @param orderSource 订单来源(1:APP下单,2:扫码下单,3:小程序下单,4:司机下单,5:调度下单) * @param travelMode 出行方式(1=拼车,2=包车) */ fun orderCrossCity(carId:Int,lineId:Int,lineShiftDriverId:Int,driverId:Int,distance:Double, orderSource:Int, startLat:Double, startLon:Double,endLat:Double,endLon:Double,travelTime:String,placementLat:Double, placementLon:Double,startAddress:String,endAddress:String,placementAddress:String, remark:String?,peopleNumber:Int,seatNumber:String,travelMode:Int,serverCarModelId:Int,totalSeat:Int): Flowable> { val map = HashMap() map["carId"] = carId map["lineId"] = lineId map["lineShiftDriverId"] = lineShiftDriverId map["driverId"] = driverId map["distance"] = distance map["orderSource"] = orderSource map["startLat"] = startLat map["startLon"] = startLon map["endLat"] = endLat map["endLon"] = endLon map["travelTime"] = travelTime map["placementLat"] = placementLat map["placementLon"] = placementLon map["startAddress"] = startAddress map["endAddress"] = endAddress map["placementAddress"] = placementAddress if (!remark.isNullOrEmpty()) map["remark"] = remark map["peopleNumber"] = peopleNumber map["seatNumber"] = seatNumber map["travelMode"] = travelMode map["serverCarModelId"] = serverCarModelId map["totalSeat"] = totalSeat map["appid"] = getAppId() return request().orderCrossCity(carId,lineId,lineShiftDriverId,driverId,distance, orderSource, startLat, startLon,endLat,endLon,travelTime,placementLat, placementLon,startAddress,endAddress,placementAddress, remark,peopleNumber,seatNumber,travelMode,serverCarModelId,totalSeat,SignUtil.getSign(map), getAppId()) } /** * 查询包车车型 */ fun queryServerCarModels(): Flowable>> { return request().queryServerCarModels() } /** * 包车下单 */ fun orderCharteredCar(carTime:Int, travelTime:String, placeLonLat:String,contactPerson:String, contactPhone:String, modelUse:String, peopleNumber:Int, serverCarModelId:Int): Flowable> { val map = HashMap() map["carTime"] = carTime map["travelTime"] = travelTime map["placeLonLat"] = placeLonLat map["contactPerson"] = contactPerson map["contactPhone"] = contactPhone map["peopleNumber"] = peopleNumber map["modelUse"] = modelUse map["serverCarModelId"] = serverCarModelId map["appid"] = getAppId() return request().orderCharteredCar(carTime,travelTime,placeLonLat,contactPerson,contactPhone,modelUse,peopleNumber, serverCarModelId,SignUtil.getSign(map), getAppId()) } /** * 物流下单 */ fun smallLogistics( serverCarModelId: Int, endLonLat: String, cargoNumber: Int, cargoType: Int, endAddress: String, placementLat: Double, placementLon: Double, recipient: String, recipientPhone: String, remark: String, startAddress: String, startLat: Double, startLon: Double, tipMoney: Int, travelTime: String, type: Int, urgent: Int, orderSource: Int = 1 ): Flowable> { val map = HashMap() map["cargoNumber"] = cargoNumber map["cargoType"] = cargoType map["endAddress"] = endAddress map["endLon"] = endLonLat.split(",")[0] map["endLat"] = endLonLat.split(",")[1] map["placementLat"] = placementLat map["placementLon"] = placementLon map["recipient"] = recipient map["recipientPhone"] = recipientPhone if (remark.isNotEmpty()) map["remark"] = remark map["startAddress"] = startAddress map["startLat"] = startLat map["startLon"] = startLon map["serverCarModelId"] = serverCarModelId map["tipMoney"] = tipMoney map["travelTime"] = travelTime map["type"] = type map["urgent"] = urgent map["orderSource"] = orderSource map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.smallLogistics,map) } /** * 根据起点和终点坐标判断是不是同一个市内 */ fun judgingTheCity(endAddress:String,startLonLat:String): Flowable> { val map = HashMap() map["endAddress"] = endAddress map["startLonLat"] = startLonLat return request().getBaseResponse(Apis.judgingTheCity,map) } /** * 积分礼物列表 */ fun queryGoods(page:Int,size: Int = Const.PAGE_SIZE): Flowable>> { val map = HashMap() map["pageNum"] = page map["size"] = size map["appid"] = getAppId() return request().queryGoods(page,size,SignUtil.getSign(map), getAppId()) } /** * 礼物详情 */ fun queryGoodsInfo(id:Int): Flowable> { val map = HashMap() map["id"] = id map["appid"] = getAppId() return request().queryGoodsInfo(id,SignUtil.getSign(map), getAppId()) } /** * 小件物流流程信息 */ fun queryTimeInfo(id:Int): Flowable> { val map = HashMap() map["id"] = id map["appid"] = getAppId() return request().queryTimeInfo(id,SignUtil.getSign(map), getAppId()) } /** * 小件物流流程信息 */ fun confirmDifferencePrice(id:Int,money: Double,state: Int): Flowable> { val map = HashMap() map["id"] = id map["money"] = money map["state"] = state map["appid"] = getAppId() return request().confirmDifferencePrice(id,state,money,SignUtil.getSign(map), getAppId()) } /** * 逆地理编码 */ fun geoCode(lat:Double,lon: Double): Flowable { //1=简体中文,2=英语,3=法语 val language = LanguageUtil.getLanguage() val lan = if (language == Const.Language.CHINESE) "zh-CN" else language return request().geoCode(IGoApplication.tripId,"${lat},${lon}",lan) } /** * 搜索 */ fun textsearch(key:String,lat: Double,lon: Double): Flowable { //1=简体中文,2=英语,3=法语 val language = LanguageUtil.getLanguage() val lan = if (language == Const.Language.CHINESE) "zh-CN" else language return request().textsearch(IGoApplication.tripId,key,"${lat},${lon}",lan) // return request().textsearch(key,5.586363,-0.187788,IGoApplication.chooseCityName,lan) //阿克拉 5.586363,-0.187788 } /** * 搜索2:使用地址自动补全 */ fun autocomplete(key:String,country:String = "gh"): Flowable { //1=简体中文,2=英语,3=法语 val language = LanguageUtil.getLanguage() val lan = if (language == Const.Language.CHINESE) "zh-CN" else language return request().autocomplete(IGoApplication.tripId,key,lan,"country:$country") } /** * 搜索2:获取经纬度 */ fun placeDetails(placeId:String): Flowable { return request().placeDetails(IGoApplication.tripId,placeId) } /** * 路线 */ fun directions(startLat: Double,startLon: Double,endLat: Double,endLon: Double): Flowable { val language = LanguageUtil.getLanguage() val lan = if (language == Const.Language.CHINESE) "zh-CN" else language return request().directions(IGoApplication.tripId,"${startLat},${startLon}","${endLat},${endLon}",lan) } /** * 谷歌token */ fun getFleetEngineAuth(tripId:String): Flowable> { return request().getFleetEngineAuth(tripId) } /** * 积分兑换 */ fun addIntegralOrder(consigneeAddress:String, consigneeName:String,consigneePhone:String, goodsId:Int, remark:String): Flowable> { val map = HashMap() map["consigneeAddress"] = consigneeAddress map["consigneeName"] = consigneeName map["consigneePhone"] = consigneePhone map["goodsId"] = goodsId if (remark.isNotEmpty()) map["remark"] = remark map["appid"] = getAppId() map["sign"] = SignUtil.getSign(map) return request().getBaseResponse(Apis.addIntegralOrder,map) } fun getOrderDrivingData(orderId:Int,orderType:Int): Flowable> { return request().getOrderDrivingData(orderId,orderType) } fun queryHomeEntrance(): Flowable> { return request().queryHomeEntrance() } fun saveLog(url: String): Flowable> { return request().saveLog(url) } }