mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-26 20:52:44 +08:00
优化findById参数类型导致的异常抛出
This commit is contained in:
parent
d8678716f3
commit
5dd385b39e
@ -16,7 +16,10 @@ class Account extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return AccountModel::findFirst($id);
|
||||
return AccountModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,7 +68,10 @@ class Audit extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return AuditModel::findFirst($id);
|
||||
return AuditModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,7 +51,10 @@ class Category extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return CategoryModel::findFirst($id);
|
||||
return CategoryModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,10 @@ class Chapter extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return ChapterModel::findFirst($id);
|
||||
return ChapterModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,7 +43,10 @@ class Connect extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return ConnectModel::findFirst($id);
|
||||
return ConnectModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +78,10 @@ class Consult extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return ConsultModel::findFirst($id);
|
||||
return ConsultModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -123,7 +123,10 @@ class Course extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return CourseModel::findFirst($id);
|
||||
return CourseModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,7 +66,10 @@ class Danmu extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return DanmuModel::findFirst($id);
|
||||
return DanmuModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,10 @@ class Help extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return HelpModel::findFirst($id);
|
||||
return HelpModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,7 +76,10 @@ class ImGroup extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return ImGroupModel::findFirst($id);
|
||||
return ImGroupModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,7 +65,10 @@ class ImMessage extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return ImMessageModel::findFirst($id);
|
||||
return ImMessageModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,7 +57,10 @@ class ImNotice extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return ImNoticeModel::findFirst($id);
|
||||
return ImNoticeModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,7 +60,10 @@ class ImUser extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return ImUserModel::findFirst($id);
|
||||
return ImUserModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,7 +60,10 @@ class Learning extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return LearningModel::findFirst($id);
|
||||
return LearningModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,7 +51,10 @@ class Nav extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return NavModel::findFirst($id);
|
||||
return NavModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,7 +79,10 @@ class Order extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return OrderModel::findFirst($id);
|
||||
return OrderModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,7 +60,10 @@ class Package extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return PackageModel::findFirst($id);
|
||||
return PackageModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,7 +54,10 @@ class Page extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return PageModel::findFirst($id);
|
||||
return PageModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,7 +66,10 @@ class Refund extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return RefundModel::findFirst($id);
|
||||
return RefundModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,10 @@ class Resource extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return ResourceModel::findFirst($id);
|
||||
return ResourceModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +77,10 @@ class Review extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return ReviewModel::findFirst($id);
|
||||
return ReviewModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,10 @@ class Reward extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return RewardModel::findFirst($id);
|
||||
return RewardModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,10 @@ class Role extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return RoleModel::findFirst($id);
|
||||
return RoleModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,7 +54,10 @@ class Slide extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return SlideModel::findFirst($id);
|
||||
return SlideModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,7 +56,10 @@ class Topic extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return TopicModel::findFirst($id);
|
||||
return TopicModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +78,10 @@ class Trade extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return TradeModel::findFirst($id);
|
||||
return TradeModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,10 @@ class Upload extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return UploadModel::findFirst($id);
|
||||
return UploadModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,7 +73,10 @@ class User extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return UserModel::findFirst($id);
|
||||
return UserModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,10 @@ class Vip extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return VipModel::findFirst($id);
|
||||
return VipModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,10 @@ class WechatSubscribe extends Repository
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
return WechatSubscribeModel::findFirst($id);
|
||||
return WechatSubscribeModel::findFirst([
|
||||
'conditions' => 'id = :id:',
|
||||
'bind' => ['id' => $id],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,8 +23,6 @@ class Account extends Validator
|
||||
$account = $accountRepo->findByEmail($name);
|
||||
} elseif (CommonValidator::phone($name)) {
|
||||
$account = $accountRepo->findByPhone($name);
|
||||
} else {
|
||||
$account = $accountRepo->findById($name);
|
||||
}
|
||||
|
||||
if (!$account) {
|
||||
@ -122,6 +120,8 @@ class Account extends Validator
|
||||
|
||||
public function checkVerifyLogin($name, $code)
|
||||
{
|
||||
$this->checkLoginName($name);
|
||||
|
||||
$account = $this->checkAccount($name);
|
||||
|
||||
$verify = new Verify();
|
||||
@ -135,6 +135,8 @@ class Account extends Validator
|
||||
|
||||
public function checkUserLogin($name, $password)
|
||||
{
|
||||
$this->checkLoginName($name);
|
||||
|
||||
$account = $this->checkAccount($name);
|
||||
|
||||
$hash = PasswordUtil::hash($password, $account->salt);
|
||||
|
Loading…
x
Reference in New Issue
Block a user