You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.1 KiB
43 lines
1.1 KiB
<?php
|
|
|
|
namespace app\admin\model\ykjp\inventory;
|
|
|
|
use think\Model;
|
|
|
|
class Inventory extends Model {
|
|
|
|
// 表名
|
|
protected $name = 'ykjp_check';
|
|
// 自动写入时间戳字段
|
|
protected $autoWriteTimestamp = 'int';
|
|
// 定义时间戳字段名
|
|
protected $createTime = 'createtime';
|
|
protected $updateTime = false;
|
|
protected $deleteTime = false;
|
|
// 追加属性
|
|
protected $append = [
|
|
'type_text'
|
|
];
|
|
|
|
public function getTypeList() {
|
|
return ['盘盈入库' => __('盘盈入库'), '盘亏出库' => __('盘亏出库')];
|
|
}
|
|
|
|
public function getTypeTextAttr($value, $data) {
|
|
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
|
|
$list = $this->getTypeList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
public function object_array($array) {
|
|
if (is_object($array)) {
|
|
$array = (array) $array;
|
|
} if (is_array($array)) {
|
|
foreach ($array as $key => $value) {
|
|
$array[$key] = $this->object_array($value);
|
|
}
|
|
}
|
|
return $array;
|
|
}
|
|
|
|
}
|
|
|