first commit

This commit is contained in:
root
2025-06-18 10:31:43 +08:00
commit d9f820b55d
981 changed files with 449311 additions and 0 deletions

View File

@ -0,0 +1,11 @@
<?php
namespace App\FormModel\admin\articles;
class ArticlesModel
{
public function edit()
{
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\FormModel\admin\articles;
class BaseModify
{
protected array $attributes = [];
public function setAttributes(array $modifyData): static
{
$this->attributes = $modifyData;
return $this;
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace App\FormModel\admin\articles;
use App\FormModel\admin\articles\trait\ModifyForUpdate;
class ModifyModel extends BaseModify
{
use ModifyForUpdate;
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\FormModel\admin\articles\module;
class BaseModule
{
protected array $attributes = [];
public function setAttributes()
{
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace App\FormModel\admin\articles\module;
class ShowsModel
{
}

View File

@ -0,0 +1,8 @@
<?php
namespace App\FormModel\admin\articles\module;
class StreetModel extends BaseModule
{
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\FormModel\admin\articles\trait;
use App\Model\AppArticle;
trait ModifyForUpdate
{
protected array $canUpdateFields = ['title', 'cover', 'images', 'brand', 'location'];
public function update()
{
$query = AppArticle::where(['aid' => $this->attributes['aid']])->first();
foreach ($this->canUpdateFields as $field) {
$val = $this->attributes[$field] ?? null;
if ($val !== null) {
$query->{$field} = $this->attributes[$field];
}
}
$query->save();
}
}