<?php
namespace backend\models;

use Yii;

class DashboardApi extends BaseApi
{
    public $apiUrl = 'dashboard';

    /**
     * @param array $data
     * @return array
     */
    public function getData($data = [])
    {
        $data['member_id']  = Yii::$app->user->id;
        $result = $this->post($this->apiUrl . '/ib-data', $data);
        if ($result['code'] == 1) {
            return $this->returnArray(1, $result['data']);
        } else {
            return $this->returnArray(0, [], $result['message']);
        }
    }
    
    /**
     * 后台首页统计信息
     * @param array $data
     * @return array
     */
    public function getAdminData($data = [])
    {
        $data['member_id']  = Yii::$app->user->id;
        $result = $this->post($this->apiUrl . '/admin-data', $data);
        if ($result['code'] == 1) {
            return $this->returnArray(1, $result['data']);
        } else {
            return $this->returnArray(0, [], $result['message']);
        }
    }
    
}