mirror of
https://gitee.com/ShopeX/OMS
synced 2026-03-23 02:45:33 +08:00
71 lines
2.8 KiB
PHP
71 lines
2.8 KiB
PHP
<?php
|
||
/**
|
||
* Copyright © ShopeX (http://www.shopex.cn). All rights reserved.
|
||
* See LICENSE file for license details.
|
||
*/
|
||
|
||
class ome_branch_view extends desktop_controller{
|
||
|
||
/**
|
||
* 获取BranchView
|
||
* @param mixed $branch_id ID
|
||
* @param mixed $url url
|
||
* @param mixed $title title
|
||
* @param mixed $method method
|
||
* @return mixed 返回结果
|
||
*/
|
||
public function getBranchView($branch_id, $url, $title='查看', $method='GET'){
|
||
//$render = app::get('ome')->render();
|
||
if ($branch_id){
|
||
$this->pagedata['branch_id'] = $branch_id;
|
||
return $branch_id;
|
||
}else {
|
||
$oBranch = app::get('ome')->model('branch');
|
||
$is_super = kernel::single('desktop_user')->is_super();
|
||
$branch_ids = $oBranch->getBranchByUser(true);
|
||
if (!$is_super){
|
||
$branch_ids = $oBranch->getBranchByUser(true);
|
||
if ($branch_ids){
|
||
if (count($branch_ids) > 1){
|
||
$this->pagedata['branch_list'] = $branch_ids;
|
||
$this->pagedata['name'] = $title;
|
||
$this->pagedata['url'] = $url;
|
||
$this->pagedata['method'] = $method;
|
||
$this->page("admin/branch/exist_branch.html");
|
||
exit;
|
||
}else {
|
||
$this->pagedata['branch_id'] = $branch_ids[0]['branch_id'];
|
||
return $branch_ids[0]['branch_id'];
|
||
}
|
||
}else{
|
||
$this->pagedata['name'] = $title;
|
||
$this->pagedata['url'] = $url;
|
||
$this->pagedata['method'] = $method;
|
||
$this->page("admin/branch/exist_branch.html");
|
||
exit;
|
||
}
|
||
}else {
|
||
$branch_ids = $oBranch->getList('branch_id,name,uname,phone,mobile','',0,-1);
|
||
if ($branch_ids){
|
||
if (count($branch_ids) > 1){
|
||
$this->pagedata['branch_list'] = $branch_ids;
|
||
$this->pagedata['name'] = $title;
|
||
$this->pagedata['url'] = $url;
|
||
$this->pagedata['method'] = $method;
|
||
$this->page("admin/branch/exist_branch.html");
|
||
exit;
|
||
}else {
|
||
$this->pagedata['branch_id'] = $branch_ids[0]['branch_id'];
|
||
return $branch_ids[0]['branch_id'];
|
||
}
|
||
}else{
|
||
$this->pagedata['name'] = $title;
|
||
$this->pagedata['url'] = $url;
|
||
$this->pagedata['method'] = $method;
|
||
$this->page("admin/branch/exist_branch.html");
|
||
exit;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} |