package com.bjtdba.api.controller;

import com.bjtdba.api.apiservice.SystemService;
import com.bjtdba.api.apiservice.UserSevice;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RequestMapping("/api")
@RestController
@Configurable

public class UserController {
    @Resource
    private UserSevice  userSevice;
    @Resource
    private SystemService systemService;

    /**
     * 实名认证
     * @param Hmap
     * @param map
     * @return
     * @throws Exception
     */
    @GetMapping("/user/add_certification")
    public Object add_certification(@RequestHeader Map<String,String> Hmap, @RequestParam Map<String,String> map){
        return  userSevice.add_certification(Hmap,map);
    }

    /**
     * 地址添加和修改
     * @param Hmap
     * @param map
     * @return
     */
    //地址
    @PostMapping("/user/address/new_create")
    public  Object addressCreate(@RequestHeader Map<String,String> Hmap,@RequestBody Map<String,String> map){
        return userSevice.addressCreate(Hmap,map);
    }

    /**
     * 删除地址
     * @param Hmap
     * @param id
     * @return
     */
    @PostMapping("/user/address/delete/{id}")
    public Object addresDel(@RequestHeader Map<String,String> Hmap, @PathVariable Integer id){
        return  userSevice.addresDel(Hmap,id);
    }

    /**
     * 地址列表
     * @param Hmap
     * @return
     */
    @GetMapping("/user/address/lst")
    public Object addresslist(@RequestHeader Map<String,String> Hmap){
        return userSevice.addresslist(Hmap);
    }

    /**
     * 获取用户信息
     * @param Hmap
     * @return
     */
    @GetMapping("/user")
    public Object userInfo(@RequestHeader Map<String,String> Hmap){
        return userSevice.userInfo(Hmap);
    }



    /**
     * 查询反馈类型
     * @param Hmap
     * @return
     */
    @GetMapping("/feedbackCategory/feedback_type_new")
    public Object feedback_type_new(@RequestHeader Map<String,String> Hmap){
        return systemService.feedback_type_new(Hmap);
    }

    /**
     * 添加反馈意见
     * @param Hmap
     * @param map
     * @return
     */
    @PostMapping("/user/feedback")
    public Object feedback(@RequestHeader Map<String,String> Hmap,@RequestBody Map<String,String> map){
        return  systemService.feedback(Hmap,map);
    }


    @GetMapping("/user/userCommission")
    public Object getUserCommission(@RequestHeader Map<String,String> Hmap){
        return userSevice.getUserCommission(Hmap);
    }


    /**
     * 添加关注/收藏/验证是否关注
     */

    @PostMapping("/relation/create")
    public Object create(@RequestHeader Map<String,String> Hmap, @RequestBody Map<String,String> map){
        return userSevice.create(Hmap,map);
    }

    /***
     * 取消关注
     */

    @PostMapping("/relation/delete")
    public Object delete(@RequestHeader Map<String,String> Hmap,@RequestBody Map<String,String> map){
        return  userSevice.delete(Hmap,map);
    }


    /**
     * 验证是否关注过
     * @param Hmap
     * @param map
     * @return
     */
    @PostMapping("/relation/query")
    public Object query(@RequestHeader Map<String,String> Hmap, @RequestBody Map<String,String> map){
        return userSevice.query(Hmap,map);
    }


}
