package com.cftech.cms.exhibi_read.web;

import com.alibaba.fastjson.JSONObject;
import com.cftech.cms.exhibi_read.model.Exhibi_read;
import com.cftech.cms.exhibi_read.service.Exhibi_readService;
import com.cftech.core.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.StreamingHttpOutputMessage;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 展会浏览量接口
 * Created by Ago on 2018/10/10.
 */
@RestController
@RequestMapping(value = "/mobile/auth/exhibi_read")
public class MobileExhibi_readController {
    @Autowired
    private Exhibi_readService exhibi_readService;

    /**
     * 展会浏览
     * @param exhibi_read
     * @return
     */
    @RequestMapping(value = "/exhibiread",method = {RequestMethod.GET,RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public JSONObject exhibiread(Exhibi_read exhibi_read){
        JSONObject jsonObject = new JSONObject();
        try {
            if(exhibi_read!=null){
                Boolean falg = exhibi_readService.save(exhibi_read);
                if(falg){
                    jsonObject.put("errorNo",0);
                }
            }else{
                jsonObject.put("errorNo",2);
            }
        }catch (Exception e){
            e.printStackTrace();
            jsonObject.put("errorNo",1);
        }
        return jsonObject;
    }
}
