* Fixed an issue where the objectType was incorrect when deleting.
This commit is contained in:
@@ -56,16 +56,17 @@ class model extends baseModel
|
||||
* 删除记录
|
||||
* Delete one record.
|
||||
*
|
||||
* @param string $table the table name
|
||||
* @param string $id the id value of the record to be deleted
|
||||
* @param string $table the table name
|
||||
* @param string $id the id value of the record to be deleted
|
||||
* @param string $objectType the object type of the record to be deleted
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function delete($table, $id)
|
||||
public function delete($table, $id, $objectType = '')
|
||||
{
|
||||
$this->dao->update($table)->set('deleted')->eq(1)->where('id')->eq($id)->exec();
|
||||
$object = preg_replace('/^' . preg_quote((string) $this->config->db->prefix) . '/', '', trim($table, '`'));
|
||||
$this->loadModel('action')->create($object, $id, 'deleted', '', actionModel::CAN_UNDELETED);
|
||||
if(!$objectType) $objectType = preg_replace('/^' . preg_quote((string) $this->config->db->prefix) . '/', '', trim($table, '`'));
|
||||
$this->loadModel('action')->create($objectType, $id, 'deleted', '', ACTIONMODEL::CAN_UNDELETED);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user