package com.willalp.web.controller.app;

import com.willalp.common.core.controller.BaseController;
import com.willalp.common.core.domain.AjaxResult;
import com.willalp.common.utils.ip.IpUtils;
import com.willalp.push.service.IHsAppPushService;
import com.willalp.yiqing.domain.vo.UserQueResultVo;
import io.swagger.annotations.Api;
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.servlet.http.HttpServletRequest;

/**
 * @author hs
 */
@Api("app推送系统控制层")
@RestController
@RequestMapping("/api/push/")
public class AppPushController extends BaseController {

//    @Resource
//    private UniAppUtils uniAppUtils;

    @Resource
    private IHsAppPushService pushService;

    @RequestMapping("save/oid")
    public AjaxResult savePushInfo(@RequestBody UserQueResultVo userQueResultVo,
                                   HttpServletRequest request) {
        return toAjax(pushService.savePushInfo(userQueResultVo,
                IpUtils.getIpAddr(request)));
    }

    @RequestMapping("off/line")
    public AjaxResult offLinePush() {
//        uniAppUtils.pushMsgOffLine(
//                "b588d2a110c79b7591de409c17719ef2",
//                "测试标题",
//                "测试内容");
        return AjaxResult.success();
    }
}
