diff --git a/application/admin/controller/Common.php b/application/admin/controller/Common.php index 16e311a4f..336b631e9 100755 --- a/application/admin/controller/Common.php +++ b/application/admin/controller/Common.php @@ -52,6 +52,7 @@ class Common extends Controller protected $form_params; protected $form_md5_key; protected $form_user_fields; + protected $form_order_by; protected $form_error; /** @@ -288,11 +289,13 @@ class Common extends Controller $this->form_params = $ret['data']['params']; $this->form_md5_key = $ret['data']['md5_key']; $this->form_user_fields = $ret['data']['user_fields']; + $this->form_order_by = $ret['data']['order_by']; $this->assign('form_table', $this->form_table); $this->assign('form_params', $this->form_params); $this->assign('form_md5_key', $this->form_md5_key); $this->assign('form_user_fields', $this->form_user_fields); + $this->assign('form_order_by', $this->form_order_by); } else { $this->form_error = $ret['msg']; $this->assign('form_error', $this->form_error); diff --git a/application/admin/controller/Goods.php b/application/admin/controller/Goods.php index d9f10293e..053dec820 100755 --- a/application/admin/controller/Goods.php +++ b/application/admin/controller/Goods.php @@ -70,6 +70,7 @@ class Goods extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], 'is_category' => 1, ]; $ret = GoodsService::GoodsList($data_params); diff --git a/application/admin/form/Goods.php b/application/admin/form/Goods.php index 552010c71..7a9967c5a 100644 --- a/application/admin/form/Goods.php +++ b/application/admin/form/Goods.php @@ -68,6 +68,7 @@ class Goods 'view_type' => 'field', 'view_key' => 'id', 'width' => 105, + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'input', 'where_type' => '=', @@ -78,6 +79,8 @@ class Goods 'view_type' => 'module', 'view_key' => 'goods/module/info', 'grid_size' => 'lg', + 'is_sort' => 1, + 'sort_field' => 'title', 'search_config' => [ 'form_type' => 'input', 'form_name' => 'title|simple_desc|seo_title|seo_keywords|seo_keywords', @@ -102,6 +105,7 @@ class Goods 'label' => '品牌', 'view_type' => 'field', 'view_key' => 'brand_name', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'module', 'template' => 'lib/module/category_brand', @@ -116,6 +120,7 @@ class Goods 'label' => '销售价格(元)', 'view_type' => 'field', 'view_key' => 'price', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', 'form_name' => 'min_price', @@ -126,6 +131,7 @@ class Goods 'label' => '原价(元)', 'view_type' => 'field', 'view_key' => 'original_price', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', 'form_name' => 'min_original_price', @@ -137,6 +143,7 @@ class Goods 'view_type' => 'field', 'view_key' => ['inventory', 'inventory_unit'], 'view_key_join' => ' ', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', 'form_name' => 'inventory', @@ -149,6 +156,7 @@ class Goods 'post_url' => MyUrl('admin/goods/statusupdate'), 'is_form_su' => 1, 'align' => 'center', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -164,6 +172,7 @@ class Goods 'view_key' => 'is_home_recommended', 'post_url' => MyUrl('admin/goods/statusupdate'), 'align' => 'center', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -179,6 +188,7 @@ class Goods 'view_key' => 'is_deduction_inventory', 'post_url' => MyUrl('admin/goods/statusupdate'), 'align' => 'center', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -194,6 +204,7 @@ class Goods 'view_key' => 'site_type', 'view_data_key' => 'name', 'view_data' => lang('common_site_type_list'), + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -207,6 +218,7 @@ class Goods 'label' => '商品型号', 'view_type' => 'field', 'view_key' => 'model', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -216,6 +228,7 @@ class Goods 'label' => '生产地', 'view_type' => 'field', 'view_key' => 'place_origin_name', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'form_name' => 'place_origin', @@ -231,6 +244,7 @@ class Goods 'view_type' => 'field', 'view_key' => 'give_integral', 'view_join_last'=> '%', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', ], @@ -239,6 +253,7 @@ class Goods 'label' => '单次最低起购数量', 'view_type' => 'field', 'view_key' => 'buy_min_number', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', ], @@ -247,6 +262,7 @@ class Goods 'label' => '单次最大购买数量', 'view_type' => 'field', 'view_key' => 'buy_max_number', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', ], @@ -255,6 +271,7 @@ class Goods 'label' => '访问次数', 'view_type' => 'field', 'view_key' => 'access_count', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', ], @@ -263,6 +280,7 @@ class Goods 'label' => '创建时间', 'view_type' => 'field', 'view_key' => 'add_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', ], @@ -271,6 +289,7 @@ class Goods 'label' => '更新时间', 'view_type' => 'field', 'view_key' => 'upd_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', ], diff --git a/application/admin/view/default/public/module/form_operate_top.html b/application/admin/view/default/public/module/form_operate_top.html index b2422296b..bb267e744 100644 --- a/application/admin/view/default/public/module/form_operate_top.html +++ b/application/admin/view/default/public/module/form_operate_top.html @@ -37,6 +37,10 @@ {{if isset($form_table['base']['is_search']) and $form_table['base']['is_search'] eq 1}} 重置 + + + + {{/if}} diff --git a/application/admin/view/default/public/module/form_table.html b/application/admin/view/default/public/module/form_table.html index 8bf1143ef..b530cbb53 100644 --- a/application/admin/view/default/public/module/form_table.html +++ b/application/admin/view/default/public/module/form_table.html @@ -28,6 +28,14 @@ {{default /}} {{if isset($t['label'])}}{{$t.label}}{{/if}} {{/switch}} + + + {{if isset($form_table['base']['is_search']) and $form_table['base']['is_search'] eq 1 and isset($t['is_sort']) and $t['is_sort'] eq 1 and !empty($t['sort_field'])}} +
+ + +
+ {{/if}} {{/if}} {{/foreach}} diff --git a/application/index/controller/Common.php b/application/index/controller/Common.php index 9195a572a..8152534eb 100755 --- a/application/index/controller/Common.php +++ b/application/index/controller/Common.php @@ -66,6 +66,7 @@ class Common extends Controller protected $form_params; protected $form_md5_key; protected $form_user_fields; + protected $form_order_by; protected $form_error; /** @@ -433,11 +434,13 @@ class Common extends Controller $this->form_params = $ret['data']['params']; $this->form_md5_key = $ret['data']['md5_key']; $this->form_user_fields = $ret['data']['user_fields']; + $this->form_order_by = $ret['data']['order_by']; $this->assign('form_table', $this->form_table); $this->assign('form_params', $this->form_params); $this->assign('form_md5_key', $this->form_md5_key); $this->assign('form_user_fields', $this->form_user_fields); + $this->assign('form_order_by', $this->form_order_by); } else { $this->form_error = $ret['msg']; $this->assign('form_error', $this->form_error); diff --git a/application/index/view/default/public/module/form_operate_top.html b/application/index/view/default/public/module/form_operate_top.html index 05a53fdad..2a8fb0023 100644 --- a/application/index/view/default/public/module/form_operate_top.html +++ b/application/index/view/default/public/module/form_operate_top.html @@ -37,6 +37,10 @@ {{if isset($form_table['base']['is_search']) and $form_table['base']['is_search'] eq 1}} 重置 + + + + {{/if}} diff --git a/application/index/view/default/public/module/form_table.html b/application/index/view/default/public/module/form_table.html index 8bf1143ef..b530cbb53 100644 --- a/application/index/view/default/public/module/form_table.html +++ b/application/index/view/default/public/module/form_table.html @@ -28,6 +28,14 @@ {{default /}} {{if isset($t['label'])}}{{$t.label}}{{/if}} {{/switch}} + + + {{if isset($form_table['base']['is_search']) and $form_table['base']['is_search'] eq 1 and isset($t['is_sort']) and $t['is_sort'] eq 1 and !empty($t['sort_field'])}} +
+ + +
+ {{/if}} {{/if}} {{/foreach}} diff --git a/application/module/FormHandleModule.php b/application/module/FormHandleModule.php index 86796bbde..a9e7e7072 100644 --- a/application/module/FormHandleModule.php +++ b/application/module/FormHandleModule.php @@ -38,6 +38,8 @@ class FormHandleModule public $where; // 用户选择字段字段 public $user_fields; + // 排序 + public $order_by; /** * 运行入口 @@ -121,6 +123,9 @@ class FormHandleModule // 用户字段选择处理 $this->FormFieldsUserSelect(); + // 排序字段处理 + $this->FormOrderByHandle(); + // 数据返回 $data = [ 'table' => $this->form_data, @@ -128,10 +133,32 @@ class FormHandleModule 'params' => $this->where_params, 'md5_key' => $this->md5_key, 'user_fields' => $this->user_fields, + 'order_by' => $this->order_by, ]; return DataReturn('success', 0, $data); } + /** + * 排序字段处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-10-24 + * @desc description + */ + public function FormOrderByHandle() + { + $order_by_key = empty($this->out_params['fp_order_by_key']) ? '' : $this->out_params['fp_order_by_key']; + $order_by_val = empty($this->out_params['fp_order_by_val']) ? '' : $this->out_params['fp_order_by_val']; + $order_by_data = (empty($order_by_key) || empty($order_by_val)) ? '' : $order_by_key.' '.$order_by_val; + + $this->order_by = [ + 'data' => $order_by_data, + 'key' => $order_by_key, + 'val' => $order_by_val, + ]; + } + /** * 字段用户选择处理 * @author Devil @@ -386,7 +413,7 @@ class FormHandleModule // 搜索条件数据处理 // 表单字段名称 - $name = $v['search_config']['form_name']; + $where_name = $v['search_config']['form_name']; // 条件类型 $where_type = isset($v['search_config']['where_type']) ? $v['search_config']['where_type'] : $v['search_config']['form_type']; // 是否自定义条件处理 @@ -423,7 +450,7 @@ class FormHandleModule } // 条件 - $this->where[] = [$name, $where_symbol, $value]; + $this->where[] = [$where_name, $where_symbol, $value]; } } break; @@ -447,12 +474,12 @@ class FormHandleModule { if(!empty($value) && is_array($value)) { - $this->where[] = [$name, $where_symbol, $value]; + $this->where[] = [$where_name, $where_symbol, $value]; } } else { if($value !== null && $value !== '') { - $this->where[] = [$name, $where_symbol, $value]; + $this->where[] = [$where_name, $where_symbol, $value]; } } } @@ -472,7 +499,7 @@ class FormHandleModule $value = $this->WhereValueHandle($value, $value_custom, ['is_min'=>1]); if($value !== null && $value !== '') { - $this->where[] = [$name, '>=', $value]; + $this->where[] = [$where_name, '>=', $value]; } } if(array_key_exists($key_max, $this->out_params) && $this->out_params[$key_max] !== null && $this->out_params[$key_max] !== '') @@ -485,7 +512,7 @@ class FormHandleModule $value = $this->WhereValueHandle($value, $value_custom, ['is_end'=>1]); if($value !== null && $value !== '') { - $this->where[] = [$name, '<=', $value]; + $this->where[] = [$where_name, '<=', $value]; } } break; @@ -505,7 +532,7 @@ class FormHandleModule $value = $this->WhereValueHandle(strtotime($value), $value_custom, ['is_start'=>1]); if($value !== null && $value !== '') { - $this->where[] = [$name, '>=', $value]; + $this->where[] = [$where_name, '>=', $value]; } } if(array_key_exists($key_end, $this->out_params) && $this->out_params[$key_end] !== null && $this->out_params[$key_end] !== '') @@ -518,12 +545,15 @@ class FormHandleModule $value = $this->WhereValueHandle(strtotime($value), $value_custom, ['is_end'=>1]); if($value !== null && $value !== '') { - $this->where[] = [$name, '<=', $value]; + $this->where[] = [$where_name, '<=', $value]; } } break; } } + + // 排序字段 + $v['sort_field'] = empty($v['sort_field']) ? $where_name : $v['sort_field']; } } } diff --git a/application/service/GoodsService.php b/application/service/GoodsService.php index e0cb5682f..2c41d4546 100755 --- a/application/service/GoodsService.php +++ b/application/service/GoodsService.php @@ -873,7 +873,7 @@ class GoodsService 'key_name' => 'site_type', 'checked_data' => array_merge([-1], array_column(lang('common_site_type_list'), 'value')), 'is_checked' => 2, - 'error_msg' => '商品型号格式 最多30个字符', + 'error_msg' => '商品类型数据值范围有误', ], [ 'checked_type' => 'length', diff --git a/application/service/MessageService.php b/application/service/MessageService.php index 78fdccf21..30d459a20 100755 --- a/application/service/MessageService.php +++ b/application/service/MessageService.php @@ -11,6 +11,7 @@ namespace app\service; use think\Db; +use think\facade\Hook; use app\service\UserService; /** @@ -49,7 +50,20 @@ class MessageService 'is_read' => 0, 'add_time' => time(), ); - return Db::name('Message')->insertGetId($data) > 0; + $message_id = Db::name('Message')->insertGetId($data); + if($message_id > 0) + { + // 消息添加钩子 + $hook_name = 'plugins_service_message_add'; + Hook::listen($hook_name, [ + 'hook_name' => $hook_name, + 'is_backend' => true, + 'data' => $data, + 'data_id' => $message_id, + ]); + return true; + } + return facade; } /** diff --git a/application/tags.php b/application/tags.php index 741848d4b..e65e3cc01 100755 --- a/application/tags.php +++ b/application/tags.php @@ -37,6 +37,8 @@ return array ( 0 => 'app\\plugins\\share\\Hook', 1 => 'app\\plugins\\exchangerate\\Hook', 2 => 'app\\plugins\\freightfee\\Hook', + 3 => 'app\\plugins\\activity\\Hook', + 4 => 'app\\plugins\\excellentbuyreturntocash\\Hook', ), 'plugins_js' => array ( @@ -60,20 +62,24 @@ return array ( array ( 0 => 'app\\plugins\\distribution\\Hook', 1 => 'app\\plugins\\wallet\\Hook', + 2 => 'app\\plugins\\excellentbuyreturntocash\\Hook', ), 'plugins_service_header_navigation_top_right_handle' => array ( 0 => 'app\\plugins\\distribution\\Hook', 1 => 'app\\plugins\\wallet\\Hook', 2 => 'app\\plugins\\exchangerate\\Hook', + 3 => 'app\\plugins\\excellentbuyreturntocash\\Hook', ), 'plugins_service_order_status_change_history_success_handle' => array ( 0 => 'app\\plugins\\distribution\\Hook', + 1 => 'app\\plugins\\excellentbuyreturntocash\\Hook', ), 'plugins_service_order_aftersale_audit_handle_end' => array ( 0 => 'app\\plugins\\distribution\\Hook', + 1 => 'app\\plugins\\excellentbuyreturntocash\\Hook', ), 'plugins_service_site_extraction_address_list' => array ( @@ -82,6 +88,7 @@ return array ( 'plugins_service_buy_order_insert_end' => array ( 0 => 'app\\plugins\\distribution\\Hook', + 1 => 'app\\plugins\\excellentbuyreturntocash\\Hook', ), 'plugins_service_goods_spec_extends_handle' => array ( @@ -95,6 +102,20 @@ return array ( array ( 0 => 'app\\plugins\\distribution\\Hook', ), + 'plugins_service_goods_handle_end' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + 1 => 'app\\plugins\\exchangerate\\Hook', + ), + 'plugins_service_goods_spec_base' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + 1 => 'app\\plugins\\exchangerate\\Hook', + ), + 'plugins_view_goods_detail_panel_price_top' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + ), 'plugins_service_user_register_end' => array ( 0 => 'app\\plugins\\wallet\\Hook', @@ -131,14 +152,6 @@ return array ( array ( 0 => 'app\\plugins\\exchangerate\\Hook', ), - 'plugins_service_goods_handle_end' => - array ( - 0 => 'app\\plugins\\exchangerate\\Hook', - ), - 'plugins_service_goods_spec_base' => - array ( - 0 => 'app\\plugins\\exchangerate\\Hook', - ), 'plugins_service_buy_group_goods_handle' => array ( 0 => 'app\\plugins\\freightfee\\Hook', @@ -146,12 +159,30 @@ return array ( 'plugins_view_goods_detail_title' => array ( 0 => 'app\\plugins\\freightfee\\Hook', + 1 => 'app\\plugins\\excellentbuyreturntocash\\Hook', ), 'plugins_service_navigation_header_handle' => array ( 0 => 'app\\plugins\\answers\\Hook', 1 => 'app\\plugins\\blog\\Hook', 2 => 'app\\plugins\\speedplaceorder\\Hook', + 3 => 'app\\plugins\\activity\\Hook', + ), + 'plugins_view_home_floor_top' => + array ( + 0 => 'app\\plugins\\activity\\Hook', + ), + 'plugins_view_home_floor_bottom' => + array ( + 0 => 'app\\plugins\\activity\\Hook', + ), + 'plugins_service_buy_order_insert_begin' => + array ( + 0 => 'app\\plugins\\excellentbuyreturntocash\\Hook', + ), + 'plugins_view_goods_detail_panel_bottom' => + array ( + 0 => 'app\\plugins\\excellentbuyreturntocash\\Hook', ), ); ?> \ No newline at end of file diff --git a/changelog.txt b/changelog.txt index 39f862aec..164b9b094 100755 --- a/changelog.txt +++ b/changelog.txt @@ -18,6 +18,7 @@ web端 3. 新增插件路由短地址规则 4. 动态表格列表支持自定义显示字段和拖拽排序 5. 后台新增用户地址管理 + 6. 动态表格列表支持排序操作 小程序 1. QQ小程序支持微信支付 @@ -29,6 +30,8 @@ web端 2. 新增IEPay新西兰货币支付(支付宝+微信) 3. 新增博客插件、写文章增加商城的搜索引擎收录、关联推荐商品 4. 钱包插件支持修改余额输入操作密码、提现支持配置最低金额 + 5. 分销插件新增收益总额自动升级,新增指定商品返现、复购优惠、推广达标返现模式 + 6. 新增活动配置插件、可首页展示活动、独立活动首页和详情页面 +=========================================================+ diff --git a/composer.json b/composer.json index 7e4c110aa..c02d6b246 100755 --- a/composer.json +++ b/composer.json @@ -21,6 +21,9 @@ "email": "fuxiang.gong@qq.com" } ], + "require": { + "php": "5.6.35" + }, "autoload": { "psr-4": { "app\\": "application" diff --git a/public/static/admin/default/css/common.css b/public/static/admin/default/css/common.css index d3b6eb4d0..c2a5a8678 100755 --- a/public/static/admin/default/css/common.css +++ b/public/static/admin/default/css/common.css @@ -61,7 +61,7 @@ select {height:28px !important;} .t-r {text-align:right;} .o-h { overflow: hidden; } .submit-state { font-size: 16px; width: 25px; height: 25px; line-height: 25px; } -input:hover, select:hover, textarea:hover, .chosen-choices:hover, .chosen-single:hover { border-style:solid; border-width:1px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; border:1px solid #4FACF5 !important; box-shadow:0 0 5px #4FACF5 !important; } +input:hover, select:hover, textarea:hover, .chosen-choices:hover, .chosen-single:hover,.am-tagsinput:hover, button.colorpicker-submit:hover { border-style:solid; border-width:1px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; border:1px solid #4FACF5 !important; box-shadow:0 0 5px #4FACF5 !important; } .am-input-group-sm > .am-input-group-btn > .am-btn, .am-input-group-sm > .am-form-field, .am-input-group-sm > .am-input-group-label, diff --git a/public/static/common/css/common.css b/public/static/common/css/common.css index a25db7eb0..c9174d802 100755 --- a/public/static/common/css/common.css +++ b/public/static/common/css/common.css @@ -545,6 +545,7 @@ button.colorpicker-submit img { .am-table-scrollable-horizontal .am-table tr th { background: #e8e6e6; min-width: 100px; + position: relative; } .am-table-scrollable-horizontal .am-table tr .am-grid-xxxl { min-width: 650px; @@ -662,6 +663,34 @@ button.colorpicker-submit img { width: calc(100% - 130px); } +/** + * 表格排序 + */ +.form-sort-container { + position: absolute; + margin-left: 3px; + top: calc(50% - 8px); +} +.form-sort-container .sort-icon { + display: block; + height: 8px; + line-height: 10px; + color: #999; + width: 15px; + text-align: center; +} +.form-sort-container .sort-icon:before { + height: 8px; + line-height: 8px; + font-size: 14px; +} +.form-sort-container .sort-icon:hover { + color: #333; +} +.form-sort-container .sort-active { + color: #0e90d2 !important; +} + /** * 公共联动地区组件样式 */ diff --git a/public/static/common/js/common.js b/public/static/common/js/common.js index 0f3eb44b3..5d7ac0456 100755 --- a/public/static/common/js/common.js +++ b/public/static/common/js/common.js @@ -1687,7 +1687,25 @@ $(function() // 表格初始化 FormTableContainerInit(); - // 表格字段拖拽排序 + // 表格字段数据排序 + $('.form-sort-container .sort-icon').on('click', function() + { + var key = $(this).data('key') || null; + var val = $(this).data('val') || null; + if(key == null || val == null) + { + Prompt('排序数据值有误'); + return false; + } + + // 赋值并搜索 + var $parent = $(this).parents('form.form-validation-search'); + $parent.find('input[name="fp_order_by_key"]').val(key); + $parent.find('input[name="fp_order_by_val"]').val(val); + $parent.find('button[type="submit"]').trigger('click'); + }); + + // 表格字显示段拖拽排序 if($('ul.form-table-fields-content-container').length > 0) { $('ul.form-table-fields-content-container').dragsort({ dragSelector: 'li', placeHolderTemplate: '
  • '});