findOrEmpty()->toArray(); if (empty($result)) { return ''; } $name_arr[] = $result['name']; if ($result['pid'] > 0) { $result = GoodsCategory::where('id',$result['pid'])->findOrEmpty()->toArray(); $name_arr[] = $result['name']; if ($result['pid'] > 0) { $result = GoodsCategory::where('id',$result['pid'])->findOrEmpty()->toArray(); $name_arr[] = $result['name']; } } return implode('/',$name_arr); } /** * @notes 采集数 * @param $value * @param $data * @return int * @author ljj * @date 2023/3/13 3:20 下午 */ public function getGatherNumAttr($value,$data) { return GoodsGather::where(['log_id'=>$data['id']])->count(); } /** * @notes 采集成功数 * @param $value * @param $data * @return int * @author ljj * @date 2023/3/13 3:20 下午 */ public function getGatherSuccessNumAttr($value,$data) { return GoodsGather::where(['log_id'=>$data['id'],'gather_status'=>YesNoEnum::YES])->count(); } /** * @notes 采集失败数 * @param $value * @param $data * @return int * @author ljj * @date 2023/3/13 3:20 下午 */ public function getGatherFailNumAttr($value,$data) { return GoodsGather::where(['log_id'=>$data['id'],'gather_status'=>YesNoEnum::NO])->count(); } }