当前位置: 首页>>代码示例>>PHP>>正文


PHP Generic::saveDistrictCityFromLatLng方法代码示例

本文整理汇总了PHP中Generic::saveDistrictCityFromLatLng方法的典型用法代码示例。如果您正苦于以下问题:PHP Generic::saveDistrictCityFromLatLng方法的具体用法?PHP Generic::saveDistrictCityFromLatLng怎么用?PHP Generic::saveDistrictCityFromLatLng使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Generic的用法示例。


在下文中一共展示了Generic::saveDistrictCityFromLatLng方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 function save()
 {
     //IMBAuth::checkOAuth();
     $device_id = addslashes($_POST['device_id']);
     $type = addslashes($_POST['type']);
     //completion check
     if ($device_id == "" || $type == "") {
         $json['status_code'] = 0;
         $json['status_message'] = "Incomplete Request";
         echo json_encode($json);
         die;
     }
     //check account..
     $acc = isset($_POST['acc_id']) ? addslashes($_POST['acc_id']) : 0;
     $res_id = isset($_POST['res_id']) ? addslashes($_POST['res_id']) : 0;
     //        IMBAuth::checkOAuth();
     $dn = new DeviceModel();
     $dnquery = new DeviceModel();
     // langkah 1 , device ID ada device type ada
     $arrs = $dnquery->getWhere("device_id = '{$device_id}' AND device_type = '{$type}'");
     $dn = $arrs[0];
     if ($dn->did == "") {
         $dn = new DeviceModel();
         $dn->device_id = $device_id;
         $dn->device_type = $type;
         $dn->acc_id = $acc;
         $dn->firstlogin = leap_mysqldate();
         $dn->dev_res_id = $res_id;
     } else {
         //kalau device id ada, acc di update
         $dn->load = 1;
         $dn->acc_id = $acc;
         $dn->dev_res_id = $res_id;
     }
     $dn->dev_lng = addslashes($_POST['lng']);
     $dn->dev_lat = addslashes($_POST['lat']);
     $dn->logindate = leap_mysqldate();
     //save user latlong to MasterUser -- 10 May 2016 sendy
     if (isset($_POST['lat']) && isset($_POST['lng']) && $acc != 0) {
         $user = new UserModel();
         $user->getByID($acc);
         $user->logindate = leap_mysqldate();
         $user->latitude = addslashes($_POST['lat']);
         $user->longitude = addslashes($_POST['lng']);
         $user->save();
     }
     //save user District and City to LocationModel -- 26 May 2016 sendy
     Generic::saveDistrictCityFromLatLng(addslashes($_POST['lat']), addslashes($_POST['lng']), $acc, $type == "cashier");
     if ($dn->save()) {
         $json['save_status'] = 1;
         $json['version'] = Efiwebsetting::getData('App_Version_' . strtolower($type));
         $json['url'] = Efiwebsetting::getData('App_URL_' . strtolower($type));
         //logged all device login 19 nov 2015 roy
         //            $logged = new DeviceLogger();
         //            $logged->log_acc_id = $dn->acc_id;
         //            $logged->log_date = leap_mysqldate();
         //            $logged->log_dev_id = $dn->device_id;
         //            $logged->log_dev_type = $dn->device_type;
         //            $logged->save();
     } else {
         $json['save_status'] = 0;
     }
     $json['status_code'] = 1;
     if ($_POST['do_not_die']) {
         return $json;
     } else {
         echo json_encode($json);
         die;
     }
 }
开发者ID:CapsuleCorpIndonesia,项目名称:martabak_revolution,代码行数:70,代码来源:RegDevice.php

示例2: userSignUp

 public function userSignUp()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $update = !Generic::IsNullOrEmptyString($_POST['id_user']);
     $idUser = Generic::IsNullOrEmptyString($_POST['id_user']) ? "" : $_POST['id_user'];
     $fullName = Generic::mustCheck($_POST['full_name'], Keys::$ERR_USER_EMPTY_FULL_NAME);
     $userName = Generic::mustCheck($_POST['user_name'], Keys::$ERR_USER_EMPTY_NICK_NAME);
     $email = Generic::mustCheck($_POST['email'], Keys::$ERR_USER_EMPTY_EMAIL);
     $password = Generic::mustCheck($_POST['pwd'], Keys::$ERR_USER_EMPTY_PASSWORD);
     //        $password2 = Generic::mustCheck($_POST['pwd2'], Keys::$ERR_USER_EMPTY_PASSWORD_2);
     $idCuisine = Generic::mustCheck($_POST['pref_cuisine'], Keys::$ERR_USER_EMPTY_CUISINE);
     $birthday = Generic::mustCheck($_POST['birthday'], Keys::$ERR_USER_EMPTY_BIRTHDAY);
     $phoneNo = Generic::mustCheck($_POST['phone_no'], Keys::$ERR_USER_EMPTY_PHONE);
     $fbId = Generic::IsNullOrEmptyString($_POST['fb_id']) ? "" : $_POST['fb_id'];
     $latitude = Generic::getOrDefault($_POST['lat'], Keys::$DEFAULT_LATITUDE);
     $longitude = Generic::getOrDefault($_POST['long'], Keys::$DEFAULT_LONGITUDE);
     $district = Generic::getOrDefault($_POST['district'], Keys::$EMPTY);
     $city = Generic::getOrDefault($_POST['city'], Keys::$EMPTY);
     $pic = Generic::getOrDefault($_POST['pic'], Keys::$EMPTY);
     ///START OF LOVELY VALIDATION TIME
     if (!Generic::isValidUserName($userName)) {
         Generic::errorMsg(Keys::$ERR_USER_INVALID_USERNAME);
     }
     if (!Generic::isValidUserNameLength($userName)) {
         Generic::errorMsg(Keys::$ERR_USER_USERNAME_TOO_LONG);
     }
     if (!Generic::isValidEmail($email)) {
         Generic::errorMsg(Keys::$ERR_USER_INVALID_EMAIL);
     }
     if (!Generic::isValidPassword($password)) {
         Generic::errorMsg(Keys::$ERR_USER_INVALID_PASSWORD);
     }
     //        if ($password != $password2)
     //            Generic::errorMsg(Keys::$ERR_USER_CONFIRM_PASSWORD_NOT_MATCH);
     $u = new UserModel();
     $arrU = $u->getWhere("user_name='{$userName}'");
     if (count($arrU) > 0) {
         Generic::errorMsg(Keys::$ERR_USER_DUPLICATE_USERNAME);
     }
     $u1 = new UserModel();
     $arrU = $u1->getWhere("email='{$email}'");
     if (count($arrU) > 0) {
         Generic::errorMsg(Keys::$ERR_USER_DUPLICATE_EMAIL);
     }
     if ($fbId != "") {
         $u2 = new UserModel();
         $arrU = $u2->getWhere("fb_id='{$fbId}'");
         if (count($arrU) > 0) {
             Generic::errorMsg(Keys::$ERR_USER_DUPLICATE_FB_ID);
         }
     }
     ///END OF LOVELY VALIDATION TIME, HOW SAD :(
     //pagar untuk regis
     if (Efiwebsetting::getData('Doku_switch')) {
         $doku = new PaymentDoku();
         $dokuId = $doku->registerCustomer($fullName, $email, $phoneNo);
         if (!$dokuId) {
             Generic::errorMsg(Keys::$ERR_USER_FAILED_CREATE_DOKU);
         }
     }
     $user = new UserModel();
     $user->full_name = $fullName;
     $user->user_name = $userName;
     $user->email = $email;
     $user->password = $password;
     $user->id_cuisine = $idCuisine;
     $user->birthday = $birthday;
     if ($pic == "") {
         $user->pic = "";
     } else {
         $user->pic = Util::savePic($pic);
     }
     $user->phone_no = $phoneNo;
     $user->fb_id = $fbId;
     $user->latitude = $latitude;
     $user->longitude = $longitude;
     $user->district = $district;
     $user->city = $city;
     $user->last_lat = $latitude;
     $user->last_long = $longitude;
     $user->last_district = $district;
     $user->last_city = $city;
     $user->status = "1";
     $user->payment_id = $dokuId;
     //        $user->load = 1;
     $uid = $user->save();
     if (!$uid) {
         Generic::errorMsg(Keys::$ERR_USER_FAILED_CREATE);
     } else {
         Generic::saveDistrictCityFromLatLng($latitude, $longitude, $uid, false);
         $results['fb_id'] = $fbId;
         $results['id_user'] = $uid;
         //$user->id_user;
         $results['user_name'] = $userName;
         $results['full_name'] = $fullName;
         $results['email'] = $email;
         $results['pic'] = Generic::insertImageUrl($pic);
         Generic::finish($results);
//.........这里部分代码省略.........
开发者ID:CapsuleCorpIndonesia,项目名称:martabak_revolution,代码行数:101,代码来源:FEU.php


注:本文中的Generic::saveDistrictCityFromLatLng方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。