You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
652 B
PHTML
32 lines
652 B
PHTML
2 years ago
|
<?php
|
||
|
|
||
|
namespace Home\Model;
|
||
|
use Think\Model;
|
||
|
|
||
|
/**
|
||
|
* 文档基础模型
|
||
|
*/
|
||
|
class AgentModel extends Model{
|
||
|
public function __construct($name = '', $tablePrefix = '', $connection = '')
|
||
|
{
|
||
|
/* 设置默认的表前缀 */
|
||
|
$this->tablePrefix ='tab_';
|
||
|
/* 执行构造方法 */
|
||
|
parent::__construct($name, $tablePrefix, $connection);
|
||
|
}
|
||
|
|
||
|
public function addRecord($params)
|
||
|
{
|
||
|
$data = $this->create($params);
|
||
|
if(!$data){
|
||
|
return $this->getError();
|
||
|
}
|
||
|
$status = $this->add($data);
|
||
|
if ($status) {
|
||
|
$id = M()->getLastInsID();
|
||
|
return $id;
|
||
|
} else {
|
||
|
return 0;
|
||
|
}
|
||
|
}
|
||
|
}
|