api login session 问题,改写授权获取基本消息的问题
在同级命名空间之中,为什么不需要use全路径,可以直接继承
commonController.php 所有控制器都继承,但是commom就在所有控制器,同级目录下
activeform 表单组件,使用的详解
yii 会验证提交数据csrf_token
行为承载于组件之上
通过user 登陆添加用户名与密码错误行为,控制用户无法登陆
migrate
[['files'],'file', 'skipOnEmpty' => false, 'extensions' => 'jpg, png, gif', 'mimeTypes'=>'image/jpeg, image/png, image/gif', 'maxSize'=>1024*1024*10, 'maxFiles'=>2],
$transaction = static::getDb()->beginTransaction();
try {
$memberRelation = MemberRelation::find()->where(['uid'=>Yii::$app->user->identity->getId()])->count();
if (!$memberRelation) {
Response::$error_code = 40001;
$this->addError('face', 40001);
return false;
}
if ($this->save(false)) {
if (Notification::send($this->device_id, ['notify'=>'face-create','code'=>200])) {
$transaction->commit();
return true;
} else {
$transaction->rollBack();
Response::$error_code = 503;
$this->addError('face', 503);
return false;
}
} else {
Response::$error_code = 502;
$this->addError('face', 502);
$transaction->rollBack();
}
} catch (\Exception $e) {
$transaction->rollBack();
Response::$error_code = 502;
$this->addError('face', 502);
return false;
}