<?php namespace Score\Lib;
use Dever;
class Action
{
    public function get($cate_name, $name)
    {
        $data['name'] = $name;
        $action = Dever::db('action', 'score')->find($data);
        if (!$action) {
            $cate_data['name'] = $cate_name;
            $action_cate = Dever::db('action_cate', 'score')->find($cate_data);
            if (!$action_cate) {
                $data['cate_id'] = Dever::db('action_cate', 'score')->insert($cate_data);
            }
            $action = array();
            $action['id'] = Dever::db('action', 'score')->insert($data);
        }
        return $action;
    }
}