public function edit_coupon() { $this->contentHeaderTitle = app::get('topshop')->_('新添/编辑优惠券'); $apiData['coupon_id'] = input::get('coupon_id'); $apiData['coupon_itemList'] = true; if ($apiData['coupon_id']) { $pagedata = app::get('topshop')->rpcCall('promotion.coupon.get', $apiData); $pagedata['valid_time'] = date('Y/m/d', $pagedata['canuse_start_time']) . '-' . date('Y/m/d', $pagedata['canuse_end_time']); $pagedata['cansend_time'] = date('Y/m/d', $pagedata['cansend_start_time']) . '-' . date('Y/m/d', $pagedata['cansend_end_time']); if ($pagedata['shop_id'] != $this->shopId) { return $this->splash('error', '', '您没有权限编辑此优惠券', true); } $objMdlCouponItem = app::get('syspromotion')->model('coupon_item'); $notEndItem = $objMdlCouponItem->getList('item_id', array('canuse_end_time|than' => time(), 'coupon_id' => $couponId)); $notItems = array_column($notEndItem, 'item_id'); $pagedata['notEndItem'] = json_encode($notItems, true); } $valid_grade = explode(',', $pagedata['valid_grade']); $pagedata['gradeList'] = app::get('topshop')->rpcCall('user.grade.list'); foreach ($pagedata['gradeList'] as &$v) { if (in_array($v['grade_id'], $valid_grade)) { $v['is_checked'] = true; } } // $pagedata['shopCatList'] = json_decode($this->getCatList(),true); $shopId = shopAuth::getShopId(); $pagedata['shopCatList'] = app::get('topshop')->rpcCall('shop.authorize.cat', array('shop_id' => $shopId)); return $this->page('topshop/promotion/coupon/edit.html', $pagedata); }
public function index() { $shopdata = app::get('topshop')->rpcCall('shop.get', array('shop_id' => shopAuth::getShopId()), 'seller'); $pagedata['shop'] = $shopdata; $this->contentHeaderTitle = app::get('topshop')->_('企业设置'); return $this->page('topshop/shop/setting.html', $pagedata); }
public function getSellerShopId($params) { if (is_null($params['oauth']) && is_null($params['seller_id'])) { throw new \LogicException('登录用户信息有误'); } if (!$params['seller_id'] && $oauth) { $params['seller_id'] = $oauth['account_id']; unset($params['oauth']); } $shopId = shopAuth::getShopId($params['seller_id']); return $shopId; }
public function export() { //导出 if (input::get('filter')) { $filter = json_decode(input::get('filter'), true); } $permission = ['systrade' => ['trade', 'order'], 'sysclearing' => ['settlement', 'settlement_detail']]; $app = input::get('app', false); $model = input::get('model', false); if (input::get('name') && $app && $model && $permission[$app] && in_array($model, $permission[$app])) { $model = $app . '_mdl_' . $model; $filter['shop_id'] = shopAuth::getShopId(); kernel::single('importexport_export')->fileDownload(input::get('filetype'), $model, input::get('name'), $filter); } else { echo '导出参数错误'; } }
public function searchItem() { $shopId = shopAuth::getShopId(); $catId = input::get('catId'); $brandId = input::get('brandId'); $keywords = input::get('searchname'); $widgetsId = input::get('widgetsId'); if ($brandId) { $searchParams = array('shop_id' => $shopId, 'cat_id' => $catId, 'brand_id' => $brandId, 'search_keywords' => $keywords); } else { $searchParams = array('shop_id' => $shopId, 'cat_id' => $catId, 'search_keywords' => $keywords); } if ($widgetsId) { $objMdlCouponItem = app::get('sysdecorate')->model('widgets_instance'); $notEndItem = $objMdlCouponItem->getRow('params', array('widgets_id' => $widgetsId)); $pagedata['notEndItem'] = $notEndItem['params']['item_id']; } else { $pagedata['notEndItem'] = array(); } $searchParams['fields'] = 'item_id,title,image_default_id,price'; $itemsList = app::get('topshop')->rpcCall('item.search', $searchParams); $pagedata['itemsList'] = $itemsList['list']; $pagedata['image_default_id'] = app::get('image')->getConf('image.set'); return json_encode($pagedata, true); }
public function delWapInfo($widgetsId, $shopId, $widgetsName) { if (!$shopId) { $shopId = shopAuth::getShopId(); } if (!$widgetsId) { throw new \LogicException(app::get('sysdecorate')->_('挂件id不能为空!')); } $reault = $this->objMdlWidgetsInstance->delete(array('widgets_id' => $widgetsId, 'shop_id' => $shopId)); if ($reault) { if ($widgetsName == 'waptags') { $sort = unserialize(app::get('topshop')->getConf('wap_decorate.tagSort')); if (is_array($widgetsId)) { foreach ($widgetsId as $key => $value) { unset($sort[$value]); } app::get('topshop')->setConf('wap_decorate.tagSort', serialize($sort)); } else { unset($sort[$widgetsId]); app::get('topshop')->setConf('wap_decorate.tagSort', serialize($sort)); } } elseif ($widgetsName == 'wapshowitems') { $sort = unserialize(app::get('topshop')->getConf('wap_decorate.showItemSort')); if (is_array($widgetsId)) { foreach ($widgetsId as $key => $value) { unset($sort[$value]); } app::get('topshop')->setConf('wap_decorate.showItemSort', serialize($sort)); } else { unset($sort[$widgetsId]); app::get('topshop')->setConf('wap_decorate.showItemSort', serialize($sort)); } } } }