Пример #1
0
 public function getCourses($programId, $regId)
 {
     $data = Curl::postCurl($_ENV['ebook'] . '/getCourseDetails/' . $programId . '/' . $regId);
     return Response::json(array('status' => 'success', 'data' => $data));
 }
Пример #2
0
 /**
  * 由ip获得所在城市
  */
 public static function getCityByIp($ip = '')
 {
     $address = '';
     if ($ip && substr($ip, 0, 7) != '192.168') {
         $key = 'Tj1ciyqmG0quiNgpr0nmAimUCCMB5qMk';
         //自己申请的百度地图api的key
         $curl = new \Curl\Curl();
         $apiUrl = 'http://api.map.baidu.com/location/ip';
         $curl->post($apiUrl, array('ak' => $key, 'ip' => $ip));
         $response = $curl->response;
         $response = \App\Tools::objectToArray($response);
         if ($response['status'] == 0) {
             $address = $response['content']['address'];
         }
     } elseif ($ip && substr($ip, 0, 7) == '192.168') {
         $address = '浙江省 杭州市 滨江区';
     } elseif (!$ip) {
         $address = '未知';
     }
     return $address;
 }
 public function verifyEmail($encryptId)
 {
     if ($encryptId) {
         $data = Crypt::decrypt($encryptId);
         $user = RegistrationDetails::where('id', 'LIKE', $data)->first();
         if ($user) {
             $email = $user->user_email;
             $confirmMail = Curl::postCurl($_ENV['uauth'] . '/users/verifyEmail', array('user_email' => $email));
             if ($confirmMail->success) {
                 $user->verified_email = 1;
                 $user->save();
                 return view('emails.emailVerified');
             }
             return view('emails.emailNotVerified');
         }
     }
     return view('emails.emailNotVerified');
 }