Przeglądaj źródła

添加查询订单

chenxiqiang 6 lat temu
rodzic
commit
81ee1b5250

+ 3
- 1
manage-server/app/Http/Controllers/ProductController.php Wyświetl plik

@@ -19,6 +19,7 @@ class ProductController extends Controller
19 19
         $name = $request->input('name');
20 20
         $info = $request->input('info');
21 21
         $classify = $request->input('classify');
22
+        $color = $request->input('color');
22 23
         $price = $request->input('price');
23 24
         $status = $request->input('status');
24 25
         if ($id) {
@@ -28,9 +29,10 @@ class ProductController extends Controller
28 29
             $product = new Product;
29 30
             $product->status = 0;
30 31
         }
31
-        if ($name && $info && $classify) {
32
+        if ($name && $info && $classify && $color) {
32 33
             $product->name = $name;
33 34
             $product->info = $info;
35
+            $product->color = $color;
34 36
             $product->price = $price;
35 37
             $product->save();
36 38
             return Response()->json([

+ 1
- 0
manage-server/app/Models/Product.php Wyświetl plik

@@ -16,6 +16,7 @@ class Product extends Model
16 16
 		'info', // 产品信息
17 17
         'price', // 产品价格
18 18
         'classify', // 产品分类
19
+        'color', // 产品颜色款色
19 20
         'collect_num', // 收藏数
20 21
         'sell_num', // 销量
21 22
 		'status', // 产品状态, 上架/下架

+ 246
- 43
manage-server/readme.md Wyświetl plik

@@ -1,60 +1,263 @@
1
-<p align="center"><img src="https://laravel.com/assets/img/components/logo-laravel.svg"></p>
1
+# 接口说明
2
+## 通用接口
3
+### 上传图片
4
+- `POST /upload`
5
+- 参数:
2 6
 
3
-<p align="center">
4
-<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
5
-<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/d/total.svg" alt="Total Downloads"></a>
6
-<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/v/stable.svg" alt="Latest Stable Version"></a>
7
-<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a>
8
-</p>
7
+参数         |  类型    |   可选  |    备注
8
+----------- |  ------  |  ------   |  --------
9
+photo       |   png/jpeg  | 	必须  |  图片
9 10
 
10
-## About Laravel
11
+- 响应:
12
+ 
13
+```
14
+{
15
+	"status": 0,
16
+	"path": "/path/photo.jpeg"
17
+}
11 18
 
12
-Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as:
19
+{
20
+	"status": -1,
21
+	"message": "error, photo is valid"
22
+}
13 23
 
14
-- [Simple, fast routing engine](https://laravel.com/docs/routing).
15
-- [Powerful dependency injection container](https://laravel.com/docs/container).
16
-- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
17
-- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
18
-- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
19
-- [Robust background job processing](https://laravel.com/docs/queues).
20
-- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
24
+{
25
+	"status": -2,
26
+	"message": "error, error message"
27
+}
28
+```
21 29
 
22
-Laravel is accessible, yet powerful, providing tools needed for large, robust applications.
30
+## 活动接口
31
+### 创建/修改活动
32
+- `POST /campaign/store`
33
+- 参数:
23 34
 
24
-## Learning Laravel
35
+参数         |  类型    |   可选               |    备注
36
+----------- |  ------  |  ------------------ |  --------
37
+id          |  integer | 	创建时空,修改时必须  |  活动id
38
+title       |  string  | 	必须               |  标题
39
+content     |  string  | 	必须               |  内容
40
+status      |  integer | 	可选               |  活动状态:0.进行中, 1.结束
25 41
 
26
-Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of any modern web application framework, making it a breeze to get started learning the framework.
42
+- 响应:
27 43
 
28
-If you're not in the mood to read, [Laracasts](https://laracasts.com) contains over 1100 video tutorials on a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library.
44
+```
45
+{
46
+	"status": 0,
47
+	"message": "保存成功"
48
+}
29 49
 
30
-## Laravel Sponsors
50
+{
51
+	"status": -1,
52
+	"message": "信息不能为空!"
53
+}
54
+```
31 55
 
32
-We would like to extend our thanks to the following sponsors for helping fund on-going Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell):
56
+### 删除活动
57
+- `DELETE /campaign/delete`
58
+- 参数:
33 59
 
34
-- **[Vehikl](https://vehikl.com/)**
35
-- **[Tighten Co.](https://tighten.co)**
36
-- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
37
-- **[Cubet Techno Labs](https://cubettech.com)**
38
-- **[British Software Development](https://www.britishsoftware.co)**
39
-- [Fragrantica](https://www.fragrantica.com)
40
-- [SOFTonSOFA](https://softonsofa.com/)
41
-- [User10](https://user10.com)
42
-- [Soumettre.fr](https://soumettre.fr/)
43
-- [CodeBrisk](https://codebrisk.com)
44
-- [1Forge](https://1forge.com)
45
-- [TECPRESSO](https://tecpresso.co.jp/)
46
-- [Runtime Converter](http://runtimeconverter.com/)
47
-- [WebL'Agence](https://weblagence.com/)
48
-- [Invoice Ninja](https://www.invoiceninja.com)
60
+参数         |  类型    |   可选    |    备注
61
+----------- |  ------  |  ------- |  --------
62
+id          |  integer | 	 必须  |  活动id
49 63
 
50
-## Contributing
64
+- 响应:
51 65
 
52
-Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
66
+ ```
67
+{
68
+	"status": 0,
69
+	"message": "删除成功"
70
+}
53 71
 
54
-## Security Vulnerabilities
72
+{
73
+	"status": -1,
74
+	"message": "id不能为空!"
75
+}
76
+```
55 77
 
56
-If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
78
+### 获得某活动
57 79
 
58
-## License
80
+- `GET /campaign/${id}`
81
+- 参数: 无
82
+- 响应:
59 83
 
60
-The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
84
+ ```
85
+{
86
+	"status": 0,
87
+	"data": {
88
+		"id": 123456,
89
+		"title": "测试标题",
90
+		"content": "测试内容",
91
+		"status": 0,
92
+		"created_at": "2018-02-16 11:10:56",
93
+		"updated_at": "2018-02-16 12:00:51"
94
+	}
95
+}
96
+```
97
+
98
+
99
+### 分页查询活动
100
+- `GET /campaigns`
101
+- 参数: 无
102
+- 响应:
103
+
104
+```
105
+{
106
+   "total": 50,
107
+   "per_page": 15,
108
+   "current_page": 1,
109
+   "last_page": 4,
110
+   "first_page_url": "http://laravel.app?page=1",
111
+   "last_page_url": "http://laravel.app?page=4",
112
+   "next_page_url": "http://laravel.app?page=2",
113
+   "prev_page_url": null,
114
+   "path": "http://laravel.app",
115
+   "from": 1,
116
+   "to": 15,
117
+   "data":[{
118
+			"id": 123456,
119
+			"title": "测试标题",
120
+			"content": "测试内容",
121
+			"status": 0,
122
+			"created_at": "2018-02-16 11:10:56",
123
+			"updated_at": "2018-02-16 12:00:51"
124
+		},{
125
+			"id": 34578,
126
+			"title": "测试标题2",
127
+			"content": "测试内容2",
128
+			"status": 1,
129
+			"created_at": "2018-02-16 11:10:56",
130
+			"updated_at": "2018-02-16 12:00:51"
131
+		},
132
+		...
133
+   ]
134
+}
135
+```
136
+
137
+## 产品接口
138
+### 创建/修改产品
139
+- `POST /product/store`
140
+- 参数:
141
+
142
+参数         |  类型    |   可选               |    备注
143
+----------- |  ------  |  ------------------ |  --------
144
+id          |  integer | 	创建时空,修改时必须  |  产品id
145
+name        |  string  | 	必须               |  产品名称
146
+info        |  string  | 	必须               |  产品信息
147
+color       |  string  |   必须               |  产品款色
148
+price       |  double  | 	必须               |  产品价格
149
+classify    |  string  | 	必须               |  产品分类
150
+status      |  integer | 	可选               |  产品状态:0.上架, 1.下架
151
+
152
+- 响应:
153
+
154
+```
155
+{
156
+	"status": 0,
157
+	"message": "保存成功"
158
+}
159
+
160
+{
161
+	"status": -1,
162
+	"message": "信息不能为空!"
163
+}
164
+```
165
+
166
+### 删除产品
167
+- `DELETE /product/delete`
168
+- 参数:
169
+
170
+参数         |  类型    |   可选    |    备注
171
+----------- |  ------  |  ------- |  --------
172
+id          |  integer | 	 必须  |  产品id
173
+
174
+- 响应:
175
+
176
+ ```
177
+{
178
+	"status": 0,
179
+	"message": "删除成功"
180
+}
181
+
182
+{
183
+	"status": -1,
184
+	"message": "id不能为空!"
185
+}
186
+```
187
+
188
+### 获得某产品
189
+
190
+- `GET /product/${id}`
191
+- 参数:无
192
+
193
+- 响应:
194
+
195
+ ```
196
+{
197
+	"status": 0,
198
+	"data": {
199
+		"id": 123456,
200
+		"name": "测试名称",
201
+		"info": "测试信息",
202
+		"price": 1234.31,
203
+		"classify": "分类1",
204
+		"color": "款色",
205
+		"collect_num": 765,  //收藏数
206
+		"sell_num": 5,       //销量
207
+		"status": 0,         //0上架, 1下架
208
+		"created_at": "2018-02-16 11:10:56",
209
+		"updated_at": "2018-02-16 12:00:51"
210
+	}
211
+}
212
+```
213
+
214
+
215
+### 分页查询活动
216
+- `GET /campaigns`
217
+- 参数: 无
218
+- 响应:
219
+
220
+```
221
+{
222
+   "total": 50,
223
+   "per_page": 15,
224
+   "current_page": 1,
225
+   "last_page": 4,
226
+   "first_page_url": "http://laravel.app?page=1",
227
+   "last_page_url": "http://laravel.app?page=4",
228
+   "next_page_url": "http://laravel.app?page=2",
229
+   "prev_page_url": null,
230
+   "path": "http://laravel.app",
231
+   "from": 1,
232
+   "to": 15,
233
+   "data":[ {
234
+			"id": 123456,
235
+			"name": "测试名称",
236
+			"info": "测试信息",
237
+			"price": 1234.31,
238
+			"classify": "分类1",
239
+			"collect_num": 765,  //收藏数
240
+			"sell_num": 5,       //销量
241
+			"status": 0,         //0上架, 1下架
242
+			"created_at": "2018-02-16 11:10:56",
243
+			"updated_at": "2018-02-16 12:00:51"
244
+		}, {
245
+			"id": 123456,
246
+			"name": "测试名称",
247
+			"info": "测试信息",
248
+			"price": 1234.31,
249
+			"classify": "分类1",
250
+			"collect_num": 765,  //收藏数
251
+			"sell_num": 5,       //销量
252
+			"status": 0,         //0上架, 1下架
253
+			"created_at": "2018-02-16 11:10:56",
254
+			"updated_at": "2018-02-16 12:00:51"
255
+		}
256
+		...
257
+   ]
258
+}
259
+```
260
+
261
+## 家居清洁订单接口
262
+### 创建/修改家居清洁订单
263
+- `POST `

+ 4
- 2
manage-server/routes/web.php Wyświetl plik

@@ -20,8 +20,10 @@ Route::post('/common/upload', 'CommonController@upload');
20 20
 
21 21
 Route::post('/campaign/store', 'CampaignController@store');
22 22
 Route::delete('/campaign/delete', 'CampaignController@delete');
23
-Route::get('/campaign/list', 'CampaignController@list');
23
+Route::get('/campaigns', 'CampaignController@list');
24
+Route::get('/campaign', 'CampaignController@get');
24 25
 
25 26
 Route::post('/product/store', 'ProductController@store');
26 27
 Route::delete('/product/delete', 'ProductController@delete');
27
-Route::get('/product/list', 'ProductController@list');
28
+Route::get('/products', 'ProductController@list');
29
+Route::get('/product', 'ProductController@get');

Loading…
Anuluj
Zapisz