package com.nq.controller.backend;
|
|
import com.nq.common.ServerResponse;
|
import com.nq.service.ISitePayOptionService;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import java.util.List;
|
|
/**
|
* 管理后台 - 支付设置(默认/支付1/支付2/支付3)
|
* 支持拖拽排序(参数随排序变动)、开启/关闭
|
*/
|
@Controller
|
@RequestMapping("/admin/payOption/")
|
public class AdminSitePayOptionController {
|
private static final Logger log = LoggerFactory.getLogger(AdminSitePayOptionController.class);
|
|
@Autowired
|
private ISitePayOptionService sitePayOptionService;
|
|
/** 列表(按当前排序),用于管理页展示与拖拽 */
|
@RequestMapping("list.do")
|
@ResponseBody
|
public ServerResponse list() {
|
return sitePayOptionService.listForAdmin();
|
}
|
|
/** 拖动排序:传入新顺序的 id 列表,如 [3,1,4,2],后端按顺序将 param 设为 0,1,2,3 */
|
@RequestMapping("updateSort.do")
|
@ResponseBody
|
public ServerResponse updateSort(@RequestBody List<Integer> orderedIds) {
|
return sitePayOptionService.updateSort(orderedIds);
|
}
|
|
/** 开启/关闭:enabled 1=开启 0=关闭 */
|
@RequestMapping("setEnabled.do")
|
@ResponseBody
|
public ServerResponse setEnabled(@RequestParam("id") Integer id, @RequestParam("enabled") Integer enabled) {
|
return sitePayOptionService.setEnabled(id, enabled);
|
}
|
}
|