<?php
if ( ! defined( 'ABSPATH' ) ) exit;

// 注意这里的类名，要和主文件里 YFJ_Module_ + ucfirst('bazi_cesuan') 对应
class YFJ_Module_Bazi_caiyunfenxi extends YFJ_Base_Module {

    public function __construct() {
        $this->module_id = 'bazi_caiyunfenxi';             // 1. 修改模块 ID
        $this->shortcode = 'yfj_bazi_caiyunfenxi';         // 2. 修改短代码
        $this->api_endpoint = '/v1/Bazi/caiyunfenxi';      // 3. 配置对应的真实 API 接口

        // 🚀 新增：声明本模块支持英文能力
        $this->supported_langs = ['zh-cn', 'zh-tw', 'en-us'];

        parent::__construct();
    }

    /**
     * 专属数据拦截与加工引擎 (重写基类方法)
     * 在这里可以对 API 返回的原始数据进行格式化、过滤或追加二次计算的自定义数据。
     */
    protected function process_api_data($raw_data) {
        // 1. 确保数据是数组格式，防止报错
        if (is_array($raw_data)) {
            //如果 API 没返回格局，给个默认的兜底值
            if (!isset($raw_data['base_info']['zhengge'])) {
                $raw_data['base_info']['zhengge'] = '未入格';
            }
        }

        //将处理后的数据返回给 views/result.php 进行渲染
        return $raw_data;
    }

    /**
     * 沙盒模式下的模拟数据
     */
    protected function get_demo_data($post_data) {
        //获取当前后台设置的语言
        $lang = get_option('yfj_language', 'zh-cn');

        // 1. 把你的完整 JSON 粘贴到单引号里面（要考虑到zh-cn 和 zh-tw）
        $demo_json_zh_cn = '{"errcode":0,"errmsg":"请求成功","notice":"本次测算结果仅供娱乐使用，请勿用于封建迷信和违法用途。","data":{"base_info":{"sex":"坤造","name":"章三","gongli":"2005年12月23日12时5分","nongli":"乙酉年 十一月 廿三日 午时","qiyun":"4年5月8天起运","jiaoyun":"2010年5月10日1时1分33秒","dayun":"庚寅","liunian":"丙午","qiangruo":"八字偏弱","zhengge":"食神格"},"bazi_info":{"kw":"申酉","tg_cg_god":["偏财","正印","日元","正财"],"bazi":["乙酉","戊子","辛巳","甲午"],"dz_cg":["辛","癸","丙|庚|戊","丁|己"],"dz_cg_god":["比肩","食神","正官|劫财|正印","七杀|偏印"],"day_cs":["临官","长生","死","病"],"na_yin":["泉中水","霹雳火","白蜡金","沙中金"]},"caiyun_info":{"yearlyOverallFortuneScore":53,"yearlyFortuneStarVisibility":"无财星显现，且命局受制，财运不济。此象主收入下降，难以守财。若冒然投资，反而亏损。宜保守理财。","yearlyFortuneStarCategory":"正财不畅，薪资、奖金等固定收入延迟或减少，需压缩非必要支出，做好节流。","bodyStrengthVsWeakness":"日主偏弱而流年不顺，八字显示行动受限，多遇挫折。今年做事难有突破，计划容易受阻，需谨慎处理人际与事务，稳步维持现状为主。","yearlyVsDestinyBranch":"命支与流年呈现冲刑并见，命局动荡，财星多有波折。今年是“财星受制，财局难固”的格局。八字上看，冲刑之象往往导致钱财来得快、去得也快。从具体来说，今年你可能会感到赚钱机会不少，但花销和损耗同样很大，往往留不住钱。偏财尤其波动，合作容易生变。适合收缩投资，减少冒险。","yearlyFortuneTreasuryInfo":"命局无财库，今年财星气机受损，格局为“虚财难守，耗散频频”。八字中财星未得生扶，库位不显，难以固守钱财。具体来说，这一年财运下滑明显，赚钱的机会减少，即使有收入，也会迅速被开支抵消。正财进账维持基本生活，但偏财几乎无力可得，还容易出现亏损。今年要特别谨防投资失败、朋友借贷或大额消费，避免资金链断裂。整体来说，这是财运低迷的一年，宜缩减开销，稳守为先。","majorFortunePeriodVsYearly":"大运地支为财星墓库，流年地支冲开财库却无财星引透，无论身强身弱，承财之力均显不足，属于 “财星墓库被流年冲开却无财星引透，财星多显散而不聚之势” 之象，不仅较难获得实际财利，反而可能因冲动投资、合作失误等情况面临破财风险。","yearlyMonthlyFortuneAndInvestmentTips":["本月财运旺盛，职场能力变现明显，固定收入呈稳步增长，稳健理财更易获利。流月虽无财库存蓄，却有较多即时性财运，适合短线操作，快速兑现机会。投资提示：适合尝试成长性项目，控制投入比例，分散配置可降低波动提升收益。","流月财运旺相，零散机会财（如佣金、奖励）频繁，小额参与易获利，见利即收。流月无明确财库，然钱财流通性强，短期合作或兼职机遇易见，积极参与可增收。投资提示：本月投资环境利好，中低风险领域机会显，分散布局易获稳健回报。","本月财运不佳，副业项目、短期理财易出问题，严禁大额参与，防止破财。财库闭藏逢流月扰动，钱财难聚，建议暂停非必要投资计划。投资提示：财运不佳，任何大额投入都需谨慎，守财为主，避免冲动参与项目。","流月财运衰弱，意外机会财多为骗局，切勿轻信，避免资金投入陷阱。流月无财库依托，钱财易随意外情况消耗，需提前做好财务规划，严格控制支出。投资提示：不宜触碰高风险标的，本月以保住本金为核心，备好应急资金。","本月财运受制，项目分红、兼职提成难兑现，严禁大额投入，防止财务恶化。流月无明确财库，钱财散耗风险较高，日常需克制消费欲望，减少无谓钱财流失。投资提示：市场波动大，切勿投机冒险，守财为上，暂停新的投资布局。","流月财运不畅，短期投资、零散财路风险大，切勿盲目参与，守住现有资金。流月财库受多重扰动，聚财阻力大，宜保持低调理财策略。投资提示：高风险项目易出问题，本月宜专注守财，优先储备3-6个月备用金。","本月财运乏力，副业、投机项目易亏损，任何大额投入都需禁止，做好风险规避。流月无财库留存，钱财易散趋势明显，生活中需格外节制，避免非必要的钱财消耗。投资提示：财运弱，任何新投资都需暂缓，守财为主，确保资金安全无虞。","流月财运不佳，高风险理财、投机机会多陷阱，切勿大额投入，远离激进操作。流月无明确财库，钱财聚少散多情况突出，需严格规划收支，减少不必要的支出。投资提示：不宜参与激进投资，本月以保住现有资金为主，避免冲动决策。","本月财运衰弱，兼职、项目合作多有变数，小额尝试亦需谨慎，忌投入过多。财库在流月被严重耗泄，财源枯竭风险高，宜紧缩各项开支。投资提示：市场风险高，切勿投入高波动领域，守财为上，储备应急资金。","流月财运平稳，短期理财、项目合作波动大，宜小心尝试，避免过度投入。流月无明显财库，财运呈平稳流动态，需关注收支细节，避免因无库导致财务波动。投资提示：机会与风险均衡，宜采用定投+长期持有的策略，降低短期波动影响。","本月财运表现中等，意外机会财时有时无，适合小额布局，不盲目跟风。流月无固定财库，钱财无固定聚向，日常开支与进账需搭配合理，保持收支平衡。投资提示：本月需谨慎参与，优先低波动领域，小额尝试新机会，不盲目跟风。","本月财运乏力，投机性财路风险高，严禁大额投入，守住财务基本盘。流月财库冲空，财机化为泡影，宜专注守财不贪意外之财。投资提示：不宜触碰高风险标的，本月以本金安全为核心，备好备用金。"],"innateFortunePattern":"日主五行属金，而金克木，故财星属木，财运好坏关键看金木能量平衡。因命主身弱，金气不足，难以承财，易有“财来财去”之象。应以土为用神补益，辅以储蓄理财，方能稳固财运。本年整体财运偏弱，财星受制，宜低调保守，谨慎理财，防止破耗。此阶段常有支出大于收入之象，若贪求快速收益，反易招致损失。切忌盲目投资，应以储蓄为先，调整心态，静待时机，待运势回升再作图谋。","fortuneLeakageRiskTips":"财星被克，易因“木材相关纠纷”（如家具质量问题、装修木料争议）漏财，建议购买前确认质检报告，保留合同凭证。","fortuneImprovementSuggestions":"财星属木，主生长与扩展之机，宜东方见财。东方若能生气勃勃，可摆放常绿植物、文昌塔、翡翠饰品或招财竹，不但能催旺事业机缘，也能滋养财运，使人思路清晰，贵人运更强，财源如春木般绵延不绝。命局身弱，承载财富的能量需循序渐进培养，宜以稳为基适配不同财运阶段：若财运向好，可借势身边助力（如合作、贵人）适度把握机会，不独自承担过重压力；若财运平缓，优先积累自身能力（如技能、资源）与储备资金，为后续机会打基础；若财运偏弱，更需减少不必要的投入与消耗，专注护好现有资源，避免因勉强担财引发额外负担。本年整体运势偏弱，易有阻碍与破耗，宜以低调保守为先，不宜冒进投资，理财需谨慎，守住已有即是最大的收获。","masterFortuneSuggestions":"八字身弱逢流年，财运方面阻力较多，食伤生财之力不足，创意转化为收益的过程多有阻滞。易因项目延期或成本超支导致盈利缩水。建议降低盈利预期，集中精力完成已有订单，避免盲目扩张业务规模。可通过梳理客户资源优化服务，增强客户粘性，为财运回升铺垫基础。"}}}';
        $demo_json_zh_tw = '{"errcode":0,"errmsg":"请求成功","notice":"本次测算结果仅供娱乐使用，请勿用于封建迷信和违法用途。","data":{"base_info":{"sex":"坤造","name":"章三","gongli":"2005年12月23日12時5分","nongli":"乙酉年 十一月 廿三日 午時","qiyun":"4年5月8天起運","jiaoyun":"2010年5月10日1時1分33秒","dayun":"庚寅","liunian":"丙午","qiangruo":"八字偏弱","zhengge":"食神格"},"bazi_info":{"kw":"申酉","tg_cg_god":["偏財","正印","日元","正財"],"bazi":["乙酉","戊子","辛巳","甲午"],"dz_cg":["辛","癸","丙|庚|戊","丁|己"],"dz_cg_god":["比肩","食神","正官|劫財|正印","七殺|偏印"],"day_cs":["臨官","長生","死","病"],"na_yin":["泉中水","霹靂火","白蠟金","沙中金"]},"caiyun_info":{"yearlyOverallFortuneScore":53,"yearlyFortuneStarVisibility":"無財星顯現，且命局受製，財運不濟。此象主收入下降，難以守財。若冒然投資，反而虧損。宜保守理財。","yearlyFortuneStarCategory":"正財不暢，薪資、獎金等固定收入延遲或減少，需壓縮非必要支出，做好節流。","bodyStrengthVsWeakness":"日主偏弱而流年不順，八字顯示行動受限，多遇挫折。今年做事難有突破，計劃容易受阻，需謹慎處理人際與事務，穩步維持現狀為主。","yearlyVsDestinyBranch":"命支與流年呈現沖刑並見，命局動蕩，財星多有波折。今年是「財星受製，財局難固」的格局。八字上看，沖刑之象往往導致錢財來得快、去得也快。從具體來說，今年你可能會感到賺錢機會不少，但花銷和損耗同樣很大，往往留不住錢。偏財尤其波動，合作容易生變。適合收縮投資，減少冒險。","yearlyFortuneTreasuryInfo":"命局無財庫，今年財星氣機受損，格局為「虛財難守，耗散頻頻」。八字中財星未得生扶，庫位不顯，難以固守錢財。具體來說，這一年財運下滑明顯，賺錢的機會減少，即使有收入，也會迅速被開支抵消。正財進賬維持基本生活，但偏財幾乎無力可得，還容易出現虧損。今年要特別謹防投資失敗、朋友借貸或大額消費，避免資金鏈斷裂。整體來說，這是財運低迷的一年，宜縮減開銷，穩守為先。","majorFortunePeriodVsYearly":"大運地支為財星墓庫，流年地支沖開財庫卻無財星引透，無論身強身弱，承財之力均顯不足，屬於 「財星墓庫被流年沖開卻無財星引透，財星多顯散而不聚之勢」 之象，不僅較難獲得實際財利，反而可能因沖動投資、合作失誤等情況面臨破財風險。","yearlyMonthlyFortuneAndInvestmentTips":["本月財運旺盛，職場能力變現明顯，固定收入呈穩步增長，穩健理財更易獲利。流月雖無財庫存蓄，卻有較多即時性財運，適合短線操作，快速兌現機會。投資提示：適合嘗試成長性項目，控製投入比例，分散配置可降低波動提升收益。","流月財運旺相，零散機會財（如傭金、獎勵）頻繁，小額參與易獲利，見利即收。流月無明確財庫，然錢財流通性強，短期合作或兼職機遇易見，積極參與可增收。投資提示：本月投資環境利好，中低風險領域機會顯，分散布局易獲穩健回報。","本月財運不佳，副業項目、短期理財易出問題，嚴禁大額參與，防止破財。財庫閉藏逢流月擾動，錢財難聚，建議暫停非必要投資計劃。投資提示：財運不佳，任何大額投入都需謹慎，守財為主，避免沖動參與項目。","流月財運衰弱，意外機會財多為騙局，切勿輕信，避免資金投入陷阱。流月無財庫依托，錢財易隨意外情況消耗，需提前做好財務規劃，嚴格控製支出。投資提示：不宜觸碰高風險標的，本月以保住本金為核心，備好應急資金。","本月財運受製，項目分紅、兼職提成難兌現，嚴禁大額投入，防止財務惡化。流月無明確財庫，錢財散耗風險較高，日常需剋製消費欲望，減少無謂錢財流失。投資提示：市場波動大，切勿投機冒險，守財為上，暫停新的投資布局。","流月財運不暢，短期投資、零散財路風險大，切勿盲目參與，守住現有資金。流月財庫受多重擾動，聚財阻力大，宜保持低調理財策略。投資提示：高風險項目易出問題，本月宜專註守財，優先儲備3-6個月備用金。","本月財運乏力，副業、投機項目易虧損，任何大額投入都需禁止，做好風險規避。流月無財庫留存，錢財易散趨勢明顯，生活中需格外節製，避免非必要的錢財消耗。投資提示：財運弱，任何新投資都需暫緩，守財為主，確保資金安全無虞。","流月財運不佳，高風險理財、投機機會多陷阱，切勿大額投入，遠離激進操作。流月無明確財庫，錢財聚少散多情況突出，需嚴格規劃收支，減少不必要的支出。投資提示：不宜參與激進投資，本月以保住現有資金為主，避免沖動決策。","本月財運衰弱，兼職、項目合作多有變數，小額嘗試亦需謹慎，忌投入過多。財庫在流月被嚴重耗泄，財源枯竭風險高，宜緊縮各項開支。投資提示：市場風險高，切勿投入高波動領域，守財為上，儲備應急資金。","流月財運平穩，短期理財、項目合作波動大，宜小心嘗試，避免過度投入。流月無明顯財庫，財運呈平穩流動態，需關註收支細節，避免因無庫導致財務波動。投資提示：機會與風險均衡，宜采用定投+長期持有的策略，降低短期波動影響。","本月財運表現中等，意外機會財時有時無，適合小額布局，不盲目跟風。流月無固定財庫，錢財無固定聚向，日常開支與進賬需搭配合理，保持收支平衡。投資提示：本月需謹慎參與，優先低波動領域，小額嘗試新機會，不盲目跟風。","本月財運乏力，投機性財路風險高，嚴禁大額投入，守住財務基本盤。流月財庫沖空，財機化為泡影，宜專註守財不貪意外之財。投資提示：不宜觸碰高風險標的，本月以本金安全為核心，備好備用金。"],"innateFortunePattern":"日主五行屬金，而金剋木，故財星屬木，財運好壞關鍵看金木能量平衡。因命主身弱，金氣不足，難以承財，易有「財來財去」之象。應以土為用神補益，輔以儲蓄理財，方能穩固財運。本年整體財運偏弱，財星受製，宜低調保守，謹慎理財，防止破耗。此階段常有支出大於收入之象，若貪求快速收益，反易招致損失。切忌盲目投資，應以儲蓄為先，調整心態，靜待時機，待運勢回升再作圖謀。","fortuneLeakageRiskTips":"財星被剋，易因「木材相關糾紛」（如家具質量問題、裝修木料爭議）漏財，建議購買前確認質檢報告，保留合同憑證。","fortuneImprovementSuggestions":"財星屬木，主生長與擴展之機，宜東方見財。東方若能生氣勃勃，可擺放常綠植物、文昌塔、翡翠飾品或招財竹，不但能催旺事業機緣，也能滋養財運，使人思路清晰，貴人運更強，財源如春木般綿延不絕。命局身弱，承載財富的能量需循序漸進培養，宜以穩為基適配不同財運階段：若財運向好，可借勢身邊助力（如合作、貴人）適度把握機會，不獨自承擔過重壓力；若財運平緩，優先積累自身能力（如技能、資源）與儲備資金，為後續機會打基礎；若財運偏弱，更需減少不必要的投入與消耗，專註護好現有資源，避免因勉強擔財引發額外負擔。本年整體運勢偏弱，易有阻礙與破耗，宜以低調保守為先，不宜冒進投資，理財需謹慎，守住已有即是最大的收獲。","masterFortuneSuggestions":"八字身弱逢流年，財運方面阻力較多，食傷生財之力不足，創意轉化為收益的過程多有阻滯。易因項目延期或成本超支導致盈利縮水。建議降低盈利預期，集中精力完成已有訂單，避免盲目擴張業務規模。可通過梳理客戶資源優化服務，增強客戶粘性，為財運回升鋪墊基礎。"}}}';
        $demo_json_en_us = '{"errcode":0,"errmsg":"请求成功","notice":"本次测算结果仅供娱乐使用，请勿用于封建迷信和违法用途。","data":{"base_info":{"sex":"Female","name":"Third Lunar Month","gongli":"2005Year12Month23Day12Hour5minute","nongli":"YiYouYear Tenth Lunar MonthFirst Lunar MonthMonth 廿Third Lunar MonthDay WuHour","qiyun":"4Year5Month8Day起运","jiaoyun":"2010Year5Month10Day1Hour1minute33second","dayun":"GengYin","liunian":"BingWu","qiangruo":"Weak Day Master","zhengge":"Eating GodPattern"},"bazi_info":{"kw":"ShenYou","tg_cg_god":["Indirect Wealth","Direct Resource","Day Stem","Direct Wealth"],"bazi":["YiYou","WuZi","XinSi","JiaWu"],"dz_cg":["Xin","Gui","Bing|Geng|Wu","Ding|Ji"],"dz_cg_god":["Equal Shoulders","Eating God","Proper Authority|Rob Wealth|Direct Resource","Seven Killings|Indirect Resource"],"day_cs":["Taking Office","Longevity","Death","Illness"],"na_yin":["Well Water","Lightning Fire","White Wax Gold","Sand Gold"]},"caiyun_info":{"yearlyOverallFortuneScore":53,"yearlyFortuneStarVisibility":"No visible Wealth Star, and the natal chart is restricted, bringing financial hardship. Income declines and saving becomes hard. Avoid rash investments to prevent losses. Conservative management is best.","yearlyFortuneStarCategory":"Main income blocked, salary, bonuses, and other fixed income delayed or reduced, need to cut unnecessary spending, manage finances.","bodyStrengthVsWeakness":"The Day Master is weak, and the year is unfavorable. Actions are limited and setbacks common. Plans may be blocked, requiring careful handling of people and affairs, with a focus on maintaining current stability.","yearlyVsDestinyBranch":"The Life Branch and year show clashes and punishments, causing turmoil and financial fluctuations. This year\'s pattern is \'restricted wealth, unstable accumulation.\' Opportunities arise, but expenses are high, often leaving little net gain. Side income is especially volatile. Focus on reducing investments and avoiding risk.","yearlyFortuneTreasuryInfo":"Without a wealth vault, financial stars are weakened, forming \'virtual wealth hard to keep, frequent losses.\' No support for financial stars, vault absent, making money hard to retain. Earning opportunities decrease; income is often offset by spending. Regular income meets basic needs, extra income minimal and unstable. Caution is required against failed investments, borrowing, or large expenses. Overall, a low-financial year; reduce spending, prioritize preservation.","majorFortunePeriodVsYearly":"The decade\'s earthly branches are wealth tombs, the year\'s branches open them without revealing wealth, forming \'Wealth tomb opened without aid, wealth scattered.\' Difficult to gain actual profit; impulsive investments or cooperation errors may lead to loss.","yearlyMonthlyFortuneAndInvestmentTips":["Financial fortune is abundant this month; career capabilities convert into income effectively. Fixed earnings grow steadily, making stable investments more profitable.Although there is no financial storage this month, immediate financial luck is abundant; suitable for short-term operations to quickly realize opportunities.Investment Tip: Suitable for growth projects; control investment proportions. Diversified allocation can reduce volatility and improve returns.","Financial fortune is robust; incidental earnings (e.g., commissions、rewards) appear frequently. Small participation can be profitable, take gains promptly.No clear financial reserve this month, yet cash circulation is strong; short-term collaborations or part-time opportunities are visible, actively participating can increase income.Investment Tip: This month\'s investment environment is favorable; opportunities in medium-to-low risk areas are visible. Diversified layouts can yield steady returns.","This month, Financial fortune is poor; side projects and short-term financial products are prone to problems. Large participation is strictly prohibited to avoid loss.The treasury is closed and disturbed; money is difficult to gather. Pause non-essential investment plans.Investment Tip: Financial luck is poor; any large investment should be cautious. Preserve funds and avoid impulsive participation.","Financial fortune is weak; unexpected earnings are often scams. Do not trust blindly, avoid investing funds in traps.No financial backing; money easily consumed by unexpected situations; financial planning in advance and strict spending control are necessary.Investment Tip: Avoid high-risk targets; focus on principal preservation and prepare emergency funds.","This month, Financial fortune is constrained; project dividends and part-time commissions are hard to realize. Large-scale investments are strictly prohibited.No clear financial reserve; risk of cash loss is high; daily restraint in consumption is needed to reduce unnecessary outflow.Investment Tip: Market volatility is high; avoid speculative risks. Capital preservation is primary; pause new investment layouts.","Financial fortune is sluggish; short-term investments and miscellaneous channels are risky. Avoid blind participation, preserve existing funds.The treasury is disrupted multiple times; wealth accumulation faces resistance. Maintain a conservative financial strategy.Investment Tip: High-risk projects are prone to issues; focus on preserving funds and maintain 3-6 months of reserves.","This month, Financial fortune is weak; side projects and speculative ventures are prone to loss. Any large-scale investment is prohibited, manage risk carefully.No financial reserve retention; money is prone to scatter; strict frugality in daily life is necessary to prevent unnecessary consumption.Investment Tip: Financial luck is weak; any new investment should be deferred. Capital preservation ensures fund safety.","Financial fortune is poor; high-risk financial products and speculative opportunities contain traps. Avoid large-scale investment, stay away from aggressive operations.No clear financial reserve; cash is sparse and dispersed; strict income and expense planning is needed to reduce unnecessary spending.Investment Tip: Avoid aggressive investments; prioritize maintaining current funds and avoid impulsive decisions.","This month, Financial fortune is weak; part-time work and project collaborations are unpredictable. Small trials require caution, avoid over-investment.The treasury suffers serious leakage; risk of depletion is high. Tighten all expenses.Investment Tip: Market risk is high; avoid high-volatility areas. Capital preservation is primary; maintain emergency funds.","Financial fortune is stable; short-term financial products and project collaborations fluctuate. Cautious trial is advisable, avoid over-investment.No obvious financial reserve; wealth flows steadily; attention to cash flow details is needed to avoid fluctuations caused by lack of reserves.Investment Tip: Opportunities and risks are balanced; adopt regular investment and long-term holding to reduce short-term volatility.","This month, Financial fortune is moderate; unexpected earnings appear occasionally. Small layouts are suitable, avoid blindly following trends.No fixed financial reserve; money does not concentrate in any direction; daily spending and inflow must be reasonably matched to maintain balance.Investment Tip: Exercise caution this month; prioritize low-volatility areas. Small trials in new opportunities are recommended, avoid blindly following trends.","This month, Financial fortune is weak; speculative financial channels carry high risk. Large investments are strictly prohibited, preserve basic capital.The treasury is conflicted and empty; financial opportunities vanish. Focus on preserving wealth, avoid chasing windfalls.Investment Tip: Avoid high-risk targets; focus on principal safety and prepare emergency funds."],"innateFortunePattern":"The Day Master belongs to Metal, which overcomes Wood, so the wealth element is Wood. The key to financial fortune lies in the balance of Metal and Wood energy. With a weak Day Master, Metal is insufficient to support wealth, leading to \'wealth comes and goes.\' Using Earth as a supportive element, along with savings and prudent financial management, can stabilize wealth.This year, overall financial fortune is weak, with restricted wealth elements. It is advisable to be low-key and conservative, manage finances cautiously, and prevent losses. Expenses may exceed income, and chasing quick profits could lead to losses. Avoid blind investment; prioritize savings, adjust mindset, and wait for favorable timing before making major financial moves.","fortuneLeakageRiskTips":"Wealth is restrained; prone to \'wood-related disputes\' (e.g., furniture quality, renovation timber issues). Suggest checking quality reports and keeping contracts.","fortuneImprovementSuggestions":"The wealth star belongs to Wood, symbolizing growth and expansion opportunities. Wealth is favorable in the East. If the eastern area is vibrant, you may place evergreen plants, Wen Chang towers, jade ornaments, or lucky bamboo. This not only boosts career opportunities but also nurtures wealth luck, clears thinking, strengthens helpful connections, and allows wealth to grow continuously like spring wood.A weak body chart requires gradually cultivating the capacity to carry wealth. Stability should guide adaptation to different wealth phases: if wealth luck is favorable, leverage external support (like partnerships or helpful contacts) and seize opportunities moderately without overburdening yourself; if wealth luck is moderate, prioritize building skills, resources, and financial reserves to prepare for future opportunities; if wealth luck is weak, minimize unnecessary investments and expenditures, focus on safeguarding existing resources, and avoid extra burdens from forced wealth pursuits.Overall fortune this year is weak, with potential obstacles and losses. Prioritize low-profile and conservative approaches, avoid reckless investments, manage finances carefully, and protecting existing resources is the greatest achievement.","masterFortuneSuggestions":"With a weak constitution facing the annual cycle, financial obstacles are many. The creative energy to generate wealth is insufficient, and turning ideas into profits is often blocked. Project delays or cost overruns may reduce earnings. Lower profit expectations, focus on completing existing orders, and avoid blind business expansion. Optimize customer resources to strengthen loyalty, laying a foundation for financial recovery."}}}';

        $demo_name_zh_cn = "测试数据";
        $demo_name_zh_tw = "測試數據";
        $demo_name_en_us = "Test Data";

        if ($lang == 'zh-cn') {
            $demo_json = $demo_json_zh_cn;
            $demo_name = $demo_name_zh_cn;
        } elseif ($lang == 'zh-tw') {
            $demo_json = $demo_json_zh_tw;
            $demo_name = $demo_name_zh_tw;
        } else {
            $demo_json = $demo_json_en_us;
            $demo_name = $demo_name_en_us;
        }

        // 2. 解析为 PHP 数组
        $demo_array_json = json_decode($demo_json, true);

        // 3. 【核心提取】剥离外层的 errcode 状态，只提取 data 节点内容
        $data = $demo_array_json['data'] ?? [];

        // 4. 【测试数据】
        if (!empty($post_data['name'])) {
            $data['base_info']['name'] = $demo_name;
        }

        // 5. 返回处理好的干净数据给 process_api_data
        return $data;
    }
}