|
|
@@ -0,0 +1,81 @@
|
|
|
+package com.zhentao.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.zhentao.common.Result;
|
|
|
+import com.zhentao.entity.MarrApply;
|
|
|
+import com.zhentao.service.MarrApplyService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 红娘申请审核
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/admin/marr-apply")
|
|
|
+@CrossOrigin(origins = "*")
|
|
|
+public class MarrApplyControllor {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MarrApplyService marrApplyService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 红娘申请列表(可按姓名/手机号模糊查询,按创建时间倒序)
|
|
|
+ */
|
|
|
+ @GetMapping("/list")
|
|
|
+ public Result<Map<String, Object>> list(@RequestParam(defaultValue = "1") Integer page,
|
|
|
+ @RequestParam(defaultValue = "10") Integer pageSize,
|
|
|
+ @RequestParam(required = false) String name,
|
|
|
+ @RequestParam(required = false) String phone) {
|
|
|
+ try {
|
|
|
+ Page<MarrApply> pageData = marrApplyService.pageQuery(page, pageSize, name, phone);
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ data.put("list", pageData.getRecords());
|
|
|
+ data.put("total", pageData.getTotal());
|
|
|
+ data.put("page", page);
|
|
|
+ data.put("pageSize", pageSize);
|
|
|
+ return Result.success(data);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return Result.error("查询红娘申请失败:" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 审核通过:更新用户isMatchmaker为1
|
|
|
+ */
|
|
|
+ @PostMapping("/approve/{applyId}")
|
|
|
+ public Result<String> approve(@PathVariable Long applyId, @RequestParam Integer userId) {
|
|
|
+ try {
|
|
|
+ boolean success = marrApplyService.approve(applyId, userId);
|
|
|
+ if (success) {
|
|
|
+ return Result.success("审核通过成功");
|
|
|
+ } else {
|
|
|
+ return Result.error("审核通过失败");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return Result.error("审核通过失败:" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除申请
|
|
|
+ */
|
|
|
+ @DeleteMapping("/delete/{applyId}")
|
|
|
+ public Result<String> delete(@PathVariable Long applyId) {
|
|
|
+ try {
|
|
|
+ boolean success = marrApplyService.delete(applyId);
|
|
|
+ if (success) {
|
|
|
+ return Result.success("删除成功");
|
|
|
+ } else {
|
|
|
+ return Result.error("删除失败");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return Result.error("删除失败:" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|