leutu
2024-06-03 3ef35e6cd16bbfa206b26bb3271eac40ad020bcb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.fastbee.data.controller;
 
import com.fastbee.common.core.controller.BaseController;
import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.iot.service.IUserSocialProfileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
/**
 * 第三方登录平台控制Controller
 *
 * @author json
 * @date 2022-04-24
 */
@Api(tags = "用户社交账户api")
@RestController
@RequestMapping("/iot/social/")
public class UserSocialController extends BaseController {
 
    @Autowired
    private IUserSocialProfileService iUserSocialProfileService;
 
 
    /**
     * 绑定
     *
     * @param bindId 绑定id
     * @return
     */
    @GetMapping("/bindId/{bindId}")
    @ApiOperation("绑定api")
    @ApiImplicitParam(name = "bindId", value = "绑定bindId", required = true, dataType = "String", paramType = "path", dataTypeClass = String.class)
    public AjaxResult bindUser(@PathVariable String bindId) {
        return iUserSocialProfileService.bindUser(bindId, getUserId());
    }
 
 
    /**
     * 绑定
     *
     * @param platform 绑定类型
     * @return
     */
    @GetMapping("/bind/{platform}")
    @ApiOperation("绑定跳转api")
    @ApiImplicitParam(name = "platform", value = "绑定platform", required = true, dataType = "String", paramType = "path", dataTypeClass = String.class)
    public AjaxResult bind(@PathVariable String platform) {
        return iUserSocialProfileService.bindSocialAccount(platform);
    }
 
    /**
     * 解绑
     *
     * @param socialUserId 用户社交平台Id
     * @return
     */
    @GetMapping("/unbind/{socialUserId}")
    @ApiOperation("解绑api")
    @ApiImplicitParam(name = "socialUserId", value = "绑定socialId", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
    public AjaxResult unbind(@PathVariable Long socialUserId) {
        return iUserSocialProfileService.unbindSocialAccount(socialUserId, getUserId());
    }
}