diff --git a/app/Repos/Account.php b/app/Repos/Account.php index 680ab79c..8c670cb6 100644 --- a/app/Repos/Account.php +++ b/app/Repos/Account.php @@ -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], + ]); } /** diff --git a/app/Repos/Audit.php b/app/Repos/Audit.php index 98dda9ec..80dcb512 100644 --- a/app/Repos/Audit.php +++ b/app/Repos/Audit.php @@ -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], + ]); } /** diff --git a/app/Repos/Category.php b/app/Repos/Category.php index a7a49d57..41a6c089 100644 --- a/app/Repos/Category.php +++ b/app/Repos/Category.php @@ -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], + ]); } /** diff --git a/app/Repos/Chapter.php b/app/Repos/Chapter.php index ff0bf1b6..3eaf0975 100644 --- a/app/Repos/Chapter.php +++ b/app/Repos/Chapter.php @@ -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], + ]); } /** diff --git a/app/Repos/Connect.php b/app/Repos/Connect.php index e32c88a1..49c07865 100644 --- a/app/Repos/Connect.php +++ b/app/Repos/Connect.php @@ -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], + ]); } /** diff --git a/app/Repos/Consult.php b/app/Repos/Consult.php index 548a6569..e2ce67cb 100644 --- a/app/Repos/Consult.php +++ b/app/Repos/Consult.php @@ -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], + ]); } /** diff --git a/app/Repos/Course.php b/app/Repos/Course.php index 5b774458..43591050 100644 --- a/app/Repos/Course.php +++ b/app/Repos/Course.php @@ -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], + ]); } /** diff --git a/app/Repos/Danmu.php b/app/Repos/Danmu.php index f4267114..95144876 100644 --- a/app/Repos/Danmu.php +++ b/app/Repos/Danmu.php @@ -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], + ]); } /** diff --git a/app/Repos/Help.php b/app/Repos/Help.php index 5f35e7df..cc93a7f4 100644 --- a/app/Repos/Help.php +++ b/app/Repos/Help.php @@ -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], + ]); } /** diff --git a/app/Repos/ImGroup.php b/app/Repos/ImGroup.php index 7265b426..f53007e1 100644 --- a/app/Repos/ImGroup.php +++ b/app/Repos/ImGroup.php @@ -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], + ]); } /** diff --git a/app/Repos/ImMessage.php b/app/Repos/ImMessage.php index 738027d0..b984bc8e 100644 --- a/app/Repos/ImMessage.php +++ b/app/Repos/ImMessage.php @@ -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], + ]); } /** diff --git a/app/Repos/ImNotice.php b/app/Repos/ImNotice.php index fe956f38..ee87d26c 100644 --- a/app/Repos/ImNotice.php +++ b/app/Repos/ImNotice.php @@ -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], + ]); } /** diff --git a/app/Repos/ImUser.php b/app/Repos/ImUser.php index f7d179db..c8518e8d 100644 --- a/app/Repos/ImUser.php +++ b/app/Repos/ImUser.php @@ -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], + ]); } /** diff --git a/app/Repos/Learning.php b/app/Repos/Learning.php index 9cee3196..cdb56bd2 100644 --- a/app/Repos/Learning.php +++ b/app/Repos/Learning.php @@ -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], + ]); } /** diff --git a/app/Repos/Nav.php b/app/Repos/Nav.php index cb991eb6..84d23152 100644 --- a/app/Repos/Nav.php +++ b/app/Repos/Nav.php @@ -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], + ]); } /** diff --git a/app/Repos/Order.php b/app/Repos/Order.php index 5c6972c2..abfc4005 100644 --- a/app/Repos/Order.php +++ b/app/Repos/Order.php @@ -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], + ]); } /** diff --git a/app/Repos/Package.php b/app/Repos/Package.php index da401779..51b2fa06 100644 --- a/app/Repos/Package.php +++ b/app/Repos/Package.php @@ -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], + ]); } /** diff --git a/app/Repos/Page.php b/app/Repos/Page.php index e7acb1fe..c3454f08 100644 --- a/app/Repos/Page.php +++ b/app/Repos/Page.php @@ -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], + ]); } /** diff --git a/app/Repos/Refund.php b/app/Repos/Refund.php index 83d9f4e5..5c02f606 100644 --- a/app/Repos/Refund.php +++ b/app/Repos/Refund.php @@ -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], + ]); } /** diff --git a/app/Repos/Resource.php b/app/Repos/Resource.php index b24dac0d..d7fa8d4d 100644 --- a/app/Repos/Resource.php +++ b/app/Repos/Resource.php @@ -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], + ]); } /** diff --git a/app/Repos/Review.php b/app/Repos/Review.php index fa84534d..9f556ac6 100644 --- a/app/Repos/Review.php +++ b/app/Repos/Review.php @@ -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], + ]); } /** diff --git a/app/Repos/Reward.php b/app/Repos/Reward.php index daa22d4e..a4edacec 100644 --- a/app/Repos/Reward.php +++ b/app/Repos/Reward.php @@ -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], + ]); } /** diff --git a/app/Repos/Role.php b/app/Repos/Role.php index c01d1c9b..7c5c4063 100644 --- a/app/Repos/Role.php +++ b/app/Repos/Role.php @@ -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], + ]); } /** diff --git a/app/Repos/Slide.php b/app/Repos/Slide.php index 4c96ce0f..0a2aa6c1 100644 --- a/app/Repos/Slide.php +++ b/app/Repos/Slide.php @@ -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], + ]); } /** diff --git a/app/Repos/Topic.php b/app/Repos/Topic.php index beee93fa..14dc3372 100644 --- a/app/Repos/Topic.php +++ b/app/Repos/Topic.php @@ -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], + ]); } /** diff --git a/app/Repos/Trade.php b/app/Repos/Trade.php index 3d6e4755..a1df0da9 100644 --- a/app/Repos/Trade.php +++ b/app/Repos/Trade.php @@ -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], + ]); } /** diff --git a/app/Repos/Upload.php b/app/Repos/Upload.php index ac0954c1..8e03bf0d 100644 --- a/app/Repos/Upload.php +++ b/app/Repos/Upload.php @@ -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], + ]); } /** diff --git a/app/Repos/User.php b/app/Repos/User.php index ac589069..1c2e1c78 100644 --- a/app/Repos/User.php +++ b/app/Repos/User.php @@ -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], + ]); } /** diff --git a/app/Repos/Vip.php b/app/Repos/Vip.php index 35c2de15..5b1605bc 100644 --- a/app/Repos/Vip.php +++ b/app/Repos/Vip.php @@ -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], + ]); } /** diff --git a/app/Repos/WechatSubscribe.php b/app/Repos/WechatSubscribe.php index 2043d889..c17d5a70 100644 --- a/app/Repos/WechatSubscribe.php +++ b/app/Repos/WechatSubscribe.php @@ -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], + ]); } /** diff --git a/app/Validators/Account.php b/app/Validators/Account.php index 0bc8e8e7..4d2d7bbf 100644 --- a/app/Validators/Account.php +++ b/app/Validators/Account.php @@ -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);