ptype = $ptype; $this->groupId = $groupId; $this->sysUserId = $sysUserId; } /** * @param array $row * * @return \Illuminate\Database\Eloquent\Model|null */ public function model(array $row) { // 跳过空数据 if (empty($row[3]) || !is_numeric($row[3])) return null; $fieldParam = [ 'group_id' => $this->groupId, 'ptype' => $this->ptype, 'sys_user_id' => $this->sysUserId, 'platform' => $row[0], 'cat_id' => isset($row[1]) ? hash('fnv164', $row[1], false) : null, 'category' => $row[1], 'nickname' => $row[2], 'accid' => $row[3], 'fans' => $row[4], ]; switch ($this->ptype) { case 1: case 2: $fieldParam['quoted_price_1'] = $row[5]; $fieldParam['ins_id'] = isset($row[6]) ? hash('fnv164', $row[6], false) : null; $fieldParam['institution'] = $row[6]; $fieldParam['contact'] = $row[7]; $fieldParam['home_link'] = $row[8]; $fieldParam['cooperate_type'] = $row[9]; $fieldParam['gender_ratio'] = $row[13]; $fieldParam['age_ratio'] = $row[14]; $fieldParam['avg_play'] = $row[10]; $fieldParam['avg_interact'] = $row[11]; $fieldParam['cpm'] = $row[12]; break; case 3: $fieldParam['quoted_price_1'] = $row[6]; $fieldParam['quoted_price_2'] = $row[5]; $fieldParam['ins_id'] = isset($row[7]) ? hash('fnv164', $row[7], false) : null; $fieldParam['institution'] = $row[7]; $fieldParam['contact'] = $row[8]; $fieldParam['home_link'] = $row[9]; $fieldParam['cooperate_type'] = $row[10]; $fieldParam['gender_ratio'] = $row[14]; $fieldParam['age_ratio'] = $row[15]; $fieldParam['med_read'] = $row[11]; $fieldParam['med_interact'] = $row[12]; $fieldParam['interact_rate'] = $row[13]; break; default: return null; } ++$this->rows; return new SysStarInformation($fieldParam); } /** * @return string|array */ public function uniqueBy() { return ['group_id', 'ins_id']; } /** * @return int */ public function startRow(): int { return 2; } public function getRowCount(): int { return $this->rows; } }