mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-11-30 02:49:03 +08:00
web端仓库优化适配多商户
This commit is contained in:
parent
ae9b15fd90
commit
6555430624
@ -12,6 +12,7 @@ namespace app\admin\controller;
|
||||
|
||||
use think\facade\Hook;
|
||||
use app\service\AdminService;
|
||||
use app\service\SystemBaseService;
|
||||
|
||||
/**
|
||||
* 管理员
|
||||
@ -263,7 +264,7 @@ class Admin extends Common
|
||||
$this->assign('admin_login_type', MyC('admin_login_type', [], true));
|
||||
|
||||
// 背景图片
|
||||
$host = config('shopxo.attachment_host');
|
||||
$host = SystemBaseService::AttachmentHost();
|
||||
$bg_images_list = [
|
||||
$host.'/static/admin/default/images/login/1.jpg',
|
||||
$host.'/static/admin/default/images/login/2.jpg',
|
||||
|
@ -18,6 +18,7 @@ use app\service\AdminPowerService;
|
||||
use app\service\ConfigService;
|
||||
use app\service\ResourcesService;
|
||||
use app\service\StoreService;
|
||||
use app\service\SystemBaseService;
|
||||
|
||||
/**
|
||||
* 管理员公共控制器
|
||||
@ -248,7 +249,7 @@ class Common extends Controller
|
||||
$this->assign('default_price_regex', lang('common_regex_price'));
|
||||
|
||||
// 附件host地址
|
||||
$this->assign('attachment_host', config('shopxo.attachment_host'));
|
||||
$this->assign('attachment_host', SystemBaseService::AttachmentHost());
|
||||
|
||||
// css/js引入host地址
|
||||
$this->assign('public_host', config('shopxo.public_host'));
|
||||
|
@ -38,7 +38,13 @@
|
||||
<!-- 仓库信息 -->
|
||||
{{if !empty($module_data['warehouse_name'])}}
|
||||
<span class="warehouse-item-container am-fr">
|
||||
{{if !empty($module_data['warehouse_icon'])}}<i class="{{$module_data.warehouse_icon}}"></i>{{/if}}
|
||||
{{if !empty($module_data['warehouse_icon'])}}
|
||||
{{if IsUrl($module_data['warehouse_icon'])}}
|
||||
<img src="{{$module_data.warehouse_icon}}" alt="{{$module_data.warehouse_name}}" class="warehouse-icon" />
|
||||
{{else /}}
|
||||
<i class="{{$module_data.warehouse_icon}}"></i>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{if empty($module_data['warehouse_url'])}}
|
||||
<strong class="warehouse-name">{{$module_data.warehouse_name}}</strong>
|
||||
{{else /}}
|
||||
|
@ -11,6 +11,11 @@
|
||||
|
||||
// 应用公共文件
|
||||
|
||||
function IsUrl($value)
|
||||
{
|
||||
return in_array(substr($value, 0, 6), ['https:', 'http:/']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件快速排序
|
||||
* @author Devil
|
||||
|
@ -363,7 +363,7 @@ class Common extends Controller
|
||||
$this->assign('default_price_regex', lang('common_regex_price'));
|
||||
|
||||
// 附件host地址
|
||||
$this->assign('attachment_host', config('shopxo.attachment_host'));
|
||||
$this->assign('attachment_host', SystemBaseService::AttachmentHost());
|
||||
|
||||
// css/js引入host地址
|
||||
$this->assign('public_host', config('shopxo.public_host'));
|
||||
|
@ -264,7 +264,13 @@
|
||||
|
||||
<!-- 仓库信息 -->
|
||||
<span class="warehouse-item-container">
|
||||
{{if !empty($v['icon'])}}<i class="{{$v.icon}}"></i>{{/if}}
|
||||
{{if !empty($v['icon'])}}
|
||||
{{if IsUrl($v['icon'])}}
|
||||
<img src="{{$v.icon}}" alt="{{$v.name}}" class="warehouse-icon" />
|
||||
{{else /}}
|
||||
<i class="{{$v.icon}}"></i>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{if empty($v['url'])}}
|
||||
<strong class="warehouse-name">{{$v.name}}</strong>
|
||||
{{else /}}
|
||||
|
@ -142,7 +142,13 @@
|
||||
<div class="items-title am-fl">出货服务:</div>
|
||||
<div class="items-detail am-fl">
|
||||
<span class="warehouse-item-container">
|
||||
{{if !empty($data['warehouse_icon'])}}<i class="{{$data.warehouse_icon}}"></i>{{/if}}
|
||||
{{if !empty($data['warehouse_icon'])}}
|
||||
{{if IsUrl($data['warehouse_icon'])}}
|
||||
<img src="{{$data.warehouse_icon}}" alt="{{$data.warehouse_name}}" class="warehouse-icon" />
|
||||
{{else /}}
|
||||
<i class="{{$data.warehouse_icon}}"></i>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{if empty($data['warehouse_url'])}}
|
||||
<strong class="warehouse-name">{{$data.warehouse_name}}</strong>
|
||||
{{else /}}
|
||||
|
@ -30,7 +30,13 @@
|
||||
<!-- 仓库信息 -->
|
||||
{{if !empty($module_data['warehouse_name'])}}
|
||||
<span class="warehouse-item-container am-fr">
|
||||
{{if !empty($module_data['warehouse_icon'])}}<i class="{{$module_data.warehouse_icon}}"></i>{{/if}}
|
||||
{{if !empty($module_data['warehouse_icon'])}}
|
||||
{{if IsUrl($module_data['warehouse_icon'])}}
|
||||
<img src="{{$module_data.warehouse_icon}}" alt="{{$module_data.warehouse_name}}" class="warehouse-icon" />
|
||||
{{else /}}
|
||||
<i class="{{$module_data.warehouse_icon}}"></i>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{if empty($module_data['warehouse_url'])}}
|
||||
<strong class="warehouse-name">{{$module_data.warehouse_name}}</strong>
|
||||
{{else /}}
|
||||
|
@ -13,6 +13,7 @@ namespace app\service;
|
||||
use think\Db;
|
||||
use think\facade\Hook;
|
||||
use app\service\UserService;
|
||||
use app\service\SystemBaseService;
|
||||
|
||||
/**
|
||||
* 资源服务层
|
||||
@ -36,7 +37,7 @@ class ResourcesService
|
||||
public static function ContentStaticReplace($content, $type = 'get')
|
||||
{
|
||||
// 配置文件附件url地址
|
||||
$attachment_host = config('shopxo.attachment_host');
|
||||
$attachment_host = SystemBaseService::AttachmentHost();
|
||||
if(empty($attachment_host))
|
||||
{
|
||||
$attachment_host = substr(__MY_PUBLIC_URL__, 0, -1);
|
||||
@ -75,7 +76,7 @@ class ResourcesService
|
||||
public static function AttachmentPathHandle($value)
|
||||
{
|
||||
// 配置文件附件url地址
|
||||
$attachment_host = config('shopxo.attachment_host');
|
||||
$attachment_host = SystemBaseService::AttachmentHost();
|
||||
$attachment_host_path = empty($attachment_host) ? __MY_PUBLIC_URL__ : $attachment_host.DS;
|
||||
|
||||
// 替换处理
|
||||
@ -125,7 +126,7 @@ class ResourcesService
|
||||
{
|
||||
if(substr($value, 0, 4) != 'http')
|
||||
{
|
||||
return config('shopxo.attachment_host').$value;
|
||||
return SystemBaseService::AttachmentHost().$value;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
@ -474,5 +474,18 @@ class SystemBaseService
|
||||
// 获取内容
|
||||
return ConfigService::ConfigContentRow('common_agreement_'.$params['document']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 附件地址
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-07-06
|
||||
* @desc description
|
||||
*/
|
||||
public static function AttachmentHost()
|
||||
{
|
||||
return config('shopxo.attachment_host');
|
||||
}
|
||||
}
|
||||
?>
|
@ -11,6 +11,7 @@
|
||||
namespace app\service;
|
||||
|
||||
use app\service\ResourcesService;
|
||||
use app\service\SystemBaseService;
|
||||
|
||||
/**
|
||||
* 百度编辑器附件服务层
|
||||
@ -275,7 +276,7 @@ class UeditorService
|
||||
$field_name = self::$current_config['catcherFieldName'];
|
||||
|
||||
// 当前站点域名或者附件域名不下载
|
||||
$attachment_host = GetUrlHost(config('shopxo.attachment_host'));
|
||||
$attachment_host = GetUrlHost(SystemBaseService::AttachmentHost());
|
||||
|
||||
// 抓取远程图片
|
||||
$list = array();
|
||||
|
@ -15,6 +15,7 @@ use think\facade\Hook;
|
||||
use app\service\RegionService;
|
||||
use app\service\SafetyService;
|
||||
use app\service\ResourcesService;
|
||||
use app\service\SystemBaseService;
|
||||
|
||||
/**
|
||||
* 用户服务层
|
||||
@ -156,7 +157,7 @@ class UserService
|
||||
{
|
||||
$v['avatar'] = ResourcesService::AttachmentPathViewHandle($v['avatar']);
|
||||
} else {
|
||||
$v['avatar'] = config('shopxo.attachment_host').'/static/index/'.strtolower(MyC('common_default_theme', 'default', true)).'/images/default-user-avatar.jpg';
|
||||
$v['avatar'] = SystemBaseService::AttachmentHost().'/static/index/'.strtolower(MyC('common_default_theme', 'default', true)).'/images/default-user-avatar.jpg';
|
||||
}
|
||||
}
|
||||
|
||||
@ -512,7 +513,7 @@ class UserService
|
||||
{
|
||||
$user['avatar'] = ResourcesService::AttachmentPathViewHandle($user['avatar']);
|
||||
} else {
|
||||
$user['avatar'] = config('shopxo.attachment_host').'/static/index/'.strtolower(config('DEFAULT_THEME', 'default')).'/images/default-user-avatar.jpg';
|
||||
$user['avatar'] = SystemBaseService::AttachmentHost().'/static/index/'.strtolower(config('DEFAULT_THEME', 'default')).'/images/default-user-avatar.jpg';
|
||||
}
|
||||
|
||||
// 移除特殊数据
|
||||
|
@ -14,6 +14,7 @@ use think\Db;
|
||||
use think\facade\Hook;
|
||||
use app\service\RegionService;
|
||||
use app\service\WarehouseGoodsService;
|
||||
use app\service\SystemBaseService;
|
||||
|
||||
/**
|
||||
* 仓库服务层
|
||||
@ -71,6 +72,12 @@ class WarehouseService
|
||||
$region = Db::name('Region')->where(['id'=>$ids])->column('name', 'id');
|
||||
}
|
||||
|
||||
// 附件地址
|
||||
$host = SystemBaseService::AttachmentHost();
|
||||
|
||||
// 仓库icon
|
||||
$warehouse_icon = $host.'/static/common/images/default-warehouse-icon.png';
|
||||
|
||||
// 循环处理数据
|
||||
foreach($data as &$v)
|
||||
{
|
||||
@ -87,10 +94,8 @@ class WarehouseService
|
||||
'warehouse_id' => $data_id,
|
||||
]);
|
||||
|
||||
// icon
|
||||
$v['icon'] = 'am-icon-cube';
|
||||
|
||||
// url地址
|
||||
// icon、url地址
|
||||
$v['icon'] = $warehouse_icon;
|
||||
$v['url'] = '';
|
||||
|
||||
// 地区
|
||||
|
@ -11,6 +11,7 @@
|
||||
namespace base;
|
||||
|
||||
use app\service\ResourcesService;
|
||||
use app\service\SystemBaseService;
|
||||
|
||||
/**
|
||||
* 二维码驱动
|
||||
@ -188,7 +189,7 @@ class Qrcode
|
||||
|
||||
// 验证下载地址域名
|
||||
$domain_arr = [
|
||||
GetUrlHost(config('shopxo.attachment_host')),
|
||||
GetUrlHost(SystemBaseService::AttachmentHost()),
|
||||
GetUrlHost(__MY_HOST__),
|
||||
];
|
||||
if(!in_array(GetUrlHost($url), $domain_arr))
|
||||
|
@ -834,4 +834,15 @@ button.colorpicker-submit img {
|
||||
form .am-panel .am-form-group:last-child,
|
||||
form .am-panel .business-form-group:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 仓库信息
|
||||
*/
|
||||
.warehouse-item-container * {
|
||||
vertical-align: middle;
|
||||
}
|
||||
.warehouse-item-container .warehouse-icon {
|
||||
widows: 14px;
|
||||
height: 14px;
|
||||
}
|
BIN
public/static/common/images/default-warehouse-icon.png
Normal file
BIN
public/static/common/images/default-warehouse-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
Loading…
Reference in New Issue
Block a user