提交 a67f2624 编写于 作者: D devil

商品详情二维码改为静态,动态表格组件优化

上级 36d04c0e
...@@ -124,6 +124,16 @@ class Common extends Controller ...@@ -124,6 +124,16 @@ class Common extends Controller
// 公共表格钩子名称动态处理 // 公共表格钩子名称动态处理
$current = 'plugins_view_admin_'.$this->controller_name; $current = 'plugins_view_admin_'.$this->controller_name;
// 是否插件默认下
if($this->controller_name == 'plugins')
{
if(!empty($this->data_request['pluginsname']))
{
$current .= '_'.trim($this->data_request['pluginsname']);
}
}
// 内容外部顶部 // 内容外部顶部
$this->assign('hook_name_content_top', $current.'_content_top'); $this->assign('hook_name_content_top', $current.'_content_top');
// 内容外部底部 // 内容外部底部
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
<div class="am-form-group"> <div class="am-form-group">
<label>{{$data.common_app_weixin_liveplayer_ver.name}}</label> <label>{{$data.common_app_weixin_liveplayer_ver.name}}</label>
<div class="am-alert am-alert-warning"> <div class="am-alert am-alert-warning">
<p>1. 获取最新组件版本号,默认[ 1.0.18 ]</p> <p>1. 获取最新组件版本号,默认[ 1.1.4 ]</p>
<p>2. 登录微信小程序平台,左侧导航[ 直播 ],申请直播权限后等待审核通过方可使用</p> <p>2. 登录微信小程序平台,左侧导航[ 直播 ],申请直播权限后等待审核通过方可使用</p>
<p>3. 点击左侧导航[ 小程序直播->接入说明 ],找到[ 使用方法说明->1. 【直播组件】如何引入 ],json 代码串[ plugins->live-player-plugin ]参数下的[ version ]的值填入</p> <p>3. 点击左侧导航[ 小程序直播->接入说明 ],找到[ 使用方法说明->1. 【直播组件】如何引入 ],json 代码串[ plugins->live-player-plugin ]参数下的[ version ]的值填入</p>
<a href="https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/live-player-plugin.html" target="_blank">去获取组件版本号 <i class="am-icon-external-link"></i></a> <a href="https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/live-player-plugin.html" target="_blank">去获取组件版本号 <i class="am-icon-external-link"></i></a>
......
...@@ -16,12 +16,11 @@ ...@@ -16,12 +16,11 @@
<!-- 钩子 --> <!-- 钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div class="plugins-tag"> <div class="plugins-tag">
<span>plugins_view_admin_goods_top_operate</span> <span>{{$hook_name_form_top_operate}}</span>
</div> </div>
{{/if}} {{/if}}
{{php}} {{php}}
$hook_name = 'plugins_view_admin_goods_top_operate'; $hook_data = Hook::listen($hook_name_form_top_operate, ['hook_name'=>$hook_name_form_top_operate, 'is_backend'=>true]);
$hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>true]);
if(!empty($hook_data) && is_array($hook_data)) if(!empty($hook_data) && is_array($hook_data))
{ {
foreach($hook_data as $hook) foreach($hook_data as $hook)
......
...@@ -169,6 +169,16 @@ class Common extends Controller ...@@ -169,6 +169,16 @@ class Common extends Controller
// 公共表格钩子名称动态处理 // 公共表格钩子名称动态处理
$current = 'plugins_view_index_'.$this->controller_name; $current = 'plugins_view_index_'.$this->controller_name;
// 是否插件默认下
if($this->controller_name == 'plugins')
{
if(!empty($this->data_request['pluginsname']))
{
$current .= '_'.trim($this->data_request['pluginsname']);
}
}
// 内容外部顶部 // 内容外部顶部
$this->assign('hook_name_content_top', $current.'_content_top'); $this->assign('hook_name_content_top', $current.'_content_top');
// 内容外部底部 // 内容外部底部
......
...@@ -95,7 +95,9 @@ class Goods extends Common ...@@ -95,7 +95,9 @@ class Goods extends Common
} }
// 二维码 // 二维码
$this->assign('qrcode_url', MyUrl('index/qrcode/index', ['content'=>urlencode(base64_encode(MyUrl('index/goods/index', ['id'=>$goods_id], true, true)))])); $qrcode = GoodsService::GoodsQrcode($goods_id, $goods['add_time']);
$qrcode_url = ($qrcode['code'] == 0 && isset($qrcode['data']['url'])) ? $qrcode['data']['url'] : '';
$this->assign('qrcode_url', $qrcode_url);
// 商品评分 // 商品评分
$goods_score = GoodsCommentsService::GoodsCommentsScore($goods_id); $goods_score = GoodsCommentsService::GoodsCommentsScore($goods_id);
......
...@@ -16,12 +16,11 @@ ...@@ -16,12 +16,11 @@
<!-- 钩子 --> <!-- 钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div class="plugins-tag"> <div class="plugins-tag">
<span>plugins_view_admin_goods_top_operate</span> <span>{{$hook_name_form_top_operate}}</span>
</div> </div>
{{/if}} {{/if}}
{{php}} {{php}}
$hook_name = 'plugins_view_admin_goods_top_operate'; $hook_data = Hook::listen($hook_name_form_top_operate, ['hook_name'=>$hook_name_form_top_operate, 'is_backend'=>true]);
$hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>true]);
if(!empty($hook_data) && is_array($hook_data)) if(!empty($hook_data) && is_array($hook_data))
{ {
foreach($hook_data as $hook) foreach($hook_data as $hook)
......
...@@ -255,7 +255,7 @@ class AppMiniService ...@@ -255,7 +255,7 @@ class AppMiniService
if(is_array($data) && isset($data['plugins'])) if(is_array($data) && isset($data['plugins']))
{ {
$data['plugins']['live-player-plugin'] = [ $data['plugins']['live-player-plugin'] = [
'version' => MyC('common_app_weixin_liveplayer_ver', '1.0.18', true), 'version' => MyC('common_app_weixin_liveplayer_ver', '1.1.4', true),
'provider' => 'wx2b03c6e691cd7370', 'provider' => 'wx2b03c6e691cd7370',
]; ];
if(file_put_contents($file, JsonFormat($data)) === false) if(file_put_contents($file, JsonFormat($data)) === false)
......
...@@ -2151,5 +2151,38 @@ class GoodsService ...@@ -2151,5 +2151,38 @@ class GoodsService
// 匹配商品销售模式 // 匹配商品销售模式
return DataReturn('success', 0, GoodsSalesModelType($site_type)); return DataReturn('success', 0, GoodsSalesModelType($site_type));
} }
/**
* 商品二维码生成
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-08-13
* @desc description
* @param [int] $goods_id [商品id]
* @param [int] $add_time [商品创建时间]
*/
public static function GoodsQrcode($goods_id, $add_time)
{
// 时间格式、是否已是时间格式
if(strstr($add_time, '-') != false)
{
$add_time = strtotime($add_time);
}
// 自定义路径和名称
$path = 'static'.DS.'upload'.DS.'images'.DS.'goods_qrcode'.DS.APPLICATION_CLIENT_TYPE.DS.date('Y', $add_time).DS.date('m', $add_time).DS.date('d', $add_time).DS;
$filename = $goods_id.'.png';
// 二维码处理参数
$params = [
'path' => DS.$path,
'filename' => $filename,
'content' => MyUrl('index/goods/index', ['id'=>$goods_id], true, true),
];
// 创建二维码
return (new \base\Qrcode())->Create($params);
}
} }
?> ?>
\ No newline at end of file
...@@ -1040,7 +1040,7 @@ class OrderService ...@@ -1040,7 +1040,7 @@ class OrderService
// 自提模式 添加订单取货码 // 自提模式 添加订单取货码
if($v['order_model'] == 2) if($v['order_model'] == 2)
{ {
$v['extraction_data'] = self::OrdersExtractionData($v['id'], $v['user_id']); $v['extraction_data'] = self::OrdersExtractionData($v['id']);
} }
} }
...@@ -1249,9 +1249,8 @@ class OrderService ...@@ -1249,9 +1249,8 @@ class OrderService
* @date 2019-11-26 * @date 2019-11-26
* @desc description * @desc description
* @param [int] $order_id [订单id] * @param [int] $order_id [订单id]
* @param [int] $user_id [用户id]
*/ */
private static function OrdersExtractionData($order_id, $user_id) private static function OrdersExtractionData($order_id)
{ {
// 必须返回的内容格式 // 必须返回的内容格式
$result = [ $result = [
...@@ -1266,30 +1265,17 @@ class OrderService ...@@ -1266,30 +1265,17 @@ class OrderService
$result['code'] = $code; $result['code'] = $code;
// 生成二维码参数 // 生成二维码参数
$qrcode_params = [ $params = [
'content' => $code, 'content' => $code,
'root_path' => ROOT.'public',
'path' => DS.'download'.DS.'order'.DS.'extraction_ode'.DS, 'path' => DS.'download'.DS.'order'.DS.'extraction_ode'.DS,
'filename' => $user_id.'_'.$order_id.'.png', 'filename' => $order_id.'.png',
]; ];
// 图片不存在则去生成二维码图片并保存至目录 // 图片不存在则去生成二维码图片并保存至目录
$file = $qrcode_params['root_path'].$qrcode_params['path'].$qrcode_params['filename']; $ret = (new \base\Qrcode())->Create($params);
if(!file_exists($file)) if($ret['code'] == 0)
{ {
$ret = (new \base\Qrcode())->Create($qrcode_params); $result['images'] = $ret['data']['url'];
if($ret['code'] == 0)
{
$result['images'] = $qrcode_params['path'].$qrcode_params['filename'];
}
} else {
$result['images'] = $qrcode_params['path'].$qrcode_params['filename'];
}
// 展示地址处理
if(!empty($result['images']))
{
$result['images'] = ResourcesService::AttachmentPathViewHandle($result['images']);
} }
} }
return $result; return $result;
......
...@@ -32,6 +32,16 @@ return array ( ...@@ -32,6 +32,16 @@ return array (
'log_write' => 'log_write' =>
array ( array (
), ),
'plugins_service_order_status_change_history_success_handle' =>
array (
0 => 'app\\plugins\\neworderemail\\Hook',
1 => 'app\\plugins\\distribution\\Hook',
2 => 'app\\plugins\\coupon\\Hook',
),
'plugins_service_order_pay_launch_handle' =>
array (
0 => 'app\\plugins\\neworderemail\\Hook',
),
'plugins_css' => 'plugins_css' =>
array ( array (
0 => 'app\\plugins\\distribution\\Hook', 0 => 'app\\plugins\\distribution\\Hook',
...@@ -52,11 +62,6 @@ return array ( ...@@ -52,11 +62,6 @@ return array (
1 => 'app\\plugins\\coupon\\Hook', 1 => 'app\\plugins\\coupon\\Hook',
2 => 'app\\plugins\\membershiplevelvip\\Hook', 2 => 'app\\plugins\\membershiplevelvip\\Hook',
), ),
'plugins_service_order_status_change_history_success_handle' =>
array (
0 => 'app\\plugins\\distribution\\Hook',
1 => 'app\\plugins\\coupon\\Hook',
),
'plugins_service_order_aftersale_audit_handle_end' => 'plugins_service_order_aftersale_audit_handle_end' =>
array ( array (
0 => 'app\\plugins\\distribution\\Hook', 0 => 'app\\plugins\\distribution\\Hook',
...@@ -101,6 +106,7 @@ return array ( ...@@ -101,6 +106,7 @@ return array (
0 => 'app\\plugins\\freightfee\\Hook', 0 => 'app\\plugins\\freightfee\\Hook',
1 => 'app\\plugins\\coupon\\Hook', 1 => 'app\\plugins\\coupon\\Hook',
2 => 'app\\plugins\\membershiplevelvip\\Hook', 2 => 'app\\plugins\\membershiplevelvip\\Hook',
3 => 'app\\plugins\\newuserreduction\\Hook',
), ),
'plugins_view_goods_detail_title' => 'plugins_view_goods_detail_title' =>
array ( array (
...@@ -117,6 +123,7 @@ return array ( ...@@ -117,6 +123,7 @@ return array (
1 => 'app\\plugins\\coupon\\Hook', 1 => 'app\\plugins\\coupon\\Hook',
2 => 'app\\plugins\\membershiplevelvip\\Hook', 2 => 'app\\plugins\\membershiplevelvip\\Hook',
3 => 'app\\plugins\\weixinliveplayer\\Hook', 3 => 'app\\plugins\\weixinliveplayer\\Hook',
4 => 'app\\plugins\\answers\\Hook',
), ),
'plugins_service_goods_handle_end' => 'plugins_service_goods_handle_end' =>
array ( array (
...@@ -180,5 +187,30 @@ return array ( ...@@ -180,5 +187,30 @@ return array (
array ( array (
0 => 'app\\plugins\\membershiplevelvip\\Hook', 0 => 'app\\plugins\\membershiplevelvip\\Hook',
), ),
'plugins_admin_css' =>
array (
0 => 'app\\plugins\\orderpricerevision\\Hook',
),
'plugins_admin_js' =>
array (
0 => 'app\\plugins\\orderpricerevision\\Hook',
),
'plugins_admin_view_common_bottom' =>
array (
0 => 'app\\plugins\\orderpricerevision\\Hook',
),
'plugins_view_admin_order_list_operate' =>
array (
0 => 'app\\plugins\\orderpricerevision\\Hook',
1 => 'app\\plugins\\orderexportprint\\Hook',
),
'plugins_view_admin_order_top_operate' =>
array (
0 => 'app\\plugins\\orderexportprint\\Hook',
),
'plugins_service_user_login_end' =>
array (
0 => 'app\\plugins\\userloginrewardintegral\\Hook',
),
); );
?> ?>
\ No newline at end of file
+=========================================================+ +=========================================================+
ShopXO 1.9.0 Release --- http://shopxo.net ShopXO 1.9.0 Release 20200818 http://shopxo.net
+=========================================================+ +=========================================================+
全局 全局
1. 积分支持按照订单商品总额比例发放,发生售后收回积分 1. 积分支持按照订单商品总额比例发放,发生售后收回积分
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
8. 支付日志、退款日志、用户消息优化 8. 支付日志、退款日志、用户消息优化
9. 商品封面图片优化 9. 商品封面图片优化
10. 搜索支持空格多个关键字 10. 搜索支持空格多个关键字
11. 商品分类支持1~3级自由配置展示
web端 web端
1. 所有条件、数据列表、新增、编辑、删除 新增钩子(公共 form 表单封装) 1. 所有条件、数据列表、新增、编辑、删除 新增钩子(公共 form 表单封装)
...@@ -28,6 +29,7 @@ web端 ...@@ -28,6 +29,7 @@ web端
12. 后台小程序配置集中管理 12. 后台小程序配置集中管理
13. 品牌支持关联多个分类 13. 品牌支持关联多个分类
14. 首页轮播支持电话、地图事件方式 14. 首页轮播支持电话、地图事件方式
15. 商品详情二维码改为静态、更容易适配各种服务器环境
小程序端 小程序端
...@@ -35,7 +37,7 @@ web端 ...@@ -35,7 +37,7 @@ web端
插件 插件
1. 分销插件新增返积分模块、海报高清 1. 分销插件新增返积分模块、海报高清
2. 会员等级推广海报高清 2. 微信小程序直播分享海报高清
3. 运费插件支持单独每一个仓库独立配置 3. 运费插件支持单独每一个仓库独立配置
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
return [ return [
// 开发模式 // 开发模式
'is_develop' => false, 'is_develop' => true,
// 默认编码 // 默认编码
'default_charset' => 'utf-8', 'default_charset' => 'utf-8',
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace base; namespace base;
use app\service\ResourcesService;
/** /**
* 二维码驱动 * 二维码驱动
* @author Devil * @author Devil
...@@ -27,9 +29,10 @@ class Qrcode ...@@ -27,9 +29,10 @@ class Qrcode
* @author Devil * @author Devil
* @blog http://gong.gg/ * @blog http://gong.gg/
* @version 1.0.0 * @version 1.0.0
* @param [array] $params [输入参数]
* @datetime 2019-04-16T21:13:10+0800 * @datetime 2019-04-16T21:13:10+0800
*/ */
public function __construct() public function __construct($params = [])
{ {
require_once ROOT.'extend'.DS.'qrcode'.DS.'phpqrcode.php'; require_once ROOT.'extend'.DS.'qrcode'.DS.'phpqrcode.php';
...@@ -44,7 +47,7 @@ class Qrcode ...@@ -44,7 +47,7 @@ class Qrcode
* @blog http://gong.gg/ * @blog http://gong.gg/
* @version 1.0.0 * @version 1.0.0
* @datetime 2019-04-16T21:13:16+0800 * @datetime 2019-04-16T21:13:16+0800
* @param [array] $params [输入参数] * @param [array] $params [输入参数]
*/ */
public function View($params = []) public function View($params = [])
{ {
...@@ -76,7 +79,7 @@ class Qrcode ...@@ -76,7 +79,7 @@ class Qrcode
* @version 1.0.0 * @version 1.0.0
* @date 2019-04-19 * @date 2019-04-19
* @desc description * @desc description
* @param [array] $params [输入参数] * @param [array] $params [输入参数]
*/ */
public function Create($params = []) public function Create($params = [])
{ {
...@@ -107,55 +110,60 @@ class Qrcode ...@@ -107,55 +110,60 @@ class Qrcode
// 文件名称 // 文件名称
$filename = empty($params['filename']) ? $this->RandNewFilename().'.png' : $params['filename']; $filename = empty($params['filename']) ? $this->RandNewFilename().'.png' : $params['filename'];
// 容错率 // 是否已经存在、存在是否需要强制重新生成
$level = isset($params['level']) && in_array($params['level'], array('L','M','Q','H')) ? $params['level'] : 'L'; if(!file_exists($dir.$filename) || (isset($params['is_force']) && $params['is_force'] == 1))
{
// 容错率
$level = isset($params['level']) && in_array($params['level'], array('L','M','Q','H')) ? $params['level'] : 'L';
// 大小,最小1,最大10 // 大小,最小1,最大10
$point_size = isset($params['size']) ? min(max(intval($params['size']), 1), 30) : 10; $point_size = isset($params['size']) ? min(max(intval($params['size']), 1), 30) : 10;
// 外边距 // 外边距
$mr = isset($params['mr']) ? intval($params['mr']) : 2; $mr = isset($params['mr']) ? intval($params['mr']) : 2;
// 生成二维码 // 生成二维码
\QRcode::png($params['content'], $dir.$filename, $level, $point_size, $mr); \QRcode::png($params['content'], $dir.$filename, $level, $point_size, $mr);
if(!file_exists($dir.$filename)) if(!file_exists($dir.$filename))
{ {
return DataReturn('二维码创建失败', -100); return DataReturn('二维码创建失败', -100);
} }
//判断是否生成带logo的二维码 //判断是否生成带logo的二维码
if(!empty($params['logo'])) if(!empty($params['logo']))
{ {
$logo = @file_get_contents($params['logo']); $logo = @file_get_contents($params['logo']);
if($logo !== false) if($logo !== false)
{ {
$qr = imagecreatefromstring(file_get_contents($dir.$filename)); //目标图象连接资源 $qr = imagecreatefromstring(file_get_contents($dir.$filename)); //目标图象连接资源
$logo = imagecreatefromstring($logo); //源图象连接资源 $logo = imagecreatefromstring($logo); //源图象连接资源
$qr_width = imagesx($qr); $qr_width = imagesx($qr);
$qr_height = imagesy($qr); $qr_height = imagesy($qr);
$logo_width = imagesx($logo); $logo_width = imagesx($logo);
$logo_height = imagesy($logo); $logo_height = imagesy($logo);
$logo_qr_width = $qr_width / 5; //组合之后logo的宽度(占二维码的1/5) $logo_qr_width = $qr_width / 5; //组合之后logo的宽度(占二维码的1/5)
$scale = $logo_width/$logo_qr_width; //logo的宽度缩放比(本身宽度/组合后的宽度) $scale = $logo_width/$logo_qr_width; //logo的宽度缩放比(本身宽度/组合后的宽度)
$logo_qr_height = $logo_height/$scale; //组合之后logo的高度 $logo_qr_height = $logo_height/$scale; //组合之后logo的高度
$from_width = ($qr_width - $logo_qr_width) / 2; //组合之后logo左上角所在坐标点 $from_width = ($qr_width - $logo_qr_width) / 2; //组合之后logo左上角所在坐标点
//重新组合图片并调整大小 //重新组合图片并调整大小
imagecopyresampled($qr, $logo, $from_width, $from_width, 0, 0, $logo_qr_width,$logo_qr_height, $logo_width, $logo_height); imagecopyresampled($qr, $logo, $from_width, $from_width, 0, 0, $logo_qr_width,$logo_qr_height, $logo_width, $logo_height);
//输出图片 //输出图片
imagepng($qr, $dir.$filename); imagepng($qr, $dir.$filename);
imagedestroy($qr); imagedestroy($qr);
imagedestroy($logo); imagedestroy($logo);
}
} }
} }
$result = [ $result = [
'dir' => $dir.$filename, 'dir' => $dir.$filename,
'root' => $this->config['root_path'], 'root' => $this->config['root_path'],
'path' => $this->config['path'], 'path' => $this->config['path'],
'filename' => $filename, 'filename' => $filename,
'url' => ResourcesService::AttachmentPathViewHandle($this->config['path'].$filename),
]; ];
return DataReturn('创建成功', 0, $result); return DataReturn('创建成功', 0, $result);
...@@ -167,7 +175,7 @@ class Qrcode ...@@ -167,7 +175,7 @@ class Qrcode
* @blog http://gong.gg/ * @blog http://gong.gg/
* @version 1.0.0 * @version 1.0.0
* @datetime 2019-04-16T21:23:01+0800 * @datetime 2019-04-16T21:23:01+0800
* @param [array] $params [输入参数] * @param [array] $params [输入参数]
*/ */
public function Download($params = []) public function Download($params = [])
{ {
......
plugins_* plugins_*
\ No newline at end of file goods_qrcode
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册