order = $order; } /** * Execute the job. * * @return void */ public function doHandle() { $this->order->load([ 'coupon', 'user', ]); if (!$this->order->user) { return; } $coupon = ''; $this->doReport(self::ACTIVATE_SVIP, $this->order->uid, [ 'gender' => $this->transformGender($this->order->user->sex), 'location' => $this->order->user->address, 'device' => $this->order->device, 'type' => $this->transformOrderType($this->order->type), 'amount_float' => $this->order->cash_fee / 100, 'coupon_type' => $this->transformCoupon($this->order->coupon), // 开通性别 字符串 : 男生、女生 // //定位城市 字符串 : 具体城市名称 // //用户系统 字符串 : ios、android // //开通类型 字符串 : 一月会员、一季会员、一年会员 // //充值金额 浮点 : 具体充值数额 // //用券类型 字符串 : 未用券、8.8折优惠券、… ]); } protected function transformCoupon($coupon) { if (!$coupon) { return '未用券'; } if ($coupon->type == '折扣券') { return ($coupon->discount / 100) . '折扣券'; } elseif ($coupon->type == '满减券') { return '最低消费' . ($coupon->min_amount / 100) . '满减券'; } elseif ($coupon->type == '抵扣券') { return ($coupon->coupon_amount / 100) . '抵扣券'; } else { return $coupon->type; } } }