package com.ozs.account.controller;

import com.ozs.account.service.AccountInfoService;
import com.ozs.account.util.R;
import com.ozs.account.util.S;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @ClassName AccountThemeController
 * @Desc 描述信息
 * @Author jade
 * @Date 2019/3/26
 * @Version 1.0
 */
@Api("用户切换主题接口")
@RestController
public class AccountThemeController {

    @Resource
    private AccountInfoService accountInfoService;

    @ApiOperation(value = "根据账号ID修改主题背景")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType = "query", name = "id", value = "账号ID", required = true, dataType = "String"),
        @ApiImplicitParam(paramType = "query", name = "theme", value = "主题内容", required = true, dataType = "String")
    })
    @GetMapping("/account/changeTheme")
    public R<String> changeTheme(@RequestParam String id,@RequestParam String theme) {
        try {
            return accountInfoService.changeTheme(id,theme);
        } catch (Exception e) {
            e.printStackTrace();
            return  new R<>(S.ERROR,S.getMsg(S.ERROR));
        }
    }

}
