<?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; } } }