Files
orico-official-website-old/app/admin/model/Inquiry.php
2024-10-29 14:04:59 +08:00

85 lines
1.9 KiB
PHP
Executable File

<?php
namespace app\admin\model;
use think\Model;
use think\Request;
use think\Config;
class Inquiry extends Model {
use \app\common\traits\AdminModel;
protected $insert = ['createtime'];
//protected $update = [];
public function getInquiryLists($where = null, $order = null, $field = null, $limit = null, $level = 0, array &$alldata = array()) {
if ($level > 5) {
return;
}
if (is_array($where)) {
$where = array_merge(['stat' => ['eq', '0']], $where);
}
if ($where) {
$this->where($where);
}
if ($order) {
$this->order($order);
}
if ($field) {
$this->field($field);
}
if (empty($limit)) {
$limit = Config::get('list_rows');
}
if ($limit) {
$this->limit($limit);
}
$list = $this->select();
if ($list) {
foreach ($list as $k => $row) {
$alldata[] = $row;
}
}
return $alldata;
}
public function getInquiryList($where = null, $order = null, $field = null, $limit = null) {
if (is_array($where)) {
$where = array_merge(['stat' => ['eq', '0']], $where);
}
if ($where) {
$this->where($where);
}
if ($field) {
$this->field($field);
}
if ($order) {
$this->order($order);
}
if ($limit) {
$this->limit($limit);
}
$data = $this->select();
return $data;
}
protected function setCreatetimeAttr($value, $data) {
return time();
}
protected function setContentAttr($content, $data) {
if (!empty($content)) {
$config = \HTMLPurifier_Config::createDefault();
$purifier = new \HTMLPurifier($config);
$content = $purifier->purify($content);
}
return $content;
}
}