我正在尝试调度一个实现的作业shouldBeUnique,但它不起作用,我的作业从来不在队列中。如果我删除 ShouldBeUnique,它会按预期工作。
我正在使用Redis。
你们知道发生了什么事吗?
这是我的代码:
<?php
namespace App\Jobs;
use Exception;
use Throwable;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Foundation\Bus\Dispatchable;
class VerifyJob implements ShouldQueue, ShouldBeUnique
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $releaseDelay = 10;
public $tries = 3;
public $user;
public function __construct(User $user)
{
$this->user = $user;
}
public function uniqueId()
{
return $this->user->id;
}
public function handle()
{
\Log::debug('verify 0');
return;
}
public function failed(Throwable $exception)
{
\Log::debug('verify 999'); …Run Code Online (Sandbox Code Playgroud) 我试图使用uni_links包让应用程序链接在 Android 上工作一整天,但没有成功。
当我打开链接时,浏览器会打开它而不是启动应用程序。
你可以看我完整的AndroidManifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app">
<!-- Permissions options for the `storage` group -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- Permissions options for the `camera` group -->
<uses-permission android:name="android.permission.CAMERA"/>
<!-- Permissions options for the `access notification policy` group -->
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>
<application
android:label="example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the …Run Code Online (Sandbox Code Playgroud) 我有一个带有 Map 属性的类,但它似乎不存储该属性。所有其他属性都存储良好:
@JsonSerializable()
@Entity()
class PossessionStats {
@JsonKey(defaultValue: 0)
int id;
String cardUuid;
int total;
Map<String, int>? totalByVersion;
CardPossessionStats({
this.id = 0,
required this.cardUuid,
this.total = 0,
this.totalByVersion,
});
}
Run Code Online (Sandbox Code Playgroud)
当我保存一个时:
stats = PossessionStats(cardUuid: card.uuid);
if (stats.totalByVersion == null) {
stats.totalByVersion = Map();
}
stats.totalByVersion!
.update(version, (value) => quantity, ifAbsent: () => quantity);
stats.total = stats.totalByVersion!.values
.fold(0, (previousValue, element) => previousValue + element);
box.put(stats);
Run Code Online (Sandbox Code Playgroud)
当我得到结果时(刷新后),我可以看到total是正确的,但totalByVersion仍然是空的。
谢谢!