文件
mashangyoujiu/Application/Common/Model/RetailSkuAttrModel.class.php

39 行
1.3 KiB
PHP
可执行文件

<?php
namespace Common\Model;
use Think\Model;
//[1.6.48]
/**
* 规格属性表
* Class RetailSkuAttrModel
* @package Common\Model
*/
class RetailSkuAttrModel extends BaseModel
{
protected $tableName = 'retail_sku_attr';
const ID = 'id'; //int(11) NOT NULL AUTO_INCREMENT,
const MERCHANT_ID = 'merchantid'; //int(11) DEFAULT NULL,
const STORE_ID = 'storeid'; //int(11) DEFAULT NULL COMMENT '门店id',
const NAME = 'name'; //varchar(255) DEFAULT NULL COMMENT '属性名',
const ADD_TIME = 'addtime'; //varchar(20) DEFAULT NULL COMMENT '添加时间',
const STATUS = 'status'; //tinyint(1) DEFAULT '1' COMMENT '0不启用 1启用',
const STATE = 'state'; //tinyint(1) DEFAULT '0' COMMENT '0正常 1删除',
const TYPE = 'type'; //tinyint(1) DEFAULT '1' COMMENT '1常用 不常用',
/**
* 根据规格属性值ID获取规格属性
* @param $list_id
* @return mixed
*/
public function getAttrName($list_id)
{
$name = $this->alias('s')
->join('ls_retail_sku_list as l on l.attr_id=s.id')
->where(array('s.state' => 0, 'l.id' => $list_id))
->getField('s.name');
return $name;
}
}