RemoteService.java
1.26 KB
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
package cn.com.glsx.modules.service;
import cn.com.glsx.common.Constants;
import cn.com.glsx.modules.model.param.RemoteRequest;
import com.alibaba.fastjson.JSONObject;
import com.glsx.plat.core.web.R;
import com.lumi.opencloud.common.AiotConfig;
import com.lumi.opencloud.common.ResponseMsg;
import com.lumi.opencloud.manager.v1.InfraredManager;
import com.lumi.opencloud.model.ir.request.IrKeyClickRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
/**
* @author zhouhaibao 绿米红外功能
* @date 2021/4/27 16:24
*/
@Service
@Slf4j
public class RemoteService {
@Value("${aqara.clientId}")
private String clientId;
@Value("${aqara.doapi}")
private String domain;
public R click(IrKeyClickRequest irKeyClickRequest, String token) {
ResponseMsg responseMsg = InfraredManager.keyClick(new AiotConfig(clientId, null, token, null, domain), irKeyClickRequest);
if (responseMsg != null && Constants.AQARA_RETURN_SUCCESS_CODE == responseMsg.getCode()) {
return R.ok(JSONObject.toJSONString(responseMsg));
}
return R.error(responseMsg.getMessage());
}
}