quanwei
2025-11-21 1db9a4130699636cabe7e0c9f7f15d004aadada0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
 
namespace app\api\controller\plus\table;
 
use app\api\controller\Controller;
use app\api\model\plus\table\Table as TableModel;
use app\common\model\settings\Region as RegionModel;
 
/**
 * 表单填写控制器
 */
class Table extends Controller
{
    /**
     * 添加用户签到
     */
    public function add($table_id)
    {
        $user = $this->getUser();
        $model = TableModel::detail($table_id);
        if($this->request->isGet()){
            $regionData = RegionModel::getRegionForApi();
            return $this->renderSuccess('', compact('model', 'regionData'));
        }
        $table_record_id = $model->add($user, $this->postData());
        if ($table_record_id) {
            return $this->renderSuccess('', compact('table_record_id')); //返回id by lyzflash
        }
        return $this->renderError($model->getError() ?: '提交失败');
    }
 
    /**
     *表单数据详情
     */
    public function detail($table_record_id)
    {
        $detail = TableModel::recorDetail($table_record_id);
        return $this->renderSuccess('', compact('detail'));
    }
 
}