package com.yn.bftl.thirdparty.modules.umeng.controller.member;

import com.yn.bftl.common.modules.configuration.entity.ThirdPartyPaySet;
import com.yn.bftl.common.modules.customerService.dto.UmengUnicastDTO;
import com.yn.bftl.thirdparty.modules.umeng.service.UmengService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 用户端-友盟消息通知
 *
 * @author huabiao
 * @create 2023/12/5  16:37
 **/
@Validated
@Api(value = "UmengMemberController", tags = "用户端-友盟消息通知")
@RestController
@RequestMapping(value = "/member/umeng")
public class UmengMemberController {

    @Resource
    private UmengService umengService;

    private static ThirdPartyPaySet thirdPartyPaySet;

    static {
        thirdPartyPaySet = new ThirdPartyPaySet();
        thirdPartyPaySet.setMessagePushAddress("http://msg.umeng.com");
        thirdPartyPaySet.setMessagePushPath("/api/send");
        thirdPartyPaySet.setMessagePushIosAppKey("64b8a0556894c55d8d250454");
        thirdPartyPaySet.setMessagePushIosAppMasterSecret("l6hjtndcjuxhltcwqg41ylpzixfvd4ef");
        thirdPartyPaySet.setMessagePushAndroidAppKey("649be21aa1a164591b3cfa20");
        thirdPartyPaySet.setMessagePushAndroidAppMasterSecret("7z2d65r20o0dcs0tzb479xgx00jtvdhq");
    }

    @ApiOperation(value = "单播")
    @PostMapping("/unicast")
    public Boolean androidUnicast(@RequestBody @Valid UmengUnicastDTO umengUnicastDTO) throws Exception {
        return umengService.sendUnicast(umengUnicastDTO);
    }
}
