51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use App\Models\ShareLog;
|
|
class AddShareLog implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
protected $data;
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct($data)
|
|
{
|
|
$this->data = $data;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
$data = $this->data;
|
|
ShareLog::firstOrCreate($data);
|
|
// //第一次分享成为介绍人
|
|
// $user = User::find($data['user_id']);
|
|
// if (!$user->recommendUserLog && $data['user_id'] != $data['from_user_id']) {
|
|
// if ($data['from_source'] == 'oa') {
|
|
// $channel = 'H5';
|
|
// }elseif ($data['from_source'] == 'mp') {
|
|
// $channel = 'MP';
|
|
// }elseif ($data['from_source'] == 'app') {
|
|
// $channel = "APP";
|
|
// }
|
|
// $user->recommendUserLog()->create(['recommend_user_id'=>$data['from_user_id'], 'channel'=>$channel]);
|
|
// }
|
|
}
|
|
}
|