Files
fastmovieai/fastmovie-admin/app/Basic.php
T
李建琦 eae151fd57 FastMovieAI AI短剧创作平台 二开基线
- 源码: xhadmincn/FastMovieAI (Apache 2.0)
- 二开: Docker部署, Swoole改Select, route.php修复, 补update/VERSION
- vendor/示例资源已gitignore
2026-08-26 18:37:36 +08:00

51 lines
1.2 KiB
PHP

<?php
namespace app;
use app\expose\trait\Json;
use support\Request;
class Basic
{
protected $model;
use Json;
/**
* 更新指定字段
* @method POST
*/
public function indexUpdateField(Request $request)
{
$id = $request->post('id');
$field = $request->post('field');
$value = $request->post('value');
$model = $this->model->where(['id' => $id])->find();
if (!$model) {
return $this->fail('数据不存在');
}
$model->{$field} = $value;
if ($model->save()) {
return $this->success();
}
return $this->fail('操作失败');
}
/**
* 更新状态字段
* @method POST
*/
public function indexUpdateState(Request $request)
{
$id = $request->post('id');
$field = $request->post('field');
$value = $request->post('value');
$model = $this->model->where(['id' => $id])->find();
if (!$model) {
return $this->fail('数据不存在');
}
$model->{$field} = $value;
if ($model->save()) {
return $this->success();
}
return $this->fail('操作失败');
}
}