| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254 |
- /**
- * 星座相关工具函数
- */
- import { TIANAPI_CONFIG } from '@/config/api-config.js'
- // 十二星座数据
- export const CONSTELLATIONS = [
- {
- name: '白羊座',
- emoji: '♈',
- period: '3.21-4.19',
- element: '火象',
- ruler: '火星',
- description: '热情勇敢的火象星座',
- traits: ['勇敢', '热情', '积极'],
- personality: '热情洋溢,勇敢直率,富有冒险精神',
- loveStyle: '主动热情,喜欢浪漫刺激的恋爱',
- luckyColor: '红色',
- luckyNumber: [1, 3, 9],
- compatibility: {
- best: ['狮子座', '射手座', '双子座'],
- good: ['水瓶座', '天秤座'],
- avoid: ['巨蟹座', '摩羯座']
- }
- },
- {
- name: '金牛座',
- emoji: '♉',
- period: '4.20-5.20',
- element: '土象',
- ruler: '金星',
- description: '稳重踏实的土象星座',
- traits: ['稳重', '务实', '固执'],
- personality: '踏实稳重,勤劳努力,值得信赖',
- loveStyle: '专一深情,默默付出',
- luckyColor: '绿色',
- luckyNumber: [2, 6, 18],
- compatibility: {
- best: ['处女座', '摩羯座', '巨蟹座'],
- good: ['双鱼座', '天蝎座'],
- avoid: ['狮子座', '水瓶座']
- }
- },
- {
- name: '双子座',
- emoji: '♊',
- period: '5.21-6.21',
- element: '风象',
- ruler: '水星',
- description: '机智灵活的风象星座',
- traits: ['机智', '多变', '好奇'],
- personality: '机智灵活,好奇心强,善于沟通交流',
- loveStyle: '喜欢有趣的恋爱关系,注重精神交流',
- luckyColor: '黄色',
- luckyNumber: [3, 5, 14],
- compatibility: {
- best: ['天秤座', '水瓶座', '白羊座'],
- good: ['狮子座', '射手座'],
- avoid: ['处女座', '双鱼座']
- }
- },
- {
- name: '巨蟹座',
- emoji: '♋',
- period: '6.22-7.22',
- element: '水象',
- ruler: '月亮',
- description: '温柔感性的水象星座',
- traits: ['温柔', '感性', '顾家'],
- personality: '温柔敏感,重视家庭和情感',
- loveStyle: '渴望稳定温馨的恋爱关系',
- luckyColor: '银色',
- luckyNumber: [2, 7, 11],
- compatibility: {
- best: ['天蝎座', '双鱼座', '金牛座'],
- good: ['处女座', '摩羯座'],
- avoid: ['白羊座', '天秤座']
- }
- },
- {
- name: '狮子座',
- emoji: '♌',
- period: '7.23-8.22',
- element: '火象',
- ruler: '太阳',
- description: '自信王者的火象星座',
- traits: ['自信', '大方', '领导'],
- personality: '自信大方,有王者风范',
- loveStyle: '在爱情中慷慨浪漫,喜欢被崇拜',
- luckyColor: '金色',
- luckyNumber: [1, 10, 19],
- compatibility: {
- best: ['白羊座', '射手座', '双子座'],
- good: ['天秤座', '水瓶座'],
- avoid: ['金牛座', '天蝎座']
- }
- },
- {
- name: '处女座',
- emoji: '♍',
- period: '8.23-9.22',
- element: '土象',
- ruler: '水星',
- description: '完美主义的土象星座',
- traits: ['完美', '细致', '挑剔'],
- personality: '追求完美,注重细节',
- loveStyle: '在感情中谨慎细心,默默关心',
- luckyColor: '蓝色',
- luckyNumber: [3, 6, 15],
- compatibility: {
- best: ['金牛座', '摩羯座', '巨蟹座'],
- good: ['天蝎座', '双鱼座'],
- avoid: ['双子座', '射手座']
- }
- },
- {
- name: '天秤座',
- emoji: '♎',
- period: '9.23-10.23',
- element: '风象',
- ruler: '金星',
- description: '优雅和谐的风象星座',
- traits: ['优雅', '和谐', '犹豫'],
- personality: '追求和谐平衡,有优雅的品味',
- loveStyle: '渴望和谐美好的爱情,重视精神契合',
- luckyColor: '粉色',
- luckyNumber: [6, 9, 24],
- compatibility: {
- best: ['双子座', '水瓶座', '狮子座'],
- good: ['白羊座', '射手座'],
- avoid: ['巨蟹座', '摩羯座']
- }
- },
- {
- name: '天蝎座',
- emoji: '♏',
- period: '10.24-11.22',
- element: '水象',
- ruler: '冥王星',
- description: '神秘深刻的水象星座',
- traits: ['神秘', '专注', '极端'],
- personality: '神秘深刻,意志坚强',
- loveStyle: '在感情中专一深情,爱恨分明',
- luckyColor: '深红色',
- luckyNumber: [4, 8, 13],
- compatibility: {
- best: ['巨蟹座', '双鱼座', '处女座'],
- good: ['金牛座', '摩羯座'],
- avoid: ['狮子座', '水瓶座']
- }
- },
- {
- name: '射手座',
- emoji: '♐',
- period: '11.23-12.21',
- element: '火象',
- ruler: '木星',
- description: '自由奔放的火象星座',
- traits: ['自由', '乐观', '直率'],
- personality: '自由奔放,乐观开朗',
- loveStyle: '在感情中追求自由和刺激',
- luckyColor: '紫色',
- luckyNumber: [3, 9, 21],
- compatibility: {
- best: ['白羊座', '狮子座', '水瓶座'],
- good: ['双子座', '天秤座'],
- avoid: ['处女座', '双鱼座']
- }
- },
- {
- name: '摩羯座',
- emoji: '♑',
- period: '12.22-1.19',
- element: '土象',
- ruler: '土星',
- description: '踏实上进的土象星座',
- traits: ['踏实', '上进', '保守'],
- personality: '踏实上进,有强烈的责任感',
- loveStyle: '在感情中谨慎稳重,注重长期发展',
- luckyColor: '棕色',
- luckyNumber: [8, 10, 26],
- compatibility: {
- best: ['金牛座', '处女座', '天蝎座'],
- good: ['巨蟹座', '双鱼座'],
- avoid: ['白羊座', '天秤座']
- }
- },
- {
- name: '水瓶座',
- emoji: '♒',
- period: '1.20-2.18',
- element: '风象',
- ruler: '天王星',
- description: '创新独立的风象星座',
- traits: ['创新', '独立', '理性'],
- personality: '独立创新,有人道主义精神',
- loveStyle: '在感情中追求精神层面的交流',
- luckyColor: '蓝紫色',
- luckyNumber: [4, 7, 22],
- compatibility: {
- best: ['双子座', '天秤座', '射手座'],
- good: ['白羊座', '狮子座'],
- avoid: ['金牛座', '天蝎座']
- }
- },
- {
- name: '双鱼座',
- emoji: '♓',
- period: '2.19-3.20',
- element: '水象',
- ruler: '海王星',
- description: '浪漫梦幻的水象星座',
- traits: ['浪漫', '梦幻', '敏感'],
- personality: '浪漫梦幻,富有同情心',
- loveStyle: '在感情中浪漫理想,渴望童话般的爱情',
- luckyColor: '海蓝色',
- luckyNumber: [5, 12, 29],
- compatibility: {
- best: ['巨蟹座', '天蝎座', '摩羯座'],
- good: ['金牛座', '处女座'],
- avoid: ['双子座', '射手座']
- }
- }
- ]
- /**
- * 根据星座名称获取星座信息
- * @param {String} constellationName 星座名称
- * @returns {Object} 星座信息对象
- */
- export function getConstellationInfo(constellationName) {
- return CONSTELLATIONS.find(c => c.name === constellationName) || null
- }
- /**
- * 根据星座名称获取星座emoji
- * @param {String} constellationName 星座名称
- * @returns {String} 星座emoji
- */
- export function getConstellationEmoji(constellationName) {
- const constellation = getConstellationInfo(constellationName)
- return constellation ? constellation.emoji : '⭐'
- }
- /**
- * 获取所有星座列表
- * @returns {Array} 星座列表
- */
- export function getAllConstellations() {
- return CONSTELLATIONS
- }
- /**
- * 调用天行数据API获取星座运势
- * @param {String} constellation 星座名称
- * @returns {Promise} API返回结果
- */
- export async function getConstellationFortuneFromAPI(constellation) {
- try {
- console.log('🔍 尝试调用天行数据星座运势API')
- console.log('星座:', constellation)
- console.log('API Key:', TIANAPI_CONFIG.API_KEY ? `${TIANAPI_CONFIG.API_KEY.slice(0, 8)}...` : '未配置')
-
- if (!TIANAPI_CONFIG.API_KEY) {
- console.log('⚠️ API Key未配置,使用本地数据')
- return null
- }
-
- // 检查是否为示例Key
- if (TIANAPI_CONFIG.API_KEY === '23e38be1fddb7c6aee4ea3e4294c6b4a') {
- console.log('⚠️ 检测到示例API Key,尝试调用(可能会失败)')
- console.log('💡 请到 https://www.tianapi.com 申请真实的API Key')
- }
-
- // 星座名称映射 (天行数据可能需要英文或特定格式)
- const constellationMap = {
- '白羊座': 'aries',
- '金牛座': 'taurus',
- '双子座': 'gemini',
- '巨蟹座': 'cancer',
- '狮子座': 'leo',
- '处女座': 'virgo',
- '天秤座': 'libra',
- '天蝎座': 'scorpio',
- '射手座': 'sagittarius',
- '摩羯座': 'capricorn',
- '水瓶座': 'aquarius',
- '双鱼座': 'pisces'
- }
-
- const englishName = constellationMap[constellation]
- if (!englishName) {
- console.log('❌ 星座名称映射失败:', constellation)
- return null
- }
-
- const url = `${TIANAPI_CONFIG.BASE_URL}${TIANAPI_CONFIG.ENDPOINTS.constellation}`
- const params = {
- key: TIANAPI_CONFIG.API_KEY,
- astro: englishName
- }
-
- console.log('📡 API请求地址:', url)
- console.log('📡 请求参数:', { ...params, key: params.key ? `${params.key.slice(0, 8)}...` : '未设置' })
-
- const response = await new Promise((resolve, reject) => {
- uni.request({
- url: url,
- data: params,
- method: 'GET',
- timeout: 10000,
- success: (res) => {
- console.log('📡 API响应状态:', res.statusCode)
- console.log('📡 API响应数据:', res.data)
- resolve(res)
- },
- fail: (err) => {
- console.error('📡 API请求失败:', err)
- reject(err)
- }
- })
- })
-
- console.log('✅ 请求完成,状态码:', response.statusCode)
-
- if (response.statusCode === 200 && response.data && response.data.code === 200) {
- const result = response.data.result
- if (result && result.list && result.list.length > 0) {
- console.log('✅ 成功获取API星座运势数据')
-
- // 解析天行数据API返回的格式
- const apiData = {}
- result.list.forEach(item => {
- switch(item.type) {
- case '综合指数':
- apiData.overall = parseInt(item.content) || 80
- break
- case '爱情指数':
- apiData.love = parseInt(item.content) || 75
- break
- case '事业指数':
- apiData.career = parseInt(item.content) || 78
- break
- case '财运指数':
- apiData.wealth = parseInt(item.content) || 72
- break
- case '健康指数':
- apiData.health = parseInt(item.content) || 80
- break
- case '今日概述':
- apiData.advice = item.content || '今天是美好的一天!'
- break
- }
- })
-
- return {
- overall: apiData.overall || 80,
- love: apiData.love || 75,
- career: apiData.career || 78,
- wealth: apiData.wealth || 72,
- health: apiData.health || 80,
- advice: apiData.advice || '今天是美好的一天,保持积极心态!',
- level: apiData.overall >= 90 ? '超棒' : apiData.overall >= 80 ? '极佳' : apiData.overall >= 70 ? '良好' : '一般',
- levelColor: apiData.overall >= 90 ? 'linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%)' :
- apiData.overall >= 80 ? 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)' :
- apiData.overall >= 70 ? 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)' :
- 'linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%)',
- source: 'tianapi',
- dataFrom: '天行数据专业API',
- updateTime: new Date().toLocaleString('zh-CN')
- }
- }
- }
-
- console.log('⚠️ API返回数据格式异常,使用本地数据')
- return null
-
- } catch (error) {
- console.error('❌ 星座运势API调用异常:', error)
- console.log('🔄 降级到本地数据')
- return null
- }
- }
- /**
- * 生成本地星座运势数据
- * @param {String} constellation 星座名称
- * @returns {Object} 运势数据
- */
- export function generateLocalConstellationFortune(constellation) {
- const constellationInfo = getConstellationInfo(constellation)
- if (!constellationInfo) {
- return null
- }
-
- // 生成随机分数
- const scores = {
- overall: Math.floor(Math.random() * 30) + 70,
- love: Math.floor(Math.random() * 40) + 60,
- career: Math.floor(Math.random() * 40) + 60,
- wealth: Math.floor(Math.random() * 40) + 60,
- health: Math.floor(Math.random() * 40) + 60
- }
-
- // 根据分数确定等级
- const levels = ['一般', '良好', '极佳', '超棒']
- const levelColors = [
- 'linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%)',
- 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)',
- 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)',
- 'linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%)'
- ]
-
- const levelIndex = Math.floor(scores.overall / 25)
- const level = levels[Math.min(levelIndex, levels.length - 1)]
- const levelColor = levelColors[Math.min(levelIndex, levelColors.length - 1)]
-
- // 根据星座特性生成建议
- const adviceTemplates = {
- '白羊座': [
- '今天是展现你勇敢本色的好时机,不要害怕迎接挑战!',
- '你的热情感染着周围的人,保持这种积极的能量。',
- '适合主动出击,在爱情或事业上都有不错的机会。'
- ],
- '金牛座': [
- '稳扎稳打是你的优势,今天坚持自己的节奏就好。',
- '财运不错,但要避免冲动消费,理性规划更重要。',
- '感情方面需要多一些耐心,真诚的付出会有回报。'
- ],
- '双子座': [
- '你的机智和幽默感今天特别受欢迎,多与人交流。',
- '适合学习新知识或尝试新事物,保持好奇心。',
- '在沟通中要注意表达的准确性,避免误解。'
- ],
- '巨蟹座': [
- '今天的直觉特别准确,相信自己的第一感觉。',
- '家庭和感情是你的能量源泉,多花时间陪伴亲人。',
- '情绪起伏较大时,找个安静的地方调整心情。'
- ],
- '狮子座': [
- '你的魅力今天格外闪耀,是展现自己的好时机。',
- '领导才能得到认可,但要注意倾听他人的意见。',
- '在感情中保持大方和真诚,会收获意想不到的惊喜。'
- ],
- '处女座': [
- '细致入微的工作态度为你赢得好评,继续保持。',
- '今天适合整理和规划,让生活更有条理。',
- '对自己不要过于苛刻,适当放松也很重要。'
- ],
- '天秤座': [
- '你的协调能力今天特别突出,可以化解不少矛盾。',
- '在美的事物上有不错的眼光,适合艺术相关活动。',
- '做决定时不要过于犹豫,相信自己的判断。'
- ],
- '天蝎座': [
- '你的洞察力今天特别敏锐,能看透事物的本质。',
- '在感情中要学会适度表达,不要把所有感受都埋在心里。',
- '专注力很强,适合处理复杂或需要深度思考的事务。'
- ],
- '射手座': [
- '自由和冒险的心情高涨,可以计划一次小旅行。',
- '乐观的态度感染着周围的人,继续传播正能量。',
- '在学习和探索新领域方面会有不错的收获。'
- ],
- '摩羯座': [
- '踏实的努力今天会看到成果,坚持就是胜利。',
- '在职场上的表现得到认可,但不要忘记劳逸结合。',
- '感情需要更多的浪漫元素,偶尔打破常规很有必要。'
- ],
- '水瓶座': [
- '创新的想法今天特别多,不妨记录下来慢慢实践。',
- '朋友圈中你是重要的智慧来源,多分享你的见解。',
- '在感情中要学会表达真实的感受,不要过于理性。'
- ],
- '双鱼座': [
- '艺术创作灵感爆发,可以尝试画画、写作或音乐。',
- '同情心让你成为朋友们的倾诉对象,但也要保护好自己。',
- '直觉和梦境可能给你重要的启示,多留意。'
- ]
- }
-
- const advice = adviceTemplates[constellation] || ['今天是美好的一天,保持积极心态!']
- const selectedAdvice = advice[Math.floor(Math.random() * advice.length)]
-
- return {
- constellation: constellation,
- date: new Date().toLocaleDateString('zh-CN'),
- overall: scores.overall,
- level: level,
- levelColor: levelColor,
- love: scores.love,
- career: scores.career,
- wealth: scores.wealth,
- health: scores.health,
- advice: selectedAdvice,
- luckyColor: constellationInfo.luckyColor,
- luckyNumber: constellationInfo.luckyNumber[Math.floor(Math.random() * constellationInfo.luckyNumber.length)],
- source: 'local',
- dataFrom: '星座占星学理论',
- updateTime: new Date().toLocaleString('zh-CN')
- }
- }
- /**
- * 获取星座运势(优先API,失败时使用本地数据)
- * @param {String} constellation 星座名称
- * @returns {Promise<Object>} 运势数据
- */
- export async function getConstellationFortune(constellation) {
- try {
- // 尝试获取API数据
- const apiResult = await getConstellationFortuneFromAPI(constellation)
-
- if (apiResult) {
- console.log('✅ 使用API星座运势数据')
- return apiResult
- }
-
- // API失败,使用本地数据
- console.log('🔄 使用本地星座运势数据')
- return generateLocalConstellationFortune(constellation)
-
- } catch (error) {
- console.error('❌ 获取星座运势异常:', error)
- // 异常情况下也使用本地数据
- return generateLocalConstellationFortune(constellation)
- }
- }
- /**
- * 生成星座匹配数据
- * @param {String} constellation 星座名称
- * @returns {Object} 匹配数据
- */
- export function generateConstellationMatch(constellation) {
- const constellationInfo = getConstellationInfo(constellation)
- if (!constellationInfo) {
- return { best: [], good: [] }
- }
-
- return {
- best: constellationInfo.compatibility.best.map(name => {
- const matchInfo = getConstellationInfo(name)
- return {
- name: name,
- emoji: matchInfo?.emoji || '⭐',
- score: Math.floor(Math.random() * 10) + 90
- }
- }),
- good: constellationInfo.compatibility.good.map(name => {
- const matchInfo = getConstellationInfo(name)
- return {
- name: name,
- emoji: matchInfo?.emoji || '⭐',
- score: Math.floor(Math.random() * 15) + 75
- }
- })
- }
- }
- /**
- * 调用天行数据API获取星座配对分析
- * @param {String} constellation1 第一个星座名称
- * @param {String} constellation2 第二个星座名称
- * @returns {Promise<Object>} API返回结果
- */
- export async function getConstellationMatchFromAPI(constellation1, constellation2) {
- try {
- console.log('🔍 尝试调用天行数据星座配对API')
- console.log('星座1:', constellation1, '星座2:', constellation2)
- console.log('API Key:', TIANAPI_CONFIG.API_KEY ? `${TIANAPI_CONFIG.API_KEY.slice(0, 8)}...` : '未配置')
-
- if (!TIANAPI_CONFIG.API_KEY) {
- console.log('⚠️ API Key未配置,使用本地数据')
- return null
- }
-
- // 检查是否为示例Key
- if (TIANAPI_CONFIG.API_KEY === '23e38be1fddb7c6aee4ea3e4294c6b4a') {
- console.log('⚠️ 检测到示例API Key,尝试调用(可能会失败)')
- console.log('💡 请到 https://www.tianapi.com 申请真实的API Key')
- }
-
- // 星座名称处理(去掉"座"字)
- const me = constellation1.replace('座', '')
- const he = constellation2.replace('座', '')
-
- const url = `${TIANAPI_CONFIG.BASE_URL}${TIANAPI_CONFIG.ENDPOINTS.constellationMatch}`
- const params = {
- key: TIANAPI_CONFIG.API_KEY,
- me: me,
- he: he
- }
-
- console.log('📡 API请求地址:', url)
- console.log('📡 请求参数:', { ...params, key: params.key ? `${params.key.slice(0, 8)}...` : '未设置' })
-
- const response = await new Promise((resolve, reject) => {
- uni.request({
- url: url,
- data: params,
- method: 'GET',
- timeout: 10000,
- success: (res) => {
- console.log('📡 API响应状态:', res.statusCode)
- console.log('📡 API响应数据:', res.data)
- resolve(res)
- },
- fail: (err) => {
- console.error('📡 API请求失败:', err)
- reject(err)
- }
- })
- })
-
- console.log('✅ 请求完成,状态码:', response.statusCode)
-
- if (response.statusCode === 200 && response.data && response.data.code === 200) {
- const result = response.data.result
- if (result && (result.title || result.content)) {
- console.log('✅ 成功获取API星座配对数据')
-
- // 解析天行数据API返回的格式
- return {
- title: result.title || `${constellation1}×${constellation2}`,
- grade: result.grade || '',
- content: result.content || '',
- source: 'tianapi',
- dataFrom: '天行数据专业API',
- updateTime: new Date().toLocaleString('zh-CN'),
- apiData: result
- }
- }
- }
-
- console.log('⚠️ API返回数据格式异常,使用本地数据')
- return null
-
- } catch (error) {
- console.error('❌ 星座配对API调用异常:', error)
- console.log('🔄 降级到本地数据')
- return null
- }
- }
- /**
- * 计算两个星座的详细配对分析(优先API,失败时使用本地数据)
- * @param {String} constellation1 第一个星座名称
- * @param {String} constellation2 第二个星座名称
- * @returns {Promise<Object>} 详细配对分析结果
- */
- export async function getDetailedConstellationMatch(constellation1, constellation2) {
- try {
- // 尝试获取API数据
- const apiResult = await getConstellationMatchFromAPI(constellation1, constellation2)
-
- if (apiResult) {
- console.log('✅ 使用API星座配对数据')
- // 将API数据转换为统一格式
- return convertAPIDataToStandardFormat(constellation1, constellation2, apiResult)
- }
-
- // API失败,使用本地数据
- console.log('🔄 使用本地星座配对数据')
- return getLocalConstellationMatch(constellation1, constellation2)
-
- } catch (error) {
- console.error('❌ 获取星座配对异常:', error)
- // 异常情况下也使用本地数据
- return getLocalConstellationMatch(constellation1, constellation2)
- }
- }
- /**
- * 将API数据转换为标准格式
- * @param {String} constellation1 第一个星座名称
- * @param {String} constellation2 第二个星座名称
- * @param {Object} apiResult API返回数据
- * @returns {Object} 标准格式的配对分析
- */
- function convertAPIDataToStandardFormat(constellation1, constellation2, apiResult) {
- const info1 = getConstellationInfo(constellation1)
- const info2 = getConstellationInfo(constellation2)
-
- // 从API的grade字段解析分数
- let totalScore = 75 // 默认分数
- if (apiResult.grade) {
- // 解析 "友情:★★ 爱情:★★★ 婚姻:★★ 亲情:★★" 格式
- const loveMatch = apiResult.grade.match(/爱情:(★+)/)
- if (loveMatch) {
- const stars = loveMatch[1].length
- totalScore = Math.min(50 + stars * 10, 100) // 1-5颗星对应60-100分
- }
- }
-
- // 确定等级和颜色
- let level, levelColor, scoreColor
- if (totalScore >= 90) {
- level = '天作之合'
- levelColor = 'linear-gradient(135deg, #FF6B9D 0%, #FFA5C6 100%)'
- scoreColor = 'linear-gradient(135deg, #FF6B9D 0%, #FFA5C6 100%)'
- } else if (totalScore >= 80) {
- level = '非常匹配'
- levelColor = 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)'
- scoreColor = 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)'
- } else if (totalScore >= 70) {
- level = '比较合适'
- levelColor = 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)'
- scoreColor = 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)'
- } else if (totalScore >= 60) {
- level = '需要努力'
- levelColor = 'linear-gradient(135deg, #FF9800 0%, #FFB74D 100%)'
- scoreColor = 'linear-gradient(135deg, #FF9800 0%, #FFB74D 100%)'
- } else {
- level = '挑战较大'
- levelColor = 'linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%)'
- scoreColor = 'linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%)'
- }
-
- // 生成本地分析作为补充
- const localAnalysis = generateConstellationAnalysis(info1, info2, { total: totalScore })
-
- return {
- constellation1: constellation1,
- constellation2: constellation2,
- totalScore: totalScore,
- level: level,
- levelColor: levelColor,
- scoreColor: scoreColor,
- title: apiResult.title || `${constellation1}×${constellation2}`,
- apiGrade: apiResult.grade || '',
- apiContent: apiResult.content || '',
- elementCompatibility: localAnalysis.elementCompatibility,
- personalityMatch: localAnalysis.personalityMatch,
- advantages: apiResult.content || localAnalysis.advantages,
- challenges: localAnalysis.challenges,
- suggestions: localAnalysis.suggestions,
- lovePrediction: localAnalysis.lovePrediction,
- source: 'tianapi',
- dataFrom: '天行数据专业API + 本地分析',
- updateTime: apiResult.updateTime
- }
- }
- /**
- * 获取本地星座配对分析
- * @param {String} constellation1 第一个星座名称
- * @param {String} constellation2 第二个星座名称
- * @returns {Object} 本地配对分析结果
- */
- function getLocalConstellationMatch(constellation1, constellation2) {
- const info1 = getConstellationInfo(constellation1)
- const info2 = getConstellationInfo(constellation2)
-
- if (!info1 || !info2) {
- return null
- }
-
- // 计算基础匹配度
- const compatibilityScore = calculateConstellationCompatibility(info1, info2)
-
- // 生成详细分析
- const analysis = generateConstellationAnalysis(info1, info2, compatibilityScore)
-
- return {
- constellation1: constellation1,
- constellation2: constellation2,
- totalScore: compatibilityScore.total,
- level: compatibilityScore.level,
- levelColor: compatibilityScore.levelColor,
- scoreColor: compatibilityScore.scoreColor,
- elementCompatibility: analysis.elementCompatibility,
- personalityMatch: analysis.personalityMatch,
- advantages: analysis.advantages,
- challenges: analysis.challenges,
- suggestions: analysis.suggestions,
- lovePrediction: analysis.lovePrediction,
- source: 'local',
- dataFrom: '星座占星学理论',
- updateTime: new Date().toLocaleString('zh-CN')
- }
- }
- /**
- * 计算星座配对得分
- * @param {Object} info1 第一个星座信息
- * @param {Object} info2 第二个星座信息
- * @returns {Object} 配对得分详情
- */
- function calculateConstellationCompatibility(info1, info2) {
- // 元素相容性得分 (30%)
- const elementScore = getElementCompatibilityScore(info1.element, info2.element)
-
- // 传统配对得分 (40%)
- const traditionalScore = getTraditionalMatchScore(info1, info2)
-
- // 性格互补得分 (30%)
- const personalityScore = getPersonalityCompatibilityScore(info1, info2)
-
- // 综合计算
- const total = Math.round(
- elementScore * 0.3 +
- traditionalScore * 0.4 +
- personalityScore * 0.3
- )
-
- // 确定等级和颜色
- let level, levelColor, scoreColor
-
- if (total >= 90) {
- level = '天作之合'
- levelColor = 'linear-gradient(135deg, #FF6B9D 0%, #FFA5C6 100%)'
- scoreColor = 'linear-gradient(135deg, #FF6B9D 0%, #FFA5C6 100%)'
- } else if (total >= 80) {
- level = '非常匹配'
- levelColor = 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)'
- scoreColor = 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)'
- } else if (total >= 70) {
- level = '比较合适'
- levelColor = 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)'
- scoreColor = 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)'
- } else if (total >= 60) {
- level = '需要努力'
- levelColor = 'linear-gradient(135deg, #FF9800 0%, #FFB74D 100%)'
- scoreColor = 'linear-gradient(135deg, #FF9800 0%, #FFB74D 100%)'
- } else {
- level = '挑战较大'
- levelColor = 'linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%)'
- scoreColor = 'linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%)'
- }
-
- return {
- total,
- level,
- levelColor,
- scoreColor,
- elementScore,
- traditionalScore,
- personalityScore
- }
- }
- /**
- * 获取元素相容性得分
- * @param {String} element1 第一个元素
- * @param {String} element2 第二个元素
- * @returns {Number} 相容性得分
- */
- function getElementCompatibilityScore(element1, element2) {
- const compatibilityMatrix = {
- '火象': { '火象': 85, '土象': 65, '风象': 90, '水象': 45 },
- '土象': { '火象': 65, '土象': 80, '风象': 55, '水象': 95 },
- '风象': { '火象': 90, '土象': 55, '风象': 75, '水象': 70 },
- '水象': { '火象': 45, '土象': 95, '风象': 70, '水象': 85 }
- }
-
- return compatibilityMatrix[element1]?.[element2] || 70
- }
- /**
- * 获取传统配对得分
- * @param {Object} info1 第一个星座信息
- * @param {Object} info2 第二个星座信息
- * @returns {Number} 传统配对得分
- */
- function getTraditionalMatchScore(info1, info2) {
- let score1 = 70, score2 = 70
-
- // 双向检查配对关系
- if (info1.compatibility.best.includes(info2.name)) score1 = 95
- else if (info1.compatibility.good.includes(info2.name)) score1 = 80
- else if (info1.compatibility.avoid.includes(info2.name)) score1 = 50
-
- if (info2.compatibility.best.includes(info1.name)) score2 = 95
- else if (info2.compatibility.good.includes(info1.name)) score2 = 80
- else if (info2.compatibility.avoid.includes(info1.name)) score2 = 50
-
- return Math.round((score1 + score2) / 2)
- }
- /**
- * 获取性格相容性得分
- * @param {Object} info1 第一个星座信息
- * @param {Object} info2 第二个星座信息
- * @returns {Number} 性格相容性得分
- */
- function getPersonalityCompatibilityScore(info1, info2) {
- // 检查共同特质
- const commonTraits = info1.traits.filter(trait => info2.traits.includes(trait))
- const commonTraitsScore = commonTraits.length * 15
-
- // 检查互补特质
- const complementaryPairs = [
- ['勇敢', '温柔'], ['热情', '稳重'], ['积极', '细致'],
- ['自信', '谦逊'], ['领导', '支持'], ['创新', '传统']
- ]
-
- let complementaryScore = 0
- complementaryPairs.forEach(pair => {
- if ((info1.traits.includes(pair[0]) && info2.traits.includes(pair[1])) ||
- (info1.traits.includes(pair[1]) && info2.traits.includes(pair[0]))) {
- complementaryScore += 10
- }
- })
-
- return Math.min(60 + commonTraitsScore + complementaryScore, 100)
- }
- /**
- * 生成星座配对分析
- * @param {Object} info1 第一个星座信息
- * @param {Object} info2 第二个星座信息
- * @param {Object} compatibilityScore 配对得分
- * @returns {Object} 配对分析
- */
- function generateConstellationAnalysis(info1, info2, compatibilityScore) {
- const element1 = info1.element
- const element2 = info2.element
- const totalScore = compatibilityScore.total
-
- // 元素相容性分析
- const elementCompatibility = getElementCompatibilityAnalysis(element1, element2)
-
- // 性格匹配分析
- const personalityMatch = getPersonalityMatchAnalysis(info1, info2)
-
- // 优势分析
- const advantages = generateAdvantagesAnalysis(info1, info2, element1, element2)
-
- // 挑战分析
- const challenges = generateChallengesAnalysis(info1, info2, element1, element2)
-
- // 建议分析
- const suggestions = generateSuggestionsAnalysis(info1, info2, totalScore)
-
- // 爱情预测
- const lovePrediction = generateLovePredictionData(totalScore)
-
- return {
- elementCompatibility,
- personalityMatch,
- advantages,
- challenges,
- suggestions,
- lovePrediction
- }
- }
- /**
- * 获取元素相容性分析
- * @param {String} element1 第一个元素
- * @param {String} element2 第二个元素
- * @returns {String} 元素相容性分析
- */
- function getElementCompatibilityAnalysis(element1, element2) {
- const analyses = {
- '火象火象': '同为火象星座,你们都充满激情和活力,能够互相理解对方的冲动和热情,但也要注意避免过度竞争。',
- '火象土象': '火象的激情与土象的稳重形成有趣的对比,火象能激发土象的活力,土象能稳定火象的冲动。',
- '火象风象': '火象与风象的结合如同火遇风,能够互相激发,创造出更大的能量和无限的可能性。',
- '火象水象': '火象与水象的组合充满戏剧性,虽然差异明显,但正是这种差异创造了独特的吸引力。',
- '土象土象': '同为土象星座,你们都追求稳定和安全感,能够建立坚实可靠的关系基础。',
- '土象风象': '土象的踏实与风象的灵活形成互补,需要相互学习和适应,找到平衡点。',
- '土象水象': '土象与水象的组合非常和谐,既有物质基础的稳定性又有情感上的丰富性。',
- '风象风象': '同为风象星座,你们都重视精神交流和智慧碰撞,有着无穷无尽的话题。',
- '风象水象': '风象的理性与水象的感性形成有趣的平衡,能够互相学习不同的思维方式。',
- '水象水象': '同为水象星座,你们情感丰富敏感,能够深度理解彼此的内心世界和情感需求。'
- }
-
- const key = element1 + element2
- return analyses[key] || analyses[element2 + element1] || '你们的元素组合有着独特的化学反应,值得深入探索。'
- }
- /**
- * 获取性格匹配分析
- * @param {Object} info1 第一个星座信息
- * @param {Object} info2 第二个星座信息
- * @returns {String} 性格匹配分析
- */
- function getPersonalityMatchAnalysis(info1, info2) {
- const commonTraits = info1.traits.filter(trait => info2.traits.includes(trait))
-
- if (commonTraits.length >= 2) {
- return `你们都具有${commonTraits.join('、')}的特质,在这些方面容易产生共鸣和理解。`
- } else if (commonTraits.length === 1) {
- return `你们共同的${commonTraits[0]}特质为关系奠定了基础,其他方面的差异则增加了吸引力。`
- } else {
- return '你们的性格特质各有特色,这种差异性能够让彼此学到很多新的东西。'
- }
- }
- /**
- * 生成优势分析
- * @param {Object} info1 第一个星座信息
- * @param {Object} info2 第二个星座信息
- * @param {String} element1 第一个元素
- * @param {String} element2 第二个元素
- * @returns {String} 优势分析
- */
- function generateAdvantagesAnalysis(info1, info2, element1, element2) {
- const advantages = []
-
- // 基于元素的优势
- if (element1 === element2) {
- advantages.push('属于同一元素,在价值观和生活节奏上有天然的默契')
- } else if (
- (element1 === '火象' && element2 === '风象') ||
- (element1 === '风象' && element2 === '火象')
- ) {
- advantages.push('火象与风象的组合充满创意和激情,能够互相激发潜能')
- } else if (
- (element1 === '土象' && element2 === '水象') ||
- (element1 === '水象' && element2 === '土象')
- ) {
- advantages.push('土象与水象的结合既稳定又温馨,能够建立深厚的情感纽带')
- }
-
- // 基于配对关系的优势
- if (info1.compatibility.best.includes(info2.name)) {
- advantages.push('从传统占星学角度来看,你们是理想的配对组合')
- } else if (info1.compatibility.good.includes(info2.name)) {
- advantages.push('你们的星座组合在传统上被认为是和谐的搭配')
- }
-
- // 基于特质的优势
- const commonTraits = info1.traits.filter(trait => info2.traits.includes(trait))
- if (commonTraits.length > 0) {
- advantages.push(`共同的${commonTraits.join('、')}特质让你们容易理解彼此`)
- }
-
- return advantages.length > 0 ? advantages.join(';') : '你们的组合有着独特的魅力和潜力。'
- }
- /**
- * 生成挑战分析
- * @param {Object} info1 第一个星座信息
- * @param {Object} info2 第二个星座信息
- * @param {String} element1 第一个元素
- * @param {String} element2 第二个元素
- * @returns {String} 挑战分析
- */
- function generateChallengesAnalysis(info1, info2, element1, element2) {
- const challenges = []
-
- // 基于元素的挑战
- if (
- (element1 === '火象' && element2 === '水象') ||
- (element1 === '水象' && element2 === '火象')
- ) {
- challenges.push('火象的直接与水象的含蓄可能造成沟通上的误解')
- } else if (
- (element1 === '土象' && element2 === '风象') ||
- (element1 === '风象' && element2 === '土象')
- ) {
- challenges.push('土象的稳重与风象的多变可能在生活节奏上产生分歧')
- }
-
- // 基于避免列表的挑战
- if (info1.compatibility.avoid.includes(info2.name)) {
- challenges.push('你们的性格差异较大,需要更多的理解和包容')
- }
-
- // 通用挑战
- challenges.push('任何关系都需要双方的努力和妥协,保持开放诚实的沟通')
-
- return challenges.join(';')
- }
- /**
- * 生成建议分析
- * @param {Object} info1 第一个星座信息
- * @param {Object} info2 第二个星座信息
- * @param {Number} totalScore 总分
- * @returns {String} 建议分析
- */
- function generateSuggestionsAnalysis(info1, info2, totalScore) {
- const suggestions = []
-
- if (totalScore >= 85) {
- suggestions.push('你们的匹配度很高,要珍惜这份难得的缘分')
- } else if (totalScore >= 70) {
- suggestions.push('通过深入了解和有效沟通,你们的关系会更加稳固')
- } else {
- suggestions.push('虽然面临一些挑战,但只要双方都愿意努力,完全可以克服')
- }
-
- suggestions.push(`理解${info1.name}的${info1.loveStyle}和${info2.name}的${info2.loveStyle},互相欣赏对方的爱情观`)
- suggestions.push('记住,星座只是参考,真正的感情需要用心去经营和维护')
-
- return suggestions.join(';')
- }
- /**
- * 生成爱情预测数据
- * @param {Number} totalScore 总分
- * @returns {Array} 爱情预测数据
- */
- function generateLovePredictionData(totalScore) {
- const baseScore = totalScore
-
- return [
- {
- label: '初见印象',
- icon: '👀',
- value: Math.min(baseScore + Math.floor(Math.random() * 10) - 5, 100) + '%',
- bgColor: 'linear-gradient(135deg, #FFB6C1 0%, #FFE4E1 100%)'
- },
- {
- label: '恋爱甜蜜度',
- icon: '🍯',
- value: Math.min(baseScore + Math.floor(Math.random() * 15) - 7, 100) + '%',
- bgColor: 'linear-gradient(135deg, #FF6B9D 0%, #FFA5C6 100%)'
- },
- {
- label: '长期稳定性',
- icon: '🏠',
- value: Math.min(baseScore + Math.floor(Math.random() * 8) - 4, 100) + '%',
- bgColor: 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)'
- },
- {
- label: '婚姻契合度',
- icon: '💍',
- value: Math.min(baseScore + Math.floor(Math.random() * 12) - 6, 100) + '%',
- bgColor: 'linear-gradient(135deg, #9C27B0 0%, #CE93D8 100%)'
- }
- ]
- }
- /**
- * 生成幸运元素
- * @param {String} constellation 星座名称
- * @returns {Array} 幸运元素列表
- */
- export function generateLuckyElements(constellation) {
- const constellationInfo = getConstellationInfo(constellation)
- if (!constellationInfo) {
- return []
- }
-
- const stones = ['紫水晶', '玫瑰石英', '黑曜石', '白水晶', '碧玺', '翡翠', '琥珀', '珍珠']
- const directions = ['东', '南', '西', '北', '东南', '西南', '东北', '西北']
-
- return [
- {
- label: '幸运色',
- icon: '🎨',
- value: constellationInfo.luckyColor,
- bgColor: 'linear-gradient(135deg, #FFB6C1 0%, #FFE4E1 100%)'
- },
- {
- label: '幸运数字',
- icon: '🔢',
- value: constellationInfo.luckyNumber[Math.floor(Math.random() * constellationInfo.luckyNumber.length)].toString(),
- bgColor: 'linear-gradient(135deg, #9C27B0 0%, #CE93D8 100%)'
- },
- {
- label: '幸运石',
- icon: '💎',
- value: stones[Math.floor(Math.random() * stones.length)],
- bgColor: 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)'
- },
- {
- label: '幸运方位',
- icon: '🧭',
- value: directions[Math.floor(Math.random() * directions.length)],
- bgColor: 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)'
- }
- ]
- }
- /**
- * 生成星座特质详解
- * @param {String} constellation 星座名称
- * @returns {Array} 特质详解列表
- */
- export function generateConstellationTraits(constellation) {
- const traitsData = {
- '白羊座': [
- { icon: '🔥', title: '性格特点', content: '热情洋溢,勇敢直率,富有冒险精神。喜欢挑战,敢于开拓新领域,是天生的领导者。' },
- { icon: '💕', title: '爱情观', content: '在爱情中主动热情,喜欢浪漫刺激的恋爱。一旦爱上就会全力以赴,但也容易因冲动而受伤。' },
- { icon: '💼', title: '事业运', content: '适合需要创新和领导能力的工作。在竞争激烈的环境中能发挥优势,但需要学会耐心和坚持。' }
- ],
- '金牛座': [
- { icon: '🏔️', title: '性格特点', content: '稳重踏实,有强烈的责任感。注重物质安全,喜欢稳定的生活环境,做事有始有终。' },
- { icon: '💕', title: '爱情观', content: '在感情中忠诚专一,注重长期稳定的关系。虽然慢热,但一旦确定关系就会全心投入。' },
- { icon: '💼', title: '事业运', content: '适合需要耐心和专业技能的工作。在金融、艺术、美食等领域有天赋,能够长期积累成就。' }
- ],
- '双子座': [
- { icon: '🌪️', title: '性格特点', content: '机智灵活,好奇心强,善于沟通交流。思维活跃,适应能力强,但有时显得不够专一。' },
- { icon: '💕', title: '爱情观', content: '喜欢有趣的恋爱关系,注重精神层面的交流。需要对方能跟上自己的思维节奏。' },
- { icon: '💼', title: '事业运', content: '适合需要沟通协调的工作。在媒体、教育、销售等领域能发挥优势,但需要避免三心二意。' }
- ],
- '巨蟹座': [
- { icon: '🏠', title: '性格特点', content: '温柔敏感,重视家庭和情感。有强烈的保护欲,善于照顾他人,但有时过于敏感多疑。' },
- { icon: '💕', title: '爱情观', content: '渴望稳定温馨的恋爱关系,会为爱人付出一切。但容易因为缺乏安全感而多疑。' },
- { icon: '💼', title: '事业运', content: '适合与人打交道的服务性工作。在医疗、教育、餐饮等领域有天赋,能给人温暖感受。' }
- ],
- '狮子座': [
- { icon: '👑', title: '性格特点', content: '自信大方,有王者风范。喜欢成为焦点,慷慨大度,但有时过于骄傲,需要别人的赞美。' },
- { icon: '💕', title: '爱情观', content: '在爱情中慷慨浪漫,喜欢被崇拜的感觉。会为爱人创造浪漫惊喜,但也需要对方的认可。' },
- { icon: '💼', title: '事业运', content: '适合需要展现个人魅力的工作。在娱乐、艺术、管理等领域能发光发热,是天生的明星。' }
- ],
- '处女座': [
- { icon: '🔍', title: '性格特点', content: '追求完美,注重细节。做事认真负责,有强烈的服务精神,但有时过于挑剔苛求。' },
- { icon: '💕', title: '爱情观', content: '在感情中谨慎细心,会默默关心对方的每个细节。虽然不善表达,但爱意深藏。' },
- { icon: '💼', title: '事业运', content: '适合需要精确性和专业性的工作。在医疗、会计、研究等领域有优势,能做到精益求精。' }
- ],
- '天秤座': [
- { icon: '⚖️', title: '性格特点', content: '追求和谐平衡,有优雅的品味。善于调解矛盾,但有时过于犹豫不决,难以做出选择。' },
- { icon: '💕', title: '爱情观', content: '渴望和谐美好的爱情,重视精神契合。在感情中善于妥协,但有时缺乏主见。' },
- { icon: '💼', title: '事业运', content: '适合需要审美和协调能力的工作。在设计、法律、外交等领域有天赋,能营造和谐氛围。' }
- ],
- '天蝎座': [
- { icon: '🦂', title: '性格特点', content: '神秘深刻,意志坚强。有强烈的直觉力,善于洞察他人内心,但有时过于极端和报复心重。' },
- { icon: '💕', title: '爱情观', content: '在感情中专一深情,爱恨分明。一旦爱上就会全身心投入,但也容易因嫉妒而痛苦。' },
- { icon: '💼', title: '事业运', content: '适合需要深度研究和洞察力的工作。在心理学、侦探、投资等领域有优势,能发现他人忽略的细节。' }
- ],
- '射手座': [
- { icon: '🏹', title: '性格特点', content: '自由奔放,乐观开朗。热爱冒险和旅行,有哲学思维,但有时过于直率,缺乏耐心。' },
- { icon: '💕', title: '爱情观', content: '在感情中追求自由和刺激,不喜欢被束缚。需要有共同兴趣和理想的伴侣。' },
- { icon: '💼', title: '事业运', content: '适合需要创新和自由度的工作。在旅游、教育、出版等领域有优势,能带来新鲜活力。' }
- ],
- '摩羯座': [
- { icon: '🏔️', title: '性格特点', content: '踏实上进,有强烈的责任感。目标明确,善于规划,但有时过于严肃,缺乏幽默感。' },
- { icon: '💕', title: '爱情观', content: '在感情中谨慎稳重,注重长期发展。虽然表达含蓄,但会通过实际行动证明爱意。' },
- { icon: '💼', title: '事业运', content: '适合需要长期规划和管理能力的工作。在企业管理、建筑、政府等领域有优势,能稳步上升。' }
- ],
- '水瓶座': [
- { icon: '🌊', title: '性格特点', content: '独立创新,有人道主义精神。思维前卫,善于发现新事物,但有时过于理性,显得冷漠。' },
- { icon: '💕', title: '爱情观', content: '在感情中追求精神层面的交流,注重友谊基础。需要理解和支持自己理想的伴侣。' },
- { icon: '💼', title: '事业运', content: '适合需要创新思维的工作。在科技、公益、新媒体等领域有优势,能引领时代潮流。' }
- ],
- '双鱼座': [
- { icon: '🌙', title: '性格特点', content: '浪漫梦幻,富有同情心。想象力丰富,艺术天赋高,但有时过于敏感,容易逃避现实。' },
- { icon: '💕', title: '爱情观', content: '在感情中浪漫理想,渴望童话般的爱情。容易为爱牺牲,但也容易受伤。' },
- { icon: '💼', title: '事业运', content: '适合需要创意和同情心的工作。在艺术、医疗、慈善等领域有优势,能给人带来温暖。' }
- ]
- }
-
- return traitsData[constellation] || []
- }
- export default {
- CONSTELLATIONS,
- getConstellationInfo,
- getConstellationEmoji,
- getAllConstellations,
- getConstellationFortune,
- generateConstellationMatch,
- generateLuckyElements,
- generateConstellationTraits,
- getDetailedConstellationMatch,
- getConstellationMatchFromAPI
- }
|