static function orderCard($data) { if (!$data) { return false; } $model = new ShopModel(); $result = $model->orderCard($data); return $result; }
public function order($offset = 0) { $orderStatus = $this->input->get('type') + 0; $weixinUtil = new WeixinUtil(); $weixinUtil->authorize("userCenter/order/{$offset}/{$orderStatus}"); $openId = $weixinUtil->getOpenId(); $orderModel = new OrderModel(); // 获得订单信息 $where = array('open_id' => $openId); if ($orderStatus) { $where['order_status'] = $orderStatus; } $orders = $orderModel->getUserOrders($openId, $orderStatus, $offset); $orderCounts = $orderModel->getUserOrderCounts($openId, $orderStatus); if (isset($orderCounts[0])) { $orderCounts = array_pop($orderCounts); } $orderCounts = isset($orderCounts['rowCounts']) ? $orderCounts['rowCounts'] : 0; $pages = (new PaginationUtil($orderCounts, 'user-center'))->pagination(); $shopModel = new ShopModel(); $shops = $shopModel->getAllShops(); $shopAddress = $shopModel->getAllShopAddress(); $this->view('userCenter/order', array('pages' => $pages, 'orders' => $orders, 'orderStatus' => $orderStatus, 'shops' => $shops, 'offset' => $offset, 'shopAddress' => $shopAddress)); }
} $totalExec = 0; //批量修改 if ($dopost == 'mut_edit') { $idArr = $_POST["sid"]; $totalExec = 0; foreach ($idArr as $id) { $shop_title = isset($_POST["shop_title"][$id]) ? $_POST["shop_title"][$id] : ''; $category_id = isset($_POST["category_id"][$id]) ? intval($_POST["category_id"][$id]) : 0; $promote_id = isset($_POST["promote_id"][$id]) ? intval($_POST["promote_id"][$id]) : 0; $sql = 'SELECT * FROM `shop` WHERE `shop_title`="' . $shop_title . '" AND `id`<>"' . $id . '"'; $rs = $pdo->query($sql); $row = $rs->fetchAll(); //取得所有记录 if (count($row) == 0) { $res = ShopModel::model()->update(array('id' => $id), array('shop_title' => $shop_title, 'category_id' => $category_id, 'promote_id' => $promote_id)); if ($res) { $totalExec++; } } else { $error[] = $shop_title . '【店铺标题不可重复】!'; } } $updateMessage = "更新" . $totalExec . "条数据"; } //删除数据 $delflag = $_GET["delflag"]; if ($delflag == 1) { $id = $_GET["id"]; $sql = "DELETE FROM `shop` WHERE `id`={$id}"; $result = $pdo->exec($sql);
<?php session_start(); include_once '../../TOMO2-Web/includes/connection.php'; include_once '../../TOMO2-Web/includes/Shop.php'; include_once '../../TOMO2-Web/PDO/ShopModel.php'; if (isset($_SESSION['name']) and $_SESSION['id'] == '10207674962976867') { $id_shop = $_GET['id_shop']; $shop = new Shop(); $shopModel = new ShopModel(); /* if (isset($_GET['name'], $_GET['description'], $_GET['upload_date'], $_GET['image'], $_GET['link'], $_GET['active'])){ $name = $_GET['name']; $description = nl2br($_GET['description']); $upload_date = $_GET['upload_date']; $link = $_GET['image']; $image = $_GET['link']; $active = $_GET['active']; if (empty($name) or empty($description) or empty($upload_date)){ $error = 'There are some fields empty. The only empty field accepted is "image" or "link" field'; } else { $query = $pdo->prepare('INSERT INTO Noticias (name, description, upload_date, image, link, active) VALUES (?, ?, ?, ?, ?, ?)'); $query->bindValue (1, $name); $query->bindValue (2, $description); $query->bindValue (3, $upload_date); $query->bindValue (4, $image); $query->bindValue (5, $link); $query->bindValue (6, $active);