package com.fuban.user.network
|
|
import cn.sinata.xldutils.data.ResultData
|
import cn.sinata.xldutils.utils.SPUtils
|
import com.google.gson.Gson
|
import com.google.gson.JsonObject
|
import com.fuban.user.network.entity.*
|
import com.fuban.user.network.entity.Function
|
import com.fuban.user.utils.Const
|
import io.reactivex.Flowable
|
|
object HttpManager {
|
private const val PAGE_SIZE = 20
|
/**
|
* 发起请求方法
|
*/
|
private fun request() =
|
RRetrofit.instance().create(ApiService::class.java)
|
|
private fun getAppId() = SPUtils.instance().getString(Const.User.APP_ID)
|
/**
|
* 获取h5
|
* @param type 1:隐私协议,2:用户协议,3:用户指南,4:法律条款,5:关于我们
|
*/
|
fun getH5(type:Int): Flowable<ResultData<JsonObject>> {
|
return request().getH5(type)
|
}
|
|
/**
|
* 获取首页电话
|
* @param code 行政区域编号
|
*/
|
fun getPhone(code: String): Flowable<ResultData<ArrayList<Phone>>> {
|
return request().getPhone(code)
|
}
|
|
/**
|
* 包车获取首页电话
|
* @param code 行政区域编号
|
*/
|
fun queryPhones(code: String): Flowable<ResultData<ArrayList<Phone>>> {
|
return request().queryPhones(code)
|
}
|
|
/**
|
* 获取首页轮播消息
|
* @param type 1:轮播消息
|
*/
|
fun queryNotices(type: Int): Flowable<ResultData<ArrayList<Message>>> {
|
return request().queryNotices(type)
|
}
|
|
/**
|
* 获取首页广告
|
* @param type 1:弹窗广告,2:底部广告
|
*/
|
fun getAds(type: Int,code: String): Flowable<ResultData<ArrayList<Message>>> {
|
return request().getAds(type,code)
|
}
|
|
/**
|
* 发送验证码
|
* @param type 1=身份验证,2=登录确认,3=用户注册,4=修改密码
|
*/
|
fun sendSms(phone: String,type: Int): Flowable<ResultData<JsonObject>> {
|
return request().getCode(phone,type)
|
}
|
/**
|
* 验证码登录
|
*/
|
fun codeLogin(phone: String,code: String,area: String? = null,ip: String? = null): Flowable<ResultData<JsonObject>> {
|
return request().codeLogin(phone,code,area,ip)
|
}
|
|
/**
|
* 密码登录
|
*/
|
fun pwdLogin(phone: String,code: String): Flowable<ResultData<JsonObject>> {
|
return request().pwdLogin(phone,code)
|
}
|
|
/**
|
* 微信登录
|
*/
|
fun wxLogin(openid: String?, registAreaCode: String, unionid: String?, avatar: String?,nickName: String?,sex: Int?): Flowable<ResultData<JsonObject>> {
|
return request().wxLogin(openid, registAreaCode, unionid,avatar,nickName, sex)
|
}
|
|
/**
|
* 一键登录
|
*/
|
fun oneClickLogin(token: String): Flowable<ResultData<JsonObject>> {
|
return request().oneClickLogin(token)
|
}
|
|
/**
|
* 微信登录绑定手机
|
*/
|
fun bindingPhone(code:String,phone: String): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["code"] = code
|
map["phone"] = phone
|
map["loginType"] = "0"
|
map["appid"] = getAppId()
|
map["sign"] = SignUtil.getSign(map)
|
return request().getBaseResponse(Apis.bindingPhone,map)
|
}
|
|
/**
|
* 注销
|
*/
|
fun unregister(): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["appid"] = getAppId()
|
map["sign"] = SignUtil.getSign(map)
|
return request().getBaseResponse(Apis.cancellation,map)
|
}
|
|
/**
|
* 忘记密码
|
*/
|
fun forgetPassword(code: String,password: String,phone: String): Flowable<ResultData<JsonObject>> {
|
return request().forgetPassword(code, password, phone)
|
}
|
|
/**
|
* 城市是否开通
|
*/
|
fun isOpenCity(code:String): Flowable<ResultData<JsonObject>> {
|
return request().isOpenCity(code)
|
}
|
|
/**
|
* 定位城市功能
|
*/
|
fun queryBusiness(city:String,province:String,district:String): Flowable<ResultData<ArrayList<Function>>> {
|
return request().queryBusiness(city,district, province)
|
}
|
|
/**
|
* 选择城市功能
|
*/
|
fun queryBusinessById(id: Int): Flowable<ResultData<ArrayList<Function>>> {
|
return request().queryBusinessById(id)
|
}
|
|
/**
|
* 开通城市列表
|
*/
|
fun queryOpenCity(): Flowable<ResultData<ArrayList<OpenCity>>> {
|
return request().queryOpenCity()
|
}
|
|
/**
|
* 附近司机数量
|
* @param type:1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车
|
*/
|
fun getDriverNum(lat:Double,lon:Double,type: Int): Flowable<ResultData<JsonObject>> {
|
return request().getDriverNum(lat, lon, type)
|
}
|
|
/**
|
* 查询价格和车型
|
* @param type:1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车
|
*/
|
fun queryServerCarModel(start:String,end:String,type: Int): Flowable<ResultData<ArrayList<CarPrice>>> {
|
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): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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
|
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)
|
}
|
|
/**
|
* 摆渡车下单
|
* @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<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<ArrayList<City>>> {
|
return request().queryRegions(id)
|
}
|
|
/**
|
* 获取物流单价
|
*/
|
fun queryLogisticsUnitPrice(endAddress: String,startLonLat: String,type: Int): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["endAddress"] = endAddress
|
map["startLonLat"] = startLonLat
|
map["type"] = type
|
map["appid"] = getAppId()
|
return request().queryLogisticsUnitPrice(endAddress, startLonLat, type,SignUtil.getSign(map), getAppId())
|
}
|
|
/**
|
* 获取物流单价
|
*/
|
fun queryPayMoney(endAddress: String,startLonLat: String,num:Int,type: Int): Flowable<ResultData<JsonObject>> {
|
return request().queryPayMoney(endAddress, startLonLat, num,type)
|
}
|
|
/**
|
* 我的订单
|
* @param type 订单类型(1=专车,2=出租车,3=直通车)
|
*/
|
fun myOrderList(page:Int,type: Int,size:Int = PAGE_SIZE): Flowable<ResultData<ArrayList<Order>>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<Order>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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(id:Int, orderType:Int, reason:String?=null, remark:String?=null): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["id"] = id
|
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<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<TrippingInfo>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<Order>> {
|
val map = HashMap<String, Any>()
|
map["orderId"] = id
|
map["orderType"] = orderType
|
map["appid"] = getAppId()
|
return request().queryEndPush(id,orderType,SignUtil.getSign(map),getAppId())
|
}
|
|
/**
|
* 司机详情
|
*/
|
fun queryDriverInfo(id:Int): Flowable<ResultData<DriverInfo>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<ArrayList<Evaluation>>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<UserInfo>> {
|
val map = HashMap<String, Any>()
|
map["appid"] = getAppId()
|
return request().queryUserInfo(SignUtil.getSign(map),getAppId())
|
}
|
|
|
/**
|
* 修改用户详情
|
*/
|
fun updateInfo(avatar:String?,birthday:String?,nickname:String?,sex:String?): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
if (avatar!=null)
|
map["avatar"] = avatar
|
if (birthday!=null)
|
map["birthday"] = birthday
|
if (nickname!=null)
|
map["nickname"] = nickname
|
if (sex!=null)
|
map["sex"] = sex
|
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): Flowable<ResultData<OrderPayBean>> {
|
val map = HashMap<String, Any>()
|
map["orderId"] = id
|
map["payType"] = payType
|
map["type"] = 1
|
map["orderType"] = orderType
|
if (couponId!=null)
|
map["couponId"] = couponId
|
map["appid"] = getAppId()
|
return request().payTaxiOrder(id,payType,1,orderType,couponId,SignUtil.getSign(map),getAppId())
|
}
|
|
/**
|
* 小件物流补差价支付
|
* @param payType 1=微信,2=支付宝,3=余额
|
*/
|
fun payOrderLogisticsSpread(id:Int,payType:Int): Flowable<ResultData<OrderPayBean>> {
|
val map = HashMap<String, Any>()
|
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): Flowable<ResultData<OrderPayBean>> {
|
val map = HashMap<String, Any>()
|
map["id"] = id
|
map["payType"] = payType
|
map["type"] = 1
|
map["cancleId"] = cancleId
|
map["orderType"] = orderType
|
map["appid"] = getAppId()
|
return request().cancleOrderTaxi(id,payType,1,orderType,cancleId,SignUtil.getSign(map),getAppId())
|
}
|
|
/**
|
* 评价
|
*/
|
fun orderEvaluate(orderId:Int,fraction:Int,orderType:Int,content:String): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["orderId"] = orderId
|
map["orderType"] = orderType
|
map["appid"] = getAppId()
|
map["sign"] = SignUtil.getSign(map)
|
return request().getBaseResponse(Apis.completeOrder,map)
|
}
|
|
/**
|
* 查询进行中的订单
|
*/
|
fun queryServingOrder(): Flowable<ResultData<ArrayList<Order>>> {
|
val map = HashMap<String, Any>()
|
map["appid"] = getAppId()
|
return request().queryTripping(SignUtil.getSign(map),getAppId())
|
}
|
|
/**
|
* 查询可用优惠券
|
*/
|
fun queryCoupon(orderId: Int,orderType: Int,page: Int): Flowable<ResultData<ArrayList<Coupon>>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<ArrayList<Point>>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<ArrayList<Point>>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<ArrayList<Coupon>>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<RealName>> {
|
val map = HashMap<String, Any>()
|
map["appid"] = getAppId()
|
return request().queryRealName(SignUtil.getSign(map),getAppId())
|
}
|
|
/**
|
* 删除优惠券
|
*/
|
fun delMyCoupon(id:Int): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["id"] = id
|
map["appid"] = getAppId()
|
map["sign"] = SignUtil.getSign(map)
|
return request().getBaseResponse(Apis.delMyCoupon,map)
|
}
|
|
/**
|
* 赠送优惠券
|
*/
|
fun giveCoupon(id:Int,userId:Int): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<UserInfo>> {
|
val map = HashMap<String, Any>()
|
map["phone"] = phone
|
map["appid"] = getAppId()
|
return request().queryUser(phone,SignUtil.getSign(map), getAppId())
|
}
|
|
/**
|
* 消费记录、提现记录、红包使用记录、积分兑换记录
|
*/
|
fun walletRecord(url:String,page: Int,size: Int = PAGE_SIZE): Flowable<ResultData<ArrayList<WalletRecord>>> {
|
val map = HashMap<String, Any>()
|
map["pageNum"] = page
|
map["size"] = size
|
map["appid"] = getAppId()
|
return request().walletRecord(url,page,size,SignUtil.getSign(map), getAppId())
|
}
|
|
/**
|
* 红包列表
|
*/
|
fun queryMyRedEnvelope(page: Int,size: Int = PAGE_SIZE): Flowable<ResultData<ArrayList<WalletRecord>>> {
|
val map = HashMap<String, Any>()
|
map["pageNum"] = page
|
map["size"] = size
|
map["appid"] = getAppId()
|
return request().queryRedEnvelope(page,size,SignUtil.getSign(map), getAppId())
|
}
|
|
/**
|
* 提现申请
|
*/
|
fun withdrawal(name:String,code:String,money:Double): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["name"] = name
|
map["code"] = code
|
map["money"] = money
|
map["appid"] = getAppId()
|
map["sign"] = SignUtil.getSign(map)
|
return request().getBaseResponse(Apis.withdrawal,map)
|
}
|
|
/**
|
* 反馈
|
*/
|
fun feedback(content:String): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["content"] = content
|
map["appid"] = getAppId()
|
map["sign"] = SignUtil.getSign(map)
|
return request().getBaseResponse(Apis.feedback,map)
|
}
|
|
/**
|
* 留言
|
*/
|
fun leaveMessage(content:String): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<ArrayList<ServiceRecord>>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<ArrayList<Message>>> {
|
val map = HashMap<String, Any>()
|
map["pageNum"] = page
|
map["size"] = size
|
map["type"] = type
|
map["appid"] = getAppId()
|
return request().msgNotice(page,size,type,SignUtil.getSign(map), getAppId())
|
}
|
|
/**
|
* 客服电话
|
*/
|
fun queryCustomerPhone(code:String): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["code"] = code
|
map["appid"] = getAppId()
|
map["sign"] = SignUtil.getSign(map)
|
return request().getBaseResponse(Apis.queryCustomerPhone,map)
|
}
|
|
/**
|
* 未读数量
|
*/
|
fun queryUnReadNum(): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["appid"] = getAppId()
|
map["sign"] = SignUtil.getSign(map)
|
return request().getBaseResponse(Apis.queryUnReadNum,map)
|
}
|
|
/**
|
* 验证短信
|
*/
|
fun checkCode(code:String,phone: String): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["password"] = password
|
map["appid"] = getAppId()
|
map["sign"] = SignUtil.getSign(map)
|
return request().getBaseResponse(Apis.updatePassword,map)
|
}
|
|
/**
|
* 修改手机号
|
*/
|
fun updatePhone(code:String,phone: String): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["code"] = code
|
map["phone"] = phone
|
map["appid"] = getAppId()
|
map["sign"] = SignUtil.getSign(map)
|
return request().getBaseResponse(Apis.updatePhone,map)
|
}
|
|
/**
|
* 清空消息
|
*/
|
fun clearSystemNotice(): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["appid"] = getAppId()
|
map["sign"] = SignUtil.getSign(map)
|
return request().getBaseResponse(Apis.clearSystemNotice,map)
|
}
|
|
/**
|
* 删除消息
|
*/
|
fun delSystemNotice(id:Int): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["id"] = id
|
map["appid"] = getAppId()
|
map["sign"] = SignUtil.getSign(map)
|
return request().getBaseResponse(Apis.delSystemNotice,map)
|
}
|
|
/**
|
* 阅读消息
|
*/
|
fun readSystemNotice(id:Int): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["id"] = id
|
map["appid"] = getAppId()
|
map["sign"] = SignUtil.getSign(map)
|
return request().getBaseResponse(Apis.readSystemNotice,map)
|
}
|
|
/**
|
* 分享得红包
|
*/
|
fun shareRedEnvelope(id:Int,type: Int): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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,type:Int = 1): Flowable<ResultData<OrderPayBean>> {
|
val map = HashMap<String, Any>()
|
map["payType"] = payType
|
map["money"] = money
|
map["type"] = type
|
map["appid"] = getAppId()
|
return request().depositBalance(money,payType,type,SignUtil.getSign(map), getAppId())
|
}
|
|
/**
|
* 检查版本
|
*/
|
fun queryNewData(): Flowable<ResultData<VersionData>> {
|
return request().queryNewData()
|
}
|
|
/**
|
* 起终点站点
|
*/
|
fun querySite(startId:Int? = null): Flowable<ResultData<ArrayList<City>>> {
|
return request().querySite(startId)
|
}
|
|
/**
|
* 线路搜索
|
*/
|
fun queryLines(startId:Int,endId:Int): Flowable<ResultData<ArrayList<Line>>> {
|
return request().queryLines(startId,endId)
|
}
|
|
/**
|
* 班次搜索
|
*/
|
fun queryDriver(day:String,lineId:Int,driverId:Int? = null): Flowable<ResultData<ArrayList<Shift>>> {
|
return request().queryDriver(day,lineId,driverId)
|
}
|
|
/**
|
* 搜索座位
|
*/
|
fun querySeat(id: Int): Flowable<ResultData<SeatInfo>> {
|
return request().querySeat(id)
|
}
|
|
/**
|
* 站点范围
|
*/
|
fun queryLocation(id: Int): Flowable<ResultData<ArrayList<Anchor>>> {
|
return request().queryLocation(id)
|
}
|
|
/**
|
* 站点是否在范围内
|
* */
|
fun areaMonitoring(id: Int,code: String,lonLat:String): Flowable<ResultData<Int>> {
|
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<ResultData<JsonObject>> {
|
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,frequentPassengersId :String,travelMode:Int,serverCarModelId:Int,totalSeat:Int): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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
|
val intList = arrayListOf<Int>()
|
intList.addAll(frequentPassengersId.split(",").map { it.toInt() })
|
val toJson = Gson().toJson(intList)
|
map["frequentPassengersId"] = toJson
|
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,toJson,travelMode,serverCarModelId,totalSeat,SignUtil.getSign(map), getAppId())
|
}
|
|
/**
|
* 查询包车车型
|
*/
|
fun queryServerCarModels(): Flowable<ResultData<ArrayList<CarPrice>>> {
|
return request().queryServerCarModels()
|
}
|
|
/**
|
* 包车下单
|
*/
|
fun orderCharteredCar(carTime:Int, travelTime:String, placeLonLat:String,contactPerson:String, contactPhone:String,
|
modelUse:String, peopleNumber:Int, serverCarModelId:Int): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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 queryLogisticsNumber(): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["appid"] = getAppId()
|
map["sign"] = SignUtil.getSign(map)
|
return request().getBaseResponse(Apis.queryLogisticsNumber,map)
|
}
|
|
/**
|
* 物流下单
|
*/
|
fun smallLogistics(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<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["cargoNumber"] = cargoNumber
|
map["cargoType"] = cargoType
|
map["endAddress"] = endAddress
|
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["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<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["endAddress"] = endAddress
|
map["startLonLat"] = startLonLat
|
return request().getBaseResponse(Apis.judgingTheCity,map)
|
}
|
|
/**
|
* 积分礼物列表
|
*/
|
fun queryGoods(page:Int,size: Int = Const.PAGE_SIZE): Flowable<ResultData<ArrayList<Goods>>> {
|
val map = HashMap<String, Any>()
|
map["pageNum"] = page
|
map["size"] = size
|
map["appid"] = getAppId()
|
return request().queryGoods(page,size,SignUtil.getSign(map), getAppId())
|
}
|
|
/**
|
* 礼物详情
|
*/
|
fun queryGoodsInfo(id:Int): Flowable<ResultData<Goods>> {
|
val map = HashMap<String, Any>()
|
map["id"] = id
|
map["appid"] = getAppId()
|
return request().queryGoodsInfo(id,SignUtil.getSign(map), getAppId())
|
}
|
|
/**
|
* 积分兑换
|
*/
|
fun addIntegralOrder(consigneeAddress:String, consigneeName:String,consigneePhone:String, goodsId:Int,
|
remark:String): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
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 queryFrequentPassengersList(): Flowable<ResultData<List<Passenger>>> {
|
return request().queryFrequentPassengersList()
|
}
|
|
/**
|
* 添加/编辑 常用乘车人
|
*/
|
fun saveFrequentPassengers(idcode:String,name:String,phone:String,sex:Int,id:Int?=null): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["idcode"] = idcode
|
map["name"] = name
|
map["phone"] = phone
|
map["sex"] = sex
|
if (id!=null)
|
map["id"] = id
|
map["appid"] = getAppId()
|
map["sign"] = SignUtil.getSign(map)
|
return request().getBaseResponse(Apis.saveFrequentPassengers,map)
|
}
|
|
/**
|
* 删除
|
*/
|
fun delFrequentPassengers(id:Int): Flowable<ResultData<JsonObject>> {
|
val map = HashMap<String, Any>()
|
map["id"] = id
|
map["appid"] = getAppId()
|
map["sign"] = SignUtil.getSign(map)
|
return request().getBaseResponse(Apis.delFrequentPassengers,map)
|
}
|
}
|