|  |  |  | 
|---|
|  |  |  | package com.matrix.system.shopXcx.api.action; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.matrix.core.pojo.AjaxResult; | 
|---|
|  |  |  | import com.matrix.biz.bean.BizUser; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.matrix.component.redis.RedisUserLoginUtils; | 
|---|
|  |  |  | import com.matrix.system.shopXcx.bean.ShopWxAcode; | 
|---|
|  |  |  | import com.matrix.component.tools.WxacodeUtil; | 
|---|
|  |  |  | import com.matrix.core.pojo.AjaxResult; | 
|---|
|  |  |  | import com.matrix.system.shopXcx.api.WeChatApiTools; | 
|---|
|  |  |  | import com.matrix.system.shopXcx.bean.ShopWxAcode; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Controller; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | 
|---|
|  |  |  | import java.util.Collections; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @description 获取<link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}">接口 | 
|---|
|  |  |  | * @description 获取 | 
|---|
|  |  |  | * @author jiangyouyao | 
|---|
|  |  |  | * @date 2019-07-03 15:15 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | 
|---|
|  |  |  | public class WxGetAcodeAction { | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private RedisUserLoginUtils redisUserLoginUtils; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | WeChatApiTools weChatApiTools; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取微信二维码 | 
|---|
|  |  |  | * @param | 
|---|
|  |  |  | 
|---|
|  |  |  | public AjaxResult getWxAcode(@RequestBody ShopWxAcode wxAcode) { | 
|---|
|  |  |  | BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); | 
|---|
|  |  |  | String openId = loginUser.getOpenId(); | 
|---|
|  |  |  | //String openId = "omfv64kVgvGpz6D8p4J3WZYuT6M4"; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String wxacodeUrl = WxacodeUtil.getWxacode(wxAcode.getScene(), wxAcode.getPage(), wxAcode.getFileName()); | 
|---|
|  |  |  | String wxacodeUrl = WxacodeUtil.getWxacode(wxAcode.getScene(), wxAcode.getPage(), wxAcode.getFileName(), | 
|---|
|  |  |  | weChatApiTools.getAppid(loginUser.getCompanyId()),weChatApiTools.getSecret(loginUser.getCompanyId())); | 
|---|
|  |  |  | String substring = wxacodeUrl.substring(0, 5); | 
|---|
|  |  |  | if("error".equals(substring)){ | 
|---|
|  |  |  | return new AjaxResult(AjaxResult.STATUS_FAIL, wxacodeUrl); | 
|---|