'1', 'pid' => '0', 'name' => '收银系统', 'avatar_id' => '0', 'user_type' => '1', 'login_name' => '13888888888', 'system_user_id' => '1', 'jurisdiction_group_id' => '1', 'is_touch' => 1, 'avatar' => '', 'user_name' => '合伙人', 'end_time' => '', 'merchant_id' => '1', 'storeid' => '1', 'identity' => '2' // 店长身份 ); echo "3. 模拟登录成功,用户数据:\n"; print_r($userData); // 4. 设置关键session(模拟BaseController需要的session) $_SESSION['jurisdiction_user'] = $userData; $_SESSION['merchant_userinfo'] = $userData; $_SESSION['login_user'] = $userData; $_SESSION['merchant_id'] = $userData['merchant_id']; $_SESSION['storeid'] = $userData['storeid']; $_SESSION['identity'] = $userData['identity']; echo "\n4. 用户session设置完成\n"; // 5. 检查session状态 echo "\n5. 当前session状态:\n"; echo "- jurisdiction_user: " . (isset($_SESSION['jurisdiction_user']) ? 'YES' : 'NO') . "\n"; echo "- merchant_id: " . (isset($_SESSION['merchant_id']) ? $_SESSION['merchant_id'] : 'NO') . "\n"; echo "- storeid: " . (isset($_SESSION['storeid']) ? $_SESSION['storeid'] : 'NO') . "\n"; echo "- identity: " . (isset($_SESSION['identity']) ? $_SESSION['identity'] : 'NO') . "\n"; // 6. 设置POST参数 $_POST = array( 'store_name' => '测试门店名称', 'store_address' => '测试门店地址', 'store_phone' => '13800138000' ); echo "\n6. POST参数设置:\n"; print_r($_POST); // 7. 测试storeSet接口 echo "\n7. 开始测试storeSet接口\n"; try { // 实例化Xcx控制器 $xcxController = new \Retail\Controller\XcxController(); // 捕获storeSet方法的输出 ob_start(); $xcxController->storeSet(); $storeSetOutput = ob_get_clean(); echo "8. storeSet方法执行完成\n"; echo "storeSet输出: " . $storeSetOutput . "\n"; // 尝试解析JSON响应 $response = json_decode($storeSetOutput, true); if ($response) { echo "解析后的响应:\n"; echo "- status: " . (isset($response['status']) ? $response['status'] : 'N/A') . "\n"; echo "- msg: " . (isset($response['msg']) ? $response['msg'] : 'N/A') . "\n"; echo "- data: " . (isset($response['data']) ? print_r($response['data'], true) : 'N/A') . "\n"; } } catch (Exception $e) { echo "执行storeSet时出现异常: " . $e->getMessage() . "\n"; echo "异常文件: " . $e->getFile() . " 第" . $e->getLine() . "行\n"; } // 8. 最终session信息 echo "\n=== 最终Session信息 ===\n"; foreach ($_SESSION as $key => $value) { if (is_array($value)) { echo "$key: " . print_r($value, true) . "\n"; } else { echo "$key: $value\n"; } } echo "\n=== 测试完成 ===\n"; ?>