OrderController.class.php
856 Bytes
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
<?php
/**
* 【后台】分类排序接口
* OrderController.class.php
* @author:daijun
* @date:2017-08-31
*/
namespace Apicp\Controller\Category;
use Common\Service\CategoryService;
class OrderController extends \Apicp\Controller\AbstractController
{
/**
* 分类排序接口
* @author daijun
*/
public function Index_post()
{
// 获取参数
$list = I('post.list');
if (empty($list)) {
E('_EMPTY_ORDER_PARAMS');
}
if (!is_array($list)) {
E('_EMPTY_ORDER_PARAMS');
}
// 实例化分类service
$cate_service = new CategoryService();
foreach ($list as $k => $v) {
// 遍历更新排序字段
$cate_service->update($v['ca_id'], ['ca_order' => $k + 1]);
}
return true;
}
}