package com.yihu.jw.base.endpoint.wx;

import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.WechatRequestMapping;
import com.yihu.jw.wechat.service.WxTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2017/5/19 0019.
 */
@RestController
@RequestMapping(WechatRequestMapping.api_common)
@Api(value = "微信模版相关操作", description = "微信模版相关操作", tags = {"微信管理 - 微信模版相关操作"})
public class WxTemplateController extends EnvelopRestEndpoint {

    @Autowired
    private WxTemplateService wxTemplateService;

    @PostMapping(value = WechatRequestMapping.WxTemplate.api_test_template, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "测试发送微信模板", notes = "测试发送微信模板")
    public String sendWeTempMesTest(String wechatId,String openid)throws Exception{
        return wxTemplateService.sendWeTempMesTest(wechatId,openid);
    }

    @PostMapping(value = WechatRequestMapping.WxTemplate.api_getAllTemplate, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "获取所有微信模板", notes = "获取所有微信模板")
    public Envelop getAllTemp(String wechatId) {
        return wxTemplateService.getAllTemp(wechatId);
    }

}
