1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace App\Jobs\GrowingIO;
- use App\Models\User\SignModel;
- use App\Models\User\UserModel;
- use Illuminate\Bus\Queueable;
- use Illuminate\Queue\SerializesModels;
- use Illuminate\Queue\InteractsWithQueue;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Foundation\Bus\Dispatchable;
- class SignReportJob extends BaseReportJob implements ShouldQueue
- {
- use Dispatchable;
- use InteractsWithQueue;
- use Queueable;
- use SerializesModels;
- /** @var SignModel */
- protected $sign;
- protected $platform;
- protected $user;
- public function __construct($sign, $platform)
- {
- $this->sign = $sign;
- $this->platform = $platform;
- }
- public function doHandle()
- {
- $this->user = UserModel::find($this->sign->uid);
- if (!$this->user) {
- return;
- }
- $this->doReport(self::SIGN, $this->sign->uid, [
- 'type' => $this->getType(),
- 'gender' => $this->getGender(),
- ]);
- }
- protected function getGender()
- {
- switch ($this->user->gender) {
- case 1:
- return '男性';
- case 2:
- return '女性';
- default:
- return '未知';
- }
- }
- protected function getType()
- {
- switch ($this->platform) {
- case "wx":
- return "小程序签到";
- case "qq":
- return "小程序签到";
- case "ios":
- return "APP签到";
- case "android":
- return "APP签到";
- }
- }
- }
|