Autionmation init...
This commit is contained in:
parent
1928735693
commit
144036d909
19
app/Controllers/CLI/Mangboard/MangboardController.php
Normal file
19
app/Controllers/CLI/Mangboard/MangboardController.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\CLI\Mangboard;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
abstract class MangboardController extends BaseController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
// Do Not Edit This Line
|
||||
parent::initController($request, $response, $logger);
|
||||
// Preload any models, libraries, etc, here.
|
||||
// E.g.: $this->session = \Config\Services::session();
|
||||
}
|
||||
}
|
||||
@ -8,7 +8,7 @@ use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class UserController extends BaseController
|
||||
class UserController extends MangboardController
|
||||
{
|
||||
private $_model = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
|
||||
16
app/Entities/Mangboard/MangboardEntity.php
Normal file
16
app/Entities/Mangboard/MangboardEntity.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Mangboard;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
abstract class MangboardEntity extends Entity
|
||||
{
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected $casts = [];
|
||||
|
||||
abstract public function __toString();
|
||||
abstract public function getPK();
|
||||
abstract public function getName();
|
||||
}
|
||||
@ -4,12 +4,8 @@ namespace App\Entities\Mangboard;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
class UserEntity extends Entity
|
||||
class UserEntity extends MangboardEntity
|
||||
{
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected $casts = [];
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return "{$this->getPK()}:{$this->getID()}:{$this->getName()}";
|
||||
@ -18,15 +14,14 @@ class UserEntity extends Entity
|
||||
{
|
||||
return $this->attributes['pid'];
|
||||
}
|
||||
public function getID()
|
||||
{
|
||||
return $this->attributes['user_id'];
|
||||
}
|
||||
public function getName()
|
||||
{
|
||||
return $this->attributes['user_name'];
|
||||
}
|
||||
|
||||
public function getID()
|
||||
{
|
||||
return $this->attributes['user_id'];
|
||||
}
|
||||
public function getPoint()
|
||||
{
|
||||
return $this->attributes['user_point'];
|
||||
|
||||
@ -4,7 +4,7 @@ namespace App\Models\Mangboard;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class BaseModel extends Model
|
||||
class MangboardModel extends Model
|
||||
{
|
||||
protected $table = '';
|
||||
protected $primaryKey = '';
|
||||
@ -4,7 +4,7 @@ namespace App\Models\Mangboard;
|
||||
|
||||
use App\Entities\Mangboard\UserEntity;
|
||||
|
||||
class UserModel extends BaseModel
|
||||
class UserModel extends MangboardModel
|
||||
{
|
||||
protected $table = 'mb_users';
|
||||
protected $primaryKey = 'pid';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user