part of 'flutter_union_ad.dart'; /// 优量汇竞价 class FlutterUnioAdBiddingController { late MethodChannel? _methodChannel; init(MethodChannel? method) { _methodChannel = method; } // 回传竞价结果 void biddingResult(FlutterUnioAdBiddingResult result) { // 竞价成功 if (result.isSuccess) { _methodChannel?.invokeMethod('biddingSucceeded', { 'expectCostPrice': result.expectCostPrice, 'highestLossPrice': result.highestLossPrice, }); // 竞价失败 } else { _methodChannel?.invokeMethod('biddingSucceeded', { 'winPrice': result.winPrice, 'lossReason': result.lossReason, 'adnId': result.adnId, }); } } } class FlutterUnioAdBiddingResult { int? expectCostPrice; int? highestLossPrice; int? winPrice; int? lossReason; String? adnId; bool isSuccess = true; FlutterUnioAdBiddingResult(); /// 竞价成功 ///[expectCostPrice] 竞胜出价,类型为Integer ///[highestLossPrice] 最大竞败方出价,类型为Integer FlutterUnioAdBiddingResult success( int expectCostPrice, int highestLossPrice, ) { isSuccess = true; this.expectCostPrice = expectCostPrice; this.highestLossPrice = highestLossPrice; return this; } /// 竞价失败 /// [winPrice] 本次竞胜方出价(单位:分),类型为Integer。选填 /// [lossReason] 优量汇广告竞败原因,类型为Integer。必填 [FlutterTencentAdBiddingLossReason] /// [adnId] 本次竞胜方渠道ID,类型为Integer。必填。 [FlutterTencentAdADNID] FlutterUnioAdBiddingResult fail(int winPrice, int lossReason, String adnId) { isSuccess = false; this.winPrice = winPrice; this.lossReason = lossReason; this.adnId = adnId; return this; } FlutterUnioAdBiddingResult.fromJson(Map json) { expectCostPrice = json['expectCostPrice']; highestLossPrice = json['highestLossPrice']; winPrice = json['winPrice']; lossReason = json['lossReason']; adnId = json['adnId']; } Map toJson() { final Map data = {}; data['isSuccess'] = isSuccess; data['expectCostPrice'] = expectCostPrice; data['highestLossPrice'] = highestLossPrice; data['winPrice'] = winPrice; data['lossReason'] = lossReason; data['adnId'] = adnId; return data; } }