Browse Source

Merge branch 'coupon_rebate' of http://120.24.33.109:11081/hyzjshwo/lanzu_api_hyperf into coupon_rebate

master
parent
commit
8d437ab29c
  1. 2
      app/Libs/SimpleSSDB.php
  2. 3
      app/Service/CouponRebateService.php
  3. 7
      app/TaskWorker/SSDBTask.php

2
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");
}

3
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;

7
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;

Loading…
Cancel
Save