'视频生成', 'video_refund' => '视频生成退款', ]; /** * 积分流水列表 * * @param $data * @return array */ public function newBuildPointsRecords($data): array { return [ 'meta' => getMeta($data), 'list' => $this->newEachPointsRecord($data), ]; } /** * 单条积分流水 * * @param $list * @return array */ public function newEachPointsRecord($list): array { $result = []; if (empty($list)) return $result; foreach ($list as $item) { $chargeInfo = getProp($item, 'charge_info'); if (is_string($chargeInfo)) { $chargeInfo = json_decode($chargeInfo, true); } $chargeInfo = is_array($chargeInfo) ? $chargeInfo : []; $type = getProp($item, 'type', ''); $result[] = [ 'id' => (int)getProp($item, 'id'), 'type' => $type, 'type_label' => self::TYPE_LABELS[$type] ?? $type, 'api_type' => getProp($item, 'api_type'), 'task_id' => (int)getProp($item, 'task_id'), 'charge_info' => [ 'model' => getProp($chargeInfo, 'model'), 'video_resolution' => getProp($chargeInfo, 'video_resolution'), 'video_duration' => getProp($chargeInfo, 'video_duration'), 'ratio' => getProp($chargeInfo, 'ratio'), ], 'points_consumed' => (float)getProp($item, 'points_consumed', 0), 'points_before' => (float)getProp($item, 'points_before', 0), 'points_after' => (float)getProp($item, 'points_after', 0), 'tokens_consumed' => (int)getProp($item, 'tokens_consumed', 0), 'remark' => getProp($item, 'remark'), 'created_at' => getProp($item, 'created_at'), ]; } return $result; } }