|
@@ -9,7 +9,8 @@ use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\DB;
|
|
-use Redis;
|
|
|
|
|
|
+use Illuminate\Support\Facades\Redis;
|
|
|
|
+use Illuminate\Support\Facades\Config;
|
|
use Illuminate\Support\Facades\Log;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
class GiftJob implements ShouldQueue
|
|
class GiftJob implements ShouldQueue
|
|
@@ -58,24 +59,9 @@ class GiftJob implements ShouldQueue
|
|
|
|
|
|
public function apiLimit($apiLimit = 1, $apiLimitTime = 1000, $key = '')
|
|
public function apiLimit($apiLimit = 1, $apiLimitTime = 1000, $key = '')
|
|
{
|
|
{
|
|
- $redisconfig = [
|
|
|
|
- // 主机
|
|
|
|
- 'host' => 'r-uf6s12w1bbuff46572.redis.rds.aliyuncs.com',
|
|
|
|
- 'host' => 'r-uf6s12w1bbuff46572pd.redis.rds.aliyuncs.com',//外网
|
|
|
|
- // 端口
|
|
|
|
- 'port' => 6379,
|
|
|
|
- 'redis_pwd' => 'tA2sXnCJcKdwzxi6',
|
|
|
|
- 'redis_selectdb' => 0,
|
|
|
|
- ];
|
|
|
|
-
|
|
|
|
- $redis = new Redis();
|
|
|
|
- $redis->connect($redisconfig["host"], $redisconfig["port"]);
|
|
|
|
- if ($redisconfig['redis_pwd']) {
|
|
|
|
- $redis->auth($redisconfig['redis_pwd']);
|
|
|
|
- }
|
|
|
|
- if($redisconfig['redis_selectdb'] > 0){
|
|
|
|
- $redis->select($redisconfig['redis_selectdb']);
|
|
|
|
- }
|
|
|
|
|
|
+ $app_name = Config::get('app.name');// laravel name
|
|
|
|
+ $key = "{$app_name}:{$key}";
|
|
|
|
+ $redis = Redis::connection();
|
|
|
|
|
|
//
|
|
//
|
|
//指定键值新增+1 并获取
|
|
//指定键值新增+1 并获取
|