예제 #1
0
 public function index()
 {
     $this->actionMenu = array(array('name' => '发布商品', 'url' => utils::getUrl('admin/system-product/add/' . base64_encode($this->url))));
     $this->menuTitle = '我的商品列表';
     $tableName = utils::getTableName($this->systemProductService->modelName);
     $systemProductList = $this->systemProductService->model->querySql($tableName);
     $hasSkuProductIdArr = $newProductList = array();
     if ($systemProductList) {
         foreach ($systemProductList['resultList'] as $product) {
             $newProductList[$product['id']] = $product;
             if ($product['is_has_sku']) {
                 $hasSkuProductIdArr[] = $product['id'];
             }
         }
     }
     $productSkuService = new productSkuService();
     $skuList = $productSkuService->getSkuListByProductIdArr($hasSkuProductIdArr);
     if ($skuList) {
         foreach ($skuList as $skuInfo) {
             $newProductList[$skuInfo['sysproduct_id']]['skuList'][] = $skuInfo;
         }
     }
     $showCategoryModel = new showCategoryModel();
     $showCategoryList = $showCategoryModel->getCacheFileCategory();
     $productAllStatus = $this->systemProductService->productStatus;
     $data = array('showCategoryList' => $showCategoryList, 'systemProductList' => $newProductList, 'productAllStatus' => $productAllStatus);
     $this->setView($data);
 }
예제 #2
0
 public function getHomeByHomeIdArr($homeIdArr)
 {
     $tableName = utils::getTableName('home');
     $homeIdStr = implode(',', $homeIdArr);
     $homeInfoList = $this->querySql($tableName, array('*'), 'id in (' . $homeIdStr . ')');
     return $homeInfoList;
 }
예제 #3
0
 public function getSkuListByProductIdArr($productIdArr)
 {
     $allSkuList = array();
     if ($productIdArr) {
         $productIdStr = implode(',', $productIdArr);
         $where = "sysproduct_id in ({$productIdStr})";
         $skuList = $this->model->querySql(utils::getTableName($this->modelName), array('*'), $where);
         if ($skuList['rowNums']) {
             $allSkuList = $skuList['resultList'];
         }
     }
     return $allSkuList;
 }
예제 #4
0
 public function getSkuByIds($skuIds)
 {
     $allSkuList = array();
     if ($skuIds) {
         $skuIdStr = implode(',', $skuIds);
         $where = "id in ({$skuIdStr})";
         $skuList = $this->model->querySql(utils::getTableName($this->modelName), array('*'), $where);
         if ($skuList['rowNums']) {
             $allSkuList = $skuList['resultList'];
         }
     }
     return $allSkuList;
 }
예제 #5
0
 public function addToCart($prodcutInfo, $nums = 1, $groupNum = 1, $groupDay = 1, $startTimeInt = 0, $skuInfo = 0)
 {
     $userId = 1;
     //判断购物车是否含有该商品
     $hasCartId = $this->checkProductIsCart($prodcutInfo['id'], $skuInfo['id']);
     if ($hasCartId) {
         $tableName = utils::getTableName($this->modelName);
         $sql = 'update ' . $tableName . ' set product_num = product_num + ' . $nums . ',group_num=' . $groupNum . ',group_day=' . $groupDay . ',start_time=' . $startTimeInt . ' where id = ' . $hasCartId;
         $this->model->executeSql($sql);
         $cartId = $hasCartId;
     } else {
         $saveData = array('product_id' => $prodcutInfo['id'], 'price' => $prodcutInfo['price'], 'product_num' => $nums, 'paddtime' => time(), 'user_id' => $userId, 'group_num' => $groupNum, 'group_day' => $groupDay, 'start_time' => $startTimeInt);
         if ($skuInfo) {
             $saveData['price'] = $skuInfo['price'];
             $saveData['sku_id'] = $skuInfo['id'];
         }
         $cartId = $this->model->insert($saveData);
     }
     return $cartId;
 }
예제 #6
0
 public function cancelOrder($id, $cancelOrderVal)
 {
     //判断订单是否在线支付,是否需要退款
     $orderInfo = $this->model->find($id);
     //订单有效判断
     $sessionUser = utils::getSessionVal('userInfo');
     $cancelStatus = array(1, 2, 3, 4);
     if (!in_array($orderInfo['pstatus'], $cancelStatus)) {
         return array('code' => '201', 'message' => '订单状态错误');
     }
     if ($orderInfo['shop_id'] != $sessionUser['shopId']) {
         return array('code' => '201', 'message' => '非法操作,你无权操作');
     }
     $returnPrice = false;
     if ($orderInfo['pay_status'] == 1) {
         $returnPrice = true;
     }
     $db = utils::getDB();
     $db->beginTransaction();
     $sessionUser['businessUserId'] = 6;
     $tableName = utils::getTableName('user');
     $sql = 'update ' . $tableName . ' set balance = balance - ' . $orderInfo['actual_total'] . ' where id = ' . $sessionUser['businessUserId'];
     $isTure = $this->model->executeSql($sql);
     if ($isTure) {
         $saveOrderData = array('id' => $orderInfo['id'], 'pstatus' => 6, 'actual_total' => 0, 'pay_status' => 3);
         $orderService = utils::getService('order');
         $orderService->model->save($saveOrderData);
         $db->commit();
     } else {
         $db->rollBack();
     }
 }
예제 #7
0
 public function getProductListByOrderIds($ids)
 {
     $tableName = utils::getTableName($this->modelName);
     $productResult = $this->model->querySql($tableName, array('*'), 'order_id in (' . implode(',', $ids) . ')');
     return $productResult;
 }
예제 #8
0
 public function getHomeByIds($ids)
 {
     $tableName = utils::getTableName($this->modelName);
     $shopList = $this->model->querySql($tableName, array('*'), 'id in (' . implode(',', $ids) . ')');
     return $shopList;
 }