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.
48 lines
1.3 KiB
48 lines
1.3 KiB
1 year ago
|
<?php
|
||
|
|
||
|
namespace app\admin\model\ykjp\purchase;
|
||
|
|
||
|
use think\Model;
|
||
|
use traits\model\SoftDelete;
|
||
|
|
||
|
class Product extends Model {
|
||
|
|
||
|
use SoftDelete;
|
||
|
|
||
|
// 表名
|
||
|
protected $name = 'ykjp_purchase_product';
|
||
|
// 自动写入时间戳字段
|
||
|
protected $autoWriteTimestamp = 'int';
|
||
|
// 定义时间戳字段名
|
||
|
protected $createTime = 'createtime';
|
||
|
protected $updateTime = 'updatetime';
|
||
|
protected $deleteTime = 'deletetime';
|
||
|
// 追加属性
|
||
|
protected $append = [
|
||
|
];
|
||
|
|
||
|
// public function products() {
|
||
|
// return $this->belongsTo('app\admin\model\ykjp\product\Product', 'product_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||
|
// }
|
||
|
|
||
|
public function products() {
|
||
|
return $this->belongsTo('app\admin\model\shopro\goods\SkuPrice', 'product_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||
|
}
|
||
|
|
||
|
public function storage() {
|
||
|
return $this->belongsTo('app\admin\model\ykjp\purchase\Storage', 'storage_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||
|
}
|
||
|
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
}
|