$name, 'code' => $code, 'created_at' => Times::getNowDateTime(), ]; try { Db::beginTransaction(); $resModel = $this->addItem($insert); if(!$resModel) throw new ModelException('添加失败'); $appid_key = $resModel->id . $resModel->name . $resModel->code; $resModel->appid = Tools::getMd5($appid_key); $resModel->secret = Tools::generateRandStr(32); $res = $resModel->save(); if(!$res) throw new ModelException('添加appid失败'); Db::commit(); }catch (\Exception $e) { Db::rollBack(); throw $e; } return $resModel; } 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); } }