Ejemplo n.º 1
0
 public function saveSelf($selfData)
 {
     if (empty($selfData['shop_id'])) {
         throw new \LogicException(app::get('sysshop')->_('请先去添加自营企业!'));
     }
     $selfData['license'] = 'on';
     $selfData['seller_type'] = '0';
     shopAuth::checkSignupAccount(trim($selfData['login_account']));
     shopAuth::checkPassport($selfData['login_password'], $selfData['psw_confirm']);
     shopAuth::checkSignup($selfData);
     $selfAccountSeller = $this->__preAccountSeller($selfData);
     $accountShopModel = app::get('sysshop')->model('account');
     $selfUserModel = app::get('sysshop')->model('seller');
     if ($selfUserModel->getRow('*', array('shop_id' => $selfData['shop_id']))) {
         throw new \LogicException(app::get('sysshop')->_('该自营企业已在使用!'));
     }
     $db = app::get('sysshop')->database();
     $db->beginTransaction();
     try {
         $sellerId = $accountShopModel->insert($selfAccountSeller);
         if (!$sellerId) {
             throw new \LogicException(app::get('sysshop')->_('添加失败'));
         }
         $sellerData = $this->__preSeller($sellerId, $selfData);
         if (!$selfUserModel->insert($sellerData)) {
             throw new \LogicException(app::get('sysshop')->_('添加失败'));
         }
         $db->commit();
     } catch (\Excessive $e) {
         $db->rollback();
         throw $e;
     }
     return true;
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
 public function save($params)
 {
     $params['seller_type'] = '1';
     if (!$params['role_id'] || $params['role_id'] == '0') {
         throw new \LogicException('请选择角色');
     }
     return shopAuth::signupSeller($params, true);
 }
Ejemplo n.º 5
0
 public function get($params)
 {
     $objMdlSeller = app::get('sysshop')->model('seller');
     $data = $objMdlSeller->getRow('*', ['seller_id' => $params['seller_id'], 'shop_id' => $params['shop_id']]);
     if ($data) {
         $data['login_account'] = shopAuth::getSellerName($params['seller_id']);
     }
     return $data;
 }
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 7
0
 /**
  * @brief  企业密码执行
  *
  * @return
  */
 public function update_shop_pwd()
 {
     try {
         $seller_id = $_POST['seller_id'];
         $data = $_POST;
         shopAuth::resetPwd($seller_id, $data);
         $this->adminlog("修改企业密码[{$seller_id}:{$seller_id}]", 1);
     } catch (Exception $e) {
         $this->adminlog("修改企业密码[{$seller_id}:{$seller_id}]", 0);
         $msg = $e->getMessage();
         return $this->splash('error', null, $msg);
     }
     $msg = app::get('sysshop')->_('修改成功');
     return $this->splash('success', null, $msg);
 }
Ejemplo n.º 8
0
 public function handle($request, Clousure $next)
 {
     $routeAs = route::currentRouteName();
     $currentPermission = shopAuth::getSellerPermission();
     //$currentPermission = false 表示为店主不用判断权限
     //获取当前用户的路由权限
     if ($currentPermission && !in_array($routeAs, $currentPermission)) {
         if (request::ajax()) {
             return response::json(array('error' => true, 'message' => '无操作权限'));
         } else {
             return redirect::action('topshop_ctl_index@nopermission');
         }
     }
     return $next($request);
 }
Ejemplo n.º 9
0
 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 '导出参数错误';
     }
 }
Ejemplo n.º 10
0
 /**
  * @brief 审核页面
  *
  * @param $enterapplyId
  *
  * @return html
  */
 public function doExamine($enterapplyId)
 {
     $objMdlEnterapply = app::get('sysshop')->model('enterapply');
     $list = $objMdlEnterapply->getRow('*', array('enterapply_id' => $enterapplyId));
     $shop = unserialize($list['shop']);
     $checkBrand = array('shop_type' => $list['shop_type'], 'shop' => array('shop_brand' => $shop['shop_brand']));
     $list['seller_name'] = shopAuth::getSellerName($list['seller_id']);
     $list['shoptype'] = $this->shoptype[$list['shop_type']];
     $cat = app::get('sysshop')->rpcCall('category.cat.get.info', array('cat_id' => $shop['shop_cat']))[$shop['shop_cat']];
     if ($shop['shop_brand']) {
         $brand = app::get('sysshop')->rpcCall('category.brand.get.list', array('brand_id' => $shop['shop_brand']))[$shop['shop_brand']];
     }
     if ($list['new_brand']) {
         $brand = app::get('sysshop')->rpcCall('category.brand.get.list', array('brand_name' => $list['new_brand']));
         if ($brand) {
             $brand = reset($brand);
         }
     }
     try {
         $checkB = kernel::single('sysshop_data_enterapply')->checkBrand($checkBrand, $msg);
     } catch (\LogicException $e) {
         echo $brand['brand_name'] . $e->getMessage();
         exit;
     }
     if (!$checkB) {
         $pagedata['checkbrand'] = $msg;
     }
     $shop['brand_name'] = $brand['brand_name'];
     $shop['shop_cat'] = $cat['cat_name'];
     $shopinfo = unserialize($list['shop_info']);
     $shopinfo['corporate_identity_img'] = base_storager::modifier($shopinfo['corporate_identity_img'], 's');
     $shopinfo['tissue_code_img'] = base_storager::modifier($shopinfo['tissue_code_img'], 's');
     $shopinfo['tax_code_img'] = base_storager::modifier($shopinfo['tax_code_img'], 's');
     $shopinfo['shopuser_identity_img'] = base_storager::modifier($shopinfo['shopuser_identity_img'], 's');
     $shopinfo['license_img'] = base_storager::modifier($shopinfo['license_img'], 's');
     $shopinfo['brand_warranty'] = base_storager::modifier($shopinfo['brand_warranty'], 's');
     $pagedata['shop'] = $shop;
     $pagedata['shop_info'] = $shopinfo;
     $pagedata['itemdata'] = $list;
     return $this->page('sysshop/admin/enterapply/examine.html', $pagedata);
 }
Ejemplo n.º 11
0
 public function modifyPwd()
 {
     $params['shop_id'] = $this->shopId;
     $params['seller_id'] = input::get('seller_id');
     $data = app::get('topshop')->rpcCall('account.shop.user.get', $params);
     if (!$data || $data['seller_type'] != '1') {
         $msg = '修改失败';
         return $this->splash('error', $url, $msg, true);
     }
     try {
         $setPwdData['login_password'] = input::get('login_password');
         $setPwdData['psw_confirm'] = input::get('psw_confirm');
         shopAuth::resetPwd($params['seller_id'], $setPwdData);
     } catch (\LogicException $e) {
         $msg = $e->getMessage();
         return $this->splash('error', $url, $msg, true);
     }
     $msg = '修改成功';
     $url = url::action('topshop_ctl_account_list@index');
     return $this->splash('success', $url, $msg, true);
 }
Ejemplo n.º 12
0
 public function createc()
 {
     $data = utils::_filter_input(input::get());
     $a = $data['pam_user'];
     $codyKey = $data['key'];
     $verifycode = $data['verifycode'];
     $userInfo = $data['pam_user'];
     $vcode = $data['vcode'];
     $seller_type = $data["seller_type"];
     if ($seller_type != "1" && $seller_type != "2" && $seller_type != "0") {
         return $this->splash('error', null, "请选择企业类型");
     }
     try {
         // $accountType = kernel::single('pam_tools')->checkLoginNameType($userInfo['account']);
         // if($accountType == "mobile")
         // {
         //     $vcodeData=userVcode::verify($vcode,$userInfo['account'],'signup');
         //     if(!$vcodeData)
         //     {
         //         throw new \LogicException(app::get('topc')->_('手机验证码错误'));
         //     }
         // }
         // else
         // {
         //     if( empty($verifycode) || !base_vcode::verify($codyKey,$verifycode) )
         //     {
         //         throw new \LogicException(app::get('topc')->_('验证码填写错误'));
         //     }
         // }
         $shopInfo = array("login_account" => $userInfo['account'], "login_password" => $userInfo['password'], "psw_confirm" => $userInfo['pwd_confirm'], "name" => $userInfo['con_name'], "mobile" => $userInfo["phone"], "email" => $userInfo["email"], "license" => "on");
         $a = 1;
         shopAuth::signupSeller($shopInfo);
         $userId = userAuth::signUp($userInfo['account'], $userInfo['password'], $userInfo['pwd_confirm']);
         //shopAuth::signupSeller($shopInfo);
         userAuth::login($userId, $userInfo['account']);
         $sql = "UPDATE sysshop_seller set seller_type=" . $seller_type . " where seller_id in  (select seller_id from sysshop_account where login_account = '" . $userInfo['account'] . "' )";
         $result = app::get('sysshop')->database()->executeUpdate($sql);
     } catch (Exception $e) {
         $msg = $e->getMessage();
         return $this->splash('error', $url, $msg, true);
     }
     $url = url::action('topc_ctl_passport@signupSuccess', ['next_page' => $this->__getFromUrl()]);
     return $this->splash('success', $url, null, true);
 }
Ejemplo n.º 13
0
 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);
 }
Ejemplo n.º 14
0
 public function updatepwd()
 {
     try {
         shopAuth::modifyPwd(input::get());
     } catch (Exception $e) {
         $msg = $e->getMessage();
         return $this->splash('error', null, $msg, true);
     }
     $url = url::action('topshop_ctl_passport@signin');
     $msg = app::get('topshop')->_('修改成功,请重新登陆');
     pamAccount::logout();
     return $this->splash('success', $url, $msg, true);
 }
Ejemplo n.º 15
0
 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));
             }
         }
     }
 }
Ejemplo n.º 16
0
 /**
  * @brief 获取到商家中心的导航菜单和左边栏菜单
  *
  * @return array $res
  */
 private function __getMenu()
 {
     $currentPermission = shopAuth::getSellerPermission();
     $defaultActionName = route::current()->getActionName();
     $shopMenu = config::get('shop');
     $shortcutMenuAction = $this->getShortcutMenu();
     $sidebar['commonUser']['label'] = '常用菜单';
     $sidebar['commonUser']['shortcutMenu'] = true;
     $sidebar['commonUser']['active'] = true;
     //是否展开
     $sidebar['commonUser']['icon'] = 'glyphicon glyphicon-heart';
     //$sidebar['commonUser']['menu'] = $commonUserMenu;
     foreach ((array) $shopMenu as $menu => $row) {
         if ($row['display'] === false) {
             continue;
         }
         foreach ((array) $row['menu'] as $k => $params) {
             //编辑常用菜单使用
             if ($params['display'] !== false && (!$currentPermission || in_array($params['as'], $currentPermission))) {
                 $allMenu[$menu]['label'] = $row['label'];
                 if (in_array($params['action'], $shortcutMenuAction)) {
                     $sidebar['commonUser']['menu'][] = $params;
                     $params['isShortcutMenu'] = true;
                 }
                 $allMenu[$menu]['menu'][] = $params;
             }
             if ($row['shopIndex'] || !$currentPermission || $params['display'] && in_array($params['as'], $currentPermission)) {
                 if (!$navbar[$menu]) {
                     $navbar[$menu]['label'] = $row['label'];
                     $navbar[$menu]['icon'] = $row['icon'];
                     $navbar[$menu]['action'] = $navbar[$menu]['action'] ? $navbar[$menu]['action'] : $params['action'];
                     $navbar[$menu]['default'] = false;
                 }
             }
             //如果为当前的路由则高亮
             if (!$navbar[$menu]['default'] && $params['action'] == $defaultActionName && $navbar[$menu]) {
                 $navbar[$menu]['default'] = true;
                 $selectMenu = $menu;
             }
         }
         if (!$row['shopIndex'] && $selectMenu == $menu) {
             foreach ((array) $row['menu'] as $k => $params) {
                 $sidebar[$menu]['active'] = true;
                 $sidebar[$menu]['label'] = $row['label'];
                 $sidebar[$menu]['icon'] = $row['icon'];
                 if (!$currentPermission || in_array($params['as'], $currentPermission)) {
                     $params['default'] = $params['action'] == $defaultActionName ? true : false;
                     $sidebar[$menu]['menu'][] = $params;
                 }
             }
         }
     }
     $res['all'] = $allMenu;
     $res['navbar'] = $navbar;
     $res['sidebar'] = $sidebar;
     return $res;
 }
Ejemplo n.º 17
0
 public function login($params)
 {
     $return = ['status' => 'success', 'data' => shopAuth::apiLogin($params['loginname'], $params['password'])];
     $return['data']['sellerId'] = $return['data']['sellerId'];
     return $return;
 }