vr-shopxo-source/app/index/form/Usergoodscomments.php

271 lines
11 KiB
PHP
Raw Normal View History

2020-06-22 15:21:23 +00:00
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
2021-03-16 02:34:52 +00:00
// | Copyright (c) 2011~2099 http://shopxo.net All rights reserved.
2020-06-22 15:21:23 +00:00
// +----------------------------------------------------------------------
2021-03-16 02:34:52 +00:00
// | Licensed ( https://opensource.org/licenses/mit-license.php )
2020-06-22 15:21:23 +00:00
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
2024-01-19 06:49:32 +00:00
namespace app\index\form;
2020-06-22 15:21:23 +00:00
2021-07-18 15:42:10 +00:00
use think\facade\Db;
2020-06-22 15:21:23 +00:00
/**
2024-01-19 06:49:32 +00:00
* 用户商品评论动态表格
2020-06-22 15:21:23 +00:00
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-08
* @desc description
*/
2024-01-19 06:49:32 +00:00
class UserGoodsComments
2020-06-22 15:21:23 +00:00
{
// 基础条件
public $condition_base = [];
2024-01-19 06:49:32 +00:00
/**
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-29
* @desc description
* @param [array] $params [输入参数]
*/
public function __construct($params = [])
{
// 用户信息
2025-09-23 13:22:38 +00:00
$user_id = empty($params['system_user']) ? 0 : $params['system_user']['id'];
$this->condition_base[] = ['user_id', '=', $user_id];
2024-01-19 06:49:32 +00:00
}
2020-06-22 15:21:23 +00:00
/**
* 入口
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-08
* @desc description
* @param [array] $params [输入参数]
*/
public function Run($params = [])
{
2024-01-19 06:49:32 +00:00
$lang = MyLang('usergoodscomments.form_table');
2020-06-22 15:21:23 +00:00
return [
// 基础配置
'base' => [
'key_field' => 'id',
'status_field' => 'is_show',
'is_search' => 1,
'is_delete' => 1,
2023-01-06 07:56:17 +00:00
'is_middle' => 0,
2020-06-22 15:21:23 +00:00
],
// 表单配置
'form' => [
[
'view_type' => 'checkbox',
'is_checked' => 0,
2023-01-29 10:11:08 +00:00
'checked_text' => MyLang('reverse_select_title'),
'not_checked_text' => MyLang('select_all_title'),
2020-06-22 15:21:23 +00:00
'align' => 'center',
'width' => 80,
],
[
2024-01-19 06:49:32 +00:00
'label' => $lang['goods'],
2020-06-22 15:21:23 +00:00
'view_type' => 'module',
2024-01-19 06:49:32 +00:00
'view_key' => 'usergoodscomments/module/goods',
'grid_size' => 'lg',
'is_sort' => 1,
2024-01-19 06:49:32 +00:00
'sort_field' => 'goods_id',
2020-06-22 15:21:23 +00:00
'search_config' => [
'form_type' => 'input',
2024-01-19 06:49:32 +00:00
'form_name' => 'id',
2020-06-22 15:21:23 +00:00
'where_type_custom' => 'in',
2024-01-19 06:49:32 +00:00
'where_value_custom' => 'WhereGoodsInfo',
'placeholder' => $lang['goods_placeholder'],
2020-06-22 15:21:23 +00:00
],
],
[
2024-01-19 06:49:32 +00:00
'label' => $lang['business_type'],
2020-06-22 15:21:23 +00:00
'view_type' => 'field',
2024-01-19 06:49:32 +00:00
'view_key' => 'business_type',
'view_data_key' => 'name',
'view_data' => MyConst('common_goods_comments_business_type_list'),
'width' => 120,
'is_sort' => 1,
2020-06-22 15:21:23 +00:00
'search_config' => [
2024-01-19 06:49:32 +00:00
'form_type' => 'select',
'where_type' => 'in',
'data' => MyConst('common_goods_comments_business_type_list'),
'data_key' => 'value',
'data_name' => 'name',
'is_multiple' => 1,
2020-06-22 15:21:23 +00:00
],
],
[
2024-01-19 06:49:32 +00:00
'label' => $lang['content'],
'view_type' => 'module',
'view_key' => 'usergoodscomments/module/content',
'grid_size' => 'sm',
2020-06-22 15:21:23 +00:00
'search_config' => [
'form_type' => 'input',
2024-01-19 06:49:32 +00:00
'form_name' => 'content',
2020-06-22 15:21:23 +00:00
'where_type' => 'like',
],
],
2023-08-27 08:59:15 +00:00
[
2024-01-19 06:49:32 +00:00
'label' => $lang['reply'],
'view_type' => 'module',
'view_key' => 'usergoodscomments/module/reply',
'grid_size' => 'sm',
2023-08-27 08:59:15 +00:00
'search_config' => [
'form_type' => 'input',
2024-01-19 06:49:32 +00:00
'form_name' => 'reply',
2023-08-27 08:59:15 +00:00
'where_type' => 'like',
],
],
2020-06-22 15:21:23 +00:00
[
2024-01-19 06:49:32 +00:00
'label' => $lang['rating'],
'view_type' => 'star',
'view_key' => 'rating',
'star_max' => 5,
'color_style' => 'danger',
'star_text_key' => 'rating_text',
'width' => 150,
'is_sort' => 1,
2020-06-22 15:21:23 +00:00
'search_config' => [
2024-01-19 06:49:32 +00:00
'form_type' => 'select',
'form_name' => 'rating',
'where_type' => 'in',
'data' => MyConst('common_goods_comments_rating_list'),
'data_key' => 'value',
'data_name' => 'name',
'is_multiple' => 1,
2020-06-22 15:21:23 +00:00
],
],
[
2024-01-19 06:49:32 +00:00
'label' => $lang['images'],
2020-06-22 15:21:23 +00:00
'view_type' => 'module',
2024-01-19 06:49:32 +00:00
'view_key' => 'usergoodscomments/module/images',
2020-06-22 15:21:23 +00:00
],
[
2023-02-02 15:54:37 +00:00
'label' => $lang['is_show'],
2024-01-19 06:49:32 +00:00
'view_type' => 'field',
'view_key' => 'is_show_text',
'width' => 130,
'is_sort' => 1,
2020-06-22 15:21:23 +00:00
'search_config' => [
'form_type' => 'select',
'where_type' => 'in',
2024-01-19 06:49:32 +00:00
'data' => MyConst('common_is_text_list'),
2020-06-22 15:21:23 +00:00
'data_key' => 'id',
'data_name' => 'name',
'is_multiple' => 1,
],
],
[
2024-01-19 06:49:32 +00:00
'label' => $lang['is_anonymous'],
'view_type' => 'field',
'view_key' => 'is_anonymous_text',
'width' => 130,
'is_sort' => 1,
2020-06-22 15:21:23 +00:00
'search_config' => [
'form_type' => 'select',
'where_type' => 'in',
2023-08-27 08:59:15 +00:00
'data' => MyConst('common_is_text_list'),
2020-06-22 15:21:23 +00:00
'data_key' => 'id',
'data_name' => 'name',
'is_multiple' => 1,
],
],
[
2024-01-19 06:49:32 +00:00
'label' => $lang['is_reply'],
2020-06-22 15:21:23 +00:00
'view_type' => 'field',
2024-01-19 06:49:32 +00:00
'view_key' => 'is_reply_text',
'width' => 130,
'is_sort' => 1,
2020-06-22 15:21:23 +00:00
'search_config' => [
2024-01-19 06:49:32 +00:00
'form_type' => 'select',
'where_type' => 'in',
'data' => MyConst('common_is_text_list'),
'data_key' => 'id',
'data_name' => 'name',
'is_multiple' => 1,
2020-06-22 15:21:23 +00:00
],
],
[
2024-01-19 06:49:32 +00:00
'label' => $lang['reply_time_time'],
2020-06-22 15:21:23 +00:00
'view_type' => 'field',
2024-01-19 06:49:32 +00:00
'view_key' => 'reply_time_time',
'is_sort' => 1,
2020-06-22 15:21:23 +00:00
'search_config' => [
2024-01-19 06:49:32 +00:00
'form_type' => 'datetime',
'form_name' => 'reply_time',
2020-06-22 15:21:23 +00:00
],
],
[
2023-02-02 15:54:37 +00:00
'label' => $lang['add_time_time'],
2020-06-22 15:21:23 +00:00
'view_type' => 'field',
'view_key' => 'add_time_time',
'is_sort' => 1,
2020-06-22 15:21:23 +00:00
'search_config' => [
'form_type' => 'datetime',
'form_name' => 'add_time',
],
],
[
2023-02-02 15:54:37 +00:00
'label' => $lang['upd_time_time'],
2020-06-22 15:21:23 +00:00
'view_type' => 'field',
'view_key' => 'upd_time_time',
'is_sort' => 1,
2020-06-22 15:21:23 +00:00
'search_config' => [
'form_type' => 'datetime',
'form_name' => 'upd_time',
],
],
[
2023-01-26 09:06:20 +00:00
'label' => MyLang('operate_title'),
2020-06-22 15:21:23 +00:00
'view_type' => 'operate',
2024-01-19 06:49:32 +00:00
'view_key' => 'usergoodscomments/module/operate',
2020-06-22 15:21:23 +00:00
'align' => 'center',
'fixed' => 'right',
],
],
2022-08-02 09:23:10 +00:00
// 数据配置
'data' => [
2024-01-19 06:49:32 +00:00
'table_name' => 'GoodsComments',
'data_handle' => 'GoodsCommentsService::GoodsCommentsListHandle',
2024-04-15 02:25:01 +00:00
'detail_where' => $this->condition_base,
2022-08-02 09:23:10 +00:00
'is_page' => 1,
'data_params' => [
2024-01-19 06:49:32 +00:00
'is_goods' => 1,
2022-08-02 09:23:10 +00:00
],
],
2020-06-22 15:21:23 +00:00
];
}
/**
2024-01-19 06:49:32 +00:00
* 商品信息条件处理
2020-06-22 15:21:23 +00:00
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-08
* @desc description
* @param [string] $value [条件值]
* @param [array] $params [输入参数]
*/
2024-01-19 06:49:32 +00:00
public function WhereGoodsInfo($value, $params = [])
2020-06-22 15:21:23 +00:00
{
if(!empty($value))
{
2024-01-19 06:49:32 +00:00
// 获取关联的商品 id
$ids = Db::name('GoodsComments')->alias('gc')->join('goods g', 'gc.goods_id=g.id')->where('g.title|g.model', 'like', '%'.$value.'%')->column('gc.id');
2020-06-22 15:21:23 +00:00
// 避免空条件造成无效的错觉
return empty($ids) ? [0] : $ids;
}
return $value;
}
}
?>