|
@@ -1,9 +1,11 @@
|
|
|
package com.etotem.cfc.controller;
|
|
package com.etotem.cfc.controller;
|
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.etotem.cfc.common.Result;
|
|
import com.etotem.cfc.common.Result;
|
|
|
|
|
+import com.etotem.cfc.entity.FamilyCommission;
|
|
|
|
|
+import com.etotem.cfc.entity.PromotionBinding;
|
|
|
import com.etotem.cfc.service.FamilyCommissionService;
|
|
import com.etotem.cfc.service.FamilyCommissionService;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
-
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -16,14 +18,14 @@ public class PromotionController {
|
|
|
private FamilyCommissionService familyCommissionService;
|
|
private FamilyCommissionService familyCommissionService;
|
|
|
|
|
|
|
|
@PostMapping("/bind")
|
|
@PostMapping("/bind")
|
|
|
- public Result<Map<String, Object>> bind(@RequestBody Map<String, Object> params) {
|
|
|
|
|
|
|
+ public Result<PromotionBinding> bind(@RequestBody Map<String, Object> params) {
|
|
|
String inviteCode = params.get("inviteCode") != null ? params.get("inviteCode").toString() : null;
|
|
String inviteCode = params.get("inviteCode") != null ? params.get("inviteCode").toString() : null;
|
|
|
Long promoterFamilyId = params.get("promoterFamilyId") != null
|
|
Long promoterFamilyId = params.get("promoterFamilyId") != null
|
|
|
? Long.valueOf(params.get("promoterFamilyId").toString()) : null;
|
|
? Long.valueOf(params.get("promoterFamilyId").toString()) : null;
|
|
|
if (inviteCode == null || promoterFamilyId == null) {
|
|
if (inviteCode == null || promoterFamilyId == null) {
|
|
|
return Result.error("邀请码和推广方家庭ID不能为空");
|
|
return Result.error("邀请码和推广方家庭ID不能为空");
|
|
|
}
|
|
}
|
|
|
- var binding = familyCommissionService.bindByInviteCode(promoterFamilyId, inviteCode);
|
|
|
|
|
|
|
+ PromotionBinding binding = familyCommissionService.bindByInviteCode(promoterFamilyId, inviteCode);
|
|
|
if (binding == null) {
|
|
if (binding == null) {
|
|
|
return Result.error("绑定失败,请检查邀请码");
|
|
return Result.error("绑定失败,请检查邀请码");
|
|
|
}
|
|
}
|
|
@@ -39,7 +41,7 @@ public class PromotionController {
|
|
|
if (familyId == null) {
|
|
if (familyId == null) {
|
|
|
return Result.error("家庭ID不能为空");
|
|
return Result.error("家庭ID不能为空");
|
|
|
}
|
|
}
|
|
|
- var pageResult = familyCommissionService.getCommissionList(familyId, page, size);
|
|
|
|
|
|
|
+ Page<FamilyCommission> pageResult = familyCommissionService.getCommissionList(familyId, page, size);
|
|
|
Map<String, Object> result = new java.util.HashMap<>();
|
|
Map<String, Object> result = new java.util.HashMap<>();
|
|
|
result.put("records", pageResult.getRecords());
|
|
result.put("records", pageResult.getRecords());
|
|
|
result.put("total", pageResult.getTotal());
|
|
result.put("total", pageResult.getTotal());
|
|
@@ -58,4 +60,4 @@ public class PromotionController {
|
|
|
List bindings = familyCommissionService.getBindings(familyId);
|
|
List bindings = familyCommissionService.getBindings(familyId);
|
|
|
return Result.success(bindings);
|
|
return Result.success(bindings);
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+}
|