quanwei
2025-10-31 f226d5fe6327e31bb471a96b7370cf94689c6608
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
 
namespace app\api\controller\plus\ticket;
 
use app\api\controller\Controller;
use app\api\model\plus\ticket\Ticket as TicketModel;
use app\api\model\settings\Setting as SettingModel;
 
/**
 * 活动控制器
 */
class Index extends Controller
{
 
    /**
     * 列表
     */
    public function index()
    {
        $model = new TicketModel;
        // 用户信息
        $user = $this->getUser();
        $list = $model->getList($this->postData(),$user);
        return $this->renderSuccess('', compact('list'));
    }
 
    /**
     *详情
     */
    public function detail($upload_id)
    {
        $detail = TicketModel::detail($upload_id);
        return $this->renderSuccess('', compact('detail'));
    }
 
    /**
     *详获取设置
     */
    public function setting()
    {
        $setting = SettingModel::getSupplierItem('ticket',0);
        return $this->renderSuccess('', compact('setting'));
    }
 
    /**
     *提交小票上传
     */
    public function submit()
    {
        $params = $this->request->param();
        // 用户信息
        $user = $this->getUser();
        // 生成记录
        $model = new TicketModel();
        $upload_id = $model->addTicket($user,$params);
        if(!$upload_id){
            return $this->renderError($model->getError() ?: '上传失败');
        }
 
        return $this->renderSuccess('', compact('upload_id'));
 
    }
 
}