public function addUser($uid) { Wind::import('SRC:service.user.srv.PwLoginService'); $srv = new PwLoginService(); $result = $srv->sysUser($uid); if ($result instanceof PwError) { return $result->getError(); } return true; }
/** * 执行用户注册 */ public function quickRegisterAction() { $registerService = new PwRegisterService(); $registerService->setUserDm($this->_getUserDm()); /*[u_regsiter]:插件扩展*/ $this->runHook('c_register', $registerService); if (($info = $registerService->register()) instanceof PwError) { $this->showError($info->getError()); } else { Wind::import('SRV:user.srv.PwLoginService'); $service = new PwLoginService(); Windid::load('user.WindidUser'); $info = $service->sysUser($info['uid']); $identity = PwLoginService::createLoginIdentify($info); $identity = base64_encode($identity); $userService = Wekit::load('user.srv.PwUserService'); $userService->createIdentity($info['uid'], $info['password']); $this->forwardRedirect(WindUrlHelper::createUrl('app/4tschool/orderpreview/run', array("message" => $message))); } }
/** * 检查用户输入的用户名 */ public function checknameAction() { $login = new PwLoginService(); list($status, $info) = $login->auth($this->getInput('username'), ''); if (-1 == $status) { $this->showError('USER:user.error.-14'); } if (!empty($info['safecv'])) { $status = PwLoginService::createLoginIdentify($login->sysUser($info['uid'])); $identify = base64_encode($status . '|'); $this->addMessage($this->_getQuestions(), 'safeCheck'); $this->addMessage($identify, '_statu'); $this->showMessage(); } $this->showMessage(); }
function bind_user($uid = 0) { if ($uid == 0) { $uid = $this->get_uid(); } Wind::import('SRV:user.srv.PwLoginService'); $service = new PwLoginService(); //$this->runHook('c_login_dorun', $login); Windid::load('user.WindidUser'); $info = $service->sysUser($uid); $identity = PwLoginService::createLoginIdentify($info); $identity = base64_encode($identity); $userService = Wekit::load('user.srv.PwUserService'); $userService->updateLastLoginData($info['uid'], $this->getRequest()->getClientIp()); $userService->createIdentity($info['uid'], $info['password']); //到主页去 $this->forwardRedirect(WindUrlHelper::createUrl('app/4tschool/index/run')); $this->showMessage('欢迎回来…', '/'); }
public function makeOrderAction() { //get data $merchandisesInfo = $this->getInput("merchandisesInfo", "post"); $id = $this->getInput("id", "post"); $to = $this->getInput("orderContactor", "post"); $phone = $this->getInput("orderPhone", "post"); $address = $this->getInput("orderAddress", "post"); $note = $this->getInput("orderRemark", "post"); $orderExpressTime = $this->getInput("orderExpressTime", "post"); $orderHour = $this->getInput('orderHour', "post"); $orderMinutes = $this->getInput('orderMinutes', "post"); $orderTime = $orderHour . ':' . $orderMinutes; $schoolId = $this->getCurrentSchoolId(); if (empty($merchandisesInfo)) { //show not correct message return; } else { $merchandisesInfo = (array) json_decode($merchandisesInfo); } $to = trim($to); $phone = trim($phone); $address = trim($address); if (empty($to) || empty($phone) || empty($address)) { echo '无效的数据'; die; } $orderItems = $merchandisesInfo['merchandises']; $shopDeduct = array(); //calculate the promo $orderMerchandiseList = $this->jcart->get_contents(); $promos = $this->_getPromoDs()->matchedPromoInCart($orderMerchandiseList); //calculate deduct price foreach ($promos['Match'] as $item) { if ($item['ShopId'] == $shopid) { $shopDeduct['ShopId'] += $item['Deduct']; } } $hasException = false; $userid = $this->loginUser->uid; $this->_getOrderAddressDs()->addorUpdateOrderAddress($id, $userid, $to, $address, $phone); $newCreated = false; if ($userid <= 0) { //generate tmp userid $newInfo = $this->_getTmpUserDS()->registerTmpUser(1); $userid = $newInfo['uid']; $newCreated = true; } try { //start transaction $this->_getMyOrderDS()->startTran(); $generatedIds = $this->_getMyOrderDS()->makeOrder($userid, $schoolId, $orderItems, $to, $phone, $address, $note, '网站'); } catch (Exception $e) { $hasException = true; $this->_getMyOrderDS()->rollBack(); } if ($hasException == false) { $message = "下单成功"; $this->_getMyOrderDS()->commit(); } else { $message = "下单失败,请联系系统管理员"; } //清空购物车 $this->jcart->empty_cart(); if ($newCreated == true) { Wind::import('SRV:user.srv.PwLoginService'); $service = new PwLoginService(); Windid::load('user.WindidUser'); $info = $service->sysUser($userid); $identity = PwLoginService::createLoginIdentify($info); $identity = base64_encode($identity); $userService = Wekit::load('user.srv.PwUserService'); $userService->createIdentity($info['uid'], $info['password']); //跳转到我的订单的画面 $this->forwardRedirect(WindUrlHelper::createUrl('app/4tschool/schoolorder/myorder', array("message" => $message))); } else { //跳转到我的订单的画面 $this->forwardRedirect(WindUrlHelper::createUrl('app/4tschool/schoolorder/myorder', array("message" => $message))); } }