feat: 新增分销分佣结算、商家认证及草稿管理功能,优化界面与版本更新
这个提交包含在:
@@ -6,24 +6,20 @@ use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 同城-系统设置
|
||||
* 同城-小程序设置
|
||||
*
|
||||
* 页面职责(同一路由 fc/setting/index):
|
||||
* ① 基础配置 base.appName / base.logo / base.servicePhone / base.aboutUs / base.shareTitle(可保存)
|
||||
* ② 支付配置 **只读展示** —— 支付能力已改由 epay 插件承载,商户号/密钥/小程序 AppID 的真源是
|
||||
* 「插件管理 → 微信支付宝整合插件 → 配置」(持久化在 addons/epay/config.php)。
|
||||
* 本页只显示插件配置的就绪状态并给出跳转,**不再**维护 wx.mchId / wx.apiKey / wx.payNotifyUrl
|
||||
* (这三个 fc_config 键已废弃,避免出现「两份配置、改了一份不生效」)。
|
||||
*
|
||||
* 键名以 Api 端现有实现为准,保证「后台写入」与「Api 读取」是同一份 fc_config:
|
||||
* - 基础配置与 application/api/controller/AdminSetting.php::base() 完全一致(base.*)。
|
||||
* 页面职责(路由 fc/setting/index):
|
||||
* 维护小程序端基础信息配置:小程序名称、LOGO、客服电话、关于我们、分享标题。
|
||||
* 保存后写入 fa_fc_config 表的 base.* 键,供小程序端接口统一读取。
|
||||
*
|
||||
* @icon fa fa-cogs
|
||||
*/
|
||||
class Setting extends Backend
|
||||
{
|
||||
/**
|
||||
* 配置页(GET 显示 / POST 保存基础配置)
|
||||
* 小程序基础设置首页(GET 显示表单 / POST 保存基础配置)
|
||||
*
|
||||
* @return string|null 渲染页面或响应重定向
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
@@ -32,14 +28,13 @@ class Setting extends Backend
|
||||
}
|
||||
|
||||
$this->view->assign('row', $this->current());
|
||||
$this->view->assign('pay', $this->payStatus());
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存基础配置
|
||||
* 保存小程序基础配置
|
||||
*
|
||||
* 说明:支付配置已迁到插件页,本页不再接收 group=pay 的提交(如提交则给出明确指引)。
|
||||
* @return void
|
||||
*/
|
||||
protected function save()
|
||||
{
|
||||
@@ -47,11 +42,6 @@ class Setting extends Backend
|
||||
if (!is_array($params)) {
|
||||
$params = $this->request->post();
|
||||
}
|
||||
$group = isset($params['group']) ? trim((string)$params['group']) : 'base';
|
||||
|
||||
if ($group === 'pay') {
|
||||
$this->error('微信支付参数已改由插件维护,请到「插件管理 → 微信支付宝整合插件 → 配置」填写');
|
||||
}
|
||||
|
||||
$appName = isset($params['appName']) ? trim((string)$params['appName']) : '';
|
||||
if ($appName === '') {
|
||||
@@ -66,14 +56,14 @@ class Setting extends Backend
|
||||
'base.shareTitle' => ['value' => isset($params['shareTitle']) ? trim((string)$params['shareTitle']) : '', 'group_key' => 'base', 'remark' => '分享标题'],
|
||||
]);
|
||||
|
||||
$this->success('基础配置已保存');
|
||||
return null;
|
||||
$this->success('小程序设置已保存');
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量写入 fc_config(存在则更新,不存在则新增)
|
||||
*
|
||||
* @param array $values 结构:键名 => ['value' => 值, 'group_key' => 分组, 'remark' => 备注]
|
||||
* @return void
|
||||
*/
|
||||
protected function setConfig(array $values)
|
||||
{
|
||||
@@ -100,7 +90,9 @@ class Setting extends Backend
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前基础配置(缺失时回落内置默认值)
|
||||
* 获取当前小程序基础配置(若数据库未设置则回退内置默认值)
|
||||
*
|
||||
* @return array 包含 appName, logo, servicePhone, aboutUs, shareTitle 的配置数组
|
||||
*/
|
||||
protected function current()
|
||||
{
|
||||
@@ -120,49 +112,4 @@ class Setting extends Backend
|
||||
'shareTitle' => $pick('base.shareTitle', ''),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付配置状态(只读,数据来自 epay 插件配置)
|
||||
*
|
||||
* @return array 插件是否安装 / 是否就绪 / 关键项是否填写 / 回调地址 / 配置页地址 / 配置文件名
|
||||
*/
|
||||
protected function payStatus()
|
||||
{
|
||||
$info = (array)get_addon_info('epay');
|
||||
$addonConfig = (array)get_addon_config('epay');
|
||||
$wx = (isset($addonConfig['wechat']) && is_array($addonConfig['wechat'])) ? $addonConfig['wechat'] : [];
|
||||
$mode = isset($wx['mode']) ? (string)$wx['mode'] : 'normal';
|
||||
|
||||
// 与用户端 Pay::epayReady() 同一判定口径
|
||||
if ($mode === 'service') {
|
||||
$ready = !empty($wx['sub_mch_id']) && !empty($wx['key']) && !empty($wx['sub_miniapp_id']);
|
||||
} else {
|
||||
$ready = !empty($wx['miniapp_id']) && !empty($wx['mch_id']) && !empty($wx['key']);
|
||||
}
|
||||
|
||||
return [
|
||||
'installed' => !empty($info),
|
||||
'ready' => $ready,
|
||||
'version' => isset($addonConfig['version']) ? (string)$addonConfig['version'] : '',
|
||||
'mode' => $mode === 'service' ? 'service' : 'normal',
|
||||
'miniappId' => isset($wx['miniapp_id']) ? (string)$wx['miniapp_id'] : '',
|
||||
'mchId' => isset($wx['mch_id']) ? (string)$wx['mch_id'] : '',
|
||||
'hasKey' => !empty($wx['key']),
|
||||
'notifyUrl' => $this->notifyUrl(),
|
||||
'configUrl' => url('addon/config', ['name' => 'epay']),
|
||||
'configFile' => 'addons/epay/config.php',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信支付回调地址(与服务端 Pay::notifyUrl() 同一算法:当前域名 + 固定路径)
|
||||
*/
|
||||
protected function notifyUrl()
|
||||
{
|
||||
$base = rtrim((string)$this->request->root(true), '/');
|
||||
// 去掉入口文件(后台入口 s.php / 前台 index.php),展示与真实回调地址保持一致
|
||||
$base = preg_replace('#/[a-zA-Z0-9_\-]+\.php$#i', '', $base);
|
||||
|
||||
return ($base !== '' ? $base : rtrim((string)$this->request->domain(), '/')) . '/api/v1/pay/notify';
|
||||
}
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户