protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $num_iid = MRequest::post('iid');
     //  商品id
     $cid = MRequest::post('cid');
     //  分类id
     $title = MRequest::post('title');
     $imgmd5 = MRequest::post('imgmd5');
     $imgtype = MRequest::post('imgtype');
     $price = MRequest::post('price');
     $stock = null;
     // $stock = MRequest::post('stock');
     $onsale = MRequest::post('onsale');
     $listtime = MRequest::post('listtime');
     $delisttime = MRequest::post('delisttime');
     $listtime = strtotime($listtime);
     $delisttime = strtotime($delisttime);
     DalItem::beginTransaction();
     try {
         DalItem::updateShopItem($num_iid, $shop->getID(), $cid, $title, $imgmd5, $imgtype, $price, $stock, $onsale, $listtime, $delisttime);
         $item = DalItem::getShopItem($shop->getID(), $num_iid, 'w');
         if (!$item) {
             throw new Exception("item not exists", -100);
         }
     } catch (Exception $e) {
         DalItem::rollback();
         return MJsonRespond::respondFail($e->getMessage());
     }
     DalItem::commit();
     return MJsonRespond::respondSuccess('成功', array('item' => $item));
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $cid = MRequest::request('cid');
     //  所属类别id
     $title = MRequest::request('title');
     $imgmd5 = MRequest::request('imgmd5');
     //  图片MD5
     $imgtype = MRequest::request('imgtype');
     //  图片类型(image/png, image/jpeg)
     $price = MRequest::request('price');
     // $stock = MRequest::request('stock');    //  库存
     $stock = 999;
     //  库存
     $onsale = MRequest::request('onsale');
     //  是否在售
     $listtime = MRequest::request('listtime');
     //  上架时间
     $delisttime = MRequest::request('delisttime');
     //  下架时间
     $listtime = strtotime($listtime);
     $delisttime = strtotime($delisttime);
     DalItem::beginTransaction();
     try {
         DalItem::addItem($shop->getID(), $cid, $title, $imgmd5, $imgtype, $price, $stock, $onsale, $listtime, $delisttime);
         $num_iid = DalItem::getInsertId();
         $item = DalItem::getShopItem($shop->getID(), $num_iid, 'w');
         DalItem::commit();
     } catch (Exception $e) {
         DalItem::rollback();
         return MJsonRespond::respondFail($e->getMessage());
     }
     return MJsonRespond::respondSuccess('成功', array('item' => $item));
 }
 protected function dashExecute(MUser $user, MShop $shop)
 {
     $orderNum = DalOrder::getShopOrderGroupNum($shop->getID());
     $this->assign('order_num', $orderNum);
     $this->pageMod = 'dashboard/order/summary.tpl.php';
     $this->title = '订单';
 }
 protected function dashExecute(MUser $user, MShop $shop)
 {
     $orderNum = DalOrder::getShopOrderGroupNum($shop->getID());
     $this->assign('order_num', $orderNum);
     $itemNum = DalItem::getShopItemCount($shop->getID());
     $this->assign('item_num', $itemNum);
     $this->pageMod = 'dashboard/home.tpl.php';
     $this->title = '后台管理';
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     try {
         $category = $shop->allCategories();
     } catch (Exception $e) {
         return MJsonRespond::respondFail('获取店铺分类失败');
     }
     return MJsonRespond::respondSuccess('成功', array('category' => $category));
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $numiid = MRequest::get('iid');
     try {
         $item = $shop->getItem($numiid);
     } catch (Exception $e) {
         return MJsonRespond::respondFail('获取商品列表失败');
     }
     return MJsonRespond::respondSuccess('成功', array('item' => $item->getMain()));
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $num_iid = MRequest::request('iid');
     try {
         DalItem::deleteShopItem($num_iid, $shop->getID());
         Observer::postNotify('item.delete', $num_iid);
     } catch (Exception $e) {
         return MJsonRespond::respondFail('删除失败');
     }
     return MJsonRespond::respondSuccess('成功');
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $cid = MRequest::request('cid');
     $newName = MRequest::request('name');
     try {
         $shop->updateCategory($cid, $newName);
         $category = $shop->getCategory($cid);
     } catch (Exception $e) {
         return MJsonRespond::respondFail('更新失败');
     }
     return MJsonRespond::respondSuccess('成功', array('category' => $category));
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $oid = MRequest::request('oid');
     try {
         LibOrder::shipShopOrder($shop->getID(), $oid);
     } catch (Exception $e) {
         return MJsonRespond::respondFail($e->getMessage());
     }
     $order = DalOrder::getShopOrder($shop->getID(), $oid);
     $order = array_pop(LibOrder::fillOrders(array($order)));
     return MJsonRespond::respondSuccess('成功', array('order' => $order));
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $cid = MRequest::request('cid');
     try {
         $shop->deleteCategory($cid);
     } catch (Exception $e) {
         if (in_array($e->getCode(), array(ERR_CATEGORY_NOT_EXIST))) {
             return MJsonRespond::respondFail($e->getMessage());
         }
         return MJsonRespond::respondFail('删除失败');
     }
     return MJsonRespond::respondSuccess('成功');
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $lng = MRequest::post('lng');
     $lat = MRequest::post('lat');
     $address = MRequest::post('address');
     $radius = MRequest::post('radius');
     $servetime = MRequest::post('servetime');
     try {
         DalShop::addOrUpdateShopGeo($shop->getID(), $lng, $lat, $address, $radius, $servetime);
     } catch (Exception $e) {
         return MJsonRespond::respondFail($e->getMessage());
     }
     return MJsonRespond::respondSuccess('成功');
 }
 protected function dashExecute(MUser $user, MShop $shop)
 {
     $category = $shop->allCategories();
     $catkv = array();
     foreach ($category as $c1) {
         if (isset($c1['nodes'])) {
             foreach ($c1['nodes'] as $node) {
                 $catkv[$node['cid']] = $node['name'];
             }
         }
     }
     $this->assign('category', $catkv);
     $this->pageMod = 'dashboard/shop/itemmanage.tpl.php';
     $this->title = '商品管理';
 }
 public final function pageExecute(MUser $me, MShop $shop)
 {
     $this->dashExecute($me, $me->getShop());
     $this->assign('pageMod', $this->pageMod);
     $leftnav = $this->leftnav();
     $topnav = $this->topnav();
     $this->assign('topnav', $topnav);
     $this->assign('leftnav', $leftnav);
     $newOrderCount = DalOrder::getNewOrderCount($shop->getID());
     $this->assign('new_order', $newOrderCount);
     $leftnavTpl = Config::configForKeyPath('nav.' . $topnav . '.left');
     $this->assign('leftnavTpl', $leftnavTpl);
     $bc = $this->getBreadcrumbs();
     $this->assign('breadcrumbs', $bc);
     $this->page = 'dashboard/framework.tpl.php';
 }
示例#14
0
 public function getShop()
 {
     if (!$this->shop) {
         $this->shop = MShop::shopByUID($this->getID());
     }
     return $this->shop;
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $cid = MRequest::post('cid');
     $ps = (int) MRequest::post('ps');
     $pn = (int) MRequest::post('pn');
     $ps = max(0, $ps);
     if (!$pn) {
         $pn = 20;
     }
     try {
         $itemlist = $shop->getShopItems($cid, $ps, $pn);
         $foundrows = $shop->totalCount();
     } catch (Exception $e) {
         return MJsonRespond::respondFail('获取商品列表失败');
     }
     return MJsonRespond::respondSuccess('成功', array('itemlist' => $itemlist, 'total' => $foundrows));
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $shopname = MRequest::post('shopname');
     $intro = MRequest::post('intro');
     $imgmd5 = MRequest::post('imgmd5');
     $imgtype = MRequest::post('imgtype');
     $tel = MRequest::post('tel');
     $bulletin = '';
     $qq = '';
     $email = '';
     try {
         DalShop::updateShop($shop->getID(), $shopname, $intro, $bulletin, $qq, $tel, $email, $imgmd5, $imgtype);
     } catch (Exception $e) {
         return MJsonRespond::respondFail($e->getMessage());
     }
     return MJsonRespond::respondSuccess('成功');
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $parent_cid = intval(MRequest::request('parent_cid'));
     $name = MRequest::request('name');
     $sid = $shop->getID();
     $intro = '';
     try {
         $cid = $shop->addCategory($parent_cid, $name, time());
     } catch (DBException $e) {
         return MJsonRespond::respondFail('创建失败');
     }
     try {
         $category = DalCategory::getCategory($cid, $shop->getID());
     } catch (DBException $e) {
         return MJsonRespond::respondFail('数据库访问失败');
     }
     return MJsonRespond::respondSuccess('创建成功', array('category' => $category));
 }
 protected function ajaxExecute(MUser $me, MShop $shop)
 {
     $ps = (int) MRequest::get('ps');
     $pn = (int) MRequest::get('pn');
     $sid = $shop->getID();
     $status = (int) MRequest::get('st');
     $sort = (int) MRequest::get('sort');
     $ps = max(0, $ps);
     if (!$pn) {
         $pn = 20;
     }
     if ($sort === 0) {
         $orders = DalOrder::getShopEarliestOrders($sid, $status, $ps, $pn);
     } else {
         $orders = DalOrder::getShopLatestOrders($sid, $status, $ps, $pn);
     }
     $total = DalOrder::totalCount();
     if (empty($orders)) {
         return MJsonRespond::respondSuccess('', array('orders' => $orders, 'total' => $total));
     }
     $orders = LibOrder::fillOrders($orders);
     return MJsonRespond::respondSuccess('成功', array('orders' => $orders, 'total' => $total));
 }
 protected function dashExecute(MUser $user, MShop $shop)
 {
     $itemNum = DalItem::getShopItemCount($shop->getID());
     $this->assign('item_num', $itemNum);
     $this->pageMod = 'dashboard/shop/summary.tpl.php';
 }
 protected function dashExecute(MUser $user, MShop $shop)
 {
     $this->assign('shopinfo', $shop->getMain());
     $this->pageMod = 'dashboard/shop/setting.tpl.php';
 }
 protected function dashExecute(MUser $user, MShop $shop)
 {
     $this->assign('geo', $shop->getShopGeo());
     $this->pageMod = 'dashboard/shop/geo.tpl.php';
 }