no message
This commit is contained in:
parent
5dcb99d1db
commit
e001acef07
@ -356,24 +356,29 @@ class Dog extends Mod\Base {
|
||||
|
||||
public function clone($aParam)
|
||||
{
|
||||
$iId = $aParam['aArg'][1] ?? false;
|
||||
$sValue = $aParam['aArg'][1] ?? false;
|
||||
// $sWhereField = $aParam["aOption"][1] ?? $this->sPrimaryKey;
|
||||
$sKeyType = $aParam["aOption"][1] ?? "int";
|
||||
|
||||
if ($iId == "?") {
|
||||
return "#clone {主键值}";
|
||||
if ($sValue == "?") {
|
||||
return "#clone__{keyType?int:int,str,int自增str随机} {whereValue}";
|
||||
}
|
||||
|
||||
if (!$iId) {
|
||||
return "需要arg[1]";
|
||||
if (!$sValue) {
|
||||
return "需要value";
|
||||
}
|
||||
|
||||
// 查找文章
|
||||
$oModelSelf = $this->oModelSelf->find($iId);
|
||||
$oModelSelf = $this->oModelSelf->where($this->sPrimaryKey, $sValue)->first();
|
||||
|
||||
if (!$oModelSelf) {
|
||||
return "没找到这个";
|
||||
}
|
||||
|
||||
$oModelSelfNew = $oModelSelf->replicate();
|
||||
if ($sKeyType == "str") {
|
||||
$oModelSelfNew->code = $oModelSelfNew->{$this->sPrimaryKey}."-clone".rand(0, 9999);
|
||||
}
|
||||
$oModelSelfNew->save();
|
||||
|
||||
$aParam = [];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user