younger_times
2023-07-25 b177ecba47250faab4ead4fc2b5ed7a3f2c40696
WanPai/Network/Services.swift
@@ -140,11 +140,13 @@
        /// 充值明细
        /// - Parameters:
        ///   - yearMonth:  记录(1充值 2扣除)
    class func voucherDetail(recordType:Int?,yearMonth:String)->Observable<BaseResponse<[BillingModel]>>{
    class func voucherDetail(recordType:Int?,yearMonth:String,page:Int,pageSize:Int = 20)->Observable<BaseResponse<[BillingModel]>>{
        let params = ParamsAppender.build(url: All_Url)
            .interface(url: "/account/api/useBenefit/voucherDetail")
            .append(key: "recordId", value: recordType)
            .append(key: "yearMonth", value: yearMonth)
            .append(key: "pageNum", value: page)
            .append(key: "pageSize", value: pageSize)
        return NetworkRequest.request(params: params, method: .post, progress: false)
    }
@@ -157,10 +159,10 @@
    }
        /// 支付
    class func useBenefitPayment(payAmount:Double,payType:PayType)->Observable<BaseResponse<SimpleModel>>{
    class func useBenefitPayment(chargeId:Int,payType:PayType)->Observable<BaseResponse<SimpleModel>>{
        let params = ParamsAppender.build(url: All_Url)
            .interface(url: "/account/api/useBenefit/payment")
            .append(key: "payAmount", value: payAmount)
            .append(key: "chargeId", value: chargeId)
            .append(key: "payType", value: payType.rawValue)
        return NetworkRequest.request(params: params, method: .post, progress: true)
    }
@@ -384,6 +386,65 @@
            .append(key: "score", value: score)
        return NetworkRequest.request(params: params, method: .post, progress: true)
    }
}
// MARK: --  商城部分
extension Services{
        /// 积分商城-商品详情
    static func UseBenefitDetail(goodsId:Int,goodsType:ExchangeType)->Observable<BaseResponse<ExchangeGoodsModel>>{
        let params = ParamsAppender.build(url: All_Url)
            .interface(url: "/account/api/useBenefit/goodsDetails")
            .append(key: "goodsId", value: goodsId)
            .append(key: "goodsType", value: goodsType.rawValue)
        return NetworkRequest.request(params: params, method: .post, progress: true)
    }
        /// 兑换门店
    static func exchangeStoreIds(id:Int,type:ExchangeType)->Observable<BaseResponse<[StoreSimpleModel]>>{
        let params = ParamsAppender.build(url: All_Url)
            .interface(url: "/account/api/useBenefit/exchangeStoreIds")
            .append(key: "goodsId", value: id)
            .append(key: "goodsType", value: type.rawValue)
        return NetworkRequest.request(params: params, method: .post, progress: false)
    }
        /// 兑换商品
    static func exchangeOperation(exchangeType:ExchangePaymentType,goodsId:Int,goodsType:ExchangeType,num:Int,payType:PayType?,stuIds:String)->Observable<BaseResponse<PaymentModel>>{
        let params = ParamsAppender.build(url: All_Url)
            .interface(url: "/account/api/useBenefit/productRedemptionOperation")
            .append(key: "exchangeType", value: exchangeType.rawValue)
            .append(key: "goodId", value: goodsId)
            .append(key: "goodsType", value: goodsType.rawValue)
            .append(key: "nums", value: num)
            .append(key: "payType", value: payType?.rawValue)
            .append(key: "stuIds", value: stuIds)
        return NetworkRequest.request(params: params, method: .post, progress: true)
    }
        /// 积分商城-实体、门票、优惠券为默认门店|课包为默认学员
    static func goodsOfCourseStore(isCourse:Bool,pointsMerId:Int)->Observable<BaseResponse<StudentProfile2Model>>{
        let params = ParamsAppender.build(url: All_Url)
            .interface(url: "/account/api/useBenefit/goodsOfCourseStore")
            .append(key: "isCourse", value: isCourse)
            .append(key: "pointsMerId", value: pointsMerId)
        return NetworkRequest.request(params: params, method: .post, progress: false)
    }
        /// 商城中心
    class func mallList(goodsType:ExchangeType?,rank:Sort2Type?,search:String?)->Observable<BaseResponse<[MarketMdoel]>>{
        let params = ParamsAppender.build(url: All_Url)
            .interface(url: "/account/api/useBenefit/integralMallList")
            .append(key: "goodsType", value: goodsType?.rawValue)
            .append(key: "rank", value: rank?.rawValue)
            .append(key: "lat", value: locationTool.currentLocation?.coordinate.latitude.string)
            .append(key: "lon", value: locationTool.currentLocation?.coordinate.longitude.string)
        return NetworkRequest.request(params: params, method: .post, progress: false)
    }
}
// MARK: -- 预约场地