chore: 重写初始提交(清空历史,整理后全量提交)

This commit is contained in:
ywxapp
2026-08-16 16:54:14 +08:00
commit 6c1a106bc1
1808 changed files with 238144 additions and 0 deletions
+123
View File
@@ -0,0 +1,123 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\controller\api;
use addon\wxchat\worker\Header;
use addon\wxchat\worker\Message;
use addon\wxchat\worker\Payload;
use think\Request;
use ywxapp\controller\FrontendBase as AddonController;
/**
* Test 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class Test extends AddonController
{
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
// ===== 序列化:对象 → JSON =====
$message = new Message() /* 通过构造函数或 fromArray 创建 */;
$message->header->to = ('22');
dump($message);
$jsonStr = json_encode($message, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
// 或直接:$array = $message->toArray();
dump($jsonStr);
dump('===== 反序列化:JSON → 对象 ===== ');
// ===== 反序列化:JSON → 对象 =====
$message = Message::fromJson($jsonStr); // 推荐:带异常处理
// 或:$message = Message::fromArray(json_decode($jsonInput, true));
dump($message);
dump('===== 反序列化:设置 → 对象 ===== ');
// ===== 反序列化:设置 → 对象 =====
$message->payload = new Payload();
$message->payload->name = "傻子";
$message->header->to = ('11');
dump($message);
dump(json_encode($message));
}
/**
* 显示创建资源表单页.
*
* @return \think\Response
*/
public function create()
{
//
}
/**
* 保存新建的资源
*
* @param \think\Request $request
* @return \think\Response
*/
public function save(Request $request)
{
//
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read($id)
{
//
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return \think\Response
*/
public function edit($id = null)
{
//
}
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param int $id
* @return \think\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete($id)
{
//
}
}