|
@@ -26,6 +26,7 @@ use App\Modules\Trade\Models\Order;
|
|
|
use App\Modules\User\Models\QappUserAddDestop;
|
|
|
use App\Modules\UserTask\Services\BaseTask;
|
|
|
use App\Modules\UserTask\Services\UserTaskService;
|
|
|
+use Illuminate\Support\Facades\Cache;
|
|
|
use Redis;
|
|
|
|
|
|
class UserService
|
|
@@ -56,15 +57,20 @@ class UserService
|
|
|
|
|
|
public static function qappAddDesktop(int $uid, int $status)
|
|
|
{
|
|
|
- $time = getMillisecond();
|
|
|
- myLog('incrAddDeskTop')->info('qappAddDesktop', compact('uid', 'status','time'));
|
|
|
+ $key = "last_add_desktop_status_".$uid;
|
|
|
+ $last_status = Cache::get($key, -1);
|
|
|
+
|
|
|
+ if ($last_status > -1 && $last_status == $status){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ Cache::forever($key, $status);
|
|
|
+
|
|
|
+ // myLog('incrAddDeskTop')->info('qappAddDesktop', compact('uid', 'status'));
|
|
|
$log = QappUserAddDestop::where('uid', $uid)->orderBy('id', 'desc')->first();
|
|
|
|
|
|
if($status == 1){
|
|
|
-
|
|
|
+ // myLog('incrAddDeskTop')->info('qappAddDesktopTask', compact('uid', 'status'));
|
|
|
UserTaskService::addUserTaskQueue($uid, BaseTask::add_desk, UserTaskService::add_trigger);
|
|
|
- $time = getMillisecond();
|
|
|
- myLog('incrAddDeskTop')->info('qappAddDesktop', compact('uid', 'status','time'));
|
|
|
}
|
|
|
|
|
|
if (!$log) {
|
|
@@ -93,8 +99,6 @@ class UserService
|
|
|
|
|
|
$job = new UserAddDeskJob($uid);
|
|
|
dispatch($job)->onConnection('rabbitmq')->onQueue('qapp_user_add_desk')->delay(now()->addMinutes(3));
|
|
|
- $time = getMillisecond();
|
|
|
- myLog('incrAddDeskTop')->info('qappAddDesktop', compact('uid', 'status','time'));
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -107,8 +111,6 @@ class UserService
|
|
|
]);
|
|
|
}
|
|
|
//相等 不做处理
|
|
|
- $time = getMillisecond();
|
|
|
- myLog('incrAddDeskTop')->info('qappAddDesktop', compact('uid', 'status','time'));
|
|
|
return false;
|
|
|
}
|
|
|
}
|