예제 #1
0
 protected function sendVerificationCode($bud_id, $email_or_phone, $where)
 {
     $code = rand(1000, 9999);
     $bud = new Bud($bud_id);
     if ($email_or_phone == 'phone') {
         $bud->phone_code = $code;
         $bud->save();
         try {
             return $this->sendSMS($where, $code);
         } catch (Services_Twilio_RestException $e) {
             $this->api_die($e->getMessage());
         }
     } else {
         if ($email_or_phone == 'email') {
             $bud->email_code = $code;
             $bud->save();
             $mailer = new \email\Mailer();
             return $mailer->sendVerificationEmail($where, $code);
         }
     }
 }