diff --git a/app/admin/controller/Common.php b/app/admin/controller/Common.php index c11e73821..7230a19e3 100755 --- a/app/admin/controller/Common.php +++ b/app/admin/controller/Common.php @@ -35,6 +35,8 @@ class Common extends BaseController // 左边权限菜单 protected $left_menu; + // 当前管理员可使用的插件 + protected $admin_plugins; // 输入参数 post|get|request protected $data_post; @@ -111,9 +113,10 @@ public function __construct() // 管理员信息 $this->admin = AdminService::LoginInfo(); - // 权限菜单 + // 权限菜单、当前管理员可使用的插件 $menu = AdminPowerService::PowerMenuInit($this->admin); $this->left_menu = $menu['admin_left_menu']; + $this->admin_plugins = $menu['admin_plugins']; // 视图初始化 $this->ViewInit(); @@ -265,6 +268,8 @@ public function ViewInit() // 权限菜单 $assign['left_menu'] = $this->left_menu; + // 当前管理员可使用的插件 + $assign['admin_plugins'] = $this->admin_plugins; // 分页信息 $this->page = max(1, isset($this->data_request['page']) ? intval($this->data_request['page']) : 1); diff --git a/app/admin/form/Appcenternav.php b/app/admin/form/Appcenternav.php index 9ce68ed97..b067a3155 100644 --- a/app/admin/form/Appcenternav.php +++ b/app/admin/form/Appcenternav.php @@ -60,6 +60,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'name', 'is_sort' => 1, + 'width' => 150, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -72,6 +73,7 @@ public function Run($params = []) 'view_data_key' => 'name', 'view_data' => MyConst('common_platform_type'), 'is_sort' => 1, + 'width' => 165, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -117,16 +119,6 @@ public function Run($params = []) 'where_type' => 'like', ], ], - [ - 'label' => $lang['desc'], - 'view_type' => 'field', - 'view_key' => 'desc', - 'is_sort' => 1, - 'search_config' => [ - 'form_type' => 'input', - 'where_type' => 'like', - ], - ], [ 'label' => $lang['is_enable'], 'view_type' => 'status', @@ -135,6 +127,7 @@ public function Run($params = []) 'is_form_su' => 1, 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -151,6 +144,7 @@ public function Run($params = []) 'post_url' => MyUrl('admin/appcenternav/statusupdate'), 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -160,6 +154,16 @@ public function Run($params = []) 'is_multiple' => 1, ], ], + [ + 'label' => $lang['desc'], + 'view_type' => 'field', + 'view_key' => 'desc', + 'is_sort' => 1, + 'search_config' => [ + 'form_type' => 'input', + 'where_type' => 'like', + ], + ], [ 'label' => $lang['sort'], 'view_type' => 'field', diff --git a/app/admin/form/Apphomenav.php b/app/admin/form/Apphomenav.php index 0d25751d9..3ff866755 100644 --- a/app/admin/form/Apphomenav.php +++ b/app/admin/form/Apphomenav.php @@ -60,6 +60,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'name', 'is_sort' => 1, + 'width' => 150, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -72,6 +73,7 @@ public function Run($params = []) 'view_data_key' => 'name', 'view_data' => MyConst('common_platform_type'), 'is_sort' => 1, + 'width' => 165, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -86,6 +88,7 @@ public function Run($params = []) 'view_type' => 'module', 'view_key' => 'apphomenav/module/images', 'align' => 'center', + 'width' => 70, ], [ 'label' => $lang['event_type'], @@ -123,6 +126,7 @@ public function Run($params = []) 'is_form_su' => 1, 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -139,6 +143,7 @@ public function Run($params = []) 'post_url' => MyUrl('admin/apphomenav/statusupdate'), 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', diff --git a/app/admin/form/Article.php b/app/admin/form/Article.php index 46eaec44e..98b2c7675 100644 --- a/app/admin/form/Article.php +++ b/app/admin/form/Article.php @@ -84,6 +84,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'article_category_name', 'is_sort' => 1, + 'width' => 140, 'search_config' => [ 'form_type' => 'select', 'form_name' => 'article_category_id', @@ -102,6 +103,7 @@ public function Run($params = []) 'is_form_su' => 1, 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -118,6 +120,7 @@ public function Run($params = []) 'post_url' => MyUrl('admin/article/statusupdate'), 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -132,6 +135,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'images_count', 'is_sort' => 1, + 'width' => 160, 'search_config' => [ 'form_type' => 'section', ], @@ -141,6 +145,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'access_count', 'is_sort' => 1, + 'width' => 160, 'search_config' => [ 'form_type' => 'section', ], diff --git a/app/admin/form/Brand.php b/app/admin/form/Brand.php index 9140f28f0..26a62403c 100644 --- a/app/admin/form/Brand.php +++ b/app/admin/form/Brand.php @@ -65,6 +65,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'name', 'is_sort' => 1, + 'width' => 150, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -86,12 +87,13 @@ public function Run($params = []) 'view_type' => 'images', 'view_key' => 'logo', 'images_height' => 25, + 'width' => 100, ], [ 'label' => $lang['url'], 'view_type' => 'module', 'view_key' => 'brand/module/url', - 'grid_size' => 'lg', + 'grid_size' => 'sm', 'search_config' => [ 'form_type' => 'input', 'form_name' => 'website_url', @@ -102,6 +104,7 @@ public function Run($params = []) 'label' => $lang['brand_category_text'], 'view_type' => 'field', 'view_key' => 'brand_category_text', + 'width' => 140, 'search_config' => [ 'form_type' => 'select', 'form_name' => 'id', @@ -121,6 +124,7 @@ public function Run($params = []) 'is_form_su' => 1, 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -135,6 +139,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'sort', 'is_sort' => 1, + 'width' => 160, 'search_config' => [ 'form_type' => 'section', ], diff --git a/app/admin/form/Customview.php b/app/admin/form/Customview.php index 08ec7f0c7..055d5d392 100644 --- a/app/admin/form/Customview.php +++ b/app/admin/form/Customview.php @@ -59,7 +59,7 @@ public function Run($params = []) 'label' => $lang['info'], 'view_type' => 'module', 'view_key' => 'customview/module/info', - 'grid_size' => 'lg', + 'grid_size' => 'sm', 'is_sort' => 1, 'search_config' => [ 'form_type' => 'input', @@ -75,6 +75,7 @@ public function Run($params = []) 'is_form_su' => 1, 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -91,6 +92,7 @@ public function Run($params = []) 'post_url' => MyUrl('admin/customview/statusupdate'), 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -107,6 +109,7 @@ public function Run($params = []) 'post_url' => MyUrl('admin/customview/statusupdate'), 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -123,6 +126,7 @@ public function Run($params = []) 'post_url' => MyUrl('admin/customview/statusupdate'), 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -137,6 +141,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'access_count', 'is_sort' => 1, + 'width' => 160, 'search_config' => [ 'form_type' => 'section', ], diff --git a/app/admin/form/Design.php b/app/admin/form/Design.php index 0d252b3c8..9ca663fe9 100644 --- a/app/admin/form/Design.php +++ b/app/admin/form/Design.php @@ -83,6 +83,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'access_count', 'is_sort' => 1, + 'width' => 160, 'search_config' => [ 'form_type' => 'section', ], @@ -95,6 +96,7 @@ public function Run($params = []) 'is_form_su' => 1, 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -111,6 +113,7 @@ public function Run($params = []) 'post_url' => MyUrl('admin/design/statusupdate'), 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -127,6 +130,7 @@ public function Run($params = []) 'post_url' => MyUrl('admin/design/statusupdate'), 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', diff --git a/app/admin/form/Goodsparamstemplate.php b/app/admin/form/Goodsparamstemplate.php index 3bdb5b922..5bead3f0c 100644 --- a/app/admin/form/Goodsparamstemplate.php +++ b/app/admin/form/Goodsparamstemplate.php @@ -80,6 +80,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'category_id', 'view_data' => $this->goods_category_list, + 'width' => 150, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -92,6 +93,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'name', 'is_sort' => 1, + 'width' => 150, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -105,6 +107,7 @@ public function Run($params = []) 'is_form_su' => 1, 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -119,6 +122,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'config_count', 'is_sort' => 1, + 'width' => 160, 'search_config' => [ 'form_type' => 'section', ], diff --git a/app/admin/form/Goodsspectemplate.php b/app/admin/form/Goodsspectemplate.php index a7b205889..99864bc05 100644 --- a/app/admin/form/Goodsspectemplate.php +++ b/app/admin/form/Goodsspectemplate.php @@ -79,6 +79,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'category_id', 'view_data' => $this->goods_category_list, + 'width' => 150, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -91,6 +92,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'name', 'is_sort' => 1, + 'width' => 150, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -104,6 +106,7 @@ public function Run($params = []) 'is_form_su' => 1, 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', diff --git a/app/admin/form/Link.php b/app/admin/form/Link.php index a0dfdff58..aaf3c8e05 100644 --- a/app/admin/form/Link.php +++ b/app/admin/form/Link.php @@ -96,6 +96,7 @@ public function Run($params = []) 'is_form_su' => 1, 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -112,6 +113,7 @@ public function Run($params = []) 'post_url' => MyUrl('admin/link/statusupdate'), 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -126,6 +128,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'sort', 'is_sort' => 1, + 'width' => 160, 'search_config' => [ 'form_type' => 'section', ], diff --git a/app/admin/form/Order.php b/app/admin/form/Order.php index a8cb35e80..257eaa72f 100644 --- a/app/admin/form/Order.php +++ b/app/admin/form/Order.php @@ -41,6 +41,7 @@ class Order public function Run($params = []) { $lang = MyLang('order.form_table'); + $lang_stats = MyLang('order.form_table_stats'); return [ // 基础配置 'base' => [ @@ -433,11 +434,11 @@ public function Run($params = []) ], 'is_page_stats' => 1, 'page_stats_data' => [ - ['name'=>'订单总额', 'field'=>'total_price'], - ['name'=>'支付总额', 'field'=>'pay_price'], - ['name'=>'商品总数', 'field'=>'buy_number_count'], - ['name'=>'退款金额', 'field'=>'refund_price'], - ['name'=>'退货数量', 'field'=>'returned_quantity'], + ['name'=>$lang_stats['total_price'], 'field'=>'total_price'], + ['name'=>$lang_stats['pay_price'], 'field'=>'pay_price'], + ['name'=>$lang_stats['buy_number_count'], 'field'=>'buy_number_count'], + ['name'=>$lang_stats['refund_price'], 'field'=>'refund_price'], + ['name'=>$lang_stats['returned_quantity'], 'field'=>'returned_quantity'], ], 'data_params' => [ 'is_public' => 0, diff --git a/app/admin/form/Orderaftersale.php b/app/admin/form/Orderaftersale.php index 78b383ac3..e491fdec5 100644 --- a/app/admin/form/Orderaftersale.php +++ b/app/admin/form/Orderaftersale.php @@ -37,6 +37,7 @@ class OrderAftersale public function Run($params = []) { $lang = MyLang('orderaftersale.form_table'); + $lang_stats = MyLang('orderaftersale.form_table_stats'); return [ // 基础配置 'base' => [ @@ -279,6 +280,11 @@ public function Run($params = []) 'is_public' => 0, 'user_type' => 'admin', ], + 'is_page_stats' => 1, + 'page_stats_data' => [ + ['name'=>$lang_stats['price'], 'field'=>'price'], + ['name'=>$lang_stats['number'], 'field'=>'number'], + ], ], ]; } diff --git a/app/admin/form/Quicknav.php b/app/admin/form/Quicknav.php index 68cfe29b6..36d8fd0a9 100644 --- a/app/admin/form/Quicknav.php +++ b/app/admin/form/Quicknav.php @@ -59,6 +59,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'name', 'is_sort' => 1, + 'width' => 150, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -71,6 +72,7 @@ public function Run($params = []) 'view_data_key' => 'name', 'view_data' => MyConst('common_platform_type'), 'is_sort' => 1, + 'width' => 165, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -85,6 +87,7 @@ public function Run($params = []) 'view_type' => 'module', 'view_key' => 'quicknav/module/images', 'align' => 'center', + 'width' => 70, ], [ 'label' => $lang['event_type'], @@ -122,6 +125,7 @@ public function Run($params = []) 'is_form_su' => 1, 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -136,6 +140,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'sort', 'is_sort' => 1, + 'width' => 160, 'search_config' => [ 'form_type' => 'section', ], diff --git a/app/admin/form/Role.php b/app/admin/form/Role.php index 278846099..019c34ac3 100644 --- a/app/admin/form/Role.php +++ b/app/admin/form/Role.php @@ -61,6 +61,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'name', 'is_sort' => 1, + 'width' => 150, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -74,6 +75,7 @@ public function Run($params = []) 'is_form_su' => 1, 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', diff --git a/app/admin/form/Slide.php b/app/admin/form/Slide.php index 9865ff069..078cf3fa1 100644 --- a/app/admin/form/Slide.php +++ b/app/admin/form/Slide.php @@ -59,6 +59,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'name', 'is_sort' => 1, + 'width' => 150, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -83,6 +84,7 @@ public function Run($params = []) 'view_data_key' => 'name', 'view_data' => MyConst('common_platform_type'), 'is_sort' => 1, + 'width' => 165, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -133,6 +135,7 @@ public function Run($params = []) 'is_form_su' => 1, 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', diff --git a/app/admin/form/Warehouse.php b/app/admin/form/Warehouse.php index 11d67a1aa..a214b1e45 100644 --- a/app/admin/form/Warehouse.php +++ b/app/admin/form/Warehouse.php @@ -78,6 +78,7 @@ public function Run($params = []) 'view_type' => 'field', 'view_key' => 'level', 'is_sort' => 1, + 'width' => 160, 'search_config' => [ 'form_type' => 'section', ], @@ -90,6 +91,7 @@ public function Run($params = []) 'is_form_su' => 1, 'align' => 'center', 'is_sort' => 1, + 'width' => 130, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', diff --git a/app/admin/lang/cht.php b/app/admin/lang/cht.php index b2e00dcaa..ace0fda79 100644 --- a/app/admin/lang/cht.php +++ b/app/admin/lang/cht.php @@ -24,7 +24,7 @@ 'order_transaction_amount_name' => '訂單成交金額走勢', 'order_trading_trend_name' => '訂單交易走勢', 'goods_hot_name' => '熱賣商品', - 'goods_hot_tips' => '僅顯示前30條商品', + 'goods_hot_tips' => '僅顯示前13條商品', 'payment_name' => '支付方式', 'order_region_name' => '訂單地域分佈', 'order_region_tips' => '僅顯示10條數據', @@ -807,6 +807,14 @@ 'add_time' => '創建時間', 'upd_time' => '更新時間', ], + // 动态表格统计字段 + 'form_table_stats' => [ + 'total_price' => '訂單總額', + 'pay_price' => '支付總額', + 'buy_number_count' => '商品總數', + 'refund_price' => '退款金額', + 'returned_quantity' => '退貨數量', + ], ], // 订单售后 @@ -844,6 +852,11 @@ 'add_time' => '創建時間', 'upd_time' => '更新時間', ], + // 动态表格统计字段 + 'form_table_stats' => [ + 'price' => '退款總額', + 'number' => '退貨總數', + ], ], // 支付方式 diff --git a/app/admin/lang/en.php b/app/admin/lang/en.php index 8305e807f..3d1750776 100644 --- a/app/admin/lang/en.php +++ b/app/admin/lang/en.php @@ -24,7 +24,7 @@ 'order_transaction_amount_name' => 'Trend of order transaction amount', 'order_trading_trend_name' => 'Order trading trend', 'goods_hot_name' => 'Hot Goods', - 'goods_hot_tips' => 'Show only the first 30 items', + 'goods_hot_tips' => 'Show only the first 13 items', 'payment_name' => 'Payment Method', 'order_region_name' => 'Order geographical distribution', 'order_region_tips' => 'Only 10 pieces of data are displayed', @@ -822,6 +822,14 @@ 'add_time' => 'Creation Time', 'upd_time' => 'Update Time', ], + // 动态表格统计字段 + 'form_table_stats' => [ + 'total_price' => 'TotalPrice', + 'pay_price' => 'PaymentPrice', + 'buy_number_count' => 'GoodsNumber', + 'refund_price' => 'RefundAmount', + 'returned_quantity' => 'RefundNumber', + ], ], // 订单售后 @@ -859,6 +867,11 @@ 'add_time' => 'Creation Time', 'upd_time' => 'Update Time', ], + // 动态表格统计字段 + 'form_table_stats' => [ + 'price' => 'Total refund amount', + 'number' => 'Total number of returns', + ], ], // 支付方式 diff --git a/app/admin/lang/spa.php b/app/admin/lang/spa.php index 045b4c323..ee5c3eca3 100644 --- a/app/admin/lang/spa.php +++ b/app/admin/lang/spa.php @@ -24,7 +24,7 @@ 'order_transaction_amount_name' => 'Evolución de la facturación de pedidos', 'order_trading_trend_name' => 'Tendencia de las transacciones de pedidos', 'goods_hot_name' => 'Productos de venta caliente', - 'goods_hot_tips' => 'Solo se muestran los primeros 30 productos', + 'goods_hot_tips' => 'Solo se muestran los primeros 13 productos', 'payment_name' => 'Método de pago', 'order_region_name' => 'Distribución geográfica de los pedidos', 'order_region_tips' => 'Solo se muestran 10 datos', @@ -807,6 +807,14 @@ 'add_time' => 'Tiempo de creación', 'upd_time' => 'Tiempo de actualización', ], + // 动态表格统计字段 + 'form_table_stats' => [ + 'total_price' => 'Total de pedidos', + 'pay_price' => 'Total de pagos', + 'buy_number_count' => 'Total de productos básicos', + 'refund_price' => 'Importe del reembolso', + 'returned_quantity' => 'Número de devoluciones', + ], ], // 订单售后 @@ -844,6 +852,11 @@ 'add_time' => 'Tiempo de creación', 'upd_time' => 'Tiempo de actualización', ], + // 动态表格统计字段 + 'form_table_stats' => [ + 'price' => 'Reembolso total', + 'number' => 'Número total de devoluciones', + ], ], // 支付方式 diff --git a/app/admin/lang/zh.php b/app/admin/lang/zh.php index bed747428..7bbee2550 100755 --- a/app/admin/lang/zh.php +++ b/app/admin/lang/zh.php @@ -24,7 +24,7 @@ 'order_transaction_amount_name' => '订单成交金额', 'order_trading_trend_name' => '订单交易', 'goods_hot_name' => '热销商品', - 'goods_hot_tips' => '仅显示前30条商品', + 'goods_hot_tips' => '仅显示前13条商品', 'payment_name' => '支付方式', 'order_region_name' => '订单地域分布', 'order_region_tips' => '仅显示10条数据', @@ -808,6 +808,14 @@ 'add_time' => '创建时间', 'upd_time' => '更新时间', ], + // 动态表格统计字段 + 'form_table_stats' => [ + 'total_price' => '订单总额', + 'pay_price' => '支付总额', + 'buy_number_count' => '商品总数', + 'refund_price' => '退款金额', + 'returned_quantity' => '退货数量', + ], ], // 订单售后 @@ -845,6 +853,11 @@ 'add_time' => '创建时间', 'upd_time' => '更新时间', ], + // 动态表格统计字段 + 'form_table_stats' => [ + 'price' => '退款总额', + 'number' => '退货总数', + ], ], // 支付方式 diff --git a/app/admin/view/default/index/init.html b/app/admin/view/default/index/init.html index 446a50592..88af02d9e 100755 --- a/app/admin/view/default/index/init.html +++ b/app/admin/view/default/index/init.html @@ -526,7 +526,7 @@
{{:MyLang('index.base_item_map_whole_country_title')}} - diff --git a/app/admin/view/default/shortcutmenu/index.html b/app/admin/view/default/shortcutmenu/index.html index 2d763eddd..88fb6015e 100644 --- a/app/admin/view/default/shortcutmenu/index.html +++ b/app/admin/view/default/shortcutmenu/index.html @@ -51,6 +51,12 @@ {{/foreach}} {{/if}} {{/foreach}} + {{if !empty($admin_plugins)}} + + {{foreach $admin_plugins as $k=>$v}} + + {{/foreach}} + {{/if}} {{/if}} {{:MyLang('or_title')}} diff --git a/app/index/form/Order.php b/app/index/form/Order.php index 3d066b9db..f4db3e91d 100644 --- a/app/index/form/Order.php +++ b/app/index/form/Order.php @@ -68,7 +68,7 @@ public function Run($params = []) // 表单配置 $lang = MyLang('order.form_table'); - $lang_page_stats = MyLang('order.form_table_page_stats'); + $lang_stats = MyLang('order.form_table_stats'); $form = [ [ 'label' => $lang['goods'], @@ -435,11 +435,11 @@ public function Run($params = []) ], 'is_page_stats' => 1, 'page_stats_data' => [ - ['name'=>$lang_page_stats['total_price'], 'field'=>'total_price', 'unit'=>$lang_page_stats['price_unit']], - ['name'=>$lang_page_stats['pay_price'], 'field'=>'pay_price', 'unit'=>$lang_page_stats['price_unit']], - ['name'=>$lang_page_stats['buy_number_count'], 'field'=>'buy_number_count'], - ['name'=>$lang_page_stats['refund_price'], 'field'=>'refund_price', 'unit'=>$lang_page_stats['price_unit']], - ['name'=>$lang_page_stats['returned_quantity'], 'field'=>'returned_quantity'], + ['name'=>$lang_stats['total_price'], 'field'=>'total_price'], + ['name'=>$lang_stats['pay_price'], 'field'=>'pay_price'], + ['name'=>$lang_stats['buy_number_count'], 'field'=>'buy_number_count'], + ['name'=>$lang_stats['refund_price'], 'field'=>'refund_price'], + ['name'=>$lang_stats['returned_quantity'], 'field'=>'returned_quantity'], ], 'data_params' => [ 'is_operate' => 1, diff --git a/app/index/form/Orderaftersale.php b/app/index/form/Orderaftersale.php index e9616367c..c011285ae 100644 --- a/app/index/form/Orderaftersale.php +++ b/app/index/form/Orderaftersale.php @@ -54,6 +54,7 @@ public function __construct($params = []) public function Run($params = []) { $lang = MyLang('orderaftersale.form_table'); + $lang_stats = MyLang('orderaftersale.form_table_stats'); return [ // 基础配置 'base' => [ @@ -266,6 +267,11 @@ public function Run($params = []) 'data_params' => [ 'is_public' => 0, ], + 'is_page_stats' => 1, + 'page_stats_data' => [ + ['name'=>$lang_stats['price'], 'field'=>'price'], + ['name'=>$lang_stats['number'], 'field'=>'number'], + ], ], ]; } diff --git a/app/index/lang/cht.php b/app/index/lang/cht.php index 6f64a257e..fce4c85e9 100644 --- a/app/index/lang/cht.php +++ b/app/index/lang/cht.php @@ -285,13 +285,12 @@ 'upd_time' => '更新時間', ], // 动态表格统计数据 - 'form_table_page_stats' => [ + 'form_table_stats' => [ 'total_price' => '訂單總額', 'pay_price' => '支付總額', 'buy_number_count' => '商品總數', - 'refund_price' => '退款', - 'returned_quantity' => '退貨', - 'price_unit' => '元', + 'refund_price' => '退款金額', + 'returned_quantity' => '退貨數量', ], ], diff --git a/app/index/lang/en.php b/app/index/lang/en.php index b7430af3a..f9d3c56fa 100644 --- a/app/index/lang/en.php +++ b/app/index/lang/en.php @@ -285,13 +285,12 @@ 'upd_time' => 'Update Time', ], // 动态表格统计数据 - 'form_table_page_stats' => [ + 'form_table_stats' => [ 'total_price' => 'TotalPrice', 'pay_price' => 'PaymentPrice', 'buy_number_count' => 'GoodsNumber', 'refund_price' => 'RefundAmount', 'returned_quantity' => 'RefundNumber', - 'price_unit' => 'yuan', ], ], @@ -369,6 +368,11 @@ 'add_time' => 'Creation Time', 'upd_time' => 'Update Time', ], + // 动态表格统计字段 + 'form_table_stats' => [ + 'price' => 'Total refund amount', + 'number' => 'Total number of returns', + ], ], // 用户 diff --git a/app/index/lang/spa.php b/app/index/lang/spa.php index 036868d85..156dc781b 100644 --- a/app/index/lang/spa.php +++ b/app/index/lang/spa.php @@ -285,13 +285,12 @@ 'upd_time' => 'Tiempo de actualización', ], // 动态表格统计数据 - 'form_table_page_stats' => [ + 'form_table_stats' => [ 'total_price' => 'Total de pedidos', 'pay_price' => 'Total de pagos', 'buy_number_count' => 'Total de productos básicos', - 'refund_price' => 'Reembolso', - 'returned_quantity' => 'Devolución', - 'price_unit' => 'Yuan', + 'refund_price' => 'Importe del reembolso', + 'returned_quantity' => 'Número de devoluciones', ], ], @@ -369,6 +368,11 @@ 'add_time' => 'Tiempo de creación', 'upd_time' => 'Tiempo de actualización', ], + // 动态表格统计字段 + 'form_table_stats' => [ + 'price' => 'Reembolso total', + 'number' => 'Número total de devoluciones', + ], ], // 用户 diff --git a/app/index/lang/zh.php b/app/index/lang/zh.php index c16e29e85..d4f979521 100755 --- a/app/index/lang/zh.php +++ b/app/index/lang/zh.php @@ -285,13 +285,12 @@ 'upd_time' => '更新时间', ], // 动态表格统计数据 - 'form_table_page_stats' => [ + 'form_table_stats' => [ 'total_price' => '订单总额', 'pay_price' => '支付总额', 'buy_number_count' => '商品总数', - 'refund_price' => '退款', - 'returned_quantity' => '退货', - 'price_unit' => '元', + 'refund_price' => '退款金额', + 'returned_quantity' => '退货数量', ], ], @@ -369,6 +368,11 @@ 'add_time' => '创建时间', 'upd_time' => '更新时间', ], + // 动态表格统计字段 + 'form_table_stats' => [ + 'price' => '退款总额', + 'number' => '退货总数', + ], ], // 用户 diff --git a/extend/base/Email.php b/extend/base/Email.php index 14a8ac274..087958a52 100755 --- a/extend/base/Email.php +++ b/extend/base/Email.php @@ -10,6 +10,7 @@ // +---------------------------------------------------------------------- namespace base; +use app\service\EmailLogService; use phpmailer\PHPMailer; /** @@ -137,9 +138,10 @@ public function SendHtml($params = []) } // 验证码替换 - if(!empty($params['code'])) + $params_code = empty($params['code']) ? '' : $params['code']; + if(!empty($params_code)) { - $params['content'] = str_replace('#code#', $params['code'], $params['content']); + $params['content'] = str_replace('#code#', $params_code, $params['content']); } // 邮件初始化 @@ -165,17 +167,31 @@ public function SendHtml($params = []) // 邮件正文不支持HTML的备用显示 $this->obj->AltBody = strip_tags($params['content']); + // 添加短信日志 + $log = EmailLogService::EmailLogAdd($this->obj->Host, $this->obj->Port, $this->obj->Username, $this->obj->From, $this->obj->FromName, $params['email'], $params['title'], $params['content'], $params_code); + if($log['code'] != 0) + { + $this->error = $log['msg']; + return false; + } + // 发送邮件 if($this->obj->Send()) { // 种session if($this->is_frq == 1) { - $this->KindofSession(empty($params['code']) ? '' : $params['code']); + $this->KindofSession(empty($params_code) ? '' : $params_code); } + + // 日志回调 + EmailLogService::EmailLogResponse($log['data']['id'], 1, time()-$log['data']['add_time']); return true; } else { $this->error = $this->obj->ErrorInfo; + + // 日志回调 + EmailLogService::EmailLogResponse($log['data']['id'], 2, time()-$log['data']['add_time'], $this->error); } return false; } diff --git a/extend/base/Sms.php b/extend/base/Sms.php index 2fd864890..32037e2c1 100755 --- a/extend/base/Sms.php +++ b/extend/base/Sms.php @@ -10,6 +10,8 @@ // +---------------------------------------------------------------------- namespace base; +use app\service\SmsLogService; + /** * 短信驱动 * @author Devil @@ -65,10 +67,10 @@ public function __construct($params = []) * @desc description * @param [string] $mobile [手机号码,多个以 英文逗号 , 分割] * @param [string|array] $code [变量code(单个直接传入 code 即可,多个传入数组)] - * @param [string] $template_code [模板 id] + * @param [string] $template_value[模板 id] * @param [boolean] $sign_name [自定义签名,默认使用基础配置的签名] */ - public function SendCode($mobile, $code, $template_code, $sign_name = '') + public function SendCode($mobile, $code, $template_value, $sign_name = '') { // 单个验证码需要校验是否频繁 if(is_string($code)) @@ -85,7 +87,7 @@ public function SendCode($mobile, $code, $template_code, $sign_name = '') } // 请求发送 - $status = $this->SmsRequest($mobile, $template_code, $sign_name, $codes); + $status = $this->SmsRequest($mobile, $template_value, $sign_name, $codes); if($status) { // 种session @@ -105,11 +107,11 @@ public function SendCode($mobile, $code, $template_code, $sign_name = '') * @date 2020-04-02 * @desc description * @param [string] $mobile [手机号码,多个以 英文逗号 , 分割] - * @param [string] $template_code [模板 id] + * @param [string] $template_value [模板 id] * @param [boolean] $sign_name [自定义签名,默认使用基础配置的签名] - * @param [string|array] $template_params [变量code(单个直接传入 code 即可,多个传入数组)] + * @param [string|array] $template_var [变量code(单个直接传入 code 即可,多个传入数组)] */ - public function SendTemplate($mobile, $template_code, $sign_name = '', $template_params = []) + public function SendTemplate($mobile, $template_value, $sign_name = '', $template_var = []) { // 是否频繁操作 if($this->is_frq == 1) @@ -122,7 +124,7 @@ public function SendTemplate($mobile, $template_code, $sign_name = '', $template } // 请求发送 - $status = $this->SmsRequest($mobile, $template_code, $sign_name, $template_params); + $status = $this->SmsRequest($mobile, $template_value, $sign_name, $template_var); if($status) { // 种session @@ -142,17 +144,41 @@ public function SendTemplate($mobile, $template_code, $sign_name = '', $template * @date 2022-03-26 * @desc description * @param [string] $mobile [手机号码,多个以 英文逗号 , 分割] - * @param [string] $template_code [模板 id] + * @param [string] $template_value [模板 id] * @param [boolean] $sign_name [自定义签名,默认使用基础配置的签名] - * @param [string|array] $template_params [默认变量code(单个直接传入 code 即可,多个传入数组)] + * @param [string|array] $template_var [默认变量code(单个直接传入 code 即可,多个传入数组)] */ - public function SmsRequest($mobile, $template_code, $sign_name = '', $template_params = []) + public function SmsRequest($mobile, $template_value, $sign_name = '', $template_var = []) { // 签名 $sign_name = empty($sign_name) ? $this->sign_ame : $sign_name; + // 短信发送钩子 + $hook_name = 'plugins_extend_sms_send_request_handle'; + $ret = array_filter(MyEventTrigger($hook_name, [ + 'hook_name' => $hook_name, + 'is_backend' => true, + 'sign_name' => $sign_name, + 'mobile' => $mobile, + 'template_value' => $template_value, + 'template_var' => $template_var, + ])); + // 存在返回值,并且存在code和mag参数,则认为是钩子处理短信的发送 + if(!empty($ret)) + { + // 处理钩子数据 + $ret = EventReturnHandle($ret); + if($ret['code'] != 0) + { + $this->error = $ret['msg']; + return false; + } + return true; + } + // 请求参数 - $params = [ + $request_url = 'http://dysmsapi.aliyuncs.com/'; + $request_params = [ 'SignName' => $sign_name, 'Format' => 'JSON', 'Version' => '2017-05-25', @@ -162,24 +188,33 @@ public function SmsRequest($mobile, $template_code, $sign_name = '', $template_p 'SignatureNonce' => uniqid(), 'Timestamp' => gmdate('Y-m-d\TH:i:s\Z'), 'Action' => 'SendSms', - 'TemplateCode' => $template_code, + 'TemplateCode' => $template_value, 'PhoneNumbers' => $mobile, ]; // 携带参数 - if(!empty($template_params)) + if(!empty($template_var)) { - if(!is_array($template_params)) + if(!is_array($template_var)) { - $template_params = ['code'=>$template_params]; + $template_var = ['code'=>$template_var]; } - $params['TemplateParam'] = json_encode($template_params, JSON_UNESCAPED_UNICODE); + $request_params['TemplateParam'] = json_encode($template_var, JSON_UNESCAPED_UNICODE); } // 签名 - $params ['Signature'] = $this->ComputeSignature($params, $this->access_key_secret); + $request_params['Signature'] = $this->ComputeSignature($request_params, $this->access_key_secret); + + // 添加短信日志 + $log = SmsLogService::SmsLogAdd('aliyun', $mobile, $sign_name, $template_value, $template_var, $request_url, $request_params); + if($log['code'] != 0) + { + $this->error = $log['msg']; + return false; + } + // 远程请求 - $url = 'http://dysmsapi.aliyuncs.com/?' . http_build_query($params); + $request_url .= '?' . http_build_query($request_params); $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_URL, $request_url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); @@ -187,12 +222,18 @@ public function SmsRequest($mobile, $template_code, $sign_name = '', $template_p $result = curl_exec($ch); curl_close($ch); $result = json_decode($result, true); - if(isset($result['Code']) && $result['Code'] != 'OK') + if(isset($result['Code']) && $result['Code'] == 'OK') { - $this->error = $this->GetErrorMessage($result['Code']); - return false; + // 日志回调 + SmsLogService::SmsLogResponse($log['data']['id'], 1, $result, time()-$log['data']['add_time']); + return true; } - return true; + + // 错误原因 + $this->error = $this->GetErrorMessage($result['Code']); + // 日志回调 + SmsLogService::SmsLogResponse($log['data']['id'], 2, $result, time()-$log['data']['add_time'], $this->error); + return false; } /** diff --git a/extend/base/Toutiao.php b/extend/base/Toutiao.php index 0dc4e44d9..d7580fd4e 100644 --- a/extend/base/Toutiao.php +++ b/extend/base/Toutiao.php @@ -217,6 +217,43 @@ public function GetMiniAccessToken() return false; } + /** + * 获取client_token + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2018-01-02T19:53:42+0800 + */ + public function GetMiniClientToken() + { + // 缓存key + $key = $this->config['appid'].'_client_token'; + $result = MyCache($key); + if(!empty($result)) + { + if($result['expires_in'] > time()) + { + return $result['access_token']; + } + } + + // 网络请求 + $params = [ + 'client_key' => $this->config['appid'], + 'client_secret' => $this->config['secret'], + 'grant_type' => 'client_credential', + ]; + $result = json_decode($this->HttpRequestPost('https://open.douyin.com/oauth/client_token/', $params, true, ['Content-Type: application/json']), true); + if(!empty($result['data']) && !empty($result['data']['access_token'])) + { + // 缓存存储 + $result['data']['expires_in'] += time(); + MyCache($key, $result['data']); + return $result['data']['access_token']; + } + return false; + } + /** * get请求 * @author Devil @@ -251,12 +288,14 @@ private function HttpRequestGet($url) * @param [boolean] $is_json [是否使用 json 数据发送] * @return [mixed] [请求返回的数据] */ - private function HttpRequestPost($url, $post, $is_json = false) + private function HttpRequestPost($url, $post, $is_json = false, $header = []) { $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HEADER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_setopt($ch, CURLOPT_URL, $url); @@ -265,18 +304,24 @@ private function HttpRequestPost($url, $post, $is_json = false) { $data_string = json_encode($post); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); - curl_setopt($ch, CURLOPT_HTTPHEADER, array( + if(empty($header)) + { + $header = [ "Content-Type: application/json; charset=utf-8", "Content-Length: " . strlen($data_string) - ) - ); + ]; + } + curl_setopt($ch, CURLOPT_HTTPHEADER, $header); } else { curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); - curl_setopt($ch, CURLOPT_HTTPHEADER, array( + if(empty($header)) + { + $header = [ "Content-Type: application/x-www-form-urlencoded", "cache-control: no-cache" - ) - ); + ]; + } + curl_setopt($ch, CURLOPT_HTTPHEADER, $header); } $result = curl_exec($ch); curl_close($ch); diff --git a/extend/base/Wechat.php b/extend/base/Wechat.php index a4ba65151..3fde5829c 100755 --- a/extend/base/Wechat.php +++ b/extend/base/Wechat.php @@ -128,6 +128,232 @@ public function MiniSubscribeMessage($params = []) return DataReturn($msg, -1); } + /** + * 小程序发货信息录入 + * @author Shon Wu + * @blog https://github.com/mantoufan/ + * @version 1.0.0 + * @date 2023-08-21 + * @desc description + * @param [string] $params['order_model'] [订单模式] + * @param [string] $params['trade_no'] [支付平台交易号] + * @param [string] $params['buyer_user'] [支付平台用户账号] + * @param [string] $params['goods_title'] [商品标题] + * @optional [string] $params['express_name'] [快递公司名称] + * @optional [string] $params['express_number'] [快递单号] + * @optional [string] $params['tel'] [收货联系人手机号] + * @return [array|null] [成功原样返回微信小程序接口响应, 失败则空] + */ + public function MiniUploadShippingInfo($params = []) + { + // 请求参数 + $p = [ + [ + 'checked_type' => 'empty', + 'key_name' => 'trade_no', + 'error_msg' => MyLang('common_extend.base.wechat.trade_no_empty_tips'), + ], + [ + 'checked_type' => 'empty', + 'key_name' => 'buyer_user', + 'error_msg' => MyLang('common_extend.base.wechat.buyer_user_empty_tips'), + ], + [ + 'checked_type' => 'empty', + 'key_name' => 'goods_title', + 'error_msg' => MyLang('common_extend.base.wechat.goods_title_empty_tips'), + ], + ]; + $ret = ParamsChecked($params, $p); + if($ret !== true) + { + return DataReturn($ret, -1); + } + + // 获取access_token + $access_token = $this->GetMiniAccessToken(); + if($access_token === false) + { + return DataReturn(MyLang('common_extend.base.common.access_token_request_fail_tips'), -1); + } + + // 是否已开通发货管理 + $key = 'wechat_is_trade_managed_'.$this->_appid; + $trade_managed = MyCache($key); + if(empty($trade_managed)) + { + $url = 'https://api.weixin.qq.com/wxa/sec/order/is_trade_managed?access_token='.$access_token; + $trade_managed = $this->HttpRequestPost($url, ['appid'=>$this->_appid], true); + MyCache($key, $trade_managed); + } + if(empty($trade_managed) || !isset($trade_managed['errcode']) || $trade_managed['errcode'] != 0 || !isset($trade_managed['is_trade_managed']) || $trade_managed['is_trade_managed'] != 1) + { + return DataReturn(MyLang('common_extend.base.common.not_opened_trade_managed_msg'), 0); + } + + // 订单模式类型 + $order_model_list = [ + // 商城订单模式:销售型(快递 / 快递 + 自提) <-> 微信小程序:实体物流配送采用快递公司进行实体物流配送形式 + 0 => 1, + // 商城订单模式:展示型 <-> 微信小程序:终止,不抛出错误 + 1 => null, + // 商城订单模式:自提型 <-> 微信小程序:用户自提 + 2 => 4, + // 商城订单模式:虚拟销售 <-> 微信小程序:虚拟商品 + 3 => 3, + ]; + $logistics_type = array_key_exists($params['order_model'], $order_model_list) ? $order_model_list[$params['order_model']] : null; + // 展示模式表示为无效的订单,不处理 + if($logistics_type === null) + { + return DataReturn(MyLang('common_extend.base.wechat.no_match_logistics_mode'), 0); + } + + // 商城参数转换为微信小程序参数 + if(!is_array($params['goods_title'])) + { + $params['goods_title'] = explode(',', $params['goods_title']); + } + $shipping_list = array_map(function($item) + { + return ['item_desc'=>$item]; + }, $params['goods_title']); + // 非快递模式物流信息智能为一项 + if($logistics_type != 1 && count($shipping_list) > 1) + { + $shipping_list = [$shipping_list[0]]; + } + + // 请求参数 + $data = [ + 'order_key' => [ + // 使用微信支付单号 + 'order_number_type' => 2, + // 原支付交易对应的微信订单号 + 'transaction_id' => $params['trade_no'], + ], + // 发货模式:1 统一发货,2 分拆发货 + 'delivery_mode' => (count($shipping_list) == 1) ? 1 : 2, + // 物流信息列表 + 'shipping_list' => $shipping_list, + // 分拆发货模式时、是否已全部发货 true | false + 'is_all_delivered' => true, + // 物流模式,发货方式枚举值:1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提 + 'logistics_type' => $logistics_type, + // 支付者,支付者信息 + 'payer' => ['openid' => $params['buyer_user']], + // 上传时间 + 'upload_time' => date('Y-m-d\TH:i:sP'), + ]; + + // 物流发货匹配快递信息 + if($data['logistics_type'] === 1) + { + // 当商城为销售型时,传入快递公司编码和快递单号,传入收件人和发件人手机号供顺丰使用 + $express_res = $this->GetMiniDeliveryIdByName($params['express_name']); + if($express_res['code'] !== 0) + { + return $express_res; + } + $consignor_tel = empty($params['consignor_tel']) ? '' : substr($params['consignor_tel'], 0, 3).'****'.substr($params['consignor_tel'], -4); + $receiver_tel = empty($params['receiver_tel']) ? '' : substr($params['receiver_tel'], 0, 3).'****'.substr($params['receiver_tel'], -4); + foreach($data['shipping_list'] as &$v) + { + $v['express_company'] = $express_res['data']; + $v['tracking_no'] = $params['express_number']; + if(!empty($consignor_tel) || !empty($receiver_tel)) + { + $v['contact'] = [ + 'consignor_contact' => $consignor_tel, + 'receiver_contact' => $receiver_tel, + ]; + } + } + } + + // 录入发货信息接口 + $url = 'https://api.weixin.qq.com/wxa/sec/order/upload_shipping_info?access_token='.$access_token; + $res = $this->HttpRequestPost($url, $data, true); + $code = isset($res['errcode']) ? $res['errcode'] : ''; + $msg = isset($res['errmsg']) ? $res['errmsg'] : MyLang('send_fail'); + // 支付单不存在 | 支付单已完成发货 | 无法继续发货、支付单已使用重新发货机会 三种情况则视为正常,不影响业务 + if(in_array($code, [10060001, 10060002, 10060003]) || $code == 0 && $msg == 'ok') + { + return DataReturn(MyLang('send_success'), 0, $res); + } else { + $msg = ($code !== '') ? $code.':'.$msg : $msg; + } + return DataReturn($msg, -1); + } + + /** + * 获取微信小程序中的快递公司编码:根据快递公司名称 + * @author Shon Wu + * @blog https://github.com/mantoufan/ + * @version 1.0.0 + * @date 2023-08-21 + * @desc description + * @param [string] $express_name [快递公司名称] + * @return [string|null] [成功返回快递公司编码, 失败则空] + */ + function GetMiniDeliveryIdByName($express_name) + { + // 获取access_token + $access_token = $this->GetMiniAccessToken(); + if($access_token === false) + { + return DataReturn(MyLang('common_extend.base.common.access_token_request_fail_tips'), -1); + } + + // 获取运力id列表接口 + $url = 'https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/get_delivery_list?access_token='.$access_token; + // 需要 POST {} 给接口 + $res = $this->HttpRequestPost($url, (object)[], true); + $msg = isset($res['errmsg']) ? $res['errmsg'] : MyLang('get_fail'); + if(isset($res['errcode']) && $res['errcode'] == 0) + { + $delivery_list = $res['delivery_list']; + $delivery_names = array_column($delivery_list, 'delivery_name'); + $delivery_index = array_search($express_name, $delivery_names); + if($delivery_index === false) + { + // 精确匹配失败后,如果公司名称包含快递、物流、速运、速递和邮政,进行模糊匹配。例如:顺丰快递 - 顺丰速运,韵达快递 - 韵达速递 + // 关键词的笛卡尔积,例如:顺丰快递未匹配,则依次查找顺丰速运、顺丰速递、顺丰物流、顺丰,直到找到一个匹配编码为止 + $to_be_replaceds = [ + '快递' => ['速运', '速递', '物流', ''], + '物流' => ['快递', '速运', '速递', ''], + '速运' => ['快递', '速递', '物流', ''], + '速递' => ['快递', '速运', '物流', ''], // EMS速递 - EMS + '邮政' => ['邮政快递', '国际邮政'], // 邮政包裹 - 邮政快递包裹 / 国际邮政包裹 + ]; + foreach($to_be_replaceds as $pattern => $replaceds) + { + if(stripos($express_name, $pattern) !== false) { + foreach($replaceds as $replaced) + { + $express_name_replaced = str_replace($pattern, $replaced, $express_name); + $delivery_index = array_search($express_name_replaced, $delivery_names); + if($delivery_index !== false) + { + break 2; + } + } + break; + } + } + } + if($delivery_index !== false) + { + return DataReturn(MyLang('get_success'), 0, $delivery_list[$delivery_index]['delivery_id']); + } + // 无匹配物流公司编码 + $msg = MyLang('common_extend.base.wechat.no_match_logistics_company_code'); + } else { + $msg = isset($res['errcode']) ? $res['errcode'].':'.$msg : $msg; + } + return DataReturn($msg, -1); + } + /** * 检验数据的真实性,并且获取解密后的明文 * @author Devil @@ -487,7 +713,7 @@ public function HttpRequestPost($url, $data, $is_parsing = true) curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_URL, $url); - curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); + curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_UNICODE)); curl_setopt($curl, CURLOPT_POST, true); $res = curl_exec($curl); curl_close($curl); diff --git a/extend/payment/OceanPayment.php b/extend/payment/OceanPayment.php index 6e2a1760a..335e92932 100644 --- a/extend/payment/OceanPayment.php +++ b/extend/payment/OceanPayment.php @@ -394,7 +394,7 @@ private function PayHtml($pay_data) $html .= '
- + '.(empty($this->config['button_order_name']) ? '进入我的订单' : $this->config['button_order_name']).'
'; @@ -419,6 +419,8 @@ private function PayHtml($pay_data) // 回调处理 var oceanpaymentCallBack = function(data) { if(data.msg){ + $(".pay-button").attr("data-status", 0); + console.log("pay reset"); // 处理卡信息错误 alert(data.msg); }else{ @@ -430,6 +432,8 @@ private function PayHtml($pay_data) var obj = {}; var response = xml_doc.getElementsByTagName("response")[0]; if(response == undefined) { + $(".pay-button").attr("data-status", 0); + console.log("pay reset"); alert("xml error"); return false; } @@ -439,6 +443,8 @@ private function PayHtml($pay_data) } // 是否需要3d验证 if((obj.pay_url || null) != null) { + $(".pay-button").attr("data-status", 0); + console.log("pay reset"); window.location.href = obj.pay_url; return false; } @@ -453,6 +459,13 @@ private function PayHtml($pay_data) // 调用支付 function pay() { + var status = parseInt($(".pay-button").attr("data-status") || 0); + if(status == 1) { + console.log("progress"); + return false; + } + console.log("pay..."); + $(".pay-button").attr("data-status", 1); // Jquery的serialize()方法 var formData = $("#payForm").serializeArray(); var obj = {} diff --git a/extend/payment/PayPal.php b/extend/payment/PayPal.php index 6b269dfe8..8463c119d 100644 --- a/extend/payment/PayPal.php +++ b/extend/payment/PayPal.php @@ -125,12 +125,22 @@ public function Config() 'is_required' => 0, 'message' => '请填写会员购买WebhookID、配置异步通知地址后得到的id', ], + [ + 'element' => 'input', + 'type' => 'text', + 'default' => '', + 'name' => 'scanpay_webhook_id', + 'placeholder' => '扫码收款WebhookID', + 'title' => '扫码收款WebhookID', + 'is_required' => 0, + 'message' => '请填写扫码收款WebhookID、配置异步通知地址后得到的id', + ], [ 'element' => 'input', 'type' => 'text', 'default' => '', 'name' => 'app_agreement', - 'placeholder' => 'APP协议头、例如:shopxochuyin://', + 'placeholder' => 'APP协议头、例如:shopxo://', 'title' => 'APP协议头(APP支付才需要配置)', 'is_required' => 0, 'message' => '请填写APP协议头', @@ -182,7 +192,7 @@ public function Config() ], [ 'element' => 'message', - 'message' => '1. 订单异步通知地址,将该地址配置到支付后台异步通知
'.__MY_URL__.'payment_default_order_'.strtolower(str_replace(['payment', '\\'], '', get_class($this))).'_notify.php

2. 钱包充值异步通知地址,将该地址配置到支付后台异步通知
'.__MY_URL__.'payment_default_wallet_'.strtolower(str_replace(['payment', '\\'], '', get_class($this))).'_notify.php

3. 会员等级购买异步通知地址,将该地址配置到支付后台异步通知
'.__MY_URL__.'payment_default_membershiplevelvip_'.strtolower(str_replace(['payment', '\\'], '', get_class($this))).'_notify.php

异步通知类型勾选【Payment capture completed】即可', + 'message' => '1. 订单异步通知地址,将该地址配置到支付后台异步通知
'.__MY_URL__.'payment_default_order_'.strtolower(str_replace(['payment', '\\'], '', get_class($this))).'_notify.php

2. 钱包充值异步通知地址,将该地址配置到支付后台异步通知
'.__MY_URL__.'payment_default_wallet_'.strtolower(str_replace(['payment', '\\'], '', get_class($this))).'_notify.php

3. 会员等级购买异步通知地址,将该地址配置到支付后台异步通知
'.__MY_URL__.'payment_default_membershiplevelvip_'.strtolower(str_replace(['payment', '\\'], '', get_class($this))).'_notify.php

4. 扫码收款异步通知地址,将该地址配置到支付后台异步通知
'.__MY_URL__.'payment_default_scanpay_'.strtolower(str_replace(['payment', '\\'], '', get_class($this))).'_notify.php

异步通知类型勾选【Payments & Payouts 下面的 Payment capture completed】即可', ], ]; diff --git a/extend/payment/Toutiao.php b/extend/payment/Toutiao.php index 748cbf8cc..4116658e5 100644 --- a/extend/payment/Toutiao.php +++ b/extend/payment/Toutiao.php @@ -10,6 +10,8 @@ // +---------------------------------------------------------------------- namespace payment; +use app\service\AppMiniUserService; + /** * 头条 * @author Devil @@ -70,6 +72,17 @@ public function Config() 'is_required' => 0, 'message' => '请填写小程序AppID', ], + [ + 'element' => 'select', + 'title' => '支付类型', + 'message' => '请选择支付类型', + 'name' => 'pay_type', + 'is_multiple' => 0, + 'element_data' => [ + ['value'=>0, 'name'=>'担保交易(普通)'], + ['value'=>1, 'name'=>'担保交易(企业-通用交易系统)'], + ], + ], [ 'element' => 'input', 'type' => 'text', @@ -91,9 +104,54 @@ public function Config() 'is_required' => 0, 'message' => '请填写Token(令牌)', ], + [ + 'element' => 'textarea', + 'name' => 'rsa_public', + 'placeholder' => '应用公钥', + 'title' => '应用公钥', + 'is_required' => 0, + 'rows' => 6, + 'message' => '请填写应用公钥', + ], + [ + 'element' => 'textarea', + 'name' => 'rsa_private', + 'placeholder' => '应用私钥', + 'title' => '应用私钥', + 'is_required' => 0, + 'rows' => 6, + 'message' => '请填写应用私钥', + ], + [ + 'element' => 'textarea', + 'name' => 'out_rsa_public', + 'placeholder' => '支付平台公钥', + 'title' => '支付平台公钥', + 'is_required' => 0, + 'rows' => 6, + 'message' => '请填写支付平台公钥', + ], + [ + 'element' => 'select', + 'title' => '交易规则标签组', + 'message' => '请选择交易规则标签组', + 'name' => 'tag_group_id', + 'is_multiple' => 0, + 'element_data' => [ + ['value'=>'tag_group_7272625659887943692', 'name'=>'通信-号卡商品(未制卡全额退/制卡后协商退)'], + ['value'=>'tag_group_7272625659887960076', 'name'=>'通信-定制服务(未制作全额退/定制后协商退)'], + ['value'=>'tag_group_7272625659887976460', 'name'=>'通信-定制服务(未制作全额退/定制后不可退)'], + ['value'=>'tag_group_7272625659887992844', 'name'=>'通信-虚拟充值(不可退)'], + ['value'=>'tag_group_7272625659888009228', 'name'=>'咨询-普通咨询(未服务全额退/开始服务后协商退)'], + ['value'=>'tag_group_7272625659888025612', 'name'=>'咨询-普通咨询(未服务全额退/开始服务后不可退)'], + ['value'=>'tag_group_7297888175123382299', 'name'=>'咨询-代写文书(未服务全额退/开始服务后协商退)'], + ['value'=>'tag_group_7272625659888041996', 'name'=>'咨询-内容消费(不可退)'], + ['value'=>'tag_group_7272625659888058380', 'name'=>'工具-虚拟服务(不可退)'], + ], + ], [ 'element' => 'message', - 'message' => '异步通知地址,将该地址配置到头条小程序后台->支付->担保交易->担保交易设置中
'.__MY_URL__.'payment_default_order_'.strtolower(str_replace(['payment', '\\'], '', get_class($this))).'_notify.php', + 'message' => '异步通知地址,将该地址配置到头条小程序后台->支付->担保交易->担保交易设置中
'.__MY_URL__.'payment_default_order_'.strtolower(str_replace(['payment', '\\'], '', get_class($this))).'_notify.php

PS:支付类型 担保交易(企业-通用交易系统)采用(应用公钥、私钥、平台公钥、交易规则标签组)配置项', ], ]; @@ -121,33 +179,130 @@ public function Pay($params = []) } // 配置信息 - if(empty($this->config)) + if(empty($this->config) || empty($this->config['app_id'])) { return DataReturn('支付缺少配置', -1); } - // 处理支付 - $parameter = [ - 'app_id' => $this->config['app_id'], - 'out_order_no' => $params['order_no'], - 'total_amount' => (int) (($params['total_price']*1000)/10), - 'subject' => $params['name'], - 'body' => $params['site_name'].'-'.$params['name'], - 'valid_time' => $this->OrderAutoCloseTime(), - 'notify_url' => $params['notify_url'], - ]; + // 支付类型 + $pay_type = isset($this->config['pay_type']) ? intval($this->config['pay_type']) : 0; + switch($pay_type) + { + // 担保交易-普通版本 + case 0 : + // 配置信息 + if(empty($this->config['salt']) || empty($this->config['token'])) + { + return DataReturn('支付缺少配置(salt|token)', -1); + } + + // 处理支付 + $parameter = [ + 'app_id' => $this->config['app_id'], + 'out_order_no' => $params['order_no'], + 'total_amount' => (int) (($params['total_price']*1000)/10), + 'subject' => $params['name'], + 'body' => $params['site_name'].'-'.$params['name'], + 'valid_time' => $this->OrderAutoCloseTime(), + 'notify_url' => $params['notify_url'], + ]; + + // 签名 + $parameter['sign'] = $this->GetParamSign($parameter); + + // 请求接口 + $url = 'https://developer.toutiao.com/api/apps/ecpay/v1/create_order'; + $ret = $this->HttpRequest($url, $parameter); + if($ret['code'] == 0 && !empty($ret['data']['data'])) + { + $ret['data'] = $ret['data']['data']; + } + return $ret; + break; + + // 担保交易-企业-通用交易系统 + case 1 : + // 配置信息 + if(empty($this->config['rsa_public']) || empty($this->config['rsa_private']) || empty($this->config['out_rsa_public']) || empty($this->config['tag_group_id'])) + { + return DataReturn('支付缺少配置(应用公钥|私钥|平台公钥|交易规则标签组)', -1); + } + + // 请求参数 + $data = json_encode([ + 'skuList' => [ + [ + 'skuId' => $params['order_no'], + 'price' => (int) (($params['total_price']*1000)/10), + 'quantity' => 1, + 'title' => $params['name'], + 'imageList' => [AttachmentPathViewHandle(MyC('home_site_logo_square'))], + 'type' => 201, + 'tagGroupId' => $this->config['tag_group_id'], + ] + ], + 'outOrderNo' => $params['order_no'], + 'totalAmount' => (int) (($params['total_price']*1000)/10), + 'payExpireSeconds' => $this->OrderAutoCloseTime(), + 'payNotifyUrl' => $params['notify_url'], + 'orderEntrySchema' => [ + 'path' => 'pages/index/index', + ], + ], JSON_UNESCAPED_UNICODE); + // 签名 + $auth = $this->GetByteAuthorization($data); + if($auth['code'] != 0) + { + return $auth; + } + return DataReturn('success', 0, ['data'=>$data, 'auth'=>$auth['data'], 'pay_type'=>$pay_type]); + break; + } + } - // 签名 - $parameter['sign'] = $this->GetParamSign($parameter); - // 请求接口 - $url = 'https://developer.toutiao.com/api/apps/ecpay/v1/create_order'; - $ret = $this->HttpRequest($url, $parameter); - if($ret['code'] == 0 && !empty($ret['data']['data'])) + /** + * 签名生成 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2023-12-27 + * @desc description + * @param [string] $data [支付信息json数据] + */ + public function GetByteAuthorization($data) { + // 私钥 + if(stripos($this->config['rsa_private'], '-----') === false) { - $ret['data'] = $ret['data']['data']; + $private_key_str = "-----BEGIN RSA PRIVATE KEY-----\n"; + $private_key_str .= wordwrap($this->config['rsa_private'], 64, "\n", true); + $private_key_str .= "\n-----END RSA PRIVATE KEY-----"; + } else { + $private_key_str = $this->config['rsa_private']; } - return $ret; + // 应用公钥版本,每次重新上传公钥后需要更新,可通过「开发管理-开发设置-密钥设置」处获取 + $key_version = '1'; + // 请求时间戳 + $timestamp = time(); + // 随机字符串 + $nonce_str = RandomString(10); + // 读取私钥 + $private_key = openssl_pkey_get_private($private_key_str); + if(!$private_key) + { + return DataReturn('私钥无效', -1); + } + // 生成签名 + $target_str = "POST\n/requestOrder\n" . $timestamp. "\n" . $nonce_str. "\n" . $data. "\n"; + openssl_sign($target_str, $sign, $private_key, OPENSSL_ALGO_SHA256); + $signature = base64_encode($sign); + if($signature === false) + { + return DataReturn('签名生成失败', -1); + } + // 构造 byteAuthorization + $auth = sprintf("SHA256-RSA2048 appid=%s,nonce_str=%s,timestamp=%s,key_version=%s,signature=%s", $this->config['app_id'], $nonce_str, $timestamp, $key_version, $signature); + return DataReturn('success', 0, $auth); } /** @@ -232,7 +387,7 @@ public function Respond($params = []) } // 退款请求不处理、直接返回成功 - if($params['type'] == 'refund') + if(isset($params['type']) && $params['type'] == 'refund') { die($this->SuccessReturn()); } @@ -243,52 +398,104 @@ public function Respond($params = []) { return DataReturn('msg转换json数据为空', -1); } - if(empty($data['cp_orderno'])) - { - return DataReturn('回调订单号为空', -1); - } - - // 查询订单信息 - $parameter = [ - 'app_id' => $this->config['app_id'], - 'out_order_no' => $data['cp_orderno'], - ]; - - // 签名 - $parameter['sign'] = $this->GetParamSign($parameter); - // 请求接口 - $url = 'https://developer.toutiao.com/api/apps/ecpay/v1/query_order'; - $ret = $this->HttpRequest($url, $parameter); - if($ret['code'] == 0 && !empty($ret['data']['payment_info']) && !empty($ret['data']['payment_info']['order_status'])) + // 支付类型 + $pay_type = isset($this->config['pay_type']) ? intval($this->config['pay_type']) : 0; + switch($pay_type) { - switch($ret['data']['payment_info']['order_status']) - { - // 处理中 - case 'PROCESSING' : - $ret = DataReturn('处理中', -10); - break; - - // 超时 - case 'TIMEOUT' : - $ret = DataReturn('超时', -20); - break; - - // 成功 - case 'SUCCESS' : - $ret = DataReturn('支付成功', 0, $this->ReturnData($data)); - break; - - // 默认 - default : - $ret = DataReturn('支付失败', -100); - } + // 担保交易-普通版本 + case 0 : + // 基础参数 + if(empty($data['cp_orderno'])) + { + return DataReturn('回调订单号为空', -1); + } + + // 查询订单信息 + $parameter = [ + 'app_id' => $this->config['app_id'], + 'out_order_no' => $data['cp_orderno'], + ]; + + // 签名 + $parameter['sign'] = $this->GetParamSign($parameter); + + // 请求接口 + $url = 'https://developer.toutiao.com/api/apps/ecpay/v1/query_order'; + $ret = $this->HttpRequest($url, $parameter); + if($ret['code'] == 0 && !empty($ret['data']['payment_info']) && !empty($ret['data']['payment_info']['order_status'])) + { + switch($ret['data']['payment_info']['order_status']) + { + // 处理中 + case 'PROCESSING' : + $ret = DataReturn('处理中', -10); + break; + + // 超时 + case 'TIMEOUT' : + $ret = DataReturn('超时', -20); + break; + + // 成功 + case 'SUCCESS' : + $ret = DataReturn('支付成功', 0, $this->ReturnData($data)); + break; + + // 默认 + default : + $ret = DataReturn('支付失败', -100); + } + } + return $ret; + break; + + // 担保交易-企业-通用交易系统 + case 1 : + // 基础参数 + if(empty($data['out_order_no']) || empty($data['order_id'])) + { + return DataReturn('回调订单号或支付单号为空', -1); + } + + // access_token + $config = [ + 'appid' => AppMiniUserService::AppMiniConfig('common_app_mini_toutiao_appid'), + 'secret' => AppMiniUserService::AppMiniConfig('common_app_mini_toutiao_appsecret'), + ]; + if(empty($config['appid']) || empty($config['secret'])) + { + return DataReturn('头条小程序密钥未配置', -1); + } + $access_token = (new \base\Toutiao($config))->GetMiniClientToken(); + if($access_token === false) + { + return DataReturn('client_token获取失败', -1); + } + $header = [ + 'access-token: '.$access_token, + 'content-type: application/json', + ]; + + // 查询订单信息 + $url = 'https://open.douyin.com/api/trade_basic/v1/developer/order_query/'; + $parameter = [ + 'order_id' => $data['order_id'], + 'out_order_no' => $data['out_order_no'], + ]; + $ret = $this->HttpRequest($url, $parameter, 30, $header); + if($ret['code'] == 0 && !empty($ret['data']['data']) && isset($ret['data']['data']['pay_status']) && $ret['data']['data']['pay_status'] == 'SUCCESS') + { + $ret = DataReturn('支付成功', 0, $this->ReturnData($ret['data']['data'])); + } + return $ret; + break; } - return $ret; + return DataReturn('支付类型未处理或支付失败('.$pay_type.')', -1); } /** - * [ReturnData 返回数据统一格式] + * 返回数据统一格式 * @author Devil * @blog http://gong.gg/ * @version 1.0.0 @@ -298,11 +505,20 @@ public function Respond($params = []) private function ReturnData($data) { // 返回数据固定基础参数 - $data['trade_no'] = isset($data['payment_order_no']) ? $data['payment_order_no'] : ''; // 支付平台 - 订单号 - $data['buyer_user'] = isset($data['seller_uid']) ? $data['seller_uid'] : ''; // 支付平台 - 用户 - $data['out_trade_no'] = $data['cp_orderno']; // 本系统发起支付的 - 订单号 - $data['subject'] = ''; // 本系统发起支付的 - 商品名称 - $data['pay_price'] = $data['total_amount']/100; // 本系统发起支付的 - 总价 + // 支付平台 - 订单号 + $data['trade_no'] = isset($data['payment_order_no']) ? $data['payment_order_no'] : (isset($data['order_id']) ? $data['order_id'] : ''); + + // 支付平台 - 用户 + $data['buyer_user'] = isset($data['seller_uid']) ? $data['seller_uid'] : (isset($data['item_order_list']) ? $data['item_order_list'][0]['item_order_id'] : ''); + + // 本系统发起支付的 - 订单号 + $data['out_trade_no'] = isset($data['cp_orderno']) ? $data['cp_orderno'] : (isset($data['out_order_no']) ? $data['out_order_no'] : ''); + + // 本系统发起支付的 - 商品名称 + $data['subject'] = ''; + + // 本系统发起支付的 - 总价 + $data['pay_price'] = $data['total_amount']/100; return $data; } @@ -355,32 +571,94 @@ public function Refund($params = []) // 退款原因 $refund_reason = empty($params['refund_reason']) ? $params['order_no'].'订单退款'.$params['refund_price'].'元' : $params['refund_reason']; - // 处理支付 - $parameter = [ - 'app_id' => $this->config['app_id'], - 'out_order_no' => $params['order_no'], - 'out_refund_no' => $params['trade_no'], - 'refund_amount' => (int) (($params['refund_price']*1000)/10), - 'reason' => $refund_reason, - ]; - - // 签名 - $parameter['sign'] = $this->GetParamSign($parameter); - - // 请求接口 - $url = 'https://developer.toutiao.com/api/apps/ecpay/v1/create_refund'; - $ret = $this->HttpRequest($url, $parameter); - if($ret['code'] == 0) + // 支付类型 + $pay_type = isset($this->config['pay_type']) ? intval($this->config['pay_type']) : 0; + switch($pay_type) { - // 统一返回格式 - $data = [ - 'trade_no' => isset($ret['data']['refund_no']) ? $ret['data']['refund_no'] : '', - 'refund_price' => $params['refund_price'], - 'return_params' => $ret['data'], - ]; - return DataReturn('退款成功', 0, $data); + // 担保交易-普通版本 + case 0 : + // 处理退款 + $parameter = [ + 'app_id' => $this->config['app_id'], + 'out_order_no' => $params['order_no'], + 'out_refund_no' => $params['trade_no'], + 'refund_amount' => (int) (($params['refund_price']*1000)/10), + 'reason' => $refund_reason, + ]; + + // 签名 + $parameter['sign'] = $this->GetParamSign($parameter); + + // 请求接口 + $url = 'https://developer.toutiao.com/api/apps/ecpay/v1/create_refund'; + $ret = $this->HttpRequest($url, $parameter); + if($ret['code'] == 0) + { + // 统一返回格式 + $data = [ + 'trade_no' => isset($ret['data']['refund_no']) ? $ret['data']['refund_no'] : '', + 'refund_price' => $params['refund_price'], + 'return_params' => $ret['data'], + ]; + return DataReturn('退款成功', 0, $data); + } + return $ret; + break; + + // 担保交易-企业-通用交易系统 + case 1 : + // access_token + $config = [ + 'appid' => AppMiniUserService::AppMiniConfig('common_app_mini_toutiao_appid'), + 'secret' => AppMiniUserService::AppMiniConfig('common_app_mini_toutiao_appsecret'), + ]; + if(empty($config['appid']) || empty($config['secret'])) + { + return DataReturn('头条小程序密钥未配置', -1); + } + $access_token = (new \base\Toutiao($config))->GetMiniClientToken(); + if($access_token === false) + { + return DataReturn('client_token获取失败', -1); + } + $header = [ + 'access-token: '.$access_token, + 'content-type: application/json', + ]; + // 处理退款 + $parameter = [ + 'order_id' => $params['trade_no'], + 'out_refund_no' => md5(time().GetNumberCode(6)), + 'order_entry_schema' => [ + 'path' => 'pages/user-orderaftersale/user-orderaftersale' + ], + 'refund_reason' => [ + ['code' => 999, 'text' => $refund_reason], + ], + 'refund_total_amount' => (int) (($params['refund_price']*1000)/10), + 'item_order_detail' => [ + [ + 'item_order_id' => $params['pay_log_data']['buyer_user'], + 'refund_amount' => (int) (($params['refund_price']*1000)/10), + ] + ], + ]; + // 请求接口 + $url = 'https://open.douyin.com/api/trade_basic/v1/developer/refund_create/'; + $ret = $this->HttpRequest($url, $parameter, 30, $header); + if($ret['code'] == 0 || stripos($ret['msg'], '[22013]') !== false) + { + // 统一返回格式 + $data = [ + 'trade_no' => (!empty($ret['data']['data']) && isset($ret['data']['data']['refund_id'])) ? $ret['data']['data']['refund_id'] : '', + 'refund_price' => $params['refund_price'], + 'return_params' => $ret['data'], + ]; + return DataReturn('退款成功', 0, $data); + } + return $ret; + break; } - return $ret; } /** @@ -453,12 +731,16 @@ public function Settlement($params = []) * @param [string] $url [请求url] * @param [array] $data [发送数据] * @param [int] $second [超时] + * @param [array] $header [头信息] * @return [mixed] [请求返回数据] */ - private function HttpRequest($url, $data, $second = 30) + private function HttpRequest($url, $data, $second = 30, $header = []) { $ch = curl_init(); - $header = ['Content-Type: application/json;charset=utf-8']; + if(empty($header)) + { + $header = ['Content-Type: application/json;charset=utf-8']; + } curl_setopt_array($ch, array( CURLOPT_URL => $url, CURLOPT_HTTPHEADER => $header, @@ -482,7 +764,8 @@ private function HttpRequest($url, $data, $second = 30) } if($res['err_no'] != 0) { - return DataReturn($res['err_tips'].'['.$res['err_no'].']', -1); + $msg = empty($res['err_tips']) ? (empty($res['err_msg']) ? '操作失败' : $res['err_msg']) : $res['err_tips']; + return DataReturn($msg.'['.$res['err_no'].']', -1); } return DataReturn('success', 0, $res); } else { diff --git a/extend/payment/WalletPay.php b/extend/payment/WalletPay.php index 15a868089..0968ac424 100644 --- a/extend/payment/WalletPay.php +++ b/extend/payment/WalletPay.php @@ -57,7 +57,7 @@ public function Config() // 基础信息 $base = [ 'name' => '钱包支付', // 插件名称 - 'version' => '0.0.4', // 插件版本 + 'version' => '0.0.5', // 插件版本 'apply_version' => '不限', // 适用系统版本描述 'desc' => '钱包余额支付', // 插件描述(支持html) 'author' => 'Devil', // 开发者 diff --git a/public/static/admin/default/css/index.init.css b/public/static/admin/default/css/index.init.css index ec46d1265..e189de925 100755 --- a/public/static/admin/default/css/index.init.css +++ b/public/static/admin/default/css/index.init.css @@ -150,7 +150,7 @@ body { .right-operate .echarts-where input { display: -webkit-inline-box !important; - width: 15.5rem !important; + width: 14rem !important; color: #888; height: 2.4rem; border-color: #f7f7f7; diff --git a/public/static/admin/default/css/shortcutmenu.css b/public/static/admin/default/css/shortcutmenu.css index b57df09b3..fffd1d01b 100644 --- a/public/static/admin/default/css/shortcutmenu.css +++ b/public/static/admin/default/css/shortcutmenu.css @@ -24,4 +24,7 @@ .shortcut-menu-form { background: #F5FBFF; +} +.shortcut-menu-form .chosen-container .chosen-results { + max-height: 18rem; } \ No newline at end of file diff --git a/public/static/admin/default/js/index.init.js b/public/static/admin/default/js/index.init.js index 47a41d22c..5815d23e1 100644 --- a/public/static/admin/default/js/index.init.js +++ b/public/static/admin/default/js/index.init.js @@ -85,7 +85,7 @@ function SystemUpgradeRequestHandle (params) { function EchartsBaseCount (data) { $('.base-user-count').text(data.user_count); $('.base-order-count').text(data.order_count); - $('.base-order-sale-count').text(data.order_asle_count); + $('.base-order-sale-count').text(data.order_sale_count); $('.base-order-complete-total').text(data.order_complete_total); } @@ -309,7 +309,7 @@ function EchartsGoodsHot (data) { var chart = echarts.init(document.getElementById('echarts-goods-hot'), 'macarons'); var option = { title: { - subtext: window['lang_goods_hot_tips'] || '仅显示前30条商品', + subtext: window['lang_goods_hot_tips'] || '仅显示前13条商品', x: 'center', bottom: '3%' }, diff --git a/public/static/common/css/common.css b/public/static/common/css/common.css index 5fa97f0bd..ac80f84b7 100755 --- a/public/static/common/css/common.css +++ b/public/static/common/css/common.css @@ -1485,8 +1485,8 @@ button.colorpicker-submit img { .am-table-scrollable-horizontal > .am-table > tfoot > tr > td { padding: 1.2rem; line-height: 2rem; - min-width: 27rem; - max-width: 35rem; + min-width: 17rem; + max-width: 17rem; word-break: break-all; } .am-table-scrollable-horizontal > .am-table .am-nowrap-initial { @@ -1498,7 +1498,7 @@ button.colorpicker-submit img { } .am-table-scrollable-horizontal > .am-table > thead > tr th { background: #f8f8f8; - min-width: 27rem; + min-width: 17rem; font-weight: 500; color: #333; position: sticky; diff --git a/public/static/index/default/css/common.css b/public/static/index/default/css/common.css index ebf07af0a..1aabf6100 100755 --- a/public/static/index/default/css/common.css +++ b/public/static/index/default/css/common.css @@ -524,7 +524,6 @@ ul.am-dropdown-content>li>a:focus { float: left; background: transparent; top: 4rem; - border-bottom: 0.1rem solid #F5F5F5; } .goods-category-s .category-content .all-goods { @@ -872,7 +871,7 @@ ul.am-dropdown-content>li>a:focus { .category-content .menu-item { left: 17.9rem; - height: 47.1rem; + height: 47rem; } .category-content .category-list li { diff --git a/public/static/index/default/css/index.css b/public/static/index/default/css/index.css index b81555098..9385fa83d 100755 --- a/public/static/index/default/css/index.css +++ b/public/static/index/default/css/index.css @@ -117,7 +117,7 @@ ul, li, ol {list-style: none;} } @media only screen and (min-width: 1260px) { /*轮播图布局*/ - .banner .am-slider, .banner .am-slider .am-slides li{height:47.1rem;} + .banner .am-slider, .banner .am-slider .am-slides li{height:47rem;} /*公告布局*/ .banner-mixed { width:22rem; top:-45rem; text-align: left; }