first commit
This commit is contained in:
77
pgserver/application/model/Dictionary.php
Normal file
77
pgserver/application/model/Dictionary.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user