|
|
@ -4,26 +4,21 @@ import cn.hutool.core.codec.Base64; |
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.ccsens.opensource.wxconfigurer.bean.dto.WxGzhAction; |
|
|
|
import com.ccsens.opensource.wxconfigurer.bean.po.WxGzhAuthType; |
|
|
|
import com.ccsens.opensource.wxconfigurer.bean.po.WxGzhMenu; |
|
|
|
import com.ccsens.opensource.wxconfigurer.util.JsonResponse; |
|
|
|
import com.ccsens.opensource.wxconfigurer.util.WxUtil; |
|
|
|
import com.ccsens.opensource.wxconfigurer.util.WxGzhUtil; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
import io.swagger.annotations.ApiImplicitParams; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.http.MediaType; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestMethod; |
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author __zHangSan |
|
|
|
*/ |
|
|
@ -55,7 +50,7 @@ public class WxController { |
|
|
|
@ResponseBody |
|
|
|
public String responseValidate(String signature,String timestamp, String nonce, String echostr) throws Exception { |
|
|
|
log.info("responseValidate..."); |
|
|
|
if (WxUtil.checkGzhSignature(signature, timestamp, nonce, echostr)) { |
|
|
|
if (WxGzhUtil.checkSignature(signature, timestamp, nonce, echostr)) { |
|
|
|
return echostr; |
|
|
|
} else { |
|
|
|
return "error"; |
|
|
@ -83,7 +78,7 @@ public class WxController { |
|
|
|
@ResponseBody |
|
|
|
public JsonResponse<String> queryMenu() throws Exception { |
|
|
|
log.info("QueryMenu..."); |
|
|
|
String queryMenu = WxUtil.queryMenu(); |
|
|
|
String queryMenu = WxGzhUtil.queryMenu(); |
|
|
|
return JsonResponse.newInstance(String.class).ok(Base64.encode(queryMenu)); |
|
|
|
} |
|
|
|
|
|
|
@ -98,7 +93,7 @@ public class WxController { |
|
|
|
String commonUrl = "https://www.ccsens.com"; |
|
|
|
String wikiUrl = "https://www.yuque.com/ccsens"; |
|
|
|
String htproUrl = "https://test.tall.wiki/ht-dev/zy"; |
|
|
|
String mtproUrl = "https://api.ccsens.com/mt/"; |
|
|
|
String mtproUrl = "https://www.tall.wiki/mt/"; |
|
|
|
String ygczUrl = "https://test.tall.wiki/pt-dev/zy"; |
|
|
|
String xccUrl = "https://business.aijiatui.com/article-h5/manual/626434620463869952/657503679879946240?cardId=628239211027324928&shareId=657503679879946240&targetId=645928070145994752&pid=645928070145994752&originId=3004"; |
|
|
|
String dmUrl = "https://business.aijiatui.com/article-h5/case/626434620463869952/657504299550572544?cardId=628239211027324928&shareId=657504299550572544&targetId=656535993763037184&originId=3001"; |
|
|
@ -118,9 +113,12 @@ public class WxController { |
|
|
|
) |
|
|
|
.add(WxGzhMenu.Button.builder().name("时物链条").sub_button( |
|
|
|
CollectionUtil.newArrayList( |
|
|
|
WxGzhMenu.Button.builder().name("htpro").type(WxGzhMenu.ButtonType.VIEW).url(htproUrl).build(), |
|
|
|
WxGzhMenu.Button.builder().name("mtpro").type(WxGzhMenu.ButtonType.VIEW).url(mtproUrl).build(), |
|
|
|
WxGzhMenu.Button.builder().name("员工成长").type(WxGzhMenu.ButtonType.VIEW).url(ygczUrl).build(), |
|
|
|
WxGzhMenu.Button.builder().name("htpro").type(WxGzhMenu.ButtonType.VIEW) |
|
|
|
.url(WxGzhUtil.getAuthedUrl(htproUrl, WxGzhAuthType.SNSAPI_USERINFO)).build(), |
|
|
|
WxGzhMenu.Button.builder().name("mtpro").type(WxGzhMenu.ButtonType.VIEW) |
|
|
|
.url(WxGzhUtil.getAuthedUrl(mtproUrl, WxGzhAuthType.SNSAPI_USERINFO)).build(), |
|
|
|
WxGzhMenu.Button.builder().name("员工成长").type(WxGzhMenu.ButtonType.VIEW) |
|
|
|
.url(WxGzhUtil.getAuthedUrl(ygczUrl, WxGzhAuthType.SNSAPI_USERINFO)).build(), |
|
|
|
WxGzhMenu.Button.builder().name("宣传册").type(WxGzhMenu.ButtonType.VIEW).url(xccUrl).build(), |
|
|
|
WxGzhMenu.Button.builder().name("DM").type(WxGzhMenu.ButtonType.VIEW).url(dmUrl).build() |
|
|
|
) |
|
|
@ -142,7 +140,7 @@ public class WxController { |
|
|
|
) |
|
|
|
).build() |
|
|
|
); |
|
|
|
WxUtil.createMenu(wxGzhMenu); |
|
|
|
WxGzhUtil.createMenu(wxGzhMenu); |
|
|
|
return JsonResponse.newInstance(String.class).ok(); |
|
|
|
} |
|
|
|
} |
|
|
|