Content.php
3.9 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
/**
* Created by PhpStorm.
* User: 86132
* Date: 2020/11/18
* Time: 15:18
*/
namespace app\api\controller;
use app\common\controller\Api;
use think\Db;
/**
* 富文本接口
*/
class Content extends Api
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = ['*'];
/**
* 富文本接口
* @ApiTitle (会员规则)
* @ApiSummary (会员规则)
* @ApiMethod (POST)
* @ApiRoute (/api/Content/VipContent)
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturn ({
'code':'1',
'msg':'返回成功',
"data": {
}
})
*/
public function VipContent()
{
$Array = Db::name('vip_content')->where('id', 1)->find();
$data = [
'Content' => $Array['content'],
'Image' => cdnurl($Array['image'])
];
$this->success('成功', $data);
}
/**
* 富文本接口
* @ApiTitle (积分规则)
* @ApiSummary (积分规则)
* @ApiMethod (POST)
* @ApiRoute (/api/Content/NumContent)
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturn ({
'code':'1',
'msg':'返回成功',
"data": {
}
})
*/
public function NumContent()
{
$Array = Db::name('num_content')->where('id', 1)->find();
$this->success('成功', $Array['content']);
}
/**
* 富文本接口
* @ApiTitle (关于我们)
* @ApiSummary (关于我们)
* @ApiMethod (POST)
* @ApiRoute (/api/Content/AboutMe)
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturn ({
'code':'1',
'msg':'返回成功',
"data": {
}
})
*/
public function AboutMe()
{
$Array = Db::name('about_me')->where('id', 1)->find();
$this->success('成功', $Array['content']);
}
/**
* 富文本接口
* @ApiTitle (常见问题)
* @ApiSummary (常见问题)
* @ApiMethod (POST)
* @ApiRoute (/api/Content/Question)
* @ApiParams (name="keywords", type="integer", required=true, description="搜索")
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturn ({
'code':'1',
'msg':'返回成功',
"data": {
}
})
*/
public function Question()
{
$keywords = input('keywords');
$map = [];
if (!empty($keywords) || $keywords != '') {
$map['question'] = ['LIKE', '%' . $keywords . '%'];
}
$Array = Db::name('question')->where($map)->order('weigh desc')->select();
$List = [];
if (!empty($Array)) {
foreach ($Array as $k => $v) {
$List[$k]['id'] = $v['id'];
$List[$k]['Question'] = $v['question'];
$List[$k]['Answer'] = $v['answer'];
}
}
$this->success('成功', $List);
}
/**
* 富文本接口
* @ApiTitle (活动规则)
* @ApiSummary (活动规则)
* @ApiMethod (POST)
* @ApiRoute (/api/Content/HuodongContent)
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturn ({
'code':'1',
'msg':'返回成功',
"data": {
}
})
*/
public function HuodongContent()
{
$Arr = Db::name('huodong_content')->where('id', 1)->find();
$this->success('成功', $Arr);
}
}