feat: 新增发票抬头、晒单、钱包日志等模型及后台管理功能
- 新增 invoice_title、showcase、wallet_log 模型及对应语言包 - 新增后台控制器、视图及搜索字段配置 - 修复服务类目删除保护逻辑 - 优化后台登录页面文案及样式 - 新增前端角色切换逻辑及页面拦截 - 新增 SVG 图标及样式变量 - 修复接口权限及下拉框默认值问题
这个提交包含在:
@@ -23,6 +23,8 @@ class Withdraw extends Backend
|
||||
* @var \app\admin\model\Withdraw
|
||||
*/
|
||||
protected $model = null;
|
||||
protected $relationSearch = true;
|
||||
protected $searchFields = 'id,account,audit_msg,master.realname,master.mobile';
|
||||
|
||||
/**
|
||||
* 审核状态机:当前状态 => 允许流转到的目标状态
|
||||
@@ -64,6 +66,44 @@ class Withdraw extends Backend
|
||||
return json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现审核与资金来源对账详情
|
||||
*/
|
||||
public function detail($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$masterId = (int)$row['master_id'];
|
||||
$master = $masterId > 0 ? Db::name('master')->where('id', $masterId)->find() : null;
|
||||
$recentSettles = $masterId > 0
|
||||
? Db::name('settle')->alias('s')
|
||||
->join('__ORDER__ o', 'o.id = s.order_id', 'LEFT')
|
||||
->where('s.master_id', $masterId)
|
||||
->field('s.*, o.order_no, o.service_name')
|
||||
->order('s.id desc')
|
||||
->limit(8)
|
||||
->select()
|
||||
: [];
|
||||
$walletLogs = $masterId > 0
|
||||
? Db::name('wallet_log')
|
||||
->where('user_type', 'master')
|
||||
->where('user_id', $masterId)
|
||||
->order('id desc')
|
||||
->limit(10)
|
||||
->select()
|
||||
: [];
|
||||
|
||||
$this->view->assign([
|
||||
'row' => $row,
|
||||
'master' => $master ?: [],
|
||||
'recentSettles' => $recentSettles,
|
||||
'walletLogs' => $walletLogs,
|
||||
]);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 财务审核:申请信息只读,仅允许合法状态流转并做资金联动
|
||||
* - 驳回:退回师傅余额并解冻,写入钱包流水,通知师傅
|
||||
@@ -139,10 +179,10 @@ class Withdraw extends Backend
|
||||
'remark' => '提现驳回,申请金额退回钱包余额' . ($auditMsg !== '' ? '(原因:' . $auditMsg . ')' : ''),
|
||||
'createtime' => time(),
|
||||
]);
|
||||
$this->sendMasterMessage((int)$master['user_id'], '提现申请已驳回', '您的提现申请 ¥' . $amount . ' 未通过财务审核:' . ($auditMsg !== '' ? $auditMsg : '无') . ',申请金额已退回钱包余额');
|
||||
$this->sendMasterMessage($masterId, (int)$master['user_id'], '提现申请已驳回', '您的提现申请 ¥' . $amount . ' 未通过财务审核:' . ($auditMsg !== '' ? $auditMsg : '无') . ',申请金额已退回钱包余额');
|
||||
} elseif ($status === 'pass') {
|
||||
// 审核通过:仅标记,资金保持冻结,等待财务打款
|
||||
$this->sendMasterMessage((int)$master['user_id'], '提现审核通过', '您的提现申请 ¥' . $amount . ' 已通过审核,财务将尽快安排打款到 ' . ($row['channel'] === 'bank' ? '银行卡' : '微信钱包'));
|
||||
$this->sendMasterMessage($masterId, (int)$master['user_id'], '提现审核通过', '您的提现申请 ¥' . $amount . ' 已通过审核,财务将尽快安排打款到 ' . ($row['channel'] === 'bank' ? '银行卡' : '微信钱包'));
|
||||
} elseif ($status === 'done') {
|
||||
// 打款完成:冻结资金划出
|
||||
Db::name('master')->where('id', $masterId)->update([
|
||||
@@ -159,7 +199,7 @@ class Withdraw extends Backend
|
||||
'remark' => '提现打款完成,冻结资金 ¥' . $amount . ' 划出(' . ($row['channel'] === 'bank' ? '银行储蓄卡' : '微信钱包') . ' ' . $row['account'] . ')',
|
||||
'createtime' => time(),
|
||||
]);
|
||||
$this->sendMasterMessage((int)$master['user_id'], '提现打款完成', '您的提现 ¥' . $amount . ' 已打款成功,请留意到账通知');
|
||||
$this->sendMasterMessage($masterId, (int)$master['user_id'], '提现打款完成', '您的提现 ¥' . $amount . ' 已打款成功,请留意到账通知');
|
||||
}
|
||||
Db::commit();
|
||||
} catch (PDOException|\Exception $e) {
|
||||
@@ -194,25 +234,42 @@ class Withdraw extends Backend
|
||||
}
|
||||
|
||||
/**
|
||||
* 向师傅所属用户发送站内消息
|
||||
* @param int $userId 用户ID
|
||||
* 向师傅端工作台及所属用户发送站内消息
|
||||
* @param int $masterId 师傅ID
|
||||
* @param int $userId 用户ID
|
||||
* @param string $title 消息标题
|
||||
* @param string $content 消息内容
|
||||
*/
|
||||
protected function sendMasterMessage($userId, $title, $content)
|
||||
protected function sendMasterMessage($masterId, $userId, $title, $content)
|
||||
{
|
||||
if (!$userId) {
|
||||
return;
|
||||
$now = time();
|
||||
$rows = [];
|
||||
if ($masterId > 0) {
|
||||
$rows[] = [
|
||||
'receive_type' => 'master',
|
||||
'receive_id' => (int)$masterId,
|
||||
'type' => 'audit',
|
||||
'title' => mb_substr((string)$title, 0, 100),
|
||||
'content' => mb_substr((string)$content, 0, 500),
|
||||
'order_id' => 0,
|
||||
'is_read' => 0,
|
||||
'createtime' => $now,
|
||||
];
|
||||
}
|
||||
if ($userId > 0) {
|
||||
$rows[] = [
|
||||
'receive_type' => 'user',
|
||||
'receive_id' => (int)$userId,
|
||||
'type' => 'system',
|
||||
'title' => mb_substr((string)$title, 0, 100),
|
||||
'content' => mb_substr((string)$content, 0, 500),
|
||||
'order_id' => 0,
|
||||
'is_read' => 0,
|
||||
'createtime' => $now,
|
||||
];
|
||||
}
|
||||
if ($rows) {
|
||||
Db::name('message')->insertAll($rows);
|
||||
}
|
||||
Db::name('message')->insert([
|
||||
'receive_type' => 'user',
|
||||
'receive_id' => $userId,
|
||||
'type' => 'system',
|
||||
'title' => mb_substr((string)$title, 0, 100),
|
||||
'content' => mb_substr((string)$content, 0, 500),
|
||||
'order_id' => 0,
|
||||
'is_read' => 0,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户