12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?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);
- }
- }
|