Browse Source

app获取跳转微信小程序的链接地址

yfh 1 week ago
parent
commit
97d536c345

+ 20 - 0
fs-company-app/src/main/java/com/fs/app/controller/FsUserCourseVideoController.java

@@ -9,9 +9,11 @@ import com.fs.common.core.domain.R;
 import com.fs.common.core.domain.ResponseResult;
 import com.fs.common.core.domain.ResponseResult;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.StringUtils;
+import com.fs.company.domain.Company;
 import com.fs.company.domain.CompanyMiniapp;
 import com.fs.company.domain.CompanyMiniapp;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.service.ICompanyMiniappService;
 import com.fs.company.service.ICompanyMiniappService;
+import com.fs.company.service.ICompanyService;
 import com.fs.company.service.ICompanyUserService;
 import com.fs.company.service.ICompanyUserService;
 import com.fs.course.domain.FsUserCoursePeriod;
 import com.fs.course.domain.FsUserCoursePeriod;
 import com.fs.course.dto.BatchSendCourseDTO;
 import com.fs.course.dto.BatchSendCourseDTO;
@@ -39,6 +41,7 @@ import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
@@ -57,6 +60,9 @@ public class FsUserCourseVideoController extends AppBaseController {
     @Autowired
     @Autowired
     private IFsUserCourseVideoService fsUserCourseVideoService;
     private IFsUserCourseVideoService fsUserCourseVideoService;
 
 
+    @Autowired
+    private ICompanyService iCompanyService;
+
     @Autowired
     @Autowired
     private IFsUserCourseService fsUserCourseService;
     private IFsUserCourseService fsUserCourseService;
 
 
@@ -290,6 +296,20 @@ public class FsUserCourseVideoController extends AppBaseController {
         return ResponseResult.ok(courseLinkService.getGotoWxAppLink(linkStr,appid));
         return ResponseResult.ok(courseLinkService.getGotoWxAppLink(linkStr,appid));
     }
     }
 
 
+    @GetMapping("/getGotoAppLink")
+    @ApiOperation("获取跳转微信小程序的链接地址")
+    public ResponseResult<String> getGotoWxAppLink(String linkStr, Long companyId) {
+        Company company = iCompanyService.selectCompanyById(companyId);
+        String appid = null;
+        if (CollectionUtils.isNotEmpty(company.getMiniAppMaster())){
+            appid = company.getMiniAppMaster().get(0);
+        }else if (CollectionUtils.isNotEmpty(company.getMiniAppServer())){
+            appid = company.getMiniAppServer().get(0);
+        }else {
+            return ResponseResult.fail(500,"请在后台配置主备小程序!");
+        }
+        return ResponseResult.ok(courseLinkService.getGotoWxAppLink(linkStr,appid));
+    }
     /**
     /**
      * 获取跳转微信小程序的链接地址
      * 获取跳转微信小程序的链接地址
      */
      */