Exemplo n.º 1
0
 public static function find()
 {
     return parent::find()->andWhere(['user_id' => Yii::$app->getUser()->id]);
 }
Exemplo n.º 2
0
 public function saveAccount($model)
 {
     //        $params = yii::$app->request->queryParams;
     $params = Yii::$app->request->getBodyParams();
     $account = new Accounts();
     $account->acc_mobile = $params['mobile'];
     $account->acc_access_token = Yii::$app->security->generateRandomString();
     $account->acc_type = $params['type'];
     $account->acc_state = 0;
     $acc_type = $params['type'];
     if ($acc_type == 0) {
         $account->acc_userid = $model->applicant_id;
     } else {
         if ($acc_type == 1) {
             $account->acc_userid = $model->business_id;
         }
     }
     if ($account->validate() && $account->save()) {
         return true;
     } else {
         return false;
     }
 }