init: 项目初始代码
This commit is contained in:
34
app/api/model/Attribute.php
Normal file
34
app/api/model/Attribute.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
namespace app\api\model;
|
||||
|
||||
|
||||
/**
|
||||
* 属性模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class Attribute extends BaseModel
|
||||
{
|
||||
protected $schema = [
|
||||
'id' => 'int',
|
||||
'platform_id' => 'int',
|
||||
'language_id' => 'int',
|
||||
'site_id' => 'int',
|
||||
'name' => 'string',
|
||||
'create_time' => 'int',
|
||||
'update_time' => 'int',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 通过属性ID,查找是否有商品引用属性
|
||||
* @param $data
|
||||
* @return array|\think\Model|null
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getGoodsAttrById($data)
|
||||
{
|
||||
return GoodsAttribute::where('attribute_id',$data['id'])->find();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user