function UpdateRouteAssignment() { $arrRouteAssignment = array('varRouteId' => $_POST['txtRouteId'], 'varRouteAssignment' => $_POST['txtRouteAssignment']); Db::execute('UPDATE routes SET assignment = :varRouteAssignment WHERE rtcode = :varRouteId', $arrRouteAssignment); $varResult = Db::getRow('SELECT * FROM routes WHERE rtcode = ?', $arrRouteAssignment['varRouteId']); echo 'Update Completed. Route assigned to ' . $varResult['assignment']; }
/** * Process payment * @return boolean */ private function processPayment() { $this->payment_processor = new Services_Paymill_PaymentProcessor(Configuration::get('PIGMBH_PAYMILL_PRIVATEKEY'), 'https://api.paymill.com/v2/'); $this->payment_processor->setAmount((int) round($this->context->cart->getOrderTotal(true, Cart::BOTH) * 100)); $this->payment_processor->setToken($this->token); $this->payment_processor->setCurrency(Tools::strtolower($this->iso_currency)); $this->payment_processor->setName($this->context->customer->lastname . ', ' . $this->context->customer->firstname); $this->payment_processor->setEmail($this->context->customer->email); $this->payment_processor->setDescription(''); $this->payment_processor->setLogger($this); $this->payment_processor->setSource(Configuration::get('PIGMBH_PAYMILL_VERSION') . '_prestashop_' . _PS_VERSION_); if ($this->payment == 'creditcard') { $sql = 'SELECT `clientId`,`paymentId` FROM `' . _DB_PREFIX_ . 'pigmbh_paymill_creditcard_userdata` WHERE `userId`=' . (int) $this->context->customer->id; } elseif ($this->payment == 'debit') { $sql = 'SELECT `clientId`,`paymentId` FROM `' . _DB_PREFIX_ . 'pigmbh_paymill_directdebit_userdata` WHERE `userId`=' . (int) $this->context->customer->id; } $user_data = $this->db->getRow($sql); $this->payment_processor->setClientId(!empty($user_data['clientId']) ? $user_data['clientId'] : null); if ($this->token === 'dummyToken') { $this->payment_processor->setPaymentId(!empty($user_data['paymentId']) ? $user_data['paymentId'] : null); } $capture_now = true; if ($this->payment == 'creditcard') { $capture_now = Configuration::get('PIGMBH_PAYMILL_CAPTURE') !== 'on'; } $result = $this->payment_processor->processPayment($capture_now); $this->log('Payment processing resulted in', $result ? 'Success' : 'Fail'); return $result; }
/** * Returns one object from collection * * @return mixed|null */ public function findOne() { if (!$this->hasStatement('select')) { $this->select('*'); } $this->limit(1); $result = null; $sql = $this->compile(); $tbl = $this->getStatement('table'); $cache_key = OrmCache::genKey($sql, $this->values_accum); if (($result_cached = OrmCache::getCachedQuery($cache_key)) !== false && $this->use_cache) { return $result_cached; } if (($result_cached = OrmCache::getFromInternalCache($cache_key)) !== false) { return $result_cached; } if ($row = Db::getRow($sql, $this->values_accum)) { $result = Orm::collection($this->entity_name)->create($row); } if ($this->use_cache) { OrmCache::cacheQuery($cache_key, $tbl['sql'], $result); return $result; } OrmCache::storeInternal($cache_key, $tbl['sql'], $result); return $result; }
/** * 取单个收藏的内容 * * @param array $condition 查询条件 * @param string $field 查询字段 * @return array 数组类型的返回结果 */ public function getOneFavorites($condition,$field='*'){ $param = array(); $param['table'] = 'favorites'; $param['field'] = array_keys($condition); $param['value'] = array_values($condition); return Db::getRow($param,$field); }
/** * 获取评论详细 * * @param $condition 查询条件 * @param $field 查询字段 */ public function getCommentRow($condition,$field='*'){ $param = array(); $param['table'] = 'sns_comment'; $param['field'] = array_keys($condition); $param['value'] = array_values($condition); return Db::getRow($param,$field); }
/** * 查询分享店铺详细 * * @param $condition 查询条件 * @param $field 查询字段 */ public function getSharestoreInfo($condition,$field='*'){ $param = array(); $param['table'] = 'sns_sharestore'; $param['field'] = array_keys($condition); $param['value'] = array_values($condition); return Db::getRow($param,$field); }
function getProject($projectId) { if (is_numeric($projectId)) { return Db::getRow('SELECT * FROM projects WHERE id = ?', $projectId); } return false; }
/** * @url POST */ function postAuth($email, $password) { //validate email and password $statement = 'SELECT userId, hash, role, nickname, notificationCount, avatarId, status FROM user where email = :email'; $bind = array('email' => $email); $user = \Db::getRow($statement, $bind); \TTOMail::createAndSendAdmin('A user is logging in', json_encode($bind)); if (password_verify($password, $user['hash'])) { //generate token $token = md5(uniqid(mt_rand(), true)); //update token to db $statement = 'UPDATE user SET token = :token WHERE userId = :userId'; $bind = array('token' => $token, 'userId' => $user['userId']); \Db::execute($statement, $bind); //then return token $response = new \stdClass(); $response->userId = $user['userId']; $response->token = $token; $response->role = $user['role']; $response->nickname = $user['nickname']; $response->notificationCount = $user['notificationCount']; $response->avatarId = $user['avatarId']; $response->status = $user['status']; return $response; } else { throw new RestException(401, 'Invalid email or password !!!'); } }
/** * 读取支付方式信息by Condition * * @param * @return array 数组格式的返回结果 */ public function getRowByCondition($conditionfield,$conditionvalue){ $param = array(); $param['table'] = 'payment'; $param['field'] = $conditionfield; $param['value'] = $conditionvalue; $result = Db::getRow($param); return $result; }
/** * @param Db $db * @param unknown_type $id_product */ public function getProductName($db, $id_product) { $res = $db->getRow("SELECT name FROM ps_product_lang WHERE id_product = " . $id_product); if (!$res) { return ""; } return $res['name']; }
public function getoneOrderGoods($rec_id) { $param = array(); $param['table'] = 'order_goods'; $param['field'] = 'rec_id'; $param['value'] = intval($rec_id); return Db::getRow($param); }
/** * 根据标识码查询一条 * * @param unknown_type $id */ public function getOneByCode($code){ $param = array( 'table' => 'document', 'field' => 'doc_code', 'value' => $code ); return Db::getRow($param); }
public function getoneComplainGoods($complain_goods_id) { $param = array(); $param['table'] = 'complain_goods'; $param['field'] = 'complain_goods_id'; $param['value'] = intval($complain_goods_id); return Db::getRow($param); }
/** * 读取记录 * * @param * @return array 数组格式的返回结果 */ public function getRow($theme_id) { $param = array(); $param['table'] = 'store_theme'; $param['field'] = 'theme_id'; $param['value'] = $theme_id; $result = Db::getRow($param); return $result; }
/** * 读取记录 * * @param * @return array 数组格式的返回结果 */ public function getRow($log_id) { $param = array(); $param['table'] = 'refund_log'; $param['field'] = 'log_id'; $param['value'] = $log_id; $result = Db::getRow($param); return $result; }
/** * @param Db $db * @param unknown_type $id_customer * @return number|Ambiguous */ public function getTodaysGPlusPoints($db, $id_customer) { // get todays $result = $db->getRow("select id_reward, points_awarded, balance\n\t\t\t\t\t\t\t\tfrom vb_customer_rewards\n\t\t\t\t\t\t\t\twhere id_customer = " . $id_customer . "\n\t\t\t\t\t\t\t\tand id_event = " . EVENT_GOOGLE_LIKE . "\n\t\t\t\t\t\t\t\tand date(date_add) = curdate()"); if (!$result) { return 0; } return $result; }
/** * @param Db $db * @param int $id_customer * @return number|Ambiguous */ public function getTodaysFacebookPoints($db, $id_customer) { //get todays $result = $db->getRow("select id_reward, points_deducted, balance\n\t\t\t\t\t\t\t\tfrom vb_customer_rewards\n\t\t\t\t\t\t\t\twhere id_customer = " . $id_customer . "\n\t\t\t\t\t\t\t\tand id_event = " . EVENT_FACEBOOK_UNLIKE . "\n\t\t\t\t\t\t\t\tand date(date_add) = curdate()"); if (!$result) { return 0; } return $result; }
/** * 读取购买记录 * * @param * @return array 数组格式的返回结果 */ public function getRow($gbuy_id) { $param = array(); $param['table'] = 'gold_buy'; $param['field'] = 'gbuy_id'; $param['value'] = $gbuy_id; $result = Db::getRow($param); return $result; }
/** * 根据编号查询咨询 * * @param unknown_type $id */ public function getOneById($id) { $param = array(); $param['table'] = 'flea_consult'; $param['field'] = 'consult_id'; $param['value'] = $id; $result = Db::getRow($param); return $result; }
/** * 取得一条运费模板扩展信息 * * @param unknown_type $transport_id * @return unknown */ public function getExtendRow($transport_id) { $param = array(); $param['table'] = 'transport_extend'; $param['field'] = 'transport_id'; $param['value'] = $transport_id; $result = Db::getRow($param); return $result; }
/** * 读取记录 * * @param * @return array 数组格式的返回结果 */ public function getRow($map_id) { $param = array(); $param['table'] = 'map'; $param['field'] = 'map_id'; $param['value'] = $map_id; $result = Db::getRow($param); return $result; }
/** * 根据店铺id获取水印 * * @param array $param 参数内容 * @return array $param 水印数组 */ public function getOneStoreWMByStoreId($store_id) { $wm_arr = array(); $store_id = intval($store_id); if ($store_id > 0) { $param = array('table' => 'store_watermark', 'field' => 'store_id', 'value' => $store_id); $wm_arr = Db::getRow($param); } return $wm_arr; }
/** * 根据编号获取一条数据 * * @param int $id * @return bool|array */ public function getOneById($id) { if (intval($id) <= 0) { return false; } $param = array(); $param['table'] = 'store_goods_class'; $param['field'] = 'stc_id'; $param['value'] = intval($id); return Db::getRow($param); }
/** * 取单个内容 * * @param int $id 分类ID * @return array 数组类型的返回结果 */ public function getOneGrade($id){ if (intval($id) > 0){ $param = array(); $param['table'] = 'store_grade'; $param['field'] = 'sg_id'; $param['value'] = intval($id); $result = Db::getRow($param); return $result; }else { return false; } }
/** * 取单个分类的内容 * * @param int $id 分类ID * @return array 数组类型的返回结果 */ public function getOneClass($id){ if (intval($id) > 0){ $param = array(); $param['table'] = 'article_class'; $param['field'] = 'ac_id'; $param['value'] = intval($id); $result = Db::getRow($param); return $result; }else { return false; } }
/** * 取单个内容 * * @param int $id 分类ID * @return array 数组类型的返回结果 */ public function getOneUpload($id){ if (intval($id) > 0){ $param = array(); $param['table'] = 'album_pic'; $param['field'] = 'apic_id'; $param['value'] = intval($id); $result = Db::getRow($param); return $result; }else { return false; } }
/** * 取单个内容 * * @param int $id ID * @return array 数组类型的返回结果 */ public function getOneNavigation($id){ if (intval($id) > 0){ $param = array(); $param['table'] = 'navigation'; $param['field'] = 'nav_id'; $param['value'] = intval($id); $result = Db::getRow($param); return $result; }else { return false; } }
/** * 取单个内容 * * @param int $id ID * @return array 数组类型的返回结果 */ public function getOneLink($id){ if (intval($id) > 0){ $param = array(); $param['table'] = 'mb_category'; $param['field'] = 'gc_id'; $param['value'] = intval($id); $result = Db::getRow($param); return $result; }else { return false; } }
/** * 根据编号获取单个内容 * * @param int 主键编号 * @return array 数组类型的返回结果 */ public function getOne($id){ if (intval($id) > 0){ $param = array(); $param['table'] = self::TABLE_NAME; $param['field'] = self::PK; $param['value'] = intval($id); $result = Db::getRow($param); return $result; }else { return false; } }
/** * 取单个学科的内容 * * @param int $id 学科ID * @return array 数组类型的返回结果 */ public function getOnedisciplineClass($id) { if (intval($id) > 0) { $param = array(); $param['table'] = 'member_discipline'; $param['field'] = 'discipline_id'; $param['value'] = intval($id); $result = Db::getRow($param); return $result; } else { return false; } }