package com.example.his.api.front.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.example.his.api.common.result.R;
import com.example.his.api.config.sa_token.StpCustomerUtil;
import com.example.his.api.front.service.CustomerImService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;

@RestController("FrontCustomerImController")
@RequestMapping("/front/customer/im")
public class CustomerImController {
    @Resource
    private CustomerImService customerImService;

    /**
     * 客服IM-账号创建
     * @return
     */
    @GetMapping("/createAccount")
    @SaCheckLogin(type = StpCustomerUtil.TYPE)
    public R createAccount() {
        int customerId = StpCustomerUtil.getLoginIdAsInt();
        HashMap result = customerImService.createAccount(customerId);
        HashMap<Object, Object> map = new HashMap<>();
        map.put("result",result);
        return R.success(map);
    }
}

