HEX
Server: Apache/2.4.59 (Debian)
System: Linux keymana 4.19.0-21-cloud-amd64 #1 SMP Debian 4.19.249-2 (2022-06-30) x86_64
User: lijunjie (1003)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/dk/wp-content/themes/food/single-post.php
<?php

/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package WordPress
 * @subpackage Twenty_Twenty_One
 * @since Twenty Twenty-One 1.0
 */

// echo 'single-post.php';

get_header('food');

//獲取預設info
$index_post = 81;
$home_info = new stdClass;
$home_info->cate1 = get_post_meta($index_post, "cate1", true);
$home_info->part2_m_url = get_post_meta($index_post, "part2_m_url", true);
$home_info->part2_pc_url = get_post_meta($index_post, "part2_pc_url", true);
$home_info->part2_cate = get_post_meta($index_post, "part2_cate", true);
$home_info->about_company_url = get_post_meta($index_post, "about_company_url", true);
$home_info->about_content = get_post_meta($index_post, "about_content", true);
$home_info->about_phone = get_post_meta($index_post, "about_phone", true);
$home_info->about_call = get_post_meta($index_post, "about_call", true);
$home_info->about_fax = get_post_meta($index_post, "about_fax", true);
$home_info->about_addr = get_post_meta($index_post, "about_addr", true);
$home_info->about_addr_en = get_post_meta($index_post, "about_addr_en", true);
$home_info->payme_url = get_post_meta($index_post, "payme_url", true);

//$pid = intval($_REQUEST['p']);
//$query = new WP_Query('p=' . $pid);
////print_r($query);
//print_r($query->post);
//$postInfoObj = $query->post;


$menu_name = 'infos_menu';
$menuArr = ai_get_menu_items($menu_name);
//print_r($menuArr);

$vueVersion = time();
?>

<app id="app">
    <yq-header></yq-header>

    <div id="main_bg">
        <main class=" w-100 py-[0.2rem] md:w-[768px] md:mx-auto xl:w-[1280px]">
<!--            1single-post.php-->
            <section class="text-gray-600 body-font">
                <div class="container  mx-auto flex flex-col">
                    <div class="md:w-[768px] md:mx-auto xl:w-[1280px]">

                        <?php if (have_posts()) : ?>
                            <?php while (have_posts()) : the_post(); ?>
                                <div class="my-[0.12rem] w-full space-x-4">
                                    <div class="flex justify-between">
                                        <h3 class="tracking-widest text-333 text-[0.26rem] font-medium my-[0.12rem]"><?php the_title(); ?></h3>

                                        <div class="flex items-center justify-between ">
                                            <!--                                                <span class="inline-flex items-center mb-0 ">-->
                                            <!--                                                    <div style="width: 31px;height: 31px;"><img-->
                                            <!--                                                                class="rounded-full object-cover object-center mr-[0.1rem]"-->
                                            <!--                                                                style="margin-right: 13px;"-->
                                            <!--                                                                src="-->
                                            <?php //echo aiwp_get_post_thumbnail_src(get_the_ID(), $size = 'thumbnail'); ?><!--"></div>-->
                                            <!--                                                    <span style="margin-left: 13px;">666 -->
                                            <?php //the_author(); ?><!--</span>-->
                                            <!--                                                </span>-->
                                            <span class="text-white inline-flex text-right md:ml-0 ml-auto leading-none text-[0.12rem] ">
                                                    <?php echo get_the_date('Y-n-d'); ?>
<!--                                                     H:i:s-->
                                                </span>
                                        </div>
                                    </div>

                                </div>

                                <?php the_content(); ?>


                                <div class="container py-1 mx-auto flex items-center sm:flex-row flex-col border-b-2 border-gray-200">
                                    <a class="flex title-font font-medium items-center md:justify-start justify-center text-gray-900">
                                        <span class="text-[0.2rem]">简介:</span>
                                        <span class="ml-[0.13rem] text-[0.2rem]"><?php the_excerpt(); ?></span>
                                    </a>
                                    <span class="inline-flex sm:ml-auto sm:mt-0 mt-4 justify-center sm:justify-start">

                                <a class="ml-1 text-gray-500">
                                    <img class="w-[0.46rem] h-[0.46rem]" :src="local_url+'/img/zone_video/zan@2x.png'"
                                         alt="user"/>
                                </a>
                                <a class="ml-1 text-gray-500">
                                    <img class="w-[0.46rem] h-[0.46rem]" :src="local_url+'/img/zone_video/keep@2x.png'"
                                         alt="user"/>
                                </a>
                                <a class="ml-1 text-gray-500">
                                    <img class="w-[0.46rem] h-[0.46rem]" :src="local_url+'/img/zone_video/send@2x.png'"
                                         alt="user"/>
                                </a>
                            </span>
                                </div>

                                <div class="flex items-center flex-wrap mb-[0.51rem] mt-auto w-full">
                                    <a class="inline-flex items-center">
                                        <?php //echo aiwp_get_post_thumbnail_src(get_the_ID(), $size = 'thumbnail'); ?><!--"-->
                                        <?php
                                        //                                        $e = get_the_author_email();
                                        //                                        print_r('$e =>' . $e);
                                        echo get_avatar(get_the_author_email(), '45');
                                        ?>
                                        <!--                                        <img alt="user" src=""-->
                                        <!--                                             class="w-[0.77rem] h-[0.77rem] rounded-full flex-shrink-0 object-cover object-center">-->
                                        <span class="flex-grow flex flex-col pl-[0.2rem]">
                                            <span class="title-font font-medium text-gray-900"><?php the_author(); ?></span>
                                            <span class="text-white text-[0.2rem] tracking-widest mt-[0.1rem]">个人描述…</span>
                                        </span>
                                    </a>
                                    <span class="text-gray-400 inline-flex items-center ml-auto leading-none py-1 ">
                                        <button class="flex mx-auto text-white bg-main-color border-0 py-1 px-1 focus:outline-none hover:bg-indigo-600 rounded-[0.05rem] text-[0.23rem]">關注</button>
                                    </span>

                                </div>
                            <?php endwhile; ?>


                        <?php else : ?>
                            没有任何内容
                        <?php endif; ?>



                        <?php
                        //显示文章评论
                        //                        comments_template();

                        //                        $cArr = [
                        //
                        //
                        ////                            'label_submit' => __( 'Post Comment' ) 发送按键,
                        //                            'label_submit' => 'Send',
                        //                            'submit_button' => '<input name="%1$s" type="submit" id="%2$s" class="%3$s 777 mx-auto text-white bg-main-color border-0 py-1 px-1 focus:outline-none hover:bg-indigo-600 rounded-[0.05rem] text-[0.23rem]" value="%4$s" />'
                        //                        ];
                        //
                        //                        comment_form($cArr);
                        ?>

                        <section class="text-gray-600 body-font overflow-hidden">
                            <div class="container px-1 py-1 mx-auto">
                                <div class="flex items-center flex-wrap mb-[0.51rem] mt-[0.2rem] w-full">
                                    <?php
                                    //显示文章评论
                                    //<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>
                                    $cArr = [
                                        'title_reply_before' => '<h3 id="reply-title" class="comment-reply-title text-[0.31rem]">',
                                        'title_reply' => '評論',

                                        'comment_field' => '<p class="comment-form-comment">
<textarea cols="45" rows="8" id="comment" name="comment" aria-required="true" class="w-full bg-gray-100 bg-opacity-50 rounded-[0.05rem] border border-gray-300 focus:border-indigo-500 focus:bg-white focus:ring-2 focus:ring-indigo-200 text-[0.20rem] outline-none text-gray-700 py-[0.1rem] px-[0.1rem] my-[0.2rem] resize-none transition-colors duration-200 ease-in-out"></textarea>
</p>',


//                            'label_submit' => __( 'Post Comment' ) 发送按键,
                                        'label_submit' => 'Send',
                                        'submit_button' => '<input name="%1$s" type="submit" id="%2$s" class="%3$s 777 mx-auto text-white bg-main-color border-0 py-1 px-1 focus:outline-none hover:bg-indigo-600 rounded-[0.05rem] text-[0.23rem]" value="%4$s" />'
                                    ];

                                    comment_form($cArr);
                                    ?>

                                    <!--                                        <img alt="user" :src="local_url+'img/user.png'"-->
                                    <!--                                             class="w-[0.77rem] h-[0.77rem] rounded-full flex-shrink-0 object-cover object-center mr-[0.26rem]">-->
                                    <!--                                        <textarea id="message" name="message"-->
                                    <!--                                                  class="w-full bg-gray-100 bg-opacity-50 rounded-[0.05rem] border border-gray-300 focus:border-indigo-500 focus:bg-white focus:ring-2 focus:ring-indigo-200 text-[0.20rem] outline-none text-gray-700 py-[0.1rem] px-[0.1rem] resize-none transition-colors duration-200 ease-in-out"></textarea>-->

                                </div>
                            </div>
                        </section>


                    </div>
                </div>
            </section>

            <!-- comment -->
            <!--            <section class="text-gray-600 body-font">-->
            <!--                <div class="container flex flex-wrap">-->
            <!--                    <div class="py-[0.2rem] ml-[0.4rem] md:w-full">-->
            <!--                        <div class="flex p-[0.2rem] sm:flex-row flex-col">-->
            <!--                                                          <div class="[0.61rem] h-[0.61rem] mr-[0.26rem]  inline-flex items-center justify-center rounded-full bg-indigo-100 text-indigo-500 flex-shrink-0">-->
            <!--                            <div class="w-[0.8rem] h-[0.8rem] sm:mr-[0.26rem] sm:mb-0 mb-2  inline-flex items-center justify-center rounded-full bg-indigo-100 text-indigo-500 flex-shrink-0">-->
            <!--                                <svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"-->
            <!--                                     stroke-width="2" class="w-[0.45rem] h-[0.45rem] " viewBox="0 0 24 24">-->
            <!--                                    <path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"></path>-->
            <!--                                    <circle cx="12" cy="7" r="4"></circle>-->
            <!--                                </svg>-->
            <!--                            </div>-->
            <!--                            <div class="flex-grow">-->
            <!--                                <h2 class="text-gray-900 text-[0.23rem] title-font font-medium ">The Catalyzer</h2>-->
            <!--                                <p class="leading-relaxed text-[0.23rem]">Blue bottle crucifix vinyl post-ironic-->
            <!--                                    four-->
            <!--                                    dollar toast-->
            <!--                                    vegan taxidermy. Gastropub indxgo juice poutine.</p>-->
            <!---->
            <!--                                <div class="flex items-center flex-wrap mb-[0.13rem] mt-auto w-full">-->
            <!---->
            <!--                                    <span class="text-gray-400 inline-flex items-center mr-[0.2rem] leading-none text-[0.2rem] py-[0.13rem] pr-1">-->
            <!--                                        <svg class="w-[0.2rem] h-[0.2rem] mr-[0.1rem]" stroke="currentColor"-->
            <!--                                             stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"-->
            <!--                                             viewBox="0 0 24 24">-->
            <!--                                            <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>-->
            <!--                                            <circle cx="12" cy="12" r="3"></circle>-->
            <!--                                        </svg>1.2K-->
            <!--                                    </span>-->
            <!--                                    <span class="text-gray-400 inline-flex items-center leading-none text-[0.2rem]">-->
            <!--                                        <svg class="w-[0.2rem] h-[0.2rem] mr-[0.1rem]" stroke="currentColor"-->
            <!--                                             stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"-->
            <!--                                             viewBox="0 0 24 24">-->
            <!--                                            <path d="M21 11.5a8.38 8.38 0 01-.9 3.8 8.5 8.5 0 01-7.6 4.7 8.38 8.38 0 01-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 01-.9-3.8 8.5 8.5 0 014.7-7.6 8.38 8.38 0 013.8-.9h.5a8.48 8.48 0 018 8v.5z"></path>-->
            <!--                                        </svg>6-->
            <!--                                    </span>-->
            <!--                                </div>-->
            <!--                            </div>-->
            <!--                        </div>-->
            <!--                    </div>-->
            <!---->
            <!--                     sub comment -->
            <!--                    <div class="container flex flex-wrap ml-[0.2rem] md:ml-[1rem]">-->
            <!--                        <div class="py-[0.1rem] ml-[0.4rem] md:w-full">-->
            <!--                            <div class="flex p-[0.2rem] sm:flex-row flex-col">-->
            <!--                                                              <div class="[0.61rem] h-[0.61rem] mr-[0.26rem]  inline-flex items-center justify-center rounded-full bg-indigo-100 text-indigo-500 flex-shrink-0">-->
            <!--                                <div class="w-[0.8rem] h-[0.8rem] sm:mr-[0.26rem] sm:mb-0 mb-2  inline-flex items-center justify-center rounded-full bg-indigo-100 text-indigo-500 flex-shrink-0">-->
            <!--                                    <svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"-->
            <!--                                         stroke-width="2" class="w-[0.45rem] h-[0.45rem] " viewBox="0 0 24 24">-->
            <!--                                        <path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"></path>-->
            <!--                                        <circle cx="12" cy="7" r="4"></circle>-->
            <!--                                    </svg>-->
            <!--                                </div>-->
            <!--                                <div class="flex-grow">-->
            <!--                                    <h2 class="text-gray-900 text-[0.23rem] title-font font-medium ">The Catalyzer</h2>-->
            <!--                                    <p class="leading-relaxed text-[0.23rem]">Blue bottle crucifix vinyl post-ironic-->
            <!--                                        four-->
            <!--                                        dollar toast-->
            <!--                                        vegan taxidermy. Gastropub indxgo juice poutine.</p>-->
            <!---->
            <!--                                    <div class="flex items-center flex-wrap mb-[0.13rem] mt-auto w-full">-->
            <!---->
            <!--                                    <span class="text-gray-400 inline-flex items-center mr-[0.2rem] leading-none text-[0.2rem] py-[0.13rem] pr-1">-->
            <!--                                        <svg class="w-[0.2rem] h-[0.2rem] mr-[0.1rem]" stroke="currentColor"-->
            <!--                                             stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"-->
            <!--                                             viewBox="0 0 24 24">-->
            <!--                                            <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>-->
            <!--                                            <circle cx="12" cy="12" r="3"></circle>-->
            <!--                                        </svg>1.2K-->
            <!--                                    </span>-->
            <!--                                        <span class="text-gray-400 inline-flex items-center leading-none text-[0.2rem]">-->
            <!--                                        <svg class="w-[0.2rem] h-[0.2rem] mr-[0.1rem]" stroke="currentColor"-->
            <!--                                             stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"-->
            <!--                                             viewBox="0 0 24 24">-->
            <!--                                            <path d="M21 11.5a8.38 8.38 0 01-.9 3.8 8.5 8.5 0 01-7.6 4.7 8.38 8.38 0 01-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 01-.9-3.8 8.5 8.5 0 014.7-7.6 8.38 8.38 0 013.8-.9h.5a8.48 8.48 0 018 8v.5z"></path>-->
            <!--                                        </svg>6-->
            <!--                                    </span>-->
            <!--                                    </div>-->
            <!--                                </div>-->
            <!--                            </div>-->
            <!--                        </div>-->
            <!--                    </div>-->
            <!--                </div>-->
            <!--            </section>-->

            <h3>共有 <?php echo get_comments_number(); ?> 条评论</h3>
            <yq-comment :list="comment_list"></yq-comment>
            <!-- comment end -->

        </main>
    </div>

    <yq-footer></yq-footer>
</app>

<script>
    const local_url = '<?php echo $local_url ?>'
    const home_info = JSON.parse('<?php echo json_encode($home_info) ?>')
    new Vue({
        el: "#app",
        components: {
            //'yq-title': httpVueLoader('<?php //showFoodAppPath('components/yq-title.vue?v=1') ?>//'),
            'yq-comment': httpVueLoader('<?php showFoodAppPath('components/yq-comment.vue?v=' . $vueVersion) ?>'),

            //'yq-header': httpVueLoader('<?php //showFoodAppPath('components/yq-header.vue?v=5') ?>//'),
            //'yq-footer': httpVueLoader('<?php //showFoodAppPath('components/yq-footer.vue?v=2') ?>//'),

            'yq-header': httpVueLoader('<?php showFoodAppPath('components/yq-header-MMC.vue?v=' . $vueVersion) ?>'),
            'yq-footer': httpVueLoader('<?php showFoodAppPath('components/yq-footer-MMC.vue?v=' . $vueVersion) ?>'),
        },
        created() {
            this.get_comment()

            // this.get_banner()
            // this.get_product_list_one()
            // this.get_product_list_two()
            // this.linkBanner()
        },
        data: {
            banner_show: true,
            product_list_one: [],

            a_banner: [],
            banner_current: 0,
            a_cate: [],
            a_cate_product: [],
            current_cate: 0,
            scrollFlag: true,
            bannerObj: null,

            comment_list: [],
        },
        methods: {
            linkBanner() {
                this.bannerObj = setInterval(() => {
                    this.nextBanner()
                }, 8000);
            },
            toBannerLink() {
                if (this.a_banner[this.banner_current].banner_url) {
                    window.open(this.a_banner[this.banner_current].banner_url, '_blank')
                }
            },
            preBanner() {
                clearInterval(this.bannerObj)
                this.bannerObj = null

                this.banner_show = false

                setTimeout(() => {
                    let temp = this.banner_current - 1
                    this.banner_current = temp < 0 ? this.a_banner.length - 1 : temp

                    this.banner_show = true

                    this.linkBanner()
                }, 700);

            },
            nextBanner() {
                clearInterval(this.bannerObj)
                this.bannerObj = null

                this.banner_show = false

                setTimeout(() => {
                    let temp = this.banner_current + 1
                    this.banner_current = temp > this.a_banner.length - 1 ? 0 : temp

                    this.banner_show = true

                    this.linkBanner()
                }, 700);
            },

            /**
             * 文章评论列表
             * @returns {Promise<void>}
             */
            async get_comment() {
                let res = await axios({
                    method: 'post',
                    url: '/api/',
                    data: Qs.stringify({
                        module: 'comments',
                        action: 'r_comments',
                        post_id:<?php echo get_the_ID();?>
                    })
                });

                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        this.comment_list = data.res
                        console.log('this.comment_list => ', this.comment_list)
                    }
                }
            },
            async get_cate_product(key) {
                this.current_cate = key
                let res = await axios({
                    method: 'post',
                    url: '/api/',
                    data: Qs.stringify({
                        module: 'product',
                        action: 'get_product_by_cate',
                        cate: [this.a_cate[this.current_cate]],
                        limit: 6
                    })
                });

                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        this.a_cate_product = data.res
                    }
                }
            },
            async get_banner() {
                let res = await axios({
                    method: 'post',
                    url: '/api/',
                    data: Qs.stringify({
                        module: 'banner',
                        action: 'get_banner',
                        banner_type: 5
                    })
                });

                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        this.a_banner = data.res
                    }
                }
            },
            async get_product_list_one() {
                let res = await axios({
                    method: 'post',
                    url: '/api/',
                    data: Qs.stringify({
                        module: 'product',
                        action: 'get_product_by_cate',
                        cate: [home_info.cate1],
                        limit: 6
                    })
                });

                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        this.product_list_one = data.res
                    }
                }

            },
            async get_product_list_two() {
                let res = await axios({
                    method: 'post',
                    url: '/api/',
                    data: Qs.stringify({
                        module: 'product',
                        action: 'get_product_by_date',
                        limit: 4
                    })
                });

                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        this.product_list_two = data.res
                    }
                }
            }
        }
    })
</script>
<?php get_footer('food'); ?>