-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yyx
committed
Nov 28, 2018
1 parent
897d8ed
commit 5630a3f
Showing
12 changed files
with
223 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
yyx-wx-commons/src/main/java/org/yyx/wx/commons/util/ResponseUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.yyx.wx.commons.util; | ||
|
||
import org.yyx.domain.ResponseEntity; | ||
import org.yyx.wx.commons.vo.pubnum.request.BaseRequest; | ||
|
||
import static org.yyx.wx.commons.bussinessenum.ResponseCodeFromWx.getCode; | ||
import static org.yyx.wx.commons.bussinessenum.ResponseCodeFromWx.isSuccess; | ||
|
||
/** | ||
* 返回结果工具类 | ||
* <p> | ||
* | ||
* @author 叶云轩 at [email protected] | ||
* @date 2018/10/19-23:05 | ||
*/ | ||
public class ResponseUtil { | ||
|
||
|
||
/** | ||
* 私有构造 | ||
*/ | ||
private ResponseUtil() { | ||
} | ||
|
||
/** | ||
* 响应的封装 | ||
* | ||
* @param baseRequest 微信请求本地服务器父类 | ||
* @return 封装结果 | ||
*/ | ||
public static ResponseEntity response(BaseRequest baseRequest) { | ||
Integer errcode = baseRequest.getErrcode(); | ||
boolean success = isSuccess(errcode); | ||
if (success) { | ||
return org.yyx.util.http.ResponseUtil.success(baseRequest); | ||
} | ||
return new ResponseEntity(Long.valueOf(errcode), getCode(errcode).getDescription(), baseRequest.getErrmsg()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,10 @@ | |
import com.alibaba.fastjson.JSONObject; | ||
import org.springframework.stereotype.Service; | ||
import org.yyx.wx.acount.auth.service.IAccessTokenService; | ||
import org.yyx.wx.commons.vo.pubnum.request.BaseRequest; | ||
import org.yyx.wx.commons.vo.pubnum.request.auth.BaseAccessTokenRequest; | ||
import org.yyx.wx.commons.vo.pubnum.request.menu.MenuRequest; | ||
import org.yyx.wx.commons.vo.pubnum.response.menu.CustomerMenuResponse; | ||
import org.yyx.wx.manage.menu.config.WxPubNumMenuConfig; | ||
import org.yyx.wx.manage.menu.service.IMenuService; | ||
|
||
|
@@ -14,7 +16,8 @@ | |
/** | ||
* 菜单业务接口实现 | ||
* <p> | ||
*w | ||
* w | ||
* | ||
* @author 叶云轩 at [email protected] | ||
* @date 2018/10/14-22:40 | ||
*/ | ||
|
@@ -26,10 +29,27 @@ public class MenuServiceImpl implements IMenuService { | |
*/ | ||
@Resource | ||
private WxPubNumMenuConfig wxPubNumMenuConfig; | ||
|
||
/** | ||
* Token业务接口 | ||
*/ | ||
@Resource | ||
private IAccessTokenService accessTokenService; | ||
|
||
/** | ||
* 自定义菜单创建接口 | ||
* | ||
* @param customerMenuResponse 要创建的菜单 | ||
* @return 结果 | ||
*/ | ||
@Override | ||
public BaseRequest createMenu(CustomerMenuResponse customerMenuResponse) { | ||
BaseAccessTokenRequest baseAccessToken = accessTokenService.getBaseAccessToken(); | ||
String createMenuStatus = HttpUtil.post(wxPubNumMenuConfig.getCreateCustomMenu() | ||
+ baseAccessToken.getAccess_token() | ||
, JSONObject.toJSONString(customerMenuResponse)); | ||
return JSONObject.parseObject(createMenuStatus, BaseRequest.class); | ||
} | ||
|
||
/** | ||
* 查询自定义菜单方法 | ||
* | ||
|
@@ -38,7 +58,8 @@ public class MenuServiceImpl implements IMenuService { | |
@Override | ||
public MenuRequest queryMenuList() { | ||
BaseAccessTokenRequest baseAccessToken = accessTokenService.getBaseAccessToken(); | ||
String menuListJson = HttpUtil.get(wxPubNumMenuConfig.getSearchMenuList() + baseAccessToken.getAccess_token()); | ||
String menuListJson = HttpUtil.get(wxPubNumMenuConfig.getSearchMenuList() | ||
+ baseAccessToken.getAccess_token()); | ||
return JSONObject.parseObject(menuListJson, MenuRequest.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# 产品模式 | ||
PRODUCT_MODE=false | ||
CHARSET=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-- 配置表 |
Oops, something went wrong.