|
|
@@ -48,34 +48,11 @@ class Sys extends Model
|
|
|
"title" => empty($data["title"])?"":$data["title"],
|
|
|
"query" => empty($data["query"])?"":$data["query"],
|
|
|
"content" => empty($data["content"])?"":$data["content"],
|
|
|
- "is_show" => isset($data["is_show"]) ? $data["is_show"] : 0,
|
|
|
+ "is_show" => empty($data["is_show"])?"":$data["is_show"],
|
|
|
];
|
|
|
- @file_put_contents('quanju.txt', "【".date('Y-m-d H:i:s')."】传参: ".json_encode($data, JSON_UNESCAPED_UNICODE)." \r\n", 8);
|
|
|
- @file_put_contents('quanju.txt', "【".date('Y-m-d H:i:s')."】处理后: ".json_encode($save, JSON_UNESCAPED_UNICODE)." \r\n", 8);
|
|
|
+ @file_put_contents('quanju.txt', json_encode($save)."-应该保存的的传参\r\n", 8);
|
|
|
|
|
|
- // 检查 id=1 的记录是否存在
|
|
|
- $exists = $this->where("id", 1)->find();
|
|
|
- if (!$exists) {
|
|
|
- @file_put_contents('quanju.txt', "【".date('Y-m-d H:i:s')."】id=1 不存在,执行插入 \r\n", 8);
|
|
|
- $result = $this->insert([
|
|
|
- "id" => 1,
|
|
|
- "shareconfig" => serialize($save)
|
|
|
- ]);
|
|
|
- } else {
|
|
|
- @file_put_contents('quanju.txt', "【".date('Y-m-d H:i:s')."】id=1 存在,执行更新 \r\n", 8);
|
|
|
- @file_put_contents('quanju.txt', "【".date('Y-m-d H:i:s')."】exists旧值: ".$exists->shareconfig." \r\n", 8);
|
|
|
- @file_put_contents('quanju.txt', "【".date('Y-m-d H:i:s')."】新值: ".serialize($save)." \r\n", 8);
|
|
|
- // 直接用原生 SQL 查询数据库当前值
|
|
|
- $dbValue = \think\facade\Db::query("SELECT shareconfig FROM table_sys WHERE id = 1");
|
|
|
- @file_put_contents('quanju.txt', "【".date('Y-m-d H:i:s')."】数据库直接查询: ".json_encode($dbValue)." \r\n", 8);
|
|
|
- // 使用 save() 方法强制更新
|
|
|
- $exists->shareconfig = serialize($save);
|
|
|
- $result = $exists->force()->save();
|
|
|
- @file_put_contents('quanju.txt', "【".date('Y-m-d H:i:s')."】强制更新结果: ".$result." \r\n", 8);
|
|
|
- }
|
|
|
- @file_put_contents('quanju.txt', "【".date('Y-m-d H:i:s')."】更新结果: ".$result." \r\n", 8);
|
|
|
-
|
|
|
- return $result;
|
|
|
+ $this->where("id",1)->update(["shareconfig"=> serialize($save)]);
|
|
|
}
|
|
|
/**
|
|
|
* 邀请配置
|