403Webshell
Server IP : 156.238.232.47  /  Your IP : 216.73.216.150
Web Server : nginx/1.25.3
System : Linux C202504152095410 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : www ( 1000)
PHP Version : 8.3.25
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/data/wwwroot/2025_12_29_03/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/data/wwwroot/2025_12_29_03//enable_shop.php
<?php
/**
 * 商城配置脚本 - 通过浏览器访问执行
 * 访问地址: http://www.lvyou1.com:81/enable_shop.php
 */
error_reporting(E_ALL);
ini_set('display_errors', 1);

// 加载ThinkPHP框架
define('IS_API', true);
require_once dirname(__FILE__) . '/core/startup.php';

app()->init();

$pdo = Db::connect()->pdo;

echo "<h1>商城配置脚本</h1>";
echo "<pre>";

try {
    echo "=== 1. 检查商城开关配置 ===\n";
    
    $shopConfig = Db::name('users_config')
        ->where('name', 'shop_open')
        ->where('inc_type', 'shop')
        ->find();
    
    if (!$shopConfig || $shopConfig['value'] != 1) {
        echo "商城开关未开启,正在开启...\n";
        if (!$shopConfig) {
            Db::name('users_config')->insert([
                'name' => 'shop_open',
                'value' => 1,
                'inc_type' => 'shop',
                'lang' => 'cn'
            ]);
            echo "✓ 已创建商城开关配置\n";
        } else {
            Db::name('users_config')
                ->where('name', 'shop_open')
                ->where('inc_type', 'shop')
                ->setField('value', 1);
            echo "✓ 已更新商城开关为开启\n";
        }
    } else {
        echo "✓ 商城开关已开启\n";
    }
    
    echo "\n=== 2. 检查产品价格字段配置 ===\n";
    
    $fieldConfig = Db::name('channelfield')
        ->where('name', 'users_price')
        ->where('channel_id', 2)
        ->find();
    
    if (!$fieldConfig) {
        echo "产品模型的 users_price 字段不存在,正在添加...\n";
        Db::name('channelfield')->insert([
            'name' => 'users_price',
            'channel_id' => 2,
            'title' => '价格',
            'dtype' => 'decimal',
            'dfvalue' => 'decimal(10,2)',
            'maxlength' => 10,
            'defaultvalue' => '0.00',
            'ifeditable' => 1,
            'ifmain' => 1,
            'ifcontrol' => 0,
            'status' => 1
        ]);
        echo "✓ 已添加 users_price 字段\n";
    } else {
        echo "✓ 产品模型的 users_price 字段已存在\n";
        echo "  - ID: {$fieldConfig['id']}\n";
        echo "  - 标题: {$fieldConfig['title']}\n";
        echo "  - ifmain: {$fieldConfig['ifmain']}\n";
        echo "  - ifeditable: {$fieldConfig['ifeditable']}\n";
        echo "  - ifcontrol: {$fieldConfig['ifcontrol']}\n";
        echo "  - status: {$fieldConfig['status']}\n";
        
        // 确保字段状态正确
        $needFix = false;
        if ($fieldConfig['status'] != 1) { $needFix = true; echo "  - status 需要修复\n"; }
        if ($fieldConfig['ifmain'] != 1) { $needFix = true; echo "  - ifmain 需要修复\n"; }
        if ($fieldConfig['ifeditable'] != 1) { $needFix = true; echo "  - ifeditable 需要修复\n"; }
        if ($fieldConfig['ifcontrol'] != 0) { $needFix = true; echo "  - ifcontrol 需要修复\n"; }
        
        if ($needFix) {
            Db::name('channelfield')
                ->where('id', $fieldConfig['id'])
                ->update([
                    'status' => 1,
                    'ifmain' => 1,
                    'ifeditable' => 1,
                    'ifcontrol' => 0
                ]);
            echo "✓ 已修复字段配置\n";
        }
    }
    
    echo "\n=== 3. 清除缓存 ===\n";
    
    // 清除缓存
    $cacheDir = dirname(__FILE__) . '/data/runtime/';
    if (is_dir($cacheDir)) {
        recursive_delete($cacheDir);
        echo "✓ 已清除数据缓存\n";
    }
    
    echo "\n=== 配置完成 ===\n";
    echo "\n请执行以下操作:\n";
    echo "1. 刷新后台产品添加页面\n";
    echo "2. 如果价格字段仍未显示,请检查:\n";
    echo "   - 商城功能是否在【系统 - 系统设置 - 商城配置】中开启\n";
    echo "   - 产品模型是否启用了 users_price 字段\n";
    
} catch (Exception $e) {
    echo "\n错误: " . $e->getMessage() . "\n";
    echo "\nTrace: " . $e->getTraceAsString() . "\n";
}

echo "</pre>";

// 递归删除目录函数
function recursive_delete($dir) {
    if (!is_dir($dir)) return;
    
    $files = array_diff(scandir($dir), array('.','..'));
    foreach ($files as $file) {
        $path = "$dir/$file";
        if (is_dir($path)) {
            recursive_delete($path);
        } else {
            @unlink($path);
        }
    }
    return @rmdir($dir);
}

Youez - 2016 - github.com/yon3zu
LinuXploit