groupId = $groupId; $this->sysUserId = $sysUserId; } /** * @param array $row * * @return \Illuminate\Database\Eloquent\Model|null */ public function model(array $row) { // 跳过空数据 if (empty($row[3])) return null; $platformId = StarService::getEnumForPlatform($row[1]); if(empty($platformId)) { EmailQueue::rPush('海外达人信息导入时存在未识别的平台', json_encode($row, 256), ['xiaohua.hou@kuxuan-inc.com'], '聚星'); return null; } $fieldParam = array( 'group_id' => $this->groupId, 'sys_user_id' => $this->sysUserId, 'platform' => $platformId, 'area' => $row[0], 'star_handle' => $row[2], 'home_page' => $row[3], 'gender' => StarService::getEnumForGender($row[4]), 'fans_total' => is_numeric($row[5]) ? $row[5] * 1000 : 0, 'view_avg' => is_numeric($row[6]) ? $row[6] : 0, 'tag_list' => StarService::starTagDeal($platformId, $row[7]), 'quote' => $row[8], 'email' => $row[9], 'whats_app' => $row[10], 'address' => $row[11], 'mcn' => $row[12], ); ++$this->rows; return new OverseasStar($fieldParam); } /** * @return string|array */ public function uniqueBy() { return ['platform', 'group_id', 'star_handle']; } /** * @return int */ public function startRow(): int { return 3; } public function getRowCount(): int { return $this->rows; } }