|
@@ -194,15 +194,21 @@ public class MiniAppController extends BaseController {
|
194
|
194
|
*/
|
195
|
195
|
@PostMapping("/login")
|
196
|
196
|
public ResponseBean login(
|
197
|
|
- String code,
|
|
197
|
+ @RequestParam(required = false) String code,
|
198
|
198
|
@RequestParam(required = false) String from,
|
199
|
199
|
@RequestParam(required = false) String recommender,
|
200
|
200
|
@RequestParam(required = false) String targetId,
|
201
|
201
|
@RequestParam(required = false) String lon,
|
202
|
202
|
@RequestParam(required = false) String lat,
|
|
203
|
+ @RequestParam(required = false, defaultValue = "false") Boolean singleMode,
|
203
|
204
|
HttpServletRequest request) {
|
204
|
205
|
String appid = request.getHeader("appid");
|
205
|
206
|
|
|
207
|
+ // 小程序分享朋友圈
|
|
208
|
+ if (singleMode) {
|
|
209
|
+ return loginSingleMode(appid);
|
|
210
|
+ }
|
|
211
|
+
|
206
|
212
|
if (StringUtils.isEmpty(code)) {
|
207
|
213
|
return ResponseBean.error("参数 code 不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
|
208
|
214
|
}
|
|
@@ -394,6 +400,33 @@ public class MiniAppController extends BaseController {
|
394
|
400
|
}
|
395
|
401
|
}
|
396
|
402
|
|
|
403
|
+ /**
|
|
404
|
+ * 小程序分享到朋友圈模式
|
|
405
|
+ * @param appid
|
|
406
|
+ * @return
|
|
407
|
+ */
|
|
408
|
+ private ResponseBean loginSingleMode(String appid) {
|
|
409
|
+ TaMiniapp miniapp = taMiniappService.getById(appid);
|
|
410
|
+ TaPerson person = new TaPerson();
|
|
411
|
+ person.setPersonId("virtual-person-id");
|
|
412
|
+ person.setMiniOpenid("virtual-open-id");
|
|
413
|
+ person.setOrgId(miniapp.getOrgId());
|
|
414
|
+
|
|
415
|
+ Map<String, Object> miniResp = new HashMap<>();
|
|
416
|
+ miniResp.put("openid", person.getMiniOpenid());
|
|
417
|
+ Map<Object, Object> map = new HashMap<>();
|
|
418
|
+ map.put("openId", person.getMiniOpenid());
|
|
419
|
+ map.put("orgId", person.getOrgId());
|
|
420
|
+ map.put("personId", person.getPersonId());
|
|
421
|
+ miniResp.put("token", JWTUtils.newTokenByMap(map));
|
|
422
|
+
|
|
423
|
+ Map<String, Object> result = new HashMap<>();
|
|
424
|
+ result.put("miniApp", miniResp);
|
|
425
|
+ result.put("person", person);
|
|
426
|
+
|
|
427
|
+ return ResponseBean.success(result);
|
|
428
|
+ }
|
|
429
|
+
|
397
|
430
|
private ResponseBean checkMiniappStatus(String appid) {
|
398
|
431
|
TaUser taUser = userService.getAdminByAppID(appid);
|
399
|
432
|
|