where($where) ->limit($offset,$size) ->order($order) ->select() ->toArray(); foreach ($list as $k=>$v){ $pInfo =Db::name('mate_goods') ->where('id',$v['pid']) ->find(); $list[$k]['title'] = $pInfo?$pInfo['title']:""; $list[$k]['type'] = $pInfo?$pInfo['type']:""; $list[$k]['unit'] = $pInfo?$pInfo['unit']:""; $list[$k]['brand'] = $pInfo?$pInfo['brand']:""; $list[$k]['buy_time'] = $pInfo?$pInfo['buy_time']:""; $list[$k]['spec'] = $pInfo?$pInfo['spec']:""; } return $list; } public function getByList($where){ $list =$this ->where($where) ->where('nums','>',0) ->select(); $list = $list?$list->toArray():[]; foreach ($list as $k=>$v){ $pInfo =Db::name('mate_goods') ->where('id',$v['pid']) ->find(); $list[$k]['title'] = $pInfo?$pInfo['title']:""; $list[$k]['type'] = $pInfo?$pInfo['type']:""; $list[$k]['unit'] = $pInfo?$pInfo['unit']:""; $list[$k]['brand'] = $pInfo?$pInfo['brand']:""; $list[$k]['buy_time'] = $pInfo?$pInfo['buy_time']:""; $list[$k]['spec'] = $pInfo?$pInfo['spec']:""; } return $list; } }