package com.duowenlvshi.duowenlszp.model.Meal.controller;

import com.duowenlvshi.duowenlszp.model.Meal.server.MealServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @author yang fang yu
 * @since 2019/9/9 20:33
 */
@Transactional
@Component
public class MealController {
    @Autowired
    MealServer mealServer;

    /**
     * 查询套餐列表
     * */
    public List<Map> selectMealList(){
        List list = mealServer.selectMealList();
        return list;
    }


    /**
     * 查询是否是免费名额
     * */
    public Map selectNum(Map<String,Object> map) {
        Map map1;
        String id = (String) map.get("token");
        String lszpBannerUrl;
        /*int j = mealServer.selectIsFree(id);
        if (j != 0) {
            map1 = mealServer.selectMealType("1");//查询免费套餐id
            lszpBannerUrl = "https://duowen-b.oss-cn-shenzhen.aliyuncs.com/ads/b/lszpbanner01.png";
            map1.put("free", "true");
        } else {
            map1 = mealServer.selectMealType("2");//查询付费套餐id
            lszpBannerUrl = "https://duowen-b.oss-cn-shenzhen.aliyuncs.com/ads/b/lszpbanner02.png";
            map1.put("free", "false");
        }*/
        map1 = mealServer.selectMealType("1");//查询免费套餐id
        lszpBannerUrl = "https://duowen-b.oss-cn-shenzhen.aliyuncs.com/ads/b/lszpbanner03.png.png";
        map1.put("free", "true");
        map1.put("lszpBannerUrl",lszpBannerUrl);
        return map1;
    }


}
