* [ * 'configRate' => 32, // 当前站点设置的回传比例为 32% * 'reportRate' => 43, // 当前站点实际的回传比例[在本单回传之前的比例] 为 43% * ] * */ public $reportInfo; /** * @var array 根据配置,对当前订单的回传与否的判定结果 *
* [ * 'result' => true|false , // true-表示订单回传,false-订单不回传 * 'type' => 'xxx', // 不回传的原因:amount_filter-金额过滤 * 'content' => 'xxx', // 具体的提示信息 * 'needRecord' => true | false , // true-需要记录到report_user_charge_records表中,false-不记录 * ] **/ public $result; /** * @var TraceContext traceInfo 信息 */ public $traceContext; public function __construct($user, $order, $channelCallbackConfig, $traceContext, $channelSettingRate = 0) { $this->user = $user; $this->order = $order; $this->channelCallbackConfig = $channelCallbackConfig; $this->traceContext = $traceContext; $this->result = [ 'result' => true, 'needRecord' => true, ]; $this->reportInfo = [ 'configRate' => $channelSettingRate, 'reportRate' => 0 ]; } public function checkNecessaryInfo() { if (!$this->user) { throw new RuntimeException('用户信息不存在'); } if (!$this->order) { throw new RuntimeException('订单信息不存在'); } if (!$this->channelCallbackConfig) { throw new RuntimeException('站点回传配置信息不存在'); } } }