<?php
/**
 * Created by PhpStorm.
 * User: leo
 * Date: 2018/2/24
 * Time: 下午12:48
 */
namespace frontendApi\modules\v1\controllers;

use common\helpers\Cache;
use common\models\forms\UploadForm;
use common\models\UserInfo;
use common\models\Withdraw;
use frontendApi\modules\v1\models\User;
use yii\web\UploadedFile;

class UploadController extends BaseController
{
    public $modelClass = UserInfo::class;

    /**
     * 提现时的上传token
     * @return mixed
     * @throws \yii\base\Exception
     * @throws \yii\web\HttpException
     */
    public function actionWithdrawToken(){
        // 检查该用户是否已经提过现，如果提过，则不允许上传身份证
        if(Withdraw::findUseSlaves()->where('USER_ID=:USER_ID', [':USER_ID'=>\Yii::$app->user->id])->exists()){
            return static::notice('这不是您的第一次提现', 400);
        }
        $token = Cache::setUploadToken();
        return static::notice($token);
    }



}