request->userInfo['supplier']['id'] ?? 0; $params = $this->request->get(); if(isset($params['type']) && $params['type'] == 2){ $where[] = ['price','<>','']; }else{ $where[] = ['price','=','']; } if(!$supplier_id) return []; return OpurchaseGoodsOffer::where($this->searchWhere)->where('supplier_id',$supplier_id)->where($where) ->with('goods') ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $data['is_adopt_text'] = $data->is_adopt_text; $unit = Unit::where('id',$data['goods']['unit'])->findOrEmpty(); $data['goods']['unit_name'] = !$unit->isEmpty() ? $unit->name : ''; }) ->toArray(); } /** * @notes 获取采购供应链商户报价数量 * @return int * @date 2024/04/27 11:26 */ public function count(): int { $supplier_id=$this->request->userInfo['supplier']['id'] ?? 1; $params = $this->request->get(); if(isset($params['type']) && $params['type'] == 2){ $where[] = ['price','<>','']; }else{ $where[] = ['price','=','']; } return OpurchaseGoodsOffer::where($this->searchWhere)->where('supplier_id',$supplier_id)->where($where)->count(); } }