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 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 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) { $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 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 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) { $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) { $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('成功'); }
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'; }
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) { $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'; }