<?php


namespace Heanup\App\Api\Controller\User;


use Heanup\App\Api\Package\Database\Mail;
use Heanup\App\Api\RestfulController;

class Lists extends RestfulController
{

    /**
     * Get Method|获取数据
     * @return void
     */
    protected function getData()
    {
        $user_key=$this->getRequest()->string("a",$_SESSION['user_key']);
//        $user_key = $this->getRequest()->string("a");
        if ($user_key) {
            $accounts = Mail::select([], ['user_key' => $user_key, 'status' => 1]);
        }
        $names = [];
        if (!empty($accounts)) {
            foreach ($accounts as $account) {
                $names[] = $account['email'] . "@" . $account['domain'];
            }
        }
        $this->showSuccess($names);
    }

    /**
     * Post Method|新增数据
     * @return void
     */
    protected function postData()
    {
        // TODO: 需要实现 postData() 方法.
    }

    /**
     * Put Method|更新数据
     * @return void
     */
    protected function putData()
    {
        // TODO: 需要实现 putData() 方法.
    }

    /**
     * Delete Method|删除数据
     * @return void
     */
    protected function deleteData()
    {
        // TODO: 需要实现 deleteData() 方法.
    }
}