platform notify
This commit is contained in:
@ -8,6 +8,13 @@ class BaseModel extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
const LOCK_TYPE_FOR_UPDATE = 1;
|
||||
const LOCK_TYPE_FOR_SHARE = 2;
|
||||
const LOCK_TYPE = [
|
||||
self::LOCK_TYPE_FOR_UPDATE => '悲观锁',
|
||||
self::LOCK_TYPE_FOR_SHARE => '乐观锁',
|
||||
];
|
||||
|
||||
function checkColInFill($aItem)
|
||||
{
|
||||
foreach ($aItem as $key => $value) {
|
||||
@ -64,6 +71,17 @@ class BaseModel extends Model
|
||||
return $this->newQuery()->where($aWhere)->get($col);
|
||||
}
|
||||
|
||||
function setLockByPrimaryKey($id,$lock_type = self::LOCK_TYPE_FOR_UPDATE): Model|\Illuminate\Database\Eloquent\Builder|null
|
||||
{
|
||||
$model = $this->newQuery()->where($this->primaryKey, $id);
|
||||
if($lock_type == self::LOCK_TYPE_FOR_SHARE){
|
||||
$model = $model->sharedLock();
|
||||
}elseif ($lock_type == self::LOCK_TYPE_FOR_UPDATE){
|
||||
$model = $model->lockForUpdate();
|
||||
}
|
||||
return $model->first();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace App\Models\Wallet\Platform;
|
||||
|
||||
use App\Cache\Table\Wallet\TableWalletPlatformCache;
|
||||
use App\Exceptions\ModelException;
|
||||
use App\Models\Wallet\Base\WalletBaseModel;
|
||||
use App\Tools\Times;
|
||||
@ -49,10 +50,19 @@ class WalletPlatformModel extends WalletBaseModel
|
||||
return $resModel;
|
||||
}
|
||||
|
||||
//@@给平台下发用户信息
|
||||
static function userTransactionNotifyToPlatform($user_transaction_id)
|
||||
function updateItem($aItem,$col = null): bool|int
|
||||
{
|
||||
$res = parent::updateItem($aItem,$col); // TODO: Change the autogenerated stub
|
||||
if($res && isset($aItem[$this->primaryKey])) {
|
||||
$this->delTableCache($aItem[$this->primaryKey]);
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
function delTableCache($key): bool
|
||||
{
|
||||
$oTableWalletPlatformCache = new TableWalletPlatformCache();
|
||||
return $oTableWalletPlatformCache->del($key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user