no message
This commit is contained in:
parent
1bcd692499
commit
edbc5299a7
@ -357,10 +357,11 @@ class Dog extends Mod\Base {
|
|||||||
public function clone($aParam)
|
public function clone($aParam)
|
||||||
{
|
{
|
||||||
$sValue = $aParam['aArg'][1] ?? false;
|
$sValue = $aParam['aArg'][1] ?? false;
|
||||||
$sWhereField = $aParam["aOption"][1] ?? $this->sPrimaryKey;
|
// $sWhereField = $aParam["aOption"][1] ?? $this->sPrimaryKey;
|
||||||
|
$sKeyType = $aParam["aOption"][1] ?? "int";
|
||||||
|
|
||||||
if ($sValue == "?") {
|
if ($sValue == "?") {
|
||||||
return "#clone__{whereField?primary} {whereValue}";
|
return "#clone__{keyType?int:int,str,int自增str随机} {whereValue}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$sValue) {
|
if (!$sValue) {
|
||||||
@ -368,7 +369,6 @@ class Dog extends Mod\Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查找文章
|
// 查找文章
|
||||||
// $oModelSelf = $this->oModelSelf->find($iId);
|
|
||||||
$oModelSelf = $this->oModelSelf->where($this->sPrimaryKey, $sValue)->first();
|
$oModelSelf = $this->oModelSelf->where($this->sPrimaryKey, $sValue)->first();
|
||||||
|
|
||||||
if (!$oModelSelf) {
|
if (!$oModelSelf) {
|
||||||
@ -376,10 +376,13 @@ class Dog extends Mod\Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$oModelSelfNew = $oModelSelf->replicate();
|
$oModelSelfNew = $oModelSelf->replicate();
|
||||||
|
if ($sKeyType == "str") {
|
||||||
|
$oModelSelfNew->code = $oModelSelfNew->{$this->sPrimaryKey}."-clone".rand(0, 9999);
|
||||||
|
}
|
||||||
$oModelSelfNew->save();
|
$oModelSelfNew->save();
|
||||||
|
|
||||||
$aParam = [];
|
$aParam = [];
|
||||||
$aParam["aArg"][1] = $oModelSelfNew->$sWhereField;
|
$aParam["aArg"][1] = $oModelSelfNew->{$this->sPrimaryKey};
|
||||||
|
|
||||||
return $this->find($aParam);
|
return $this->find($aParam);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user