/** * 配達可能な人を選択する * 現在はstatusが「店舗にいる」or「店舗に向かっている」だけでフィルターをかけている * todo 配達者の候補として自分を選択肢から外す * @param $id */ public function selectDeliveryman($id) { $this->_log->debug(__CLASS__ . ":" . __FUNCTION__ . " called:(" . __LINE__ . ")"); $db = Common::getMaster(); $mCustomer = new TCustomer($db); $select = $mCustomer->select(); $select->where('customerID != ?', $id)->where('status = ?', customerStatus::In)->orWhere('status = ?', customerStatus::Going); $deliverCustomer = $mCustomer->fetchAll($select)->toArray(); return $deliverCustomer; }
/** * ログイン * @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]; }