|
|
@@ -0,0 +1,40 @@
|
|
|
+package com.cyksj.web.controller.kf;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.cyksj.dto.Result;
|
|
|
+import com.cyksj.enums.GatewayResponse;
|
|
|
+import com.cyksj.mapper.corp.kf.CorpKfAccountMapper;
|
|
|
+import com.cyksj.model.entity.CorpKfAccount;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 项目名: yhlxj2
|
|
|
+ * 文件名: CorpKfController
|
|
|
+ * 创建者: JavaZou
|
|
|
+ * 创建时间:2025/1/10 11:18
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/applets/corp/kf")
|
|
|
+@RequiredArgsConstructor
|
|
|
+public class CorpKfController {
|
|
|
+ private final CorpKfAccountMapper corpKfAccountMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取微信客服
|
|
|
+ */
|
|
|
+ @GetMapping("/get")
|
|
|
+ public Result<String> getCorpKf(Integer scene) {
|
|
|
+ CorpKfAccount corpKfAccount = corpKfAccountMapper.selectOne(Wrappers.lambdaQuery(CorpKfAccount.class)
|
|
|
+ .eq(CorpKfAccount::getScene, scene)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (corpKfAccount == null) {
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+ String openKfId = corpKfAccount.getOpenKfId();
|
|
|
+ String url = "https://work.weixin.qq.com/kfid/" + openKfId;
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(url);
|
|
|
+ }
|
|
|
+}
|