constellation.js 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235
  1. /**
  2. * 星座相关工具函数
  3. */
  4. import { TIANAPI_CONFIG } from '@/config/api-config.js'
  5. // 十二星座数据
  6. export const CONSTELLATIONS = [
  7. {
  8. name: '白羊座',
  9. emoji: '♈',
  10. period: '3.21-4.19',
  11. element: '火象',
  12. ruler: '火星',
  13. description: '热情勇敢的火象星座',
  14. traits: ['勇敢', '热情', '积极'],
  15. personality: '热情洋溢,勇敢直率,富有冒险精神',
  16. loveStyle: '主动热情,喜欢浪漫刺激的恋爱',
  17. luckyColor: '红色',
  18. luckyNumber: [1, 3, 9],
  19. compatibility: {
  20. best: ['狮子座', '射手座', '双子座'],
  21. good: ['水瓶座', '天秤座'],
  22. avoid: ['巨蟹座', '摩羯座']
  23. }
  24. },
  25. {
  26. name: '金牛座',
  27. emoji: '♉',
  28. period: '4.20-5.20',
  29. element: '土象',
  30. ruler: '金星',
  31. description: '稳重踏实的土象星座',
  32. traits: ['稳重', '务实', '固执'],
  33. personality: '踏实稳重,勤劳努力,值得信赖',
  34. loveStyle: '专一深情,默默付出',
  35. luckyColor: '绿色',
  36. luckyNumber: [2, 6, 18],
  37. compatibility: {
  38. best: ['处女座', '摩羯座', '巨蟹座'],
  39. good: ['双鱼座', '天蝎座'],
  40. avoid: ['狮子座', '水瓶座']
  41. }
  42. },
  43. {
  44. name: '双子座',
  45. emoji: '♊',
  46. period: '5.21-6.21',
  47. element: '风象',
  48. ruler: '水星',
  49. description: '机智灵活的风象星座',
  50. traits: ['机智', '多变', '好奇'],
  51. personality: '机智灵活,好奇心强,善于沟通交流',
  52. loveStyle: '喜欢有趣的恋爱关系,注重精神交流',
  53. luckyColor: '黄色',
  54. luckyNumber: [3, 5, 14],
  55. compatibility: {
  56. best: ['天秤座', '水瓶座', '白羊座'],
  57. good: ['狮子座', '射手座'],
  58. avoid: ['处女座', '双鱼座']
  59. }
  60. },
  61. {
  62. name: '巨蟹座',
  63. emoji: '♋',
  64. period: '6.22-7.22',
  65. element: '水象',
  66. ruler: '月亮',
  67. description: '温柔感性的水象星座',
  68. traits: ['温柔', '感性', '顾家'],
  69. personality: '温柔敏感,重视家庭和情感',
  70. loveStyle: '渴望稳定温馨的恋爱关系',
  71. luckyColor: '银色',
  72. luckyNumber: [2, 7, 11],
  73. compatibility: {
  74. best: ['天蝎座', '双鱼座', '金牛座'],
  75. good: ['处女座', '摩羯座'],
  76. avoid: ['白羊座', '天秤座']
  77. }
  78. },
  79. {
  80. name: '狮子座',
  81. emoji: '♌',
  82. period: '7.23-8.22',
  83. element: '火象',
  84. ruler: '太阳',
  85. description: '自信王者的火象星座',
  86. traits: ['自信', '大方', '领导'],
  87. personality: '自信大方,有王者风范',
  88. loveStyle: '在爱情中慷慨浪漫,喜欢被崇拜',
  89. luckyColor: '金色',
  90. luckyNumber: [1, 10, 19],
  91. compatibility: {
  92. best: ['白羊座', '射手座', '双子座'],
  93. good: ['天秤座', '水瓶座'],
  94. avoid: ['金牛座', '天蝎座']
  95. }
  96. },
  97. {
  98. name: '处女座',
  99. emoji: '♍',
  100. period: '8.23-9.22',
  101. element: '土象',
  102. ruler: '水星',
  103. description: '完美主义的土象星座',
  104. traits: ['完美', '细致', '挑剔'],
  105. personality: '追求完美,注重细节',
  106. loveStyle: '在感情中谨慎细心,默默关心',
  107. luckyColor: '蓝色',
  108. luckyNumber: [3, 6, 15],
  109. compatibility: {
  110. best: ['金牛座', '摩羯座', '巨蟹座'],
  111. good: ['天蝎座', '双鱼座'],
  112. avoid: ['双子座', '射手座']
  113. }
  114. },
  115. {
  116. name: '天秤座',
  117. emoji: '♎',
  118. period: '9.23-10.23',
  119. element: '风象',
  120. ruler: '金星',
  121. description: '优雅和谐的风象星座',
  122. traits: ['优雅', '和谐', '犹豫'],
  123. personality: '追求和谐平衡,有优雅的品味',
  124. loveStyle: '渴望和谐美好的爱情,重视精神契合',
  125. luckyColor: '粉色',
  126. luckyNumber: [6, 9, 24],
  127. compatibility: {
  128. best: ['双子座', '水瓶座', '狮子座'],
  129. good: ['白羊座', '射手座'],
  130. avoid: ['巨蟹座', '摩羯座']
  131. }
  132. },
  133. {
  134. name: '天蝎座',
  135. emoji: '♏',
  136. period: '10.24-11.22',
  137. element: '水象',
  138. ruler: '冥王星',
  139. description: '神秘深刻的水象星座',
  140. traits: ['神秘', '专注', '极端'],
  141. personality: '神秘深刻,意志坚强',
  142. loveStyle: '在感情中专一深情,爱恨分明',
  143. luckyColor: '深红色',
  144. luckyNumber: [4, 8, 13],
  145. compatibility: {
  146. best: ['巨蟹座', '双鱼座', '处女座'],
  147. good: ['金牛座', '摩羯座'],
  148. avoid: ['狮子座', '水瓶座']
  149. }
  150. },
  151. {
  152. name: '射手座',
  153. emoji: '♐',
  154. period: '11.23-12.21',
  155. element: '火象',
  156. ruler: '木星',
  157. description: '自由奔放的火象星座',
  158. traits: ['自由', '乐观', '直率'],
  159. personality: '自由奔放,乐观开朗',
  160. loveStyle: '在感情中追求自由和刺激',
  161. luckyColor: '紫色',
  162. luckyNumber: [3, 9, 21],
  163. compatibility: {
  164. best: ['白羊座', '狮子座', '水瓶座'],
  165. good: ['双子座', '天秤座'],
  166. avoid: ['处女座', '双鱼座']
  167. }
  168. },
  169. {
  170. name: '摩羯座',
  171. emoji: '♑',
  172. period: '12.22-1.19',
  173. element: '土象',
  174. ruler: '土星',
  175. description: '踏实上进的土象星座',
  176. traits: ['踏实', '上进', '保守'],
  177. personality: '踏实上进,有强烈的责任感',
  178. loveStyle: '在感情中谨慎稳重,注重长期发展',
  179. luckyColor: '棕色',
  180. luckyNumber: [8, 10, 26],
  181. compatibility: {
  182. best: ['金牛座', '处女座', '天蝎座'],
  183. good: ['巨蟹座', '双鱼座'],
  184. avoid: ['白羊座', '天秤座']
  185. }
  186. },
  187. {
  188. name: '水瓶座',
  189. emoji: '♒',
  190. period: '1.20-2.18',
  191. element: '风象',
  192. ruler: '天王星',
  193. description: '创新独立的风象星座',
  194. traits: ['创新', '独立', '理性'],
  195. personality: '独立创新,有人道主义精神',
  196. loveStyle: '在感情中追求精神层面的交流',
  197. luckyColor: '蓝紫色',
  198. luckyNumber: [4, 7, 22],
  199. compatibility: {
  200. best: ['双子座', '天秤座', '射手座'],
  201. good: ['白羊座', '狮子座'],
  202. avoid: ['金牛座', '天蝎座']
  203. }
  204. },
  205. {
  206. name: '双鱼座',
  207. emoji: '♓',
  208. period: '2.19-3.20',
  209. element: '水象',
  210. ruler: '海王星',
  211. description: '浪漫梦幻的水象星座',
  212. traits: ['浪漫', '梦幻', '敏感'],
  213. personality: '浪漫梦幻,富有同情心',
  214. loveStyle: '在感情中浪漫理想,渴望童话般的爱情',
  215. luckyColor: '海蓝色',
  216. luckyNumber: [5, 12, 29],
  217. compatibility: {
  218. best: ['巨蟹座', '天蝎座', '摩羯座'],
  219. good: ['金牛座', '处女座'],
  220. avoid: ['双子座', '射手座']
  221. }
  222. }
  223. ]
  224. /**
  225. * 根据星座名称获取星座信息
  226. * @param {String} constellationName 星座名称
  227. * @returns {Object} 星座信息对象
  228. */
  229. export function getConstellationInfo(constellationName) {
  230. return CONSTELLATIONS.find(c => c.name === constellationName) || null
  231. }
  232. /**
  233. * 根据星座名称获取星座emoji
  234. * @param {String} constellationName 星座名称
  235. * @returns {String} 星座emoji
  236. */
  237. export function getConstellationEmoji(constellationName) {
  238. const constellation = getConstellationInfo(constellationName)
  239. return constellation ? constellation.emoji : '⭐'
  240. }
  241. /**
  242. * 获取所有星座列表
  243. * @returns {Array} 星座列表
  244. */
  245. export function getAllConstellations() {
  246. return CONSTELLATIONS
  247. }
  248. /**
  249. * 调用天行数据API获取星座运势
  250. * @param {String} constellation 星座名称
  251. * @returns {Promise} API返回结果
  252. */
  253. export async function getConstellationFortuneFromAPI(constellation) {
  254. try {
  255. if (!TIANAPI_CONFIG.API_KEY) {
  256. return null
  257. }
  258. // 星座名称映射 (天行数据可能需要英文或特定格式)
  259. const constellationMap = {
  260. '白羊座': 'aries',
  261. '金牛座': 'taurus',
  262. '双子座': 'gemini',
  263. '巨蟹座': 'cancer',
  264. '狮子座': 'leo',
  265. '处女座': 'virgo',
  266. '天秤座': 'libra',
  267. '天蝎座': 'scorpio',
  268. '射手座': 'sagittarius',
  269. '摩羯座': 'capricorn',
  270. '水瓶座': 'aquarius',
  271. '双鱼座': 'pisces'
  272. }
  273. const englishName = constellationMap[constellation]
  274. if (!englishName) {
  275. return null
  276. }
  277. const url = `${TIANAPI_CONFIG.BASE_URL}${TIANAPI_CONFIG.ENDPOINTS.constellation}`
  278. const params = {
  279. key: TIANAPI_CONFIG.API_KEY,
  280. astro: englishName
  281. }
  282. const response = await new Promise((resolve, reject) => {
  283. uni.request({
  284. url: url,
  285. data: params,
  286. method: 'GET',
  287. timeout: 10000,
  288. success: (res) => {
  289. resolve(res)
  290. },
  291. fail: (err) => {
  292. console.error('📡 API请求失败:', err)
  293. reject(err)
  294. }
  295. })
  296. })
  297. if (response.statusCode === 200 && response.data && response.data.code === 200) {
  298. const result = response.data.result
  299. if (result && result.list && result.list.length > 0) {
  300. // 解析天行数据API返回的格式
  301. const apiData = {}
  302. result.list.forEach(item => {
  303. switch(item.type) {
  304. case '综合指数':
  305. apiData.overall = parseInt(item.content) || 80
  306. break
  307. case '爱情指数':
  308. apiData.love = parseInt(item.content) || 75
  309. break
  310. case '事业指数':
  311. apiData.career = parseInt(item.content) || 78
  312. break
  313. case '财运指数':
  314. apiData.wealth = parseInt(item.content) || 72
  315. break
  316. case '健康指数':
  317. apiData.health = parseInt(item.content) || 80
  318. break
  319. case '今日概述':
  320. apiData.advice = item.content || '今天是美好的一天!'
  321. break
  322. }
  323. })
  324. return {
  325. overall: apiData.overall || 80,
  326. love: apiData.love || 75,
  327. career: apiData.career || 78,
  328. wealth: apiData.wealth || 72,
  329. health: apiData.health || 80,
  330. advice: apiData.advice || '今天是美好的一天,保持积极心态!',
  331. level: apiData.overall >= 90 ? '超棒' : apiData.overall >= 80 ? '极佳' : apiData.overall >= 70 ? '良好' : '一般',
  332. levelColor: apiData.overall >= 90 ? 'linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%)' :
  333. apiData.overall >= 80 ? 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)' :
  334. apiData.overall >= 70 ? 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)' :
  335. 'linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%)',
  336. source: 'tianapi',
  337. dataFrom: '天行数据专业API',
  338. updateTime: new Date().toLocaleString('zh-CN')
  339. }
  340. }
  341. }
  342. return null
  343. } catch (error) {
  344. console.error('❌ 星座运势API调用异常:', error)
  345. return null
  346. }
  347. }
  348. /**
  349. * 生成本地星座运势数据
  350. * @param {String} constellation 星座名称
  351. * @returns {Object} 运势数据
  352. */
  353. export function generateLocalConstellationFortune(constellation) {
  354. const constellationInfo = getConstellationInfo(constellation)
  355. if (!constellationInfo) {
  356. return null
  357. }
  358. // 生成随机分数
  359. const scores = {
  360. overall: Math.floor(Math.random() * 30) + 70,
  361. love: Math.floor(Math.random() * 40) + 60,
  362. career: Math.floor(Math.random() * 40) + 60,
  363. wealth: Math.floor(Math.random() * 40) + 60,
  364. health: Math.floor(Math.random() * 40) + 60
  365. }
  366. // 根据分数确定等级
  367. const levels = ['一般', '良好', '极佳', '超棒']
  368. const levelColors = [
  369. 'linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%)',
  370. 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)',
  371. 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)',
  372. 'linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%)'
  373. ]
  374. const levelIndex = Math.floor(scores.overall / 25)
  375. const level = levels[Math.min(levelIndex, levels.length - 1)]
  376. const levelColor = levelColors[Math.min(levelIndex, levelColors.length - 1)]
  377. // 根据星座特性生成建议
  378. const adviceTemplates = {
  379. '白羊座': [
  380. '今天是展现你勇敢本色的好时机,不要害怕迎接挑战!',
  381. '你的热情感染着周围的人,保持这种积极的能量。',
  382. '适合主动出击,在爱情或事业上都有不错的机会。'
  383. ],
  384. '金牛座': [
  385. '稳扎稳打是你的优势,今天坚持自己的节奏就好。',
  386. '财运不错,但要避免冲动消费,理性规划更重要。',
  387. '感情方面需要多一些耐心,真诚的付出会有回报。'
  388. ],
  389. '双子座': [
  390. '你的机智和幽默感今天特别受欢迎,多与人交流。',
  391. '适合学习新知识或尝试新事物,保持好奇心。',
  392. '在沟通中要注意表达的准确性,避免误解。'
  393. ],
  394. '巨蟹座': [
  395. '今天的直觉特别准确,相信自己的第一感觉。',
  396. '家庭和感情是你的能量源泉,多花时间陪伴亲人。',
  397. '情绪起伏较大时,找个安静的地方调整心情。'
  398. ],
  399. '狮子座': [
  400. '你的魅力今天格外闪耀,是展现自己的好时机。',
  401. '领导才能得到认可,但要注意倾听他人的意见。',
  402. '在感情中保持大方和真诚,会收获意想不到的惊喜。'
  403. ],
  404. '处女座': [
  405. '细致入微的工作态度为你赢得好评,继续保持。',
  406. '今天适合整理和规划,让生活更有条理。',
  407. '对自己不要过于苛刻,适当放松也很重要。'
  408. ],
  409. '天秤座': [
  410. '你的协调能力今天特别突出,可以化解不少矛盾。',
  411. '在美的事物上有不错的眼光,适合艺术相关活动。',
  412. '做决定时不要过于犹豫,相信自己的判断。'
  413. ],
  414. '天蝎座': [
  415. '你的洞察力今天特别敏锐,能看透事物的本质。',
  416. '在感情中要学会适度表达,不要把所有感受都埋在心里。',
  417. '专注力很强,适合处理复杂或需要深度思考的事务。'
  418. ],
  419. '射手座': [
  420. '自由和冒险的心情高涨,可以计划一次小旅行。',
  421. '乐观的态度感染着周围的人,继续传播正能量。',
  422. '在学习和探索新领域方面会有不错的收获。'
  423. ],
  424. '摩羯座': [
  425. '踏实的努力今天会看到成果,坚持就是胜利。',
  426. '在职场上的表现得到认可,但不要忘记劳逸结合。',
  427. '感情需要更多的浪漫元素,偶尔打破常规很有必要。'
  428. ],
  429. '水瓶座': [
  430. '创新的想法今天特别多,不妨记录下来慢慢实践。',
  431. '朋友圈中你是重要的智慧来源,多分享你的见解。',
  432. '在感情中要学会表达真实的感受,不要过于理性。'
  433. ],
  434. '双鱼座': [
  435. '艺术创作灵感爆发,可以尝试画画、写作或音乐。',
  436. '同情心让你成为朋友们的倾诉对象,但也要保护好自己。',
  437. '直觉和梦境可能给你重要的启示,多留意。'
  438. ]
  439. }
  440. const advice = adviceTemplates[constellation] || ['今天是美好的一天,保持积极心态!']
  441. const selectedAdvice = advice[Math.floor(Math.random() * advice.length)]
  442. return {
  443. constellation: constellation,
  444. date: new Date().toLocaleDateString('zh-CN'),
  445. overall: scores.overall,
  446. level: level,
  447. levelColor: levelColor,
  448. love: scores.love,
  449. career: scores.career,
  450. wealth: scores.wealth,
  451. health: scores.health,
  452. advice: selectedAdvice,
  453. luckyColor: constellationInfo.luckyColor,
  454. luckyNumber: constellationInfo.luckyNumber[Math.floor(Math.random() * constellationInfo.luckyNumber.length)],
  455. source: 'local',
  456. dataFrom: '星座占星学理论',
  457. updateTime: new Date().toLocaleString('zh-CN')
  458. }
  459. }
  460. /**
  461. * 获取星座运势(优先API,失败时使用本地数据)
  462. * @param {String} constellation 星座名称
  463. * @returns {Promise<Object>} 运势数据
  464. */
  465. export async function getConstellationFortune(constellation) {
  466. try {
  467. // 尝试获取API数据
  468. const apiResult = await getConstellationFortuneFromAPI(constellation)
  469. if (apiResult) {
  470. return apiResult
  471. }
  472. // API失败,使用本地数据
  473. return generateLocalConstellationFortune(constellation)
  474. } catch (error) {
  475. console.error('❌ 获取星座运势异常:', error)
  476. // 异常情况下也使用本地数据
  477. return generateLocalConstellationFortune(constellation)
  478. }
  479. }
  480. /**
  481. * 生成星座匹配数据
  482. * @param {String} constellation 星座名称
  483. * @returns {Object} 匹配数据
  484. */
  485. export function generateConstellationMatch(constellation) {
  486. const constellationInfo = getConstellationInfo(constellation)
  487. if (!constellationInfo) {
  488. return { best: [], good: [] }
  489. }
  490. return {
  491. best: constellationInfo.compatibility.best.map(name => {
  492. const matchInfo = getConstellationInfo(name)
  493. return {
  494. name: name,
  495. emoji: matchInfo?.emoji || '⭐',
  496. score: Math.floor(Math.random() * 10) + 90
  497. }
  498. }),
  499. good: constellationInfo.compatibility.good.map(name => {
  500. const matchInfo = getConstellationInfo(name)
  501. return {
  502. name: name,
  503. emoji: matchInfo?.emoji || '⭐',
  504. score: Math.floor(Math.random() * 15) + 75
  505. }
  506. })
  507. }
  508. }
  509. /**
  510. * 调用天行数据API获取星座配对分析
  511. * @param {String} constellation1 第一个星座名称
  512. * @param {String} constellation2 第二个星座名称
  513. * @returns {Promise<Object>} API返回结果
  514. */
  515. export async function getConstellationMatchFromAPI(constellation1, constellation2) {
  516. try {
  517. if (!TIANAPI_CONFIG.API_KEY) {
  518. return null
  519. }
  520. // 星座名称处理(去掉"座"字)
  521. const me = constellation1.replace('座', '')
  522. const he = constellation2.replace('座', '')
  523. const url = `${TIANAPI_CONFIG.BASE_URL}${TIANAPI_CONFIG.ENDPOINTS.constellationMatch}`
  524. const params = {
  525. key: TIANAPI_CONFIG.API_KEY,
  526. me: me,
  527. he: he
  528. }
  529. const response = await new Promise((resolve, reject) => {
  530. uni.request({
  531. url: url,
  532. data: params,
  533. method: 'GET',
  534. timeout: 10000,
  535. success: (res) => {
  536. resolve(res)
  537. },
  538. fail: (err) => {
  539. console.error('📡 API请求失败:', err)
  540. reject(err)
  541. }
  542. })
  543. })
  544. if (response.statusCode === 200 && response.data && response.data.code === 200) {
  545. const result = response.data.result
  546. if (result && (result.title || result.content)) {
  547. // 解析天行数据API返回的格式
  548. return {
  549. title: result.title || `${constellation1}×${constellation2}`,
  550. grade: result.grade || '',
  551. content: result.content || '',
  552. source: 'tianapi',
  553. dataFrom: '天行数据专业API',
  554. updateTime: new Date().toLocaleString('zh-CN'),
  555. apiData: result
  556. }
  557. }
  558. }
  559. return null
  560. } catch (error) {
  561. console.error('❌ 星座配对API调用异常:', error)
  562. return null
  563. }
  564. }
  565. /**
  566. * 计算两个星座的详细配对分析(优先API,失败时使用本地数据)
  567. * @param {String} constellation1 第一个星座名称
  568. * @param {String} constellation2 第二个星座名称
  569. * @returns {Promise<Object>} 详细配对分析结果
  570. */
  571. export async function getDetailedConstellationMatch(constellation1, constellation2) {
  572. try {
  573. // 尝试获取API数据
  574. const apiResult = await getConstellationMatchFromAPI(constellation1, constellation2)
  575. if (apiResult) {
  576. return convertAPIDataToStandardFormat(constellation1, constellation2, apiResult)
  577. }
  578. return getLocalConstellationMatch(constellation1, constellation2)
  579. } catch (error) {
  580. console.error('❌ 获取星座配对异常:', error)
  581. // 异常情况下也使用本地数据
  582. return getLocalConstellationMatch(constellation1, constellation2)
  583. }
  584. }
  585. /**
  586. * 将API数据转换为标准格式
  587. * @param {String} constellation1 第一个星座名称
  588. * @param {String} constellation2 第二个星座名称
  589. * @param {Object} apiResult API返回数据
  590. * @returns {Object} 标准格式的配对分析
  591. */
  592. function convertAPIDataToStandardFormat(constellation1, constellation2, apiResult) {
  593. const info1 = getConstellationInfo(constellation1)
  594. const info2 = getConstellationInfo(constellation2)
  595. // 从API的grade字段解析分数
  596. let totalScore = 75 // 默认分数
  597. if (apiResult.grade) {
  598. // 解析 "友情:★★ 爱情:★★★ 婚姻:★★ 亲情:★★" 格式
  599. const loveMatch = apiResult.grade.match(/爱情:(★+)/)
  600. if (loveMatch) {
  601. const stars = loveMatch[1].length
  602. totalScore = Math.min(50 + stars * 10, 100) // 1-5颗星对应60-100分
  603. }
  604. }
  605. // 确定等级和颜色
  606. let level, levelColor, scoreColor
  607. if (totalScore >= 90) {
  608. level = '天作之合'
  609. levelColor = 'linear-gradient(135deg, #FF6B9D 0%, #FFA5C6 100%)'
  610. scoreColor = 'linear-gradient(135deg, #FF6B9D 0%, #FFA5C6 100%)'
  611. } else if (totalScore >= 80) {
  612. level = '非常匹配'
  613. levelColor = 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)'
  614. scoreColor = 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)'
  615. } else if (totalScore >= 70) {
  616. level = '比较合适'
  617. levelColor = 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)'
  618. scoreColor = 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)'
  619. } else if (totalScore >= 60) {
  620. level = '需要努力'
  621. levelColor = 'linear-gradient(135deg, #FF9800 0%, #FFB74D 100%)'
  622. scoreColor = 'linear-gradient(135deg, #FF9800 0%, #FFB74D 100%)'
  623. } else {
  624. level = '挑战较大'
  625. levelColor = 'linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%)'
  626. scoreColor = 'linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%)'
  627. }
  628. // 生成本地分析作为补充
  629. const localAnalysis = generateConstellationAnalysis(info1, info2, { total: totalScore })
  630. return {
  631. constellation1: constellation1,
  632. constellation2: constellation2,
  633. totalScore: totalScore,
  634. level: level,
  635. levelColor: levelColor,
  636. scoreColor: scoreColor,
  637. title: apiResult.title || `${constellation1}×${constellation2}`,
  638. apiGrade: apiResult.grade || '',
  639. apiContent: apiResult.content || '',
  640. elementCompatibility: localAnalysis.elementCompatibility,
  641. personalityMatch: localAnalysis.personalityMatch,
  642. advantages: apiResult.content || localAnalysis.advantages,
  643. challenges: localAnalysis.challenges,
  644. suggestions: localAnalysis.suggestions,
  645. lovePrediction: localAnalysis.lovePrediction,
  646. source: 'tianapi',
  647. dataFrom: '天行数据专业API + 本地分析',
  648. updateTime: apiResult.updateTime
  649. }
  650. }
  651. /**
  652. * 获取本地星座配对分析
  653. * @param {String} constellation1 第一个星座名称
  654. * @param {String} constellation2 第二个星座名称
  655. * @returns {Object} 本地配对分析结果
  656. */
  657. function getLocalConstellationMatch(constellation1, constellation2) {
  658. const info1 = getConstellationInfo(constellation1)
  659. const info2 = getConstellationInfo(constellation2)
  660. if (!info1 || !info2) {
  661. return null
  662. }
  663. // 计算基础匹配度
  664. const compatibilityScore = calculateConstellationCompatibility(info1, info2)
  665. // 生成详细分析
  666. const analysis = generateConstellationAnalysis(info1, info2, compatibilityScore)
  667. return {
  668. constellation1: constellation1,
  669. constellation2: constellation2,
  670. totalScore: compatibilityScore.total,
  671. level: compatibilityScore.level,
  672. levelColor: compatibilityScore.levelColor,
  673. scoreColor: compatibilityScore.scoreColor,
  674. elementCompatibility: analysis.elementCompatibility,
  675. personalityMatch: analysis.personalityMatch,
  676. advantages: analysis.advantages,
  677. challenges: analysis.challenges,
  678. suggestions: analysis.suggestions,
  679. lovePrediction: analysis.lovePrediction,
  680. source: 'local',
  681. dataFrom: '星座占星学理论',
  682. updateTime: new Date().toLocaleString('zh-CN')
  683. }
  684. }
  685. /**
  686. * 计算星座配对得分
  687. * @param {Object} info1 第一个星座信息
  688. * @param {Object} info2 第二个星座信息
  689. * @returns {Object} 配对得分详情
  690. */
  691. function calculateConstellationCompatibility(info1, info2) {
  692. // 元素相容性得分 (30%)
  693. const elementScore = getElementCompatibilityScore(info1.element, info2.element)
  694. // 传统配对得分 (40%)
  695. const traditionalScore = getTraditionalMatchScore(info1, info2)
  696. // 性格互补得分 (30%)
  697. const personalityScore = getPersonalityCompatibilityScore(info1, info2)
  698. // 综合计算
  699. const total = Math.round(
  700. elementScore * 0.3 +
  701. traditionalScore * 0.4 +
  702. personalityScore * 0.3
  703. )
  704. // 确定等级和颜色
  705. let level, levelColor, scoreColor
  706. if (total >= 90) {
  707. level = '天作之合'
  708. levelColor = 'linear-gradient(135deg, #FF6B9D 0%, #FFA5C6 100%)'
  709. scoreColor = 'linear-gradient(135deg, #FF6B9D 0%, #FFA5C6 100%)'
  710. } else if (total >= 80) {
  711. level = '非常匹配'
  712. levelColor = 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)'
  713. scoreColor = 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)'
  714. } else if (total >= 70) {
  715. level = '比较合适'
  716. levelColor = 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)'
  717. scoreColor = 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)'
  718. } else if (total >= 60) {
  719. level = '需要努力'
  720. levelColor = 'linear-gradient(135deg, #FF9800 0%, #FFB74D 100%)'
  721. scoreColor = 'linear-gradient(135deg, #FF9800 0%, #FFB74D 100%)'
  722. } else {
  723. level = '挑战较大'
  724. levelColor = 'linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%)'
  725. scoreColor = 'linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%)'
  726. }
  727. return {
  728. total,
  729. level,
  730. levelColor,
  731. scoreColor,
  732. elementScore,
  733. traditionalScore,
  734. personalityScore
  735. }
  736. }
  737. /**
  738. * 获取元素相容性得分
  739. * @param {String} element1 第一个元素
  740. * @param {String} element2 第二个元素
  741. * @returns {Number} 相容性得分
  742. */
  743. function getElementCompatibilityScore(element1, element2) {
  744. const compatibilityMatrix = {
  745. '火象': { '火象': 85, '土象': 65, '风象': 90, '水象': 45 },
  746. '土象': { '火象': 65, '土象': 80, '风象': 55, '水象': 95 },
  747. '风象': { '火象': 90, '土象': 55, '风象': 75, '水象': 70 },
  748. '水象': { '火象': 45, '土象': 95, '风象': 70, '水象': 85 }
  749. }
  750. return compatibilityMatrix[element1]?.[element2] || 70
  751. }
  752. /**
  753. * 获取传统配对得分
  754. * @param {Object} info1 第一个星座信息
  755. * @param {Object} info2 第二个星座信息
  756. * @returns {Number} 传统配对得分
  757. */
  758. function getTraditionalMatchScore(info1, info2) {
  759. let score1 = 70, score2 = 70
  760. // 双向检查配对关系
  761. if (info1.compatibility.best.includes(info2.name)) score1 = 95
  762. else if (info1.compatibility.good.includes(info2.name)) score1 = 80
  763. else if (info1.compatibility.avoid.includes(info2.name)) score1 = 50
  764. if (info2.compatibility.best.includes(info1.name)) score2 = 95
  765. else if (info2.compatibility.good.includes(info1.name)) score2 = 80
  766. else if (info2.compatibility.avoid.includes(info1.name)) score2 = 50
  767. return Math.round((score1 + score2) / 2)
  768. }
  769. /**
  770. * 获取性格相容性得分
  771. * @param {Object} info1 第一个星座信息
  772. * @param {Object} info2 第二个星座信息
  773. * @returns {Number} 性格相容性得分
  774. */
  775. function getPersonalityCompatibilityScore(info1, info2) {
  776. // 检查共同特质
  777. const commonTraits = info1.traits.filter(trait => info2.traits.includes(trait))
  778. const commonTraitsScore = commonTraits.length * 15
  779. // 检查互补特质
  780. const complementaryPairs = [
  781. ['勇敢', '温柔'], ['热情', '稳重'], ['积极', '细致'],
  782. ['自信', '谦逊'], ['领导', '支持'], ['创新', '传统']
  783. ]
  784. let complementaryScore = 0
  785. complementaryPairs.forEach(pair => {
  786. if ((info1.traits.includes(pair[0]) && info2.traits.includes(pair[1])) ||
  787. (info1.traits.includes(pair[1]) && info2.traits.includes(pair[0]))) {
  788. complementaryScore += 10
  789. }
  790. })
  791. return Math.min(60 + commonTraitsScore + complementaryScore, 100)
  792. }
  793. /**
  794. * 生成星座配对分析
  795. * @param {Object} info1 第一个星座信息
  796. * @param {Object} info2 第二个星座信息
  797. * @param {Object} compatibilityScore 配对得分
  798. * @returns {Object} 配对分析
  799. */
  800. function generateConstellationAnalysis(info1, info2, compatibilityScore) {
  801. const element1 = info1.element
  802. const element2 = info2.element
  803. const totalScore = compatibilityScore.total
  804. // 元素相容性分析
  805. const elementCompatibility = getElementCompatibilityAnalysis(element1, element2)
  806. // 性格匹配分析
  807. const personalityMatch = getPersonalityMatchAnalysis(info1, info2)
  808. // 优势分析
  809. const advantages = generateAdvantagesAnalysis(info1, info2, element1, element2)
  810. // 挑战分析
  811. const challenges = generateChallengesAnalysis(info1, info2, element1, element2)
  812. // 建议分析
  813. const suggestions = generateSuggestionsAnalysis(info1, info2, totalScore)
  814. // 爱情预测
  815. const lovePrediction = generateLovePredictionData(totalScore)
  816. return {
  817. elementCompatibility,
  818. personalityMatch,
  819. advantages,
  820. challenges,
  821. suggestions,
  822. lovePrediction
  823. }
  824. }
  825. /**
  826. * 获取元素相容性分析
  827. * @param {String} element1 第一个元素
  828. * @param {String} element2 第二个元素
  829. * @returns {String} 元素相容性分析
  830. */
  831. function getElementCompatibilityAnalysis(element1, element2) {
  832. const analyses = {
  833. '火象火象': '同为火象星座,你们都充满激情和活力,能够互相理解对方的冲动和热情,但也要注意避免过度竞争。',
  834. '火象土象': '火象的激情与土象的稳重形成有趣的对比,火象能激发土象的活力,土象能稳定火象的冲动。',
  835. '火象风象': '火象与风象的结合如同火遇风,能够互相激发,创造出更大的能量和无限的可能性。',
  836. '火象水象': '火象与水象的组合充满戏剧性,虽然差异明显,但正是这种差异创造了独特的吸引力。',
  837. '土象土象': '同为土象星座,你们都追求稳定和安全感,能够建立坚实可靠的关系基础。',
  838. '土象风象': '土象的踏实与风象的灵活形成互补,需要相互学习和适应,找到平衡点。',
  839. '土象水象': '土象与水象的组合非常和谐,既有物质基础的稳定性又有情感上的丰富性。',
  840. '风象风象': '同为风象星座,你们都重视精神交流和智慧碰撞,有着无穷无尽的话题。',
  841. '风象水象': '风象的理性与水象的感性形成有趣的平衡,能够互相学习不同的思维方式。',
  842. '水象水象': '同为水象星座,你们情感丰富敏感,能够深度理解彼此的内心世界和情感需求。'
  843. }
  844. const key = element1 + element2
  845. return analyses[key] || analyses[element2 + element1] || '你们的元素组合有着独特的化学反应,值得深入探索。'
  846. }
  847. /**
  848. * 获取性格匹配分析
  849. * @param {Object} info1 第一个星座信息
  850. * @param {Object} info2 第二个星座信息
  851. * @returns {String} 性格匹配分析
  852. */
  853. function getPersonalityMatchAnalysis(info1, info2) {
  854. const commonTraits = info1.traits.filter(trait => info2.traits.includes(trait))
  855. if (commonTraits.length >= 2) {
  856. return `你们都具有${commonTraits.join('、')}的特质,在这些方面容易产生共鸣和理解。`
  857. } else if (commonTraits.length === 1) {
  858. return `你们共同的${commonTraits[0]}特质为关系奠定了基础,其他方面的差异则增加了吸引力。`
  859. } else {
  860. return '你们的性格特质各有特色,这种差异性能够让彼此学到很多新的东西。'
  861. }
  862. }
  863. /**
  864. * 生成优势分析
  865. * @param {Object} info1 第一个星座信息
  866. * @param {Object} info2 第二个星座信息
  867. * @param {String} element1 第一个元素
  868. * @param {String} element2 第二个元素
  869. * @returns {String} 优势分析
  870. */
  871. function generateAdvantagesAnalysis(info1, info2, element1, element2) {
  872. const advantages = []
  873. // 基于元素的优势
  874. if (element1 === element2) {
  875. advantages.push('属于同一元素,在价值观和生活节奏上有天然的默契')
  876. } else if (
  877. (element1 === '火象' && element2 === '风象') ||
  878. (element1 === '风象' && element2 === '火象')
  879. ) {
  880. advantages.push('火象与风象的组合充满创意和激情,能够互相激发潜能')
  881. } else if (
  882. (element1 === '土象' && element2 === '水象') ||
  883. (element1 === '水象' && element2 === '土象')
  884. ) {
  885. advantages.push('土象与水象的结合既稳定又温馨,能够建立深厚的情感纽带')
  886. }
  887. // 基于配对关系的优势
  888. if (info1.compatibility.best.includes(info2.name)) {
  889. advantages.push('从传统占星学角度来看,你们是理想的配对组合')
  890. } else if (info1.compatibility.good.includes(info2.name)) {
  891. advantages.push('你们的星座组合在传统上被认为是和谐的搭配')
  892. }
  893. // 基于特质的优势
  894. const commonTraits = info1.traits.filter(trait => info2.traits.includes(trait))
  895. if (commonTraits.length > 0) {
  896. advantages.push(`共同的${commonTraits.join('、')}特质让你们容易理解彼此`)
  897. }
  898. return advantages.length > 0 ? advantages.join(';') : '你们的组合有着独特的魅力和潜力。'
  899. }
  900. /**
  901. * 生成挑战分析
  902. * @param {Object} info1 第一个星座信息
  903. * @param {Object} info2 第二个星座信息
  904. * @param {String} element1 第一个元素
  905. * @param {String} element2 第二个元素
  906. * @returns {String} 挑战分析
  907. */
  908. function generateChallengesAnalysis(info1, info2, element1, element2) {
  909. const challenges = []
  910. // 基于元素的挑战
  911. if (
  912. (element1 === '火象' && element2 === '水象') ||
  913. (element1 === '水象' && element2 === '火象')
  914. ) {
  915. challenges.push('火象的直接与水象的含蓄可能造成沟通上的误解')
  916. } else if (
  917. (element1 === '土象' && element2 === '风象') ||
  918. (element1 === '风象' && element2 === '土象')
  919. ) {
  920. challenges.push('土象的稳重与风象的多变可能在生活节奏上产生分歧')
  921. }
  922. // 基于避免列表的挑战
  923. if (info1.compatibility.avoid.includes(info2.name)) {
  924. challenges.push('你们的性格差异较大,需要更多的理解和包容')
  925. }
  926. // 通用挑战
  927. challenges.push('任何关系都需要双方的努力和妥协,保持开放诚实的沟通')
  928. return challenges.join(';')
  929. }
  930. /**
  931. * 生成建议分析
  932. * @param {Object} info1 第一个星座信息
  933. * @param {Object} info2 第二个星座信息
  934. * @param {Number} totalScore 总分
  935. * @returns {String} 建议分析
  936. */
  937. function generateSuggestionsAnalysis(info1, info2, totalScore) {
  938. const suggestions = []
  939. if (totalScore >= 85) {
  940. suggestions.push('你们的匹配度很高,要珍惜这份难得的缘分')
  941. } else if (totalScore >= 70) {
  942. suggestions.push('通过深入了解和有效沟通,你们的关系会更加稳固')
  943. } else {
  944. suggestions.push('虽然面临一些挑战,但只要双方都愿意努力,完全可以克服')
  945. }
  946. suggestions.push(`理解${info1.name}的${info1.loveStyle}和${info2.name}的${info2.loveStyle},互相欣赏对方的爱情观`)
  947. suggestions.push('记住,星座只是参考,真正的感情需要用心去经营和维护')
  948. return suggestions.join(';')
  949. }
  950. /**
  951. * 生成爱情预测数据
  952. * @param {Number} totalScore 总分
  953. * @returns {Array} 爱情预测数据
  954. */
  955. function generateLovePredictionData(totalScore) {
  956. const baseScore = totalScore
  957. return [
  958. {
  959. label: '初见印象',
  960. icon: '👀',
  961. value: Math.min(baseScore + Math.floor(Math.random() * 10) - 5, 100) + '%',
  962. bgColor: 'linear-gradient(135deg, #FFB6C1 0%, #FFE4E1 100%)'
  963. },
  964. {
  965. label: '恋爱甜蜜度',
  966. icon: '🍯',
  967. value: Math.min(baseScore + Math.floor(Math.random() * 15) - 7, 100) + '%',
  968. bgColor: 'linear-gradient(135deg, #FF6B9D 0%, #FFA5C6 100%)'
  969. },
  970. {
  971. label: '长期稳定性',
  972. icon: '🏠',
  973. value: Math.min(baseScore + Math.floor(Math.random() * 8) - 4, 100) + '%',
  974. bgColor: 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)'
  975. },
  976. {
  977. label: '婚姻契合度',
  978. icon: '💍',
  979. value: Math.min(baseScore + Math.floor(Math.random() * 12) - 6, 100) + '%',
  980. bgColor: 'linear-gradient(135deg, #9C27B0 0%, #CE93D8 100%)'
  981. }
  982. ]
  983. }
  984. /**
  985. * 生成幸运元素
  986. * @param {String} constellation 星座名称
  987. * @returns {Array} 幸运元素列表
  988. */
  989. export function generateLuckyElements(constellation) {
  990. const constellationInfo = getConstellationInfo(constellation)
  991. if (!constellationInfo) {
  992. return []
  993. }
  994. const stones = ['紫水晶', '玫瑰石英', '黑曜石', '白水晶', '碧玺', '翡翠', '琥珀', '珍珠']
  995. const directions = ['东', '南', '西', '北', '东南', '西南', '东北', '西北']
  996. return [
  997. {
  998. label: '幸运色',
  999. icon: '🎨',
  1000. value: constellationInfo.luckyColor,
  1001. bgColor: 'linear-gradient(135deg, #FFB6C1 0%, #FFE4E1 100%)'
  1002. },
  1003. {
  1004. label: '幸运数字',
  1005. icon: '🔢',
  1006. value: constellationInfo.luckyNumber[Math.floor(Math.random() * constellationInfo.luckyNumber.length)].toString(),
  1007. bgColor: 'linear-gradient(135deg, #9C27B0 0%, #CE93D8 100%)'
  1008. },
  1009. {
  1010. label: '幸运石',
  1011. icon: '💎',
  1012. value: stones[Math.floor(Math.random() * stones.length)],
  1013. bgColor: 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)'
  1014. },
  1015. {
  1016. label: '幸运方位',
  1017. icon: '🧭',
  1018. value: directions[Math.floor(Math.random() * directions.length)],
  1019. bgColor: 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)'
  1020. }
  1021. ]
  1022. }
  1023. /**
  1024. * 生成星座特质详解
  1025. * @param {String} constellation 星座名称
  1026. * @returns {Array} 特质详解列表
  1027. */
  1028. export function generateConstellationTraits(constellation) {
  1029. const traitsData = {
  1030. '白羊座': [
  1031. { icon: '🔥', title: '性格特点', content: '热情洋溢,勇敢直率,富有冒险精神。喜欢挑战,敢于开拓新领域,是天生的领导者。' },
  1032. { icon: '💕', title: '爱情观', content: '在爱情中主动热情,喜欢浪漫刺激的恋爱。一旦爱上就会全力以赴,但也容易因冲动而受伤。' },
  1033. { icon: '💼', title: '事业运', content: '适合需要创新和领导能力的工作。在竞争激烈的环境中能发挥优势,但需要学会耐心和坚持。' }
  1034. ],
  1035. '金牛座': [
  1036. { icon: '🏔️', title: '性格特点', content: '稳重踏实,有强烈的责任感。注重物质安全,喜欢稳定的生活环境,做事有始有终。' },
  1037. { icon: '💕', title: '爱情观', content: '在感情中忠诚专一,注重长期稳定的关系。虽然慢热,但一旦确定关系就会全心投入。' },
  1038. { icon: '💼', title: '事业运', content: '适合需要耐心和专业技能的工作。在金融、艺术、美食等领域有天赋,能够长期积累成就。' }
  1039. ],
  1040. '双子座': [
  1041. { icon: '🌪️', title: '性格特点', content: '机智灵活,好奇心强,善于沟通交流。思维活跃,适应能力强,但有时显得不够专一。' },
  1042. { icon: '💕', title: '爱情观', content: '喜欢有趣的恋爱关系,注重精神层面的交流。需要对方能跟上自己的思维节奏。' },
  1043. { icon: '💼', title: '事业运', content: '适合需要沟通协调的工作。在媒体、教育、销售等领域能发挥优势,但需要避免三心二意。' }
  1044. ],
  1045. '巨蟹座': [
  1046. { icon: '🏠', title: '性格特点', content: '温柔敏感,重视家庭和情感。有强烈的保护欲,善于照顾他人,但有时过于敏感多疑。' },
  1047. { icon: '💕', title: '爱情观', content: '渴望稳定温馨的恋爱关系,会为爱人付出一切。但容易因为缺乏安全感而多疑。' },
  1048. { icon: '💼', title: '事业运', content: '适合与人打交道的服务性工作。在医疗、教育、餐饮等领域有天赋,能给人温暖感受。' }
  1049. ],
  1050. '狮子座': [
  1051. { icon: '👑', title: '性格特点', content: '自信大方,有王者风范。喜欢成为焦点,慷慨大度,但有时过于骄傲,需要别人的赞美。' },
  1052. { icon: '💕', title: '爱情观', content: '在爱情中慷慨浪漫,喜欢被崇拜的感觉。会为爱人创造浪漫惊喜,但也需要对方的认可。' },
  1053. { icon: '💼', title: '事业运', content: '适合需要展现个人魅力的工作。在娱乐、艺术、管理等领域能发光发热,是天生的明星。' }
  1054. ],
  1055. '处女座': [
  1056. { icon: '🔍', title: '性格特点', content: '追求完美,注重细节。做事认真负责,有强烈的服务精神,但有时过于挑剔苛求。' },
  1057. { icon: '💕', title: '爱情观', content: '在感情中谨慎细心,会默默关心对方的每个细节。虽然不善表达,但爱意深藏。' },
  1058. { icon: '💼', title: '事业运', content: '适合需要精确性和专业性的工作。在医疗、会计、研究等领域有优势,能做到精益求精。' }
  1059. ],
  1060. '天秤座': [
  1061. { icon: '⚖️', title: '性格特点', content: '追求和谐平衡,有优雅的品味。善于调解矛盾,但有时过于犹豫不决,难以做出选择。' },
  1062. { icon: '💕', title: '爱情观', content: '渴望和谐美好的爱情,重视精神契合。在感情中善于妥协,但有时缺乏主见。' },
  1063. { icon: '💼', title: '事业运', content: '适合需要审美和协调能力的工作。在设计、法律、外交等领域有天赋,能营造和谐氛围。' }
  1064. ],
  1065. '天蝎座': [
  1066. { icon: '🦂', title: '性格特点', content: '神秘深刻,意志坚强。有强烈的直觉力,善于洞察他人内心,但有时过于极端和报复心重。' },
  1067. { icon: '💕', title: '爱情观', content: '在感情中专一深情,爱恨分明。一旦爱上就会全身心投入,但也容易因嫉妒而痛苦。' },
  1068. { icon: '💼', title: '事业运', content: '适合需要深度研究和洞察力的工作。在心理学、侦探、投资等领域有优势,能发现他人忽略的细节。' }
  1069. ],
  1070. '射手座': [
  1071. { icon: '🏹', title: '性格特点', content: '自由奔放,乐观开朗。热爱冒险和旅行,有哲学思维,但有时过于直率,缺乏耐心。' },
  1072. { icon: '💕', title: '爱情观', content: '在感情中追求自由和刺激,不喜欢被束缚。需要有共同兴趣和理想的伴侣。' },
  1073. { icon: '💼', title: '事业运', content: '适合需要创新和自由度的工作。在旅游、教育、出版等领域有优势,能带来新鲜活力。' }
  1074. ],
  1075. '摩羯座': [
  1076. { icon: '🏔️', title: '性格特点', content: '踏实上进,有强烈的责任感。目标明确,善于规划,但有时过于严肃,缺乏幽默感。' },
  1077. { icon: '💕', title: '爱情观', content: '在感情中谨慎稳重,注重长期发展。虽然表达含蓄,但会通过实际行动证明爱意。' },
  1078. { icon: '💼', title: '事业运', content: '适合需要长期规划和管理能力的工作。在企业管理、建筑、政府等领域有优势,能稳步上升。' }
  1079. ],
  1080. '水瓶座': [
  1081. { icon: '🌊', title: '性格特点', content: '独立创新,有人道主义精神。思维前卫,善于发现新事物,但有时过于理性,显得冷漠。' },
  1082. { icon: '💕', title: '爱情观', content: '在感情中追求精神层面的交流,注重友谊基础。需要理解和支持自己理想的伴侣。' },
  1083. { icon: '💼', title: '事业运', content: '适合需要创新思维的工作。在科技、公益、新媒体等领域有优势,能引领时代潮流。' }
  1084. ],
  1085. '双鱼座': [
  1086. { icon: '🌙', title: '性格特点', content: '浪漫梦幻,富有同情心。想象力丰富,艺术天赋高,但有时过于敏感,容易逃避现实。' },
  1087. { icon: '💕', title: '爱情观', content: '在感情中浪漫理想,渴望童话般的爱情。容易为爱牺牲,但也容易受伤。' },
  1088. { icon: '💼', title: '事业运', content: '适合需要创意和同情心的工作。在艺术、医疗、慈善等领域有优势,能给人带来温暖。' }
  1089. ]
  1090. }
  1091. return traitsData[constellation] || []
  1092. }
  1093. export default {
  1094. CONSTELLATIONS,
  1095. getConstellationInfo,
  1096. getConstellationEmoji,
  1097. getAllConstellations,
  1098. getConstellationFortune,
  1099. generateConstellationMatch,
  1100. generateLuckyElements,
  1101. generateConstellationTraits,
  1102. getDetailedConstellationMatch,
  1103. getConstellationMatchFromAPI
  1104. }