vr-shopxo-source/app/admin/form/Paylog.php

312 lines
11 KiB
PHP
Raw Normal View History

2020-06-27 14:48:16 +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-27 14:48:16 +00:00
// +----------------------------------------------------------------------
2021-03-16 02:34:52 +00:00
// | Licensed ( https://opensource.org/licenses/mit-license.php )
2020-06-27 14:48:16 +00:00
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\admin\form;
2021-07-18 15:42:10 +00:00
use think\facade\Db;
2020-06-27 14:48:16 +00:00
use app\service\PayLogService;
/**
* 支付日志动态表格
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-26
* @desc description
*/
2020-11-13 16:55:18 +00:00
class PayLog
2020-06-27 14:48:16 +00:00
{
// 基础条件
public $condition_base = [];
2023-08-27 08:59:15 +00:00
// 业务类型
public $business_type_list;
/**
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-29
* @desc description
* @param [array] $params [输入参数]
*/
public function __construct($params = [])
{
$list = MyConst('common_pay_log_business_type_list');
$data = Db::name('PayLog')->group('business_type')->column('business_type');
if(!empty($data))
{
foreach($data as $v)
{
if(!array_key_exists($v, $list))
{
$list[$v] = ['value' => $v, 'name' => $v];
}
}
}
$this->business_type_list = $list;
}
2020-06-27 14:48:16 +00:00
/**
* 入口
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-26
* @desc description
* @param [array] $params [输入参数]
*/
public function Run($params = [])
{
2023-02-02 15:54:37 +00:00
$lang = MyLang('paylog.form_table');
2020-06-27 14:48:16 +00:00
return [
// 基础配置
'base' => [
'key_field' => 'id',
'is_search' => 1,
2020-07-28 13:15:47 +00:00
'is_middle' => 0,
2020-06-27 14:48:16 +00:00
],
// 表单配置
'form' => [
[
2023-02-02 15:54:37 +00:00
'label' => $lang['user'],
2020-06-27 14:48:16 +00:00
'view_type' => 'module',
'view_key' => 'lib/module/user',
'grid_size' => 'sm',
'is_sort' => 1,
2020-06-27 14:48:16 +00:00
'search_config' => [
'form_type' => 'input',
'form_name' => 'user_id',
'where_type_custom' => 'in',
2024-04-15 02:25:01 +00:00
'where_value_custom' => 'SystemModuleUserWhereHandle',
2023-02-02 15:54:37 +00:00
'placeholder' => $lang['user_placeholder'],
2020-06-27 14:48:16 +00:00
],
],
2020-07-28 13:15:47 +00:00
[
2023-02-02 15:54:37 +00:00
'label' => $lang['log_no'],
2020-07-28 13:15:47 +00:00
'view_type' => 'field',
'view_key' => 'log_no',
2020-07-28 15:28:06 +00:00
'width' => 165,
'is_sort' => 1,
2020-07-28 13:15:47 +00:00
'search_config' => [
'form_type' => 'input',
'where_type' => '=',
],
],
2020-06-27 14:48:16 +00:00
[
2023-02-02 15:54:37 +00:00
'label' => $lang['payment'],
2020-06-27 14:48:16 +00:00
'view_type' => 'module',
'view_key' => 'paylog/module/payment',
2020-07-28 15:28:06 +00:00
'grid_size' => 'sm',
'is_sort' => 1,
2020-06-27 14:48:16 +00:00
'search_config' => [
'form_type' => 'select',
'form_name' => 'payment',
'where_type' => 'in',
2020-07-26 15:49:08 +00:00
'data' => $this->PayLogPaymentTypeList(),
2020-06-27 14:48:16 +00:00
'data_key' => 'id',
'data_name' => 'name',
'is_multiple' => 1,
],
],
2020-07-26 15:49:08 +00:00
[
2023-02-02 15:54:37 +00:00
'label' => $lang['status'],
2020-07-26 15:49:08 +00:00
'view_type' => 'field',
'view_key' => 'status',
'view_data_key' => 'name',
2023-08-27 08:59:15 +00:00
'view_data' => MyConst('common_pay_log_status_list'),
'is_sort' => 1,
2020-07-26 15:49:08 +00:00
'search_config' => [
'form_type' => 'select',
'where_type' => 'in',
2023-08-27 08:59:15 +00:00
'data' => MyConst('common_pay_log_status_list'),
2020-07-26 15:49:08 +00:00
'data_key' => 'value',
'data_name' => 'name',
'is_multiple' => 1,
],
],
2020-07-28 13:15:47 +00:00
[
2023-02-02 15:54:37 +00:00
'label' => $lang['total_price'],
2020-07-28 13:15:47 +00:00
'view_type' => 'field',
'view_key' => 'total_price',
'is_sort' => 1,
2020-07-28 13:15:47 +00:00
'search_config' => [
'form_type' => 'section',
'is_point' => 1,
],
],
[
2023-02-02 15:54:37 +00:00
'label' => $lang['pay_price'],
2020-07-28 13:15:47 +00:00
'view_type' => 'field',
'view_key' => 'pay_price',
'is_sort' => 1,
2020-07-28 13:15:47 +00:00
'search_config' => [
'form_type' => 'section',
'is_point' => 1,
],
],
2020-06-27 14:48:16 +00:00
[
2023-02-02 15:54:37 +00:00
'label' => $lang['business_type'],
2020-06-27 14:48:16 +00:00
'view_type' => 'field',
2020-07-02 14:42:01 +00:00
'view_key' => 'business_type',
2023-08-27 08:59:15 +00:00
'view_data_key' => 'name',
'view_data' => $this->business_type_list,
'is_sort' => 1,
2020-06-27 14:48:16 +00:00
'search_config' => [
'form_type' => 'select',
'where_type' => 'in',
2023-08-27 08:59:15 +00:00
'data' => $this->business_type_list,
'data_key' => 'value',
2020-06-27 14:48:16 +00:00
'data_name' => 'name',
'is_multiple' => 1,
],
],
[
2023-02-02 15:54:37 +00:00
'label' => $lang['business_list'],
2020-07-26 15:49:08 +00:00
'view_type' => 'module',
'view_key' => 'paylog/module/business_list',
'width' => 300,
'search_config' => [
'form_type' => 'input',
'form_name' => 'id',
'where_type_custom' => 'in',
2020-08-20 15:38:41 +00:00
'where_value_custom' => 'WhereValueBusinessInfo',
2020-07-26 15:49:08 +00:00
],
],
2020-06-27 14:48:16 +00:00
[
2023-02-02 15:54:37 +00:00
'label' => $lang['trade_no'],
2020-06-27 14:48:16 +00:00
'view_type' => 'field',
'view_key' => 'trade_no',
2020-07-28 13:59:54 +00:00
'grid_size' => 'sm',
'is_sort' => 1,
2020-06-27 14:48:16 +00:00
'search_config' => [
'form_type' => 'input',
2020-07-26 15:49:08 +00:00
'where_type' => '=',
2020-06-27 14:48:16 +00:00
],
],
[
2023-02-02 15:54:37 +00:00
'label' => $lang['buyer_user'],
2020-06-27 14:48:16 +00:00
'view_type' => 'field',
'view_key' => 'buyer_user',
2020-07-28 13:59:54 +00:00
'grid_size' => 'sm',
'is_sort' => 1,
2020-06-27 14:48:16 +00:00
'search_config' => [
'form_type' => 'input',
'where_type' => 'like',
],
],
[
2023-02-02 15:54:37 +00:00
'label' => $lang['subject'],
2020-06-27 14:48:16 +00:00
'view_type' => 'field',
2020-07-26 15:49:08 +00:00
'view_key' => 'subject',
'is_sort' => 1,
2020-06-27 14:48:16 +00:00
'search_config' => [
2020-07-26 15:49:08 +00:00
'form_type' => 'input',
'where_type' => 'like',
2020-06-27 14:48:16 +00:00
],
],
[
2023-02-02 15:54:37 +00:00
'label' => $lang['pay_time'],
2020-06-27 14:48:16 +00:00
'view_type' => 'field',
2020-07-26 15:49:08 +00:00
'view_key' => 'pay_time',
'is_sort' => 1,
2020-06-27 14:48:16 +00:00
'search_config' => [
2020-07-26 15:49:08 +00:00
'form_type' => 'datetime',
2020-06-27 14:48:16 +00:00
],
],
[
2023-02-02 15:54:37 +00:00
'label' => $lang['close_time'],
2020-06-27 14:48:16 +00:00
'view_type' => 'field',
2020-07-26 15:49:08 +00:00
'view_key' => 'close_time',
'is_sort' => 1,
2020-06-27 14:48:16 +00:00
'search_config' => [
2020-07-26 15:49:08 +00:00
'form_type' => 'datetime',
2020-06-27 14:48:16 +00:00
],
],
[
2023-02-02 15:54:37 +00:00
'label' => $lang['add_time'],
2020-06-27 14:48:16 +00:00
'view_type' => 'field',
2020-07-26 15:49:08 +00:00
'view_key' => 'add_time',
'is_sort' => 1,
2020-06-27 14:48:16 +00:00
'search_config' => [
'form_type' => 'datetime',
],
],
2020-06-28 14:50:10 +00:00
[
2023-01-26 09:06:20 +00:00
'label' => MyLang('operate_title'),
2020-06-28 14:50:10 +00:00
'view_type' => 'operate',
'view_key' => 'paylog/module/operate',
'align' => 'center',
'fixed' => 'right',
2024-01-19 06:49:32 +00:00
'width' => 120,
2020-06-28 14:50:10 +00:00
],
2020-06-27 14:48:16 +00:00
],
2022-08-02 09:23:10 +00:00
// 数据配置
'data' => [
'table_name' => 'PayLog',
'data_handle' => 'PayLogService::PayLogListHandle',
'is_page' => 1,
'data_params' => [
'is_public' => 0,
'user_type' => 'admin',
],
],
2020-06-27 14:48:16 +00:00
];
}
/**
* 支付方式类型
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-26
* @desc description
*/
2020-07-26 15:49:08 +00:00
public function PayLogPaymentTypeList()
2020-06-27 14:48:16 +00:00
{
2020-07-28 15:28:06 +00:00
$data = [];
2020-06-27 14:48:16 +00:00
$ret = PayLogService::PayLogTypeList();
2020-07-28 15:28:06 +00:00
if(!empty($ret['data']))
{
foreach($ret['data'] as $v)
{
$data[] = [
'id' => $v['id'],
'name' => $v['name'].'('.$v['id'].')',
];
}
}
return $data;
2020-06-27 14:48:16 +00:00
}
2020-07-26 15:49:08 +00:00
/**
* 关联业务条件处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-30
* @desc description
* @param [string] $value [条件值]
* @param [array] $params [输入参数]
*/
public function WhereValueBusinessInfo($value, $params = [])
{
if(!empty($value))
{
// 获取业务id
2020-07-26 15:49:08 +00:00
$ids = Db::name('PayLogValue')->where('business_id|business_no', '=', $value)->column('pay_log_id');
// 避免空条件造成无效的错觉
return empty($ids) ? [0] : $ids;
}
return $value;
}
2020-06-27 14:48:16 +00:00
}
?>