private static function jwtEncode($data)
 {
     return is_array($data) ? XiiUtil::base64Encode(XiiJson::encode($data)) : XiiUtil::base64Encode($data);
 }
Beispiel #2
0
 private static function getFromApi()
 {
     if (!empty(self::$_outputData)) {
         return;
     }
     self::config();
     $tmp = XiiCurl::Run([XIIS_PARAMS_URL => self::$_apiUrl, XIIS_PARAMS_DATA => self::$_apiCondition, XIIS_PARAMS_METHOD => self::$_apiMethod]);
     if ($tmp[XIIS_FEEDBACK_STATUS]) {
         self::$_outputData = XiiJson::decode($tmp[XIIS_FEEDBACK_DATA]);
         self::$_dataFrom = XIIS_DATA_FROM_API;
         self::logRecord([XIIS_DATA_FROM_API => self::SUCCESS_GET_FROM_API]);
     } else {
         self::logRecord([XIIS_DATA_FROM_API => $tmp[XIIS_FEEDBACK_MSG]]);
     }
 }
Beispiel #3
0
 public function actionVerifysms()
 {
     $hp = isset($this->_requestData[self::$_handphoneField]) && !empty($this->_requestData[self::$_handphoneField]) && is_numeric($this->_requestData[self::$_handphoneField]) ? $this->_requestData[self::$_handphoneField] : false;
     if (!$hp) {
         self::sendError(EC_BACKEND_HANDPHONE_NO_HP);
     }
     $verify = isset($this->_requestData[self::$_handphoneVerifyField]) && !empty($this->_requestData[self::$_handphoneVerifyField]) && is_numeric($this->_requestData[self::$_handphoneVerifyField]) ? $this->_requestData[self::$_handphoneVerifyField] : false;
     if (!$verify) {
         self::sendError(EC_BACKEND_HANDPHONE_NO_CODE);
     }
     $feedback = self::verifySmsLeancLoud($hp, $verify);
     if ($feedback['code'] == 200) {
         $msg = XiiError::getErrorMessage(EC_BACKEND_HANDPHONE_VERIFY_OK);
         $para[XIIS_DEFAULT_PRI_KEY] = (int) self::getUserId();
         $para[self::$_handphoneStatusField] = self::$_handphoneStatusValue;
         $this->_authModel->edit($para);
     } else {
         $tmp = XiiJson::decode($feedback['msg']);
         $msg = isset($tmp['error']) ? $tmp['error'] : 'Verify : LeanCloud No Error';
     }
     $this->redirect(self::$_handphoneJumpUrl . '?' . self::$_handphoneCodeField . '=' . $msg);
 }