You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
2.4 KiB
55 lines
2.4 KiB
package com.tptj.demo.hg.third.sms; |
|
|
|
import com.fr.decision.webservice.annotation.LoginStatusChecker; |
|
import com.fr.general.GeneralUtils; |
|
import com.fr.json.JSONObject; |
|
import com.fr.log.FineLoggerFactory; |
|
import com.fr.stable.StringUtils; |
|
import com.fr.third.springframework.stereotype.Controller; |
|
import com.fr.third.springframework.web.bind.annotation.RequestMapping; |
|
import com.fr.third.springframework.web.bind.annotation.ResponseBody; |
|
import com.fr.web.utils.WebUtils; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
/** |
|
* @author 秃破天际 |
|
* @version 10.0 |
|
* Created by 秃破天际 on 2021/7/23 |
|
**/ |
|
@Controller("SmsThirdSheQu") |
|
@RequestMapping(value = "/shequ") |
|
@LoginStatusChecker(required = false) |
|
public class DemoResource { |
|
|
|
@RequestMapping(value = "/**") |
|
@ResponseBody |
|
public void dispatcher( HttpServletRequest request, HttpServletResponse response ) throws Exception{ |
|
String info = request.getPathInfo(); |
|
String method = request.getMethod(); |
|
if( "/shequ/v1/user/login/".equals(info) ){ |
|
//内网下模拟帆软通行证登录 |
|
print(request,response,"{\"code\":200,\"message\":\"success\",\"data\":{\"access_token\":\"Um5rO7Ef5gvCqBWQw08LJkRilxtc4SGN\",\"expires_time\":1627015460,\"refresh_token\":\"HQqs6A9dTn1CElwP3tLJ4McX387pj2Uu\",\"refresh_expires_time\":1628217860,\"client\":{\"appid\":\"shequapp\",\"uid\":99999,\"username\":\"三方集成\"}},\"status\":0}"); |
|
}else if("/shequ/v1/sms/".equals(info) && "POST".equals(method)){ |
|
//内网下验证短信开启 |
|
print(request,response,"{\"status\":\"success\",\"data\":{\"app_key\":\"third_app_key\",\"app_secret\":\"third_app_secret\"}}"); |
|
}else if( "/shequ/v1/sms/user_info".equals(info) && "POST".equals(method) ){ |
|
//内网下获取短信模板 |
|
print( request, response, SMSUserInfo.DATA.toString() ); |
|
}else if( "/shequ/v1/ping".equals(info) ){ |
|
//内网下模拟在线 |
|
WebUtils.printAsString(response, StringUtils.EMPTY); |
|
} |
|
} |
|
|
|
private static void print(HttpServletRequest req, HttpServletResponse res, String response){ |
|
try{ |
|
|
|
JSONObject obj = new JSONObject(response); |
|
WebUtils.flushSuccessMessageAutoClose(req,res,obj); |
|
}catch(Exception e){ |
|
FineLoggerFactory.getLogger().error(e.getMessage(),e); |
|
} |
|
} |
|
}
|
|
|