123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- namespace app\common\model;
- use think\facade\Db;
- class Attribute extends BaseModel
- {
- const SHOW0 = 0;
- const SHOW1 = 1;
-
- public function getAttributeList($condition, $field = '*')
- {
- return Db::name('attribute')->where($condition)->field($field)->order('attr_sort asc')->select()->toArray();
- }
-
- public function getAttributeShowList($condition, $field = '*')
- {
- $condition[] = array('attr_show', '=', self::SHOW1);
- return $this->getAttributeList($condition, $field);
- }
-
- public function getAttributeValueList($condition, $field = '*')
- {
- return Db::name('attributevalue')->where($condition)->field($field)->order('attrvalue_sort asc,attrvalue_id asc')->select()->toArray();
- }
-
- public function addAttributeValueAll($data)
- {
- return Db::name('attributevalue')->insertAll($data);
- }
-
- public function addAttributeValue($data)
- {
- return Db::name('attributevalue')->insertGetId($data);
- }
-
- public function editAttributeValue($update, $condition)
- {
- return Db::name('attributevalue')->where($condition)->update($update);
- }
- }
|