|
@@ -4,6 +4,7 @@ namespace App\Jobs\Push;
|
|
|
|
|
|
use App\Modules\Push\Models\QappNewUserPushTask;
|
|
|
use App\Modules\Push\Models\QappNewUserPushTaskLog;
|
|
|
+use App\Modules\Push\Models\QappPushUser;
|
|
|
use App\Modules\Push\Services\PushMessageService;
|
|
|
use App\Modules\Trade\Models\Order;
|
|
|
use App\Modules\User\Models\QappUserAddDestop;
|
|
@@ -70,21 +71,32 @@ class NewUserPushMsg implements ShouldQueue
|
|
|
*/
|
|
|
public function handle()
|
|
|
{
|
|
|
- $log = $this->createLog();
|
|
|
- $filter = $this->fliterUser($this->task->push_filter, $this->uid);
|
|
|
- if ($filter) {
|
|
|
- $result = PushMessageService::pushMessageToUser($this->uid, $this->task->title, $this->task->content, $this->task->url);
|
|
|
- $log->push_time = now();
|
|
|
- if ($result) {
|
|
|
- $log->status = 3;
|
|
|
- $log->push_result = json_encode($result);
|
|
|
+ if (stripos($this->task->providers, $this->findUserProvider($this->uid)) >= 0) {
|
|
|
+ $log = $this->createLog();
|
|
|
+ $filter = $this->fliterUser($this->task->push_filter, $this->uid);
|
|
|
+ if ($filter) {
|
|
|
+ $result = PushMessageService::pushMessageToUser($this->uid, $this->task->title, $this->task->content, $this->task->url);
|
|
|
+ $log->push_time = now();
|
|
|
+ if ($result) {
|
|
|
+ $log->status = 3;
|
|
|
+ $log->push_result = json_encode($result);
|
|
|
+ } else {
|
|
|
+ $log->status = 4;
|
|
|
+ }
|
|
|
} else {
|
|
|
- $log->status = 4;
|
|
|
+ $log->status = 5;
|
|
|
}
|
|
|
- } else {
|
|
|
- $log->status = 5;
|
|
|
+ $log->save();
|
|
|
}
|
|
|
- $log->save();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查找用户机型
|
|
|
+ */
|
|
|
+ private function findUserProvider(int $uid)
|
|
|
+ {
|
|
|
+ $push_user = QappPushUser::where('uid', $uid)->first();
|
|
|
+ return $push_user ? $push_user->provider : '';
|
|
|
}
|
|
|
|
|
|
private function findUserBalance(int $uid): int
|