12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
-
-
- namespace app\home\model;
-
- use think\Db;
- use think\Model;
-
-
- class ProductAttr extends Model
- {
-
- protected function initialize()
- {
-
- parent::initialize();
- }
-
-
-
- public function getProAttr($aids = [], $field = 'b.*, a.*')
- {
- $where = [];
- !empty($aids) && $where['b.aid'] = ['IN', $aids];
- $where['a.is_del'] = 0;
- $result = Db::name('ProductAttribute')->field($field)
- ->alias('a')
- ->join('__PRODUCT_ATTR__ b', 'b.attr_id = a.attr_id', 'LEFT')
- ->where($where)
- ->order('a.sort_order asc, a.attr_id asc')
- ->select();
- !empty($result) && $result = group_same_key($result, 'aid');
-
- return $result;
- }
-
-
-
- public function getProAttrNew($aids = [], $field = 'b.*, a.*')
- {
- $where = [];
- !empty($aids) && $where['b.aid'] = ['IN', $aids];
- $where['a.is_del'] = 0;
- $result = Db::name('ShopProductAttribute')->field($field)
- ->alias('a')
- ->join('__SHOP_PRODUCT_ATTR__ b', 'b.attr_id = a.attr_id', 'LEFT')
- ->where($where)
- ->order('a.sort_order asc, a.attr_id asc')
- ->select();
- !empty($result) && $result = group_same_key($result, 'aid');
-
- return $result;
- }
- }
|