diff --git a/app/Libs/SimpleSSDB.php b/app/Libs/SimpleSSDB.php index b6920b2..c829bda 100644 --- a/app/Libs/SimpleSSDB.php +++ b/app/Libs/SimpleSSDB.php @@ -78,7 +78,7 @@ class SSDB function __construct($host, $port, $timeout_ms=2000){ $timeout_f = (float)$timeout_ms/1000; - $this->sock = @stream_socket_client("[$host]:$port", $errno, $errstr, $timeout_f); + $this->sock = @stream_socket_client("$host:$port", $errno, $errstr, $timeout_f); if(!$this->sock){ throw new SSDBException("$errno: $errstr"); } diff --git a/app/Service/CouponRebateService.php b/app/Service/CouponRebateService.php index 6641015..d3474ff 100644 --- a/app/Service/CouponRebateService.php +++ b/app/Service/CouponRebateService.php @@ -61,6 +61,7 @@ class CouponRebateService implements CouponRebateServiceInterface $userReceiveCouponIds = $ssdb->exec('hgetall', SsdbKeysPrefix::COUPON_REBATE_RECEIVE . $couponActivity . $userId); if($userReceiveCouponIds !== false){ $ids = array_diff($idsData, $userReceiveCouponIds); + $receiveSsdb = $userReceiveCouponIds; }else{ $ids = $idsData; } @@ -129,7 +130,7 @@ class CouponRebateService implements CouponRebateServiceInterface if ( $couponReceive->save() && $coupon->save() ) { $success[] = $coupon; - $receiveSsdb[] = $coupon->id;; + $receiveSsdb[] = $coupon->id; } }else{ $fail[] = $coupon; diff --git a/app/TaskWorker/SSDBTask.php b/app/TaskWorker/SSDBTask.php index 9c6ef29..fd4d451 100644 --- a/app/TaskWorker/SSDBTask.php +++ b/app/TaskWorker/SSDBTask.php @@ -24,6 +24,13 @@ class SSDBTask return $result; } + public function execWithoutTask($method,...$args) + { + $result = $this->client()->__call($method,$args); + + return $result; + } + protected function client(){ if ($this->ss instanceof SimpleSSDB) { return $this->ss;