|
|
|
@ -9,6 +9,7 @@ import com.hfkj.common.alipay.AlipayUtils; |
|
|
|
|
import com.hfkj.common.exception.ErrorCode; |
|
|
|
|
import com.hfkj.common.exception.ErrorHelp; |
|
|
|
|
import com.hfkj.common.exception.SysCode; |
|
|
|
|
import com.hfkj.common.pay.util.SignatureUtil; |
|
|
|
|
import com.hfkj.common.security.UserCenter; |
|
|
|
|
import com.hfkj.common.utils.HttpsUtils; |
|
|
|
|
import com.hfkj.common.utils.MemberValidateUtil; |
|
|
|
@ -58,16 +59,24 @@ public class BsUserController { |
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/autoLogin", method = RequestMethod.POST) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "登录并注册") |
|
|
|
|
@ApiOperation(value = "自动登录并注册") |
|
|
|
|
public ResponseData autoLogin(@RequestBody JSONObject body) { |
|
|
|
|
try { |
|
|
|
|
if (body == null |
|
|
|
|
|| StringUtils.isBlank(body.getString("appid")) |
|
|
|
|
|| StringUtils.isBlank(body.getString("phone"))) { |
|
|
|
|
|| StringUtils.isBlank(body.getString("phone")) |
|
|
|
|
|| StringUtils.isBlank(body.getString("sign")) |
|
|
|
|
) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
// 接入appid
|
|
|
|
|
BsAgentApiParam agentApiParam = agentApiParamService.getParamByAppId(body.getString("appid")); |
|
|
|
|
|
|
|
|
|
// 验证签名
|
|
|
|
|
BsAgentApiParam apiParam = agentApiParamService.getParamByAppId(agentApiParam.getAppId()); |
|
|
|
|
if (!SignatureUtil.checkSign(body.getString("sign"), body, apiParam.getAppSecret())) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, ""); |
|
|
|
|
} |
|
|
|
|
String phone = body.getString("phone"); |
|
|
|
|
|
|
|
|
|
Map<String, Object> other = new HashMap<>(); |
|
|
|
@ -77,7 +86,7 @@ public class BsUserController { |
|
|
|
|
return ResponseMsgUtil.success(userService.login(UserLoginPlatform.TRIPARTITE, UserLoginType.TRIPARTITE, phone, other)); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("LoginController --> phone() error!", e); |
|
|
|
|
log.error("LoginController --> autoLogin() error!", e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|