/** * ログイン * @param $params */ public function login($params) { $this->_log->debug(__CLASS__ . ":" . __FUNCTION__ . " called:(" . __LINE__ . ")"); $errFlg = false; $db = Common::getMaster(); $mCustomer = new TCustomer($db); $select = $mCustomer->select(); $select->where('email = ?', $params['email']); $customer = $mCustomer->fetchAll($select)->toArray(); if (count($customer) != 1) { $this->_log->error('ログインユーザが存在しない or 複数人存在します.'); $errFlg = true; } else { $this->_log->debug('ログインユーザが存在しました.'); Auth::setAuth($customer[0]); } return $errFlg; }
/** * 顧客情報を取得. * @param int $id */ public function selectCustomerByCustomerID($id) { $this->_log->debug(__CLASS__ . ":" . __FUNCTION__ . " called:(" . __LINE__ . ")"); $customerInfo = array(); $db = Common::getMaster(); $mCustomer = new TCustomer($db); $select = $mCustomer->select(); $select->where('customerID = ?', $id); $customerInfo = $mCustomer->fetchAll($select)->toArray(); if (count($customerInfo) != 1) { $this->_log->error('取得した顧客情報が1つではありませんでした.'); return; } return $customerInfo[0]; }
/** * 配達者or依頼者を評価する * @param $customerID * @param $params * @throws Exception */ public function evaluatePerson($customerID, $params) { $this->_log->debug(__CLASS__ . ":" . __FUNCTION__ . " called:(" . __LINE__ . ")"); $db = Common::getMaster(); $this->_begin($db); try { $mRequest = new TRequest($db); $requestInfo = $mRequest->findRecord($params['requestID']); $mCustomer = new TCustomer($db); if ($customerID == $requestInfo['recipientID']) { // 配達者を評価 $this->_log->debug("配達者を評価"); $mCustomer->updateRecord($requestInfo['deliverymanID'], $params); } elseif ($customerID == $requestInfo['deliverymanID']) { // 依頼者を評価 $this->_log->debug("配達者を評価"); $mCustomer->updateRecord($requestInfo['recipientID'], $params); } $this->_commit(); } catch (Exception $e) { $this->_rollBack(); throw $e; } return; }