Commit 67aa169f by 杨树贤

判断问题

parent 5bc822a7
......@@ -9,6 +9,7 @@ use App\Http\Services\MessageService;
use App\Http\Services\SupplierApplyService;
use App\Http\Services\SupplierService;
use App\Model\BigData\DataManageModel;
use App\Model\RedisModel;
use App\Model\SupplierAccountModel;
use App\Model\SupplierChannelModel;
use Illuminate\Http\Request;
......@@ -104,9 +105,14 @@ class ExternalApiController extends Controller
}
$cacheKey = "supplier:account_exist:" . $supplierId;
$exist = Cache::remember($cacheKey, 30, function () use ($supplierId) {
return SupplierAccountModel::where('supplier_id', $supplierId)->where('a_status', 1)->exists();
});
$redis = new RedisModel();
$exist = $redis->get($cacheKey);
if ($exist) {
$this->externalResponse(0, 'ok', '有芯链账号');
}
$exist = SupplierAccountModel::where('supplier_id', $supplierId)->where('a_status', 1)->exists();
$redis->set($cacheKey, $exist);
$redis->expire($cacheKey, 30);
if ($exist) {
$this->externalResponse(0, 'ok', '有芯链账号');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment