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

This commit is contained in:
devil 2020-08-13 13:41:36 +08:00
parent 36d04c0e83
commit a67f26245f
14 changed files with 166 additions and 84 deletions

View File

@ -124,6 +124,16 @@ class Common extends Controller
// 公共表格钩子名称动态处理
$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');
// 内容外部底部

View File

@ -78,7 +78,7 @@
<div class="am-form-group">
<label>{{$data.common_app_weixin_liveplayer_ver.name}}</label>
<div class="am-alert am-alert-warning">
<p>1. 获取最新组件版本号,默认[ 1.0.18 ]</p>
<p>1. 获取最新组件版本号,默认[ 1.1.4 ]</p>
<p>2. 登录微信小程序平台,左侧导航[ 直播 ],申请直播权限后等待审核通过方可使用</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>

View File

@ -16,12 +16,11 @@
<!-- 钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div class="plugins-tag">
<span>plugins_view_admin_goods_top_operate</span>
<span>{{$hook_name_form_top_operate}}</span>
</div>
{{/if}}
{{php}}
$hook_name = 'plugins_view_admin_goods_top_operate';
$hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>true]);
$hook_data = Hook::listen($hook_name_form_top_operate, ['hook_name'=>$hook_name_form_top_operate, 'is_backend'=>true]);
if(!empty($hook_data) && is_array($hook_data))
{
foreach($hook_data as $hook)

View File

@ -169,6 +169,16 @@ class Common extends Controller
// 公共表格钩子名称动态处理
$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');
// 内容外部底部

View File

@ -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);

View File

@ -16,12 +16,11 @@
<!-- 钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div class="plugins-tag">
<span>plugins_view_admin_goods_top_operate</span>
<span>{{$hook_name_form_top_operate}}</span>
</div>
{{/if}}
{{php}}
$hook_name = 'plugins_view_admin_goods_top_operate';
$hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>true]);
$hook_data = Hook::listen($hook_name_form_top_operate, ['hook_name'=>$hook_name_form_top_operate, 'is_backend'=>true]);
if(!empty($hook_data) && is_array($hook_data))
{
foreach($hook_data as $hook)

View File

@ -255,7 +255,7 @@ class AppMiniService
if(is_array($data) && isset($data['plugins']))
{
$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',
];
if(file_put_contents($file, JsonFormat($data)) === false)

View File

@ -2151,5 +2151,38 @@ class GoodsService
// 匹配商品销售模式
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);
}
}
?>

View File

@ -1040,7 +1040,7 @@ class OrderService
// 自提模式 添加订单取货码
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
* @date 2019-11-26
* @desc description
* @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 = [
@ -1266,30 +1265,17 @@ class OrderService
$result['code'] = $code;
// 生成二维码参数
$qrcode_params = [
$params = [
'content' => $code,
'root_path' => ROOT.'public',
'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'];
if(!file_exists($file))
$ret = (new \base\Qrcode())->Create($params);
if($ret['code'] == 0)
{
$ret = (new \base\Qrcode())->Create($qrcode_params);
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']);
$result['images'] = $ret['data']['url'];
}
}
return $result;

View File

@ -32,6 +32,16 @@ return array (
'log_write' =>
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' =>
array (
0 => 'app\\plugins\\distribution\\Hook',
@ -52,11 +62,6 @@ return array (
1 => 'app\\plugins\\coupon\\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' =>
array (
0 => 'app\\plugins\\distribution\\Hook',
@ -101,6 +106,7 @@ return array (
0 => 'app\\plugins\\freightfee\\Hook',
1 => 'app\\plugins\\coupon\\Hook',
2 => 'app\\plugins\\membershiplevelvip\\Hook',
3 => 'app\\plugins\\newuserreduction\\Hook',
),
'plugins_view_goods_detail_title' =>
array (
@ -117,6 +123,7 @@ return array (
1 => 'app\\plugins\\coupon\\Hook',
2 => 'app\\plugins\\membershiplevelvip\\Hook',
3 => 'app\\plugins\\weixinliveplayer\\Hook',
4 => 'app\\plugins\\answers\\Hook',
),
'plugins_service_goods_handle_end' =>
array (
@ -180,5 +187,30 @@ return array (
array (
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',
),
);
?>

View File

@ -1,5 +1,5 @@
+=========================================================+
ShopXO 1.9.0 Release --- http://shopxo.net
ShopXO 1.9.0 Release 20200818 http://shopxo.net
+=========================================================+
全局
1. 积分支持按照订单商品总额比例发放,发生售后收回积分
@ -12,6 +12,7 @@
8. 支付日志、退款日志、用户消息优化
9. 商品封面图片优化
10. 搜索支持空格多个关键字
11. 商品分类支持1~3级自由配置展示
web端
1. 所有条件、数据列表、新增、编辑、删除 新增钩子(公共 form 表单封装)
@ -28,6 +29,7 @@ web端
12. 后台小程序配置集中管理
13. 品牌支持关联多个分类
14. 首页轮播支持电话、地图事件方式
15. 商品详情二维码改为静态、更容易适配各种服务器环境
小程序端
@ -35,7 +37,7 @@ web端
插件
1. 分销插件新增返积分模块、海报高清
2. 会员等级推广海报高清
2. 微信小程序直播分享海报高清
3. 运费插件支持单独每一个仓库独立配置

View File

@ -15,7 +15,7 @@
return [
// 开发模式
'is_develop' => false,
'is_develop' => true,
// 默认编码
'default_charset' => 'utf-8',

View File

@ -10,6 +10,8 @@
// +----------------------------------------------------------------------
namespace base;
use app\service\ResourcesService;
/**
* 二维码驱动
* @author Devil
@ -27,9 +29,10 @@ class Qrcode
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @param [array] $params [输入参数]
* @datetime 2019-04-16T21:13:10+0800
*/
public function __construct()
public function __construct($params = [])
{
require_once ROOT.'extend'.DS.'qrcode'.DS.'phpqrcode.php';
@ -44,7 +47,7 @@ class Qrcode
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-04-16T21:13:16+0800
* @param [array] $params [输入参数]
* @param [array] $params [输入参数]
*/
public function View($params = [])
{
@ -76,7 +79,7 @@ class Qrcode
* @version 1.0.0
* @date 2019-04-19
* @desc description
* @param [array] $params [输入参数]
* @param [array] $params [输入参数]
*/
public function Create($params = [])
{
@ -107,55 +110,60 @@ class Qrcode
// 文件名称
$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';
// 大小最小1最大10
$point_size = isset($params['size']) ? min(max(intval($params['size']), 1), 30) : 10;
// 外边距
$mr = isset($params['mr']) ? intval($params['mr']) : 2;
// 生成二维码
\QRcode::png($params['content'], $dir.$filename, $level, $point_size, $mr);
if(!file_exists($dir.$filename))
// 是否已经存在、存在是否需要强制重新生成
if(!file_exists($dir.$filename) || (isset($params['is_force']) && $params['is_force'] == 1))
{
return DataReturn('二维码创建失败', -100);
}
//判断是否生成带logo的二维码
if(!empty($params['logo']))
{
$logo = @file_get_contents($params['logo']);
if($logo !== false)
{
$qr = imagecreatefromstring(file_get_contents($dir.$filename)); //目标图象连接资源
$logo = imagecreatefromstring($logo); //源图象连接资源
$qr_width = imagesx($qr);
$qr_height = imagesy($qr);
$logo_width = imagesx($logo);
$logo_height = imagesy($logo);
$logo_qr_width = $qr_width / 5; //组合之后logo的宽度(占二维码的1/5)
$scale = $logo_width/$logo_qr_width; //logo的宽度缩放比(本身宽度/组合后的宽度)
$logo_qr_height = $logo_height/$scale; //组合之后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);
//输出图片
imagepng($qr, $dir.$filename);
imagedestroy($qr);
imagedestroy($logo);
// 容错率
$level = isset($params['level']) && in_array($params['level'], array('L','M','Q','H')) ? $params['level'] : 'L';
// 大小最小1最大10
$point_size = isset($params['size']) ? min(max(intval($params['size']), 1), 30) : 10;
// 外边距
$mr = isset($params['mr']) ? intval($params['mr']) : 2;
// 生成二维码
\QRcode::png($params['content'], $dir.$filename, $level, $point_size, $mr);
if(!file_exists($dir.$filename))
{
return DataReturn('二维码创建失败', -100);
}
//判断是否生成带logo的二维码
if(!empty($params['logo']))
{
$logo = @file_get_contents($params['logo']);
if($logo !== false)
{
$qr = imagecreatefromstring(file_get_contents($dir.$filename)); //目标图象连接资源
$logo = imagecreatefromstring($logo); //源图象连接资源
$qr_width = imagesx($qr);
$qr_height = imagesy($qr);
$logo_width = imagesx($logo);
$logo_height = imagesy($logo);
$logo_qr_width = $qr_width / 5; //组合之后logo的宽度(占二维码的1/5)
$scale = $logo_width/$logo_qr_width; //logo的宽度缩放比(本身宽度/组合后的宽度)
$logo_qr_height = $logo_height/$scale; //组合之后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);
//输出图片
imagepng($qr, $dir.$filename);
imagedestroy($qr);
imagedestroy($logo);
}
}
}
$result = [
'dir' => $dir.$filename,
'root' => $this->config['root_path'],
'path' => $this->config['path'],
'filename' => $filename,
'url' => ResourcesService::AttachmentPathViewHandle($this->config['path'].$filename),
];
return DataReturn('创建成功', 0, $result);
@ -167,7 +175,7 @@ class Qrcode
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-04-16T21:23:01+0800
* @param [array] $params [输入参数]
* @param [array] $params [输入参数]
*/
public function Download($params = [])
{

View File

@ -1 +1,2 @@
plugins_*
plugins_*
goods_qrcode