Files
pgserver3.0/pgserver/application/model/Dictionary.php
annnj-company 130c1026c4 first commit
2026-04-17 18:29:53 +08:00

78 lines
1.8 KiB
PHP

<?php
namespace app\model;
/**
* 楼盘模型
*/
class Dictionary extends Base {
protected $autoWriteTimestamp = true;
// 定义时间戳字段名
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
/**
* 根据类型和值查询名称
* @param string $type
* @return array
* @author zhongjiaqi
*/
public function getValnameByCode($type, $code) {
$where = array(
'status' => 1,
'type' => $type,
'code' => $code
);
$valname = $this->where($where)->value('valname');
return $valname;
}
/**
* 根据类型和值查询备注 订单信息敏感词特殊处理
* @param string $type
* @return array
*/
public function getRemarkByCode($type, $code) {
$where = array(
'status' => 1,
'type' => $type,
'code' => $code
);
$remark = $this->where($where)->value('remark');
return $remark;
}
/**
* 根据类型和值查询名称
* @param string $type
* @return array
*/
public function getcodeByvalname($type, $valname) {
$where = array(
'status' => 1,
'type' => $type,
'valname' => $valname
);
$code = $this->where($where)->value('code');
return $code;
}
/**
* 查询多个字典类型
* @param $typeArr
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function dictionaryMultiType($typeArr) {
return self::where(['type' => ['in', $typeArr], 'status' => 1])->field('type,code,valname')->select();
}
}