Esempio n. 1
0
 public function storeVerifyAction()
 {
     $store = $this->postData;
     $verifyCode = $this->mobileVerifyCodeModel->getLastVerifyCode($store['storeMobile']);
     if ($verifyCode != $store['storeMobileCode']) {
         return $this->response(ApiError::VERIFY_CODE_INVALID, ApiError::VERIFY_CODE_INVALID_MSG);
     }
     unset($store['storeMobileCode']);
     $store['idPic'] = Utility::saveBaseCodePic($store['idPic']);
     $store['memberIdPic'] = Utility::saveBaseCodePic($store['memberIdPic']);
     $store['memberID'] = $this->memberInfo['memberID'];
     $store['storeName'] = $this->memberInfo['nickName'];
     try {
         $this->storeModel->beginTransaction();
         if (!empty($this->_storeInfo)) {
             $store['verifyStatus'] = 1;
             $this->storeModel->update($store, array('storeID' => $this->_storeInfo['storeID']));
         } else {
             $this->storeModel->insert($store);
             $storeID = $this->storeModel->getLastInsertValue();
             $this->memberInfoModel->update(array('storeID' => $storeID), array('memberID' => $this->memberInfo['memberID']));
         }
         $this->storeModel->commit();
         return $this->response(ApiSuccess::COMMON_SUCCESS, ApiSuccess::COMMON_SUCCESS_MSG);
     } catch (\Exception $e) {
         $this->storeModel->rollback();
         return $this->response($e->getCode(), $e->getMessage());
     }
 }