<?php

namespace app\admin\controller;

use app\common\controller\Backend;

/**
 * 数字波色查询
 */
class Num extends Backend
{
    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\admin\model\Num;
    }

    /**
     * 返回数字与波色的映射关系
     */
    public function getColorMap()
    {
        $list = $this->model->field('num,color')->select();
        $map = [];
        foreach ($list as $item) {
            $map[$item['num']] = $item['color'];
        }
        $this->success($map);
    }

    /**
     * 返回数字与生肖的映射关系
     */
    public function getAnimalMap()
    {
        $list = $this->model->field('num,animal')->select();
        $map = [];
        foreach ($list as $item) {
            $map[$item['num']] = $item['animal'];
        }
        $this->success($map);
    }
}
