97 lines
2.1 KiB
PHP
97 lines
2.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Hura8\Components\User\Model;
|
||
|
|
|
||
|
|
|
||
|
|
use Hura8\Interfaces\AppResponse;
|
||
|
|
use Hura8\System\Model\aEntityBaseModel;
|
||
|
|
use Hura8\Interfaces\iEntityModel;
|
||
|
|
use Hura8\Interfaces\EntityType;
|
||
|
|
|
||
|
|
|
||
|
|
class UserCommentReplyModel extends aEntityBaseModel implements iEntityModel
|
||
|
|
{
|
||
|
|
|
||
|
|
public function __construct() {
|
||
|
|
parent::__construct(EntityType::USER_COMMENT_REPLY);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
protected function extendedFilterOptions() : array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
// empty for now
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
protected function _buildQueryConditionExtend(array $condition) : ?array
|
||
|
|
{
|
||
|
|
/*$condition = array(
|
||
|
|
"q" => "",
|
||
|
|
"status" => 0,
|
||
|
|
'read' => 1,-1
|
||
|
|
);*/
|
||
|
|
|
||
|
|
$catCondition = [];
|
||
|
|
$bind_types = [];
|
||
|
|
$bind_values = [];
|
||
|
|
|
||
|
|
|
||
|
|
if(isset($condition["read"]) && $condition["read"]){
|
||
|
|
$catCondition[] = " AND `is_read` = ? ";
|
||
|
|
$bind_types[] = 'd';
|
||
|
|
$bind_values[] = ($condition["read"] == 1) ? 1 : 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
return array( join(" ", $catCondition), $bind_types, $bind_values);
|
||
|
|
}
|
||
|
|
|
||
|
|
protected function _buildQueryOrderBy($sort_by = "new")
|
||
|
|
{
|
||
|
|
return parent::_buildQueryOrderBy($sort_by);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
protected function beforeCreateItem(array $input_info) : AppResponse
|
||
|
|
{
|
||
|
|
$info = $input_info;
|
||
|
|
|
||
|
|
$info['create_time'] = CURRENT_TIME;
|
||
|
|
$info['create_by'] = ADMIN_NAME;
|
||
|
|
|
||
|
|
return new AppResponse('ok', null, $info);
|
||
|
|
}
|
||
|
|
|
||
|
|
protected function afterCreateItem($new_item_id, $new_item_info)
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
protected function beforeUpdateItem($item_id, $current_item_info, $new_input_info) : AppResponse
|
||
|
|
{
|
||
|
|
$info = $new_input_info;
|
||
|
|
|
||
|
|
$info['last_update'] = CURRENT_TIME;
|
||
|
|
$info['last_update_by'] = ADMIN_NAME;
|
||
|
|
|
||
|
|
return new AppResponse('ok', null, $info);
|
||
|
|
}
|
||
|
|
|
||
|
|
protected function afterUpdateItem($item_id, $old_item_info, $new_item_info)
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
protected function beforeDeleteItem($item_id, $item_info) : AppResponse
|
||
|
|
{
|
||
|
|
return new AppResponse('ok');
|
||
|
|
}
|
||
|
|
|
||
|
|
protected function afterDeleteItem($item_id, $item_info)
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|