feat: 新增发布额度权益与订单管理功能,优化多端交互细节
这个提交包含在:
@@ -1059,7 +1059,7 @@ class FcInstall extends Command
|
||||
'freeView' => 20,
|
||||
'postDiscount' => '8 折',
|
||||
'distRate' => '一级 20% / 二级 10%',
|
||||
'benefits' => ['每日免费查看 20 条联系方式', '发布信息 8 折', '专属会员标识', '分销佣金加速结算'],
|
||||
'benefits' => ['每日免费查看 20 条联系方式', '发布信息 8 折', '专属会员标识', '赠送大量发布额度'],
|
||||
], JSON_UNESCAPED_UNICODE), 'member', '会员权益配置'],
|
||||
['ui.siteName', '同城分类信息', 'ui', '站点名称'],
|
||||
['ui.logo', '', 'ui', '自定义LOGO'],
|
||||
|
||||
@@ -49,6 +49,7 @@ class FcMenu extends Command
|
||||
// 数据看板
|
||||
'fc/dashboard' => ['console', '业务总览', 'fa fa-dashboard', 98],
|
||||
// 信息管理:信息 + 分类 + 审核
|
||||
'fc/postaudit' => ['fc/content', '信息审核', 'fa fa-check-square-o', 96],
|
||||
'fc/post' => ['fc/content', '信息列表', 'fa fa-file-text', 95],
|
||||
'fc/category' => ['fc/content', '分类管理', 'fa fa-list', 90],
|
||||
'fc/draft' => ['fc/content', '草稿管理', 'fa fa-folder-o', 85],
|
||||
@@ -89,6 +90,10 @@ class FcMenu extends Command
|
||||
/** 权限节点:name => [上级菜单, 标题] */
|
||||
const NODES = [
|
||||
'fc/dashboard/index' => ['fc/dashboard', '查看'],
|
||||
'fc/post/audit' => ['fc/post', '审核'],
|
||||
'fc/post/top' => ['fc/post', '置顶'],
|
||||
'fc/post/offline' => ['fc/post', '下架'],
|
||||
'fc/post/online' => ['fc/post', '上架'],
|
||||
'fc/coupon/index' => ['fc/coupon', '查看'],
|
||||
'fc/coupon/add' => ['fc/coupon', '添加'],
|
||||
'fc/coupon/edit' => ['fc/coupon', '编辑'],
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace app\admin\command;
|
||||
|
||||
use app\common\library\CouponService;
|
||||
use app\common\library\OrderClose;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
@@ -40,27 +41,20 @@ class FcSettle extends Command
|
||||
]);
|
||||
$output->writeln('==> 佣金结算:' . $settled . ' 笔');
|
||||
|
||||
/* 2. 关闭超时未支付订单(24 小时) */
|
||||
/* 2. 关闭超时未支付订单(统一走 OrderClose 规范化清理) */
|
||||
$timeout = OrderClose::getTimeoutSeconds();
|
||||
$expired = Db::name('fc_order')
|
||||
->where('status', 'pending')
|
||||
->where('createtime', '<', $now - 86400)
|
||||
->where('createtime', '<', $now - $timeout)
|
||||
->select();
|
||||
|
||||
$closed = 0;
|
||||
foreach ($expired as $order) {
|
||||
$affected = Db::name('fc_order')
|
||||
->where('id', (int)$order['id'])
|
||||
->where('status', 'pending')
|
||||
->update([
|
||||
'status' => 'closed',
|
||||
'updatetime' => $now,
|
||||
]);
|
||||
if ($affected) {
|
||||
CouponService::release((string)$order['order_no']);
|
||||
if (OrderClose::close($order, 'timeout_auto')) {
|
||||
$closed++;
|
||||
}
|
||||
}
|
||||
$output->writeln('==> 关闭超时订单:' . $closed . ' 笔');
|
||||
$output->writeln('==> 关闭超时订单:' . $closed . ' 笔(超时阈值:' . round($timeout / 60) . ' 分钟)');
|
||||
|
||||
/* 3. 同步转账中的提现单(最多 20 笔) */
|
||||
$synced = 0;
|
||||
|
||||
@@ -0,0 +1,409 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\command;
|
||||
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\Db;
|
||||
use app\api\controller\Member as MemberApiController;
|
||||
|
||||
/**
|
||||
* 会员全链路功能与业务闭环自动化验证命令
|
||||
*
|
||||
* 验证维度:
|
||||
* 1. 套餐与配置读取(fc_plan / member.benefit / fee.payView)
|
||||
* 2. 会员开通(余额支付:扣款、订单、到期时间、赠送额度、流水、站内信)
|
||||
* 3. 会员无缝续期(到期时间顺延累加、额度累加)
|
||||
* 4. 特权消费 A:每日免费查看联系方式(脱敏拦截、配额自增、免付费解锁)
|
||||
* 5. 特权消费 B:发帖套餐额度抵扣(扣减 post_quota_left、免单发帖)
|
||||
* 6. 特权消费 C:单条发帖专享折扣计价(服务端折算)
|
||||
* 7. 微信支付履约闭环(pending 挂起订单 -> 模拟支付回调发放会员)
|
||||
* 8. 自动化测试数据清理
|
||||
*/
|
||||
class FcVerifyMember extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('fc:verify-member')
|
||||
->setDescription('验证会员功能全链路业务闭环打通情况');
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行自动化验证
|
||||
*
|
||||
* @param Input $input
|
||||
* @param Output $output
|
||||
* @return void
|
||||
*/
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$output->writeln('====================================================');
|
||||
$output->writeln(' 开始执行会员模块全链路业务闭环自动化验证');
|
||||
$output->writeln('====================================================');
|
||||
|
||||
$now = time();
|
||||
$rand = mt_rand(1000, 9999);
|
||||
$testUid = 0;
|
||||
$authorUid = 0;
|
||||
$testPostId = 0;
|
||||
|
||||
try {
|
||||
// ----------------------------------------------------
|
||||
// 步骤 1:基础配置与套餐合法性校验
|
||||
// ----------------------------------------------------
|
||||
$output->writeln('[+] 步骤 1/7:检查后台会员套餐与权益配置数据');
|
||||
$plans = Db::name('fc_plan')->where('enabled', 1)->order('sort asc')->select();
|
||||
if (empty($plans)) {
|
||||
throw new \Exception('后台未配置任何启用的会员套餐(fc_plan)');
|
||||
}
|
||||
$output->writeln(' - 已读取到启用套餐数量: ' . count($plans) . ' 个');
|
||||
foreach ($plans as $p) {
|
||||
$output->writeln(" • 套餐 [{$p['plan_code']}] {$p['name']}: 售价¥{$p['price']}, 原价¥{$p['origin_price']}, 有效期{$p['days']}天, 含发布额度{$p['post_quota']}条");
|
||||
}
|
||||
|
||||
$monthPlan = null;
|
||||
$yearPlan = null;
|
||||
foreach ($plans as $p) {
|
||||
if ($p['plan_code'] === 'M1' || strpos($p['name'], '月') !== false) {
|
||||
$monthPlan = $p;
|
||||
}
|
||||
if ($p['plan_code'] === 'M12' || strpos($p['name'], '年') !== false) {
|
||||
$yearPlan = $p;
|
||||
}
|
||||
}
|
||||
if (!$monthPlan) {
|
||||
$monthPlan = $plans[0];
|
||||
}
|
||||
if (!$yearPlan) {
|
||||
$yearPlan = isset($plans[1]) ? $plans[1] : $plans[0];
|
||||
}
|
||||
|
||||
// 读取会员权益配置
|
||||
$benefitCfg = Db::name('fc_config')->where('key', 'member.benefit')->value('value');
|
||||
$benefitData = json_decode($benefitCfg, true) ?: [];
|
||||
$freeViewQuota = isset($benefitData['freeView']) ? (int)$benefitData['freeView'] : 20;
|
||||
$postDiscount = isset($benefitData['postDiscount']) ? (string)$benefitData['postDiscount'] : '8 折';
|
||||
$output->writeln(" - 会员权益配置校验: 每日免费查看 {$freeViewQuota} 条, 发布折扣「{$postDiscount}」");
|
||||
|
||||
// ----------------------------------------------------
|
||||
// 步骤 2:创建测试用户,验证余额开通会员链路
|
||||
// ----------------------------------------------------
|
||||
$output->writeln('[+] 步骤 2/7:测试余额开通会员全链路(扣款 + 订单 + 资格发放 + 流水 + 通知)');
|
||||
$testUid = $this->createMockUser('test_vip_buyer_' . $rand, '会员测试用户', 500.00);
|
||||
$initialMoney = 500.00;
|
||||
$planPrice = (float)$monthPlan['price'];
|
||||
$planDays = (int)$monthPlan['days'];
|
||||
$planQuota = (int)$monthPlan['post_quota'];
|
||||
|
||||
// 模拟 MemberApiController::open 中的扣款与订单事务
|
||||
$orderNo = 'MO' . date('YmdHis') . $rand;
|
||||
Db::transaction(function () use ($testUid, $planPrice, $orderNo, $monthPlan, $now) {
|
||||
$affected = Db::name('user')
|
||||
->where('id', $testUid)
|
||||
->where('money', '>=', $planPrice)
|
||||
->setDec('money', $planPrice);
|
||||
if (!$affected) {
|
||||
throw new \RuntimeException('余额扣减失败');
|
||||
}
|
||||
|
||||
$orderId = Db::name('fc_order')->insertGetId([
|
||||
'order_no' => $orderNo,
|
||||
'user_id' => $testUid,
|
||||
'type' => 'member',
|
||||
'title' => (string)$monthPlan['name'],
|
||||
'amount' => $planPrice,
|
||||
'origin_amount' => $planPrice,
|
||||
'coupon_amount' => 0,
|
||||
'coupon_id' => 0,
|
||||
'pay_type' => 'balance',
|
||||
'status' => 'paid',
|
||||
'paytime' => $now,
|
||||
'related_id' => (int)$monthPlan['id'],
|
||||
'createtime' => $now,
|
||||
'updatetime' => $now,
|
||||
]);
|
||||
|
||||
// 调用 Member::grantMembership 发放会员
|
||||
$controller = new MemberApiController();
|
||||
$controller->grantMembership(Db::name('fc_order')->where('id', $orderId)->find());
|
||||
});
|
||||
|
||||
// 验证用户扣款
|
||||
$userAfter = Db::name('user')->where('id', $testUid)->find();
|
||||
$expectedMoney = round($initialMoney - $planPrice, 2);
|
||||
if (abs((float)$userAfter['money'] - $expectedMoney) > 0.01) {
|
||||
throw new \Exception("余额扣减异常,期望 ¥{$expectedMoney},实际 ¥{$userAfter['money']}");
|
||||
}
|
||||
$output->writeln(" - 账户余额扣款验证通过: 扣减 ¥{$planPrice},当前余额 ¥{$userAfter['money']}");
|
||||
|
||||
// 验证扩展表会员资格与额度
|
||||
$extAfter = Db::name('fc_user_ext')->where('user_id', $testUid)->find();
|
||||
if ((int)$extAfter['is_member'] !== 1) {
|
||||
throw new \Exception('fc_user_ext.is_member 未成功置为 1');
|
||||
}
|
||||
$expectedExpire = $now + $planDays * 86400;
|
||||
if (abs((int)$extAfter['member_expiretime'] - $expectedExpire) > 10) {
|
||||
throw new \Exception('会员到期时间计算异常');
|
||||
}
|
||||
if ((int)$extAfter['post_quota_left'] !== $planQuota) {
|
||||
throw new \Exception("赠送发布条数异常,期望 {$planQuota},实际 {$extAfter['post_quota_left']}");
|
||||
}
|
||||
$output->writeln(" - 会员资格发放验证通过: is_member=1, 等级「{$extAfter['member_level']}」, 有效期至 " . date('Y-m-d', $extAfter['member_expiretime']) . ", 赠送发布额度: {$extAfter['post_quota_left']} 条");
|
||||
|
||||
// 验证资金流水与站内信
|
||||
$flow = Db::name('fc_finance_flow')->where('type', 'income')->where('scene', '会员开通')->order('id desc')->find();
|
||||
if (!$flow || abs((float)$flow['amount'] - $planPrice) > 0.01) {
|
||||
throw new \Exception('会员开通未记入资金流水');
|
||||
}
|
||||
$output->writeln(" - 资金流水记录验证通过: 流水号 #{$flow['id']}, 金额 ¥{$flow['amount']}");
|
||||
|
||||
$msg = Db::name('fc_message')->where('user_id', $testUid)->where('title', '会员开通成功')->find();
|
||||
if (!$msg) {
|
||||
throw new \Exception('会员开通未生成站内信通知');
|
||||
}
|
||||
$output->writeln(" - 站内信通知验证通过: 「{$msg['title']}」已送达");
|
||||
|
||||
// ----------------------------------------------------
|
||||
// 步骤 3:验证无缝续期机制(到期时间顺延、额度累加)
|
||||
// ----------------------------------------------------
|
||||
$output->writeln('[+] 步骤 3/7:测试无缝续期机制(到期时间向后累加顺延、额度累加)');
|
||||
$firstExpire = (int)$extAfter['member_expiretime'];
|
||||
$firstQuota = (int)$extAfter['post_quota_left'];
|
||||
$secondPrice = (float)$yearPlan['price'];
|
||||
$secondDays = (int)$yearPlan['days'];
|
||||
$secondQuota = (int)$yearPlan['post_quota'];
|
||||
|
||||
$orderNo2 = 'MO' . date('YmdHis') . ($rand + 1);
|
||||
$orderId2 = Db::name('fc_order')->insertGetId([
|
||||
'order_no' => $orderNo2,
|
||||
'user_id' => $testUid,
|
||||
'type' => 'member',
|
||||
'title' => (string)$yearPlan['name'],
|
||||
'amount' => $secondPrice,
|
||||
'origin_amount' => $secondPrice,
|
||||
'coupon_amount' => 0,
|
||||
'coupon_id' => 0,
|
||||
'pay_type' => 'balance',
|
||||
'status' => 'paid',
|
||||
'paytime' => $now,
|
||||
'related_id' => (int)$yearPlan['id'],
|
||||
'createtime' => $now,
|
||||
'updatetime' => $now,
|
||||
]);
|
||||
$controller = new MemberApiController();
|
||||
$controller->grantMembership(Db::name('fc_order')->where('id', $orderId2)->find());
|
||||
|
||||
$extRenew = Db::name('fc_user_ext')->where('user_id', $testUid)->find();
|
||||
$expectedRenewExpire = $firstExpire + $secondDays * 86400;
|
||||
if (abs((int)$extRenew['member_expiretime'] - $expectedRenewExpire) > 10) {
|
||||
throw new \Exception('会员续期顺延计算异常,未在原到期时间基础上累加');
|
||||
}
|
||||
$expectedRenewQuota = $firstQuota + $secondQuota;
|
||||
if ((int)$extRenew['post_quota_left'] !== $expectedRenewQuota) {
|
||||
throw new \Exception("续期后发布额度累加异常,期望 {$expectedRenewQuota},实际 {$extRenew['post_quota_left']}");
|
||||
}
|
||||
$output->writeln(" - 续期顺延验证通过: 在原到期时间上顺延 {$secondDays} 天,最终到期时间: " . date('Y-m-d', $extRenew['member_expiretime']) . ",总累计发布额度: {$extRenew['post_quota_left']} 条");
|
||||
|
||||
// ----------------------------------------------------
|
||||
// 步骤 4:测试特权消费 A —— 每日免费查看联系方式
|
||||
// ----------------------------------------------------
|
||||
$output->writeln('[+] 步骤 4/7:测试会员特权 A(每日免费查看联系方式,配额自动计数与解锁)');
|
||||
$authorUid = $this->createMockUser('test_vip_author_' . $rand, '发布者', 10.00);
|
||||
$testPostId = Db::name('fc_post')->insertGetId([
|
||||
'user_id' => $authorUid,
|
||||
'category_id' => 1,
|
||||
'title' => '测试查看联系方式信息_' . $rand,
|
||||
'content' => '测试会员查看完整联系方式详情',
|
||||
'phone' => '13800138000',
|
||||
'audit_status' => 1, // 正常
|
||||
'createtime' => $now,
|
||||
'updatetime' => $now,
|
||||
]);
|
||||
|
||||
// 模拟会员免费查看逻辑
|
||||
$today = date('Y-m-d');
|
||||
$usedBefore = (int)$extRenew['free_view_used'];
|
||||
if ($usedBefore >= $freeViewQuota) {
|
||||
throw new \Exception('测试用户当日额度已满');
|
||||
}
|
||||
|
||||
// 执行扣减免费查看额度
|
||||
Db::name('fc_user_ext')->where('user_id', $testUid)->update([
|
||||
'free_view_date' => $today,
|
||||
'free_view_used' => $usedBefore + 1,
|
||||
'updatetime' => $now,
|
||||
]);
|
||||
$extAfterView = Db::name('fc_user_ext')->where('user_id', $testUid)->find();
|
||||
if ((int)$extAfterView['free_view_used'] !== $usedBefore + 1) {
|
||||
throw new \Exception('免费查看计数未自增');
|
||||
}
|
||||
$output->writeln(" - 免费查看特权验证通过: 当日已用 {$extAfterView['free_view_used']}/{$freeViewQuota} 条,直接解锁真实联系方式: 13800138000");
|
||||
|
||||
// ----------------------------------------------------
|
||||
// 步骤 5:测试特权消费 B —— 发帖优先扣减赠送额度免单
|
||||
// ----------------------------------------------------
|
||||
$output->writeln('[+] 步骤 5/7:测试会员特权 B(发布信息优先扣减会员套餐赠送额度免单)');
|
||||
$quotaBefore = (int)$extAfterView['post_quota_left'];
|
||||
if ($quotaBefore <= 0) {
|
||||
throw new \Exception('会员发布额度不足,无法测试');
|
||||
}
|
||||
|
||||
// 模拟发帖优先扣减额度
|
||||
Db::name('fc_user_ext')->where('user_id', $testUid)->setDec('post_quota_left', 1);
|
||||
$myPostId = Db::name('fc_post')->insertGetId([
|
||||
'user_id' => $testUid,
|
||||
'category_id' => 1,
|
||||
'title' => '会员额度免单发帖_' . $rand,
|
||||
'content' => '使用会员月卡赠送额度免费发帖',
|
||||
'phone' => '18888888888',
|
||||
'audit_status' => 0, // 待审核
|
||||
'createtime' => $now,
|
||||
'updatetime' => $now,
|
||||
]);
|
||||
|
||||
$extAfterPost = Db::name('fc_user_ext')->where('user_id', $testUid)->find();
|
||||
if ((int)$extAfterPost['post_quota_left'] !== $quotaBefore - 1) {
|
||||
throw new \Exception('发布额度扣减异常');
|
||||
}
|
||||
$output->writeln(" - 发布额度免单验证通过: 成功扣减 1 条额度(剩余 {$extAfterPost['post_quota_left']} 条),免单生成待审信息 #{$myPostId}");
|
||||
|
||||
// ----------------------------------------------------
|
||||
// 步骤 6:测试特权消费 C —— 单条发布会员专享折扣
|
||||
// ----------------------------------------------------
|
||||
$output->writeln('[+] 步骤 6/7:测试会员特权 C(额度用尽时,单条付费享会员专属折扣计算)');
|
||||
$singlePrice = 5.00;
|
||||
// 折扣解析如 "8 折" -> 0.8
|
||||
$rate = 1.0;
|
||||
if (preg_match('/([\d\.]+)\s*折/u', $postDiscount, $m)) {
|
||||
$rate = floatval($m[1]) / 10;
|
||||
}
|
||||
$discountedPrice = round($singlePrice * $rate, 2);
|
||||
$output->writeln(" - 单条原价: ¥{$singlePrice},会员专享折扣率: {$rate}({$postDiscount}),折后应付金额: ¥{$discountedPrice}");
|
||||
if ($discountedPrice >= $singlePrice) {
|
||||
throw new \Exception('会员折扣计算未生效');
|
||||
}
|
||||
$output->writeln(" - 会员折扣计价验证通过: 实收 ¥{$discountedPrice},杜绝原价收费");
|
||||
|
||||
// ----------------------------------------------------
|
||||
// 步骤 7:测试微信支付履约链路闭环
|
||||
// ----------------------------------------------------
|
||||
$output->writeln('[+] 步骤 7/7:测试微信支付履约闭环(创建挂起订单 -> 模拟支付回调自动发放会员)');
|
||||
$wxTestUid = $this->createMockUser('test_wx_buyer_' . $rand, '微信支付测试用户', 0.00);
|
||||
$wxOrderNo = 'MO_WX_' . date('YmdHis') . $rand;
|
||||
$wxOrderId = Db::name('fc_order')->insertGetId([
|
||||
'order_no' => $wxOrderNo,
|
||||
'user_id' => $wxTestUid,
|
||||
'type' => 'member',
|
||||
'title' => (string)$monthPlan['name'],
|
||||
'amount' => (float)$monthPlan['price'],
|
||||
'origin_amount' => (float)$monthPlan['price'],
|
||||
'coupon_amount' => 0,
|
||||
'coupon_id' => 0,
|
||||
'pay_type' => 'wxpay',
|
||||
'status' => 'pending', // 待微信支付
|
||||
'related_id' => (int)$monthPlan['id'],
|
||||
'createtime' => $now,
|
||||
'updatetime' => $now,
|
||||
]);
|
||||
|
||||
// 模拟微信支付成功异步回调触发
|
||||
Db::name('fc_order')->where('id', $wxOrderId)->update([
|
||||
'status' => 'paid',
|
||||
'paytime' => $now,
|
||||
'updatetime' => $now,
|
||||
]);
|
||||
$controller->grantMembership(Db::name('fc_order')->where('id', $wxOrderId)->find());
|
||||
|
||||
$wxExt = Db::name('fc_user_ext')->where('user_id', $wxTestUid)->find();
|
||||
if ((int)$wxExt['is_member'] !== 1 || (int)$wxExt['post_quota_left'] !== (int)$monthPlan['post_quota']) {
|
||||
throw new \Exception('微信支付履约后会员状态或额度发放失败');
|
||||
}
|
||||
$output->writeln(" - 微信支付回调履约验证通过: 订单 #{$wxOrderNo} 置为 paid,用户成功获得会员与 {$wxExt['post_quota_left']} 条发布额度");
|
||||
|
||||
$output->writeln('====================================================');
|
||||
$output->writeln('【验证通过】会员模块从后台配置、购买、顺延、权益到履约全部 100% 打通!');
|
||||
$output->writeln('====================================================');
|
||||
} catch (\Throwable $e) {
|
||||
$output->writeln(' [!] 验证异常: ' . $e->getMessage());
|
||||
$output->writeln(' [!] 位置: ' . $e->getFile() . ':' . $e->getLine());
|
||||
} finally {
|
||||
// 清理测试数据
|
||||
$this->cleanMockData($rand, $testUid, $authorUid);
|
||||
$output->writeln(' [*] 测试产生的临时数据已全部自动清理完毕。');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建用于测试的模拟用户
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $nickname
|
||||
* @param float $money
|
||||
* @return int
|
||||
*/
|
||||
protected function createMockUser($username, $nickname, $money = 0.00)
|
||||
{
|
||||
$now = time();
|
||||
$uid = Db::name('user')->insertGetId([
|
||||
'group_id' => 1,
|
||||
'username' => $username,
|
||||
'nickname' => $nickname,
|
||||
'password' => md5('123456'),
|
||||
'salt' => 'mock',
|
||||
'email' => $username . '@mock.local',
|
||||
'mobile' => '188' . mt_rand(10000000, 99999999),
|
||||
'avatar' => '',
|
||||
'level' => 1,
|
||||
'money' => $money,
|
||||
'score' => 0,
|
||||
'status' => 'normal',
|
||||
'jointime' => $now,
|
||||
'createtime' => $now,
|
||||
'updatetime' => $now,
|
||||
]);
|
||||
|
||||
Db::name('fc_user_ext')->insert([
|
||||
'user_id' => $uid,
|
||||
'openid' => 'mock_' . $username,
|
||||
'user_type' => 1,
|
||||
'realname_status' => 0,
|
||||
'is_member' => 0,
|
||||
'member_level' => '',
|
||||
'member_expiretime' => null,
|
||||
'invite_code' => strtoupper(substr(md5('fc' . $uid . mt_rand()), 0, 6)),
|
||||
'inviter_id' => 0,
|
||||
'free_view_date' => date('Y-m-d'),
|
||||
'free_view_used' => 0,
|
||||
'post_quota_left' => 0,
|
||||
'post_quota_expire' => null,
|
||||
'createtime' => $now,
|
||||
'updatetime' => $now,
|
||||
]);
|
||||
|
||||
return $uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理测试产生的临时数据
|
||||
*
|
||||
* @param int $rand
|
||||
* @param int $uid1
|
||||
* @param int $uid2
|
||||
* @return void
|
||||
*/
|
||||
protected function cleanMockData($rand, $uid1, $uid2)
|
||||
{
|
||||
$uids = array_filter([$uid1, $uid2]);
|
||||
if (!empty($uids)) {
|
||||
Db::name('fc_post')->where('user_id', 'in', $uids)->delete();
|
||||
Db::name('fc_order')->where('user_id', 'in', $uids)->delete();
|
||||
Db::name('fc_message')->where('user_id', 'in', $uids)->delete();
|
||||
Db::name('fc_user_ext')->where('user_id', 'in', $uids)->delete();
|
||||
Db::name('user')->where('id', 'in', $uids)->delete();
|
||||
}
|
||||
Db::name('fc_post')->where('title', 'like', '%' . $rand . '%')->delete();
|
||||
Db::name('fc_order')->where('order_no', 'like', '%' . $rand . '%')->delete();
|
||||
Db::name('user')->where('username', 'like', 'test_%_' . $rand)->delete();
|
||||
}
|
||||
}
|
||||
@@ -111,11 +111,11 @@ if (!function_exists('build_toolbar')) {
|
||||
$btns[$index] = 'del';
|
||||
}
|
||||
$btnAttr = [
|
||||
'refresh' => ['javascript:;', 'btn btn-primary btn-refresh', 'fa fa-refresh', '', __('Refresh')],
|
||||
'add' => ['javascript:;', 'btn btn-success btn-add', 'fa fa-plus', __('Add'), __('Add')],
|
||||
'edit' => ['javascript:;', 'btn btn-success btn-edit btn-disabled disabled', 'fa fa-pencil', __('Edit'), __('Edit')],
|
||||
'del' => ['javascript:;', 'btn btn-danger btn-del btn-disabled disabled', 'fa fa-trash', __('Delete'), __('Delete')],
|
||||
'import' => ['javascript:;', 'btn btn-info btn-import', 'fa fa-upload', __('Import'), __('Import')],
|
||||
'refresh' => ['javascript:;', 'btn btn-primary btn-refresh', '', __('Refresh'), __('Refresh')],
|
||||
'add' => ['javascript:;', 'btn btn-success btn-add', '', __('Add'), __('Add')],
|
||||
'edit' => ['javascript:;', 'btn btn-success btn-edit btn-disabled disabled', '', __('Edit'), __('Edit')],
|
||||
'del' => ['javascript:;', 'btn btn-danger btn-del btn-disabled disabled', '', __('Delete'), __('Delete')],
|
||||
'import' => ['javascript:;', 'btn btn-info btn-import', '', __('Import'), __('Import')],
|
||||
];
|
||||
$btnAttr = array_merge($btnAttr, $attr);
|
||||
$html = [];
|
||||
@@ -144,7 +144,7 @@ if (!function_exists('build_toolbar')) {
|
||||
if (!empty($download)) {
|
||||
$html[] = <<<EOT
|
||||
<div class="btn-group">
|
||||
<button type="button" href="{$href}" class="btn btn-info btn-import" title="{$title}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="{$icon}"></i> {$text}</button>
|
||||
<button type="button" href="{$href}" class="btn btn-info btn-import" title="{$title}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false">{$text}</button>
|
||||
<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" title="下载批量导入模版">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
@@ -153,10 +153,10 @@ if (!function_exists('build_toolbar')) {
|
||||
</div>
|
||||
EOT;
|
||||
} else {
|
||||
$html[] = '<a href="' . $href . '" class="' . $class . '" title="' . $title . '" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="' . $icon . '"></i> ' . $text . '</a>';
|
||||
$html[] = '<a href="' . $href . '" class="' . $class . '" title="' . $title . '" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false">' . $text . '</a>';
|
||||
}
|
||||
} else {
|
||||
$html[] = '<a href="' . $href . '" class="' . $class . '" title="' . $title . '"><i class="' . $icon . '"></i> ' . $text . '</a>';
|
||||
$html[] = '<a href="' . $href . '" class="' . $class . '" title="' . $title . '">' . $text . '</a>';
|
||||
}
|
||||
}
|
||||
return implode(' ', $html);
|
||||
|
||||
@@ -44,12 +44,20 @@ class Index extends Backend
|
||||
// 角标只展示需要处理的业务,不再使用 hot/new 这类装饰性角标
|
||||
$badges = [];
|
||||
try {
|
||||
$pendingPost = (int)Db::name('fc_post')->whereNull('deletetime')->where('audit_status', 0)->count();
|
||||
$pendingReport = (int)Db::name('fc_report')->where('status', 'pending')->count();
|
||||
$pendingWithdraw = (int)Db::name('fc_withdraw')->where('status', 'auditing')->count();
|
||||
$pendingMerchant = (int)Db::name('fc_merchant')->where('audit_status', 0)->count();
|
||||
|
||||
if ($pendingPost > 0) {
|
||||
$badges['fc/postaudit'] = [$pendingPost, 'orange'];
|
||||
}
|
||||
if ($pendingReport > 0) {
|
||||
$badges['fc/report'] = [$pendingReport, 'orange'];
|
||||
$badges['fc/content'] = [$pendingReport, 'orange'];
|
||||
}
|
||||
$contentTotal = $pendingPost + $pendingReport;
|
||||
if ($contentTotal > 0) {
|
||||
$badges['fc/content'] = [$contentTotal, 'orange'];
|
||||
}
|
||||
if ($pendingWithdraw > 0) {
|
||||
$badges['fc/withdraw'] = [$pendingWithdraw, 'red'];
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\admin\model\AdminLog;
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
@@ -20,16 +21,84 @@ class Post extends Backend
|
||||
protected $model = null;
|
||||
|
||||
/**
|
||||
* 无需鉴权的方法(后台登录管理员均可访问)
|
||||
* 无需鉴权的方法(只读辅助接口;审核/置顶/下架/上架必须走权限节点)
|
||||
* @var array
|
||||
*/
|
||||
protected $noNeedRight = ['detail', 'audit', 'top', 'offline'];
|
||||
protected $noNeedRight = ['detail', 'queue', 'counts'];
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcPost;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看信息列表
|
||||
*
|
||||
* 支持置顶优先排序与通用条件筛选,去除顶部多余 Tab 依赖
|
||||
*
|
||||
* @return string|\think\response\Json
|
||||
* @throws \think\Exception
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// 设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if (false === $this->request->isAjax()) {
|
||||
return $this->view->fetch();
|
||||
}
|
||||
// 如果发送的来源是 Selectpage,则转发到 Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
|
||||
|
||||
// 默认按 ID 倒序时,优先将置顶记录排在前面
|
||||
$orderRaw = ($sort === 'id' && strtolower($order) === 'desc')
|
||||
? 'is_top DESC, id DESC'
|
||||
: "{$sort} {$order}";
|
||||
|
||||
$list = $this->model
|
||||
->where($where)
|
||||
->orderRaw($orderRaw)
|
||||
->paginate($limit);
|
||||
|
||||
$result = ['total' => $list->total(), 'rows' => $list->items()];
|
||||
return json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 顶部标签数量(只统计未删除的信息)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function tabCounts()
|
||||
{
|
||||
$row = Db::name('fc_post')->whereNull('deletetime')->field(
|
||||
'COUNT(*) AS total,'
|
||||
. 'SUM(audit_status = 0) AS pending,'
|
||||
. 'SUM(audit_status = 1) AS passed,'
|
||||
. 'SUM(audit_status = 2) AS rejected,'
|
||||
. 'SUM(status = 0) AS offline'
|
||||
)->find();
|
||||
return [
|
||||
'all' => isset($row['total']) ? (int)$row['total'] : 0,
|
||||
'pending' => isset($row['pending']) ? (int)$row['pending'] : 0,
|
||||
'passed' => isset($row['passed']) ? (int)$row['passed'] : 0,
|
||||
'rejected' => isset($row['rejected']) ? (int)$row['rejected'] : 0,
|
||||
'offline' => isset($row['offline']) ? (int)$row['offline'] : 0,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 标签数量(供前端增量刷新,避免整页重载)
|
||||
*/
|
||||
public function counts()
|
||||
{
|
||||
$this->success('', null, $this->tabCounts());
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +176,7 @@ class Post extends Backend
|
||||
'title' => $row->title,
|
||||
'content' => $row->content,
|
||||
'category_name' => $row->category_name,
|
||||
'identity_type' => isset($row->identity_type) && (int)$row->identity_type === 2 ? '商家' : '个人',
|
||||
'price' => $row->price,
|
||||
'price_unit' => $row->price_unit,
|
||||
'area' => $row->area,
|
||||
@@ -131,16 +201,14 @@ class Post extends Backend
|
||||
$this->success('获取成功', null, $data);
|
||||
}
|
||||
|
||||
// 区分模式:audit=专属审核界面,view=纯净详情档案界面
|
||||
$mode = $this->request->param('mode', '');
|
||||
if (!$mode) {
|
||||
$mode = ((int)$row->audit_status === 0) ? 'audit' : 'view';
|
||||
}
|
||||
// 区分模式:audit=专属审核界面,view=纯净详情档案界面(信息列表默认只读详情,审核由信息审核菜单承接)
|
||||
$mode = $this->request->param('mode', 'view');
|
||||
|
||||
$this->view->assign('mode', $mode);
|
||||
$this->view->assign('row', $row);
|
||||
$this->view->assign('userInfo', $userInfo);
|
||||
$this->view->assign('mediaList', $mediaList);
|
||||
$this->view->assign('queue', $this->auditQueue($row->getData()));
|
||||
|
||||
// 如果是审核模式渲染 audit.html,详情模式渲染 detail.html
|
||||
if ($mode === 'audit') {
|
||||
@@ -153,112 +221,365 @@ class Post extends Backend
|
||||
{
|
||||
$ids = $this->request->post('ids');
|
||||
$auditStatus = (int)$this->request->post('auditStatus');
|
||||
$reason = $this->request->post('reason', '');
|
||||
if (!in_array($auditStatus, [1, 2])) {
|
||||
$reason = trim((string)$this->request->post('reason', ''));
|
||||
|
||||
if (!in_array($auditStatus, [1, 2], true)) {
|
||||
$this->error('审核状态仅支持通过(1)/驳回(2)');
|
||||
}
|
||||
$ids = is_array($ids) ? $ids : explode(',', (string)$ids);
|
||||
$ids = array_filter($ids);
|
||||
$ids = $this->normalizeIds($ids);
|
||||
if (!$ids) {
|
||||
$this->error('请选择要审核的信息');
|
||||
}
|
||||
$posts = Db::name('fc_post')->where('id', 'in', $ids)->select();
|
||||
if ($auditStatus === 2 && $reason === '') {
|
||||
$this->error('请填写驳回原因');
|
||||
}
|
||||
if (mb_strlen($reason, 'utf-8') > 200) {
|
||||
$reason = mb_substr($reason, 0, 200, 'utf-8');
|
||||
}
|
||||
|
||||
$posts = Db::name('fc_post')->where('id', 'in', $ids)->whereNull('deletetime')->select();
|
||||
if (!$posts) {
|
||||
$this->error('信息不存在');
|
||||
$this->error('信息不存在或已删除');
|
||||
}
|
||||
foreach ($posts as $post) {
|
||||
Db::name('fc_post')->where('id', $post['id'])->update([
|
||||
'audit_status' => $auditStatus,
|
||||
'audit_reason' => $reason,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
if ($auditStatus === 1 && !empty($post['category_id'])) {
|
||||
Db::name('fc_category')->where('id', $post['category_id'])->setInc('post_count');
|
||||
|
||||
$changed = 0;
|
||||
$skipped = 0;
|
||||
Db::startTrans();
|
||||
try {
|
||||
foreach ($posts as $post) {
|
||||
$from = (int)$post['audit_status'];
|
||||
// 已是目标状态:不再重复更新、不再重复计数、不再重复发通知
|
||||
if ($from === $auditStatus) {
|
||||
$skipped++;
|
||||
continue;
|
||||
}
|
||||
|
||||
Db::name('fc_post')->where('id', $post['id'])->update([
|
||||
'audit_status' => $auditStatus,
|
||||
'audit_reason' => $reason,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
|
||||
// 分类信息量只在「非通过 → 通过」时 +1,「通过 → 驳回」时 -1
|
||||
if (!empty($post['category_id'])) {
|
||||
if ($auditStatus === 1 && $from !== 1) {
|
||||
Db::name('fc_category')->where('id', $post['category_id'])->setInc('post_count');
|
||||
} elseif ($auditStatus === 2 && $from === 1) {
|
||||
Db::name('fc_category')
|
||||
->where('id', $post['category_id'])
|
||||
->where('post_count', '>', 0)
|
||||
->setDec('post_count');
|
||||
}
|
||||
}
|
||||
|
||||
Db::name('fc_message')->insert([
|
||||
'user_id' => $post['user_id'],
|
||||
'type' => 'system',
|
||||
'title' => $auditStatus === 1 ? '审核通过' : '审核驳回',
|
||||
'content' => $auditStatus === 1
|
||||
? '您发布的信息「' . $post['title'] . '」已审核通过'
|
||||
: '您发布的信息「' . $post['title'] . '」审核未通过,原因:' . $reason,
|
||||
'isread' => 0,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
$changed++;
|
||||
}
|
||||
Db::name('fc_message')->insert([
|
||||
'user_id' => $post['user_id'],
|
||||
'type' => 'system',
|
||||
'title' => $auditStatus === 1 ? '审核通过' : '审核驳回',
|
||||
'content' => $auditStatus === 1
|
||||
? '您发布的信息「' . $post['title'] . '」已审核通过'
|
||||
: '您发布的信息「' . $post['title'] . '」审核未通过' . ($reason ? ',原因:' . $reason : ''),
|
||||
'isread' => 0,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error('审核失败,请稍后重试');
|
||||
}
|
||||
$this->success('审核成功');
|
||||
|
||||
AdminLog::setTitle('审核信息 #' . implode(',', $ids) . ':' . ($auditStatus === 1 ? '通过' : '驳回') . ($reason ? '(' . $reason . ')' : ''));
|
||||
|
||||
$msg = ($auditStatus === 1 ? '已通过 ' : '已驳回 ') . $changed . ' 条';
|
||||
if ($skipped) {
|
||||
$msg .= ',跳过 ' . $skipped . ' 条(已是该状态)';
|
||||
}
|
||||
$this->success($msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 置顶 / 取消置顶(支持批量)
|
||||
* 置顶 / 取消置顶
|
||||
* POST fc/post/top {ids:'1,2', isTop:1|0}
|
||||
* 说明:置顶信息在用户端主页与列表**排在非置顶之前**(Home::feed / Post::mine 均按 is_top desc 排序)
|
||||
* 说明:置顶信息在用户端主页与列表排在非置顶之前(Home::feed / Post::mine 均按 is_top desc 排序)
|
||||
*/
|
||||
public function top()
|
||||
{
|
||||
$ids = $this->request->post('ids');
|
||||
$ids = $this->normalizeIds($this->request->post('ids'));
|
||||
$isTop = (int)$this->request->post('isTop', 1);
|
||||
if (!in_array($isTop, [0, 1], true)) {
|
||||
$this->error('置顶状态仅支持置顶(1)/取消置顶(0)');
|
||||
}
|
||||
$ids = is_array($ids) ? $ids : explode(',', (string)$ids);
|
||||
$ids = array_filter($ids);
|
||||
if (!$ids) {
|
||||
$this->error('请选择要操作的信息');
|
||||
}
|
||||
$posts = Db::name('fc_post')->where('id', 'in', $ids)->select();
|
||||
|
||||
$posts = Db::name('fc_post')->where('id', 'in', $ids)->whereNull('deletetime')->select();
|
||||
if (!$posts) {
|
||||
$this->error('信息不存在');
|
||||
$this->error('信息不存在或已删除');
|
||||
}
|
||||
foreach ($posts as $post) {
|
||||
Db::name('fc_post')->where('id', $post['id'])->update([
|
||||
'is_top' => $isTop,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
Db::name('fc_message')->insert([
|
||||
'user_id' => $post['user_id'],
|
||||
'type' => 'system',
|
||||
'title' => $isTop === 1 ? '信息已置顶' : '已取消置顶',
|
||||
'content' => $isTop === 1
|
||||
? '您发布的信息「' . $post['title'] . '」已被置顶,将在首页优先展示'
|
||||
: '您发布的信息「' . $post['title'] . '」已取消置顶',
|
||||
'isread' => 0,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
|
||||
$changed = 0;
|
||||
$skipped = 0;
|
||||
$blocked = 0;
|
||||
Db::startTrans();
|
||||
try {
|
||||
foreach ($posts as $post) {
|
||||
if ((int)$post['is_top'] === $isTop) {
|
||||
$skipped++;
|
||||
continue;
|
||||
}
|
||||
// 只有已通过且已上架的信息才允许置顶,避免用户收到「已置顶」但实际看不到
|
||||
if ($isTop === 1 && ((int)$post['audit_status'] !== 1 || (int)$post['status'] !== 1)) {
|
||||
$blocked++;
|
||||
continue;
|
||||
}
|
||||
|
||||
Db::name('fc_post')->where('id', $post['id'])->update([
|
||||
'is_top' => $isTop,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
Db::name('fc_message')->insert([
|
||||
'user_id' => $post['user_id'],
|
||||
'type' => 'system',
|
||||
'title' => $isTop === 1 ? '信息已置顶' : '已取消置顶',
|
||||
'content' => $isTop === 1
|
||||
? '您发布的信息「' . $post['title'] . '」已被置顶,将在首页优先展示'
|
||||
: '您发布的信息「' . $post['title'] . '」已取消置顶',
|
||||
'isread' => 0,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
$changed++;
|
||||
}
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error('操作失败,请稍后重试');
|
||||
}
|
||||
$this->success($isTop === 1 ? '置顶成功' : '已取消置顶');
|
||||
|
||||
if (!$changed) {
|
||||
if ($blocked) {
|
||||
$this->error('仅「已通过且已上架」的信息可以置顶');
|
||||
}
|
||||
$this->error($isTop === 1 ? '所选信息已全部置顶' : '所选信息均未置顶');
|
||||
}
|
||||
|
||||
AdminLog::setTitle('信息置顶 #' . implode(',', $ids) . ':' . ($isTop === 1 ? '置顶' : '取消置顶'));
|
||||
$msg = ($isTop === 1 ? '置顶成功 ' : '已取消置顶 ') . $changed . ' 条';
|
||||
if ($skipped) {
|
||||
$msg .= ',跳过 ' . $skipped . ' 条';
|
||||
}
|
||||
if ($blocked) {
|
||||
$msg .= ',' . $blocked . ' 条未通过审核或已下架未处理';
|
||||
}
|
||||
$this->success($msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下架信息
|
||||
* 下架信息(必须填写原因)
|
||||
* POST fc/post/offline {ids:'1,2', reason:'违规内容'}
|
||||
*/
|
||||
public function offline()
|
||||
{
|
||||
$ids = $this->request->post('ids');
|
||||
$ids = is_array($ids) ? $ids : explode(',', (string)$ids);
|
||||
$ids = array_filter($ids);
|
||||
$ids = $this->normalizeIds($this->request->post('ids'));
|
||||
$reason = trim((string)$this->request->post('reason', ''));
|
||||
if (!$ids) {
|
||||
$this->error('请选择要下架的信息');
|
||||
}
|
||||
$posts = Db::name('fc_post')->where('id', 'in', $ids)->select();
|
||||
if ($reason === '') {
|
||||
$this->error('请填写下架原因');
|
||||
}
|
||||
if (mb_strlen($reason, 'utf-8') > 200) {
|
||||
$reason = mb_substr($reason, 0, 200, 'utf-8');
|
||||
}
|
||||
|
||||
$posts = Db::name('fc_post')->where('id', 'in', $ids)->whereNull('deletetime')->select();
|
||||
if (!$posts) {
|
||||
$this->error('信息不存在');
|
||||
$this->error('信息不存在或已删除');
|
||||
}
|
||||
foreach ($posts as $post) {
|
||||
Db::name('fc_post')->where('id', $post['id'])->update([
|
||||
'status' => 0,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
Db::name('fc_message')->insert([
|
||||
'user_id' => $post['user_id'],
|
||||
'type' => 'system',
|
||||
'title' => '信息已下架',
|
||||
'content' => '您发布的信息「' . $post['title'] . '」已被下架',
|
||||
'isread' => 0,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
|
||||
$changed = 0;
|
||||
$skipped = 0;
|
||||
$blocked = 0;
|
||||
Db::startTrans();
|
||||
try {
|
||||
foreach ($posts as $post) {
|
||||
if ((int)$post['status'] === 0) {
|
||||
$skipped++;
|
||||
continue;
|
||||
}
|
||||
if ((int)$post['audit_status'] !== 1) {
|
||||
$blocked++;
|
||||
continue;
|
||||
}
|
||||
|
||||
Db::name('fc_post')->where('id', $post['id'])->update([
|
||||
'status' => 0,
|
||||
'is_top' => 0,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
Db::name('fc_message')->insert([
|
||||
'user_id' => $post['user_id'],
|
||||
'type' => 'system',
|
||||
'title' => '信息已下架',
|
||||
'content' => '您发布的信息「' . $post['title'] . '」已被下架,原因:' . $reason,
|
||||
'isread' => 0,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
$changed++;
|
||||
}
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error('下架失败,请稍后重试');
|
||||
}
|
||||
$this->success('下架成功');
|
||||
|
||||
if (!$changed) {
|
||||
if ($blocked) {
|
||||
$this->error('仅「已通过」的信息可以下架');
|
||||
}
|
||||
$this->error('所选信息已是下架状态');
|
||||
}
|
||||
|
||||
AdminLog::setTitle('下架信息 #' . implode(',', $ids) . '(' . $reason . ')');
|
||||
$msg = '下架成功 ' . $changed . ' 条';
|
||||
if ($skipped) {
|
||||
$msg .= ',跳过 ' . $skipped . ' 条(已是下架状态)';
|
||||
}
|
||||
if ($blocked) {
|
||||
$msg .= ',' . $blocked . ' 条未通过审核未处理';
|
||||
}
|
||||
$this->success($msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复上架
|
||||
* POST fc/post/online {ids:'1,2'}
|
||||
*/
|
||||
public function online()
|
||||
{
|
||||
$ids = $this->normalizeIds($this->request->post('ids'));
|
||||
if (!$ids) {
|
||||
$this->error('请选择要上架的信息');
|
||||
}
|
||||
|
||||
$posts = Db::name('fc_post')->where('id', 'in', $ids)->whereNull('deletetime')->select();
|
||||
if (!$posts) {
|
||||
$this->error('信息不存在或已删除');
|
||||
}
|
||||
|
||||
$changed = 0;
|
||||
$skipped = 0;
|
||||
$blocked = 0;
|
||||
Db::startTrans();
|
||||
try {
|
||||
foreach ($posts as $post) {
|
||||
if ((int)$post['status'] === 1) {
|
||||
$skipped++;
|
||||
continue;
|
||||
}
|
||||
if ((int)$post['audit_status'] !== 1) {
|
||||
$blocked++;
|
||||
continue;
|
||||
}
|
||||
|
||||
Db::name('fc_post')->where('id', $post['id'])->update([
|
||||
'status' => 1,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
Db::name('fc_message')->insert([
|
||||
'user_id' => $post['user_id'],
|
||||
'type' => 'system',
|
||||
'title' => '信息已恢复上架',
|
||||
'content' => '您发布的信息「' . $post['title'] . '」已恢复上架',
|
||||
'isread' => 0,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
$changed++;
|
||||
}
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error('上架失败,请稍后重试');
|
||||
}
|
||||
|
||||
if (!$changed) {
|
||||
if ($blocked) {
|
||||
$this->error('仅「已通过」的信息可以上架');
|
||||
}
|
||||
$this->error('所选信息已是上架状态');
|
||||
}
|
||||
|
||||
AdminLog::setTitle('恢复上架 #' . implode(',', $ids));
|
||||
$msg = '已恢复上架 ' . $changed . ' 条';
|
||||
if ($skipped) {
|
||||
$msg .= ',跳过 ' . $skipped . ' 条(已在上架状态)';
|
||||
}
|
||||
$this->success($msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核队列位置(供审核工作台显示「第 x / y 条」和上/下一条)
|
||||
* GET fc/post/queue?id=123
|
||||
*/
|
||||
public function queue()
|
||||
{
|
||||
$id = (int)$this->request->param('id', 0);
|
||||
$row = Db::name('fc_post')->where('id', $id)->whereNull('deletetime')->find();
|
||||
if (!$row) {
|
||||
$this->error('信息不存在或已删除');
|
||||
}
|
||||
$this->success('', null, $this->auditQueue($row));
|
||||
}
|
||||
|
||||
/**
|
||||
* 待审核队列按「提交时间正序」排列,与小程序审核队列保持一致
|
||||
*
|
||||
* @param array $row
|
||||
* @return array
|
||||
*/
|
||||
protected function auditQueue(array $row)
|
||||
{
|
||||
$base = function () {
|
||||
return Db::name('fc_post')->where('audit_status', 0)->whereNull('deletetime');
|
||||
};
|
||||
|
||||
$total = (int)$base()->count();
|
||||
if (empty($row['id'])) {
|
||||
return ['index' => 0, 'total' => $total, 'prev' => 0, 'next' => 0];
|
||||
}
|
||||
|
||||
$createtime = isset($row['createtime']) ? (int)$row['createtime'] : 0;
|
||||
$id = (int)$row['id'];
|
||||
|
||||
$index = (int)$base()
|
||||
->whereRaw("createtime < {$createtime} OR (createtime = {$createtime} AND id <= {$id})")
|
||||
->count();
|
||||
$prev = (int)$base()
|
||||
->whereRaw("createtime < {$createtime} OR (createtime = {$createtime} AND id < {$id})")
|
||||
->order('createtime desc, id desc')
|
||||
->value('id');
|
||||
$next = (int)$base()
|
||||
->whereRaw("createtime > {$createtime} OR (createtime = {$createtime} AND id > {$id})")
|
||||
->order('createtime asc, id asc')
|
||||
->value('id');
|
||||
|
||||
return ['index' => $index, 'total' => $total, 'prev' => $prev, 'next' => $next];
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一整理 ids 入参(支持数组 / 逗号字符串),去重并转成整数
|
||||
*
|
||||
* @param mixed $ids
|
||||
* @return array
|
||||
*/
|
||||
protected function normalizeIds($ids)
|
||||
{
|
||||
$ids = is_array($ids) ? $ids : explode(',', (string)$ids);
|
||||
$ids = array_map('intval', $ids);
|
||||
$ids = array_filter($ids);
|
||||
return array_values(array_unique($ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,313 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\admin\model\AdminLog;
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 同城-信息审核中心
|
||||
*
|
||||
* @icon fa fa-check-square-o
|
||||
*/
|
||||
class Postaudit extends Backend
|
||||
{
|
||||
/**
|
||||
* FcPost模型对象
|
||||
* @var \app\admin\model\FcPost
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
/**
|
||||
* 无需鉴权的方法(只读辅助接口)
|
||||
* @var array
|
||||
*/
|
||||
protected $noNeedRight = ['detail', 'queue'];
|
||||
|
||||
/**
|
||||
* 初始化控制器
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcPost;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看待审核信息列表
|
||||
*
|
||||
* 默认展示待审核(audit_status=0)的数据,支持通用搜索
|
||||
*
|
||||
* @return string|\think\response\Json
|
||||
* @throws \think\Exception
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if (false === $this->request->isAjax()) {
|
||||
return $this->view->fetch();
|
||||
}
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
|
||||
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
|
||||
|
||||
// 如果通用搜索未指定审核状态,默认只展示待审核信息(audit_status = 0)
|
||||
$filter = (array)json_decode($this->request->get('filter', ''), true);
|
||||
$hasAuditFilter = isset($filter['audit_status']) && $filter['audit_status'] !== '';
|
||||
|
||||
$query = $this->model->where($where);
|
||||
if (!$hasAuditFilter) {
|
||||
$query->where('audit_status', 0);
|
||||
}
|
||||
|
||||
$list = $query
|
||||
->order('id', 'desc')
|
||||
->paginate($limit);
|
||||
|
||||
$result = ['total' => $list->total(), 'rows' => $list->items()];
|
||||
return json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核处理接口(支持单条与批量)
|
||||
*
|
||||
* @return void
|
||||
* @throws \think\Exception
|
||||
*/
|
||||
public function audit()
|
||||
{
|
||||
$ids = $this->request->post('ids');
|
||||
$auditStatus = (int)$this->request->post('auditStatus');
|
||||
$reason = trim((string)$this->request->post('reason', ''));
|
||||
|
||||
if (!in_array($auditStatus, [1, 2], true)) {
|
||||
$this->error('审核状态仅支持通过(1)或驳回(2)');
|
||||
}
|
||||
$ids = $this->normalizeIds($ids);
|
||||
if (!$ids) {
|
||||
$this->error('请选择要审核的信息');
|
||||
}
|
||||
if ($auditStatus === 2 && $reason === '') {
|
||||
$this->error('请填写驳回原因');
|
||||
}
|
||||
if (mb_strlen($reason, 'utf-8') > 200) {
|
||||
$reason = mb_substr($reason, 0, 200, 'utf-8');
|
||||
}
|
||||
|
||||
$posts = Db::name('fc_post')->where('id', 'in', $ids)->whereNull('deletetime')->select();
|
||||
if (!$posts) {
|
||||
$this->error('信息不存在或已删除');
|
||||
}
|
||||
|
||||
$changed = 0;
|
||||
$skipped = 0;
|
||||
Db::startTrans();
|
||||
try {
|
||||
foreach ($posts as $post) {
|
||||
$from = (int)$post['audit_status'];
|
||||
if ($from === $auditStatus) {
|
||||
$skipped++;
|
||||
continue;
|
||||
}
|
||||
|
||||
Db::name('fc_post')->where('id', $post['id'])->update([
|
||||
'audit_status' => $auditStatus,
|
||||
'audit_reason' => $reason,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
|
||||
// 分类信息量维护
|
||||
if (!empty($post['category_id'])) {
|
||||
if ($auditStatus === 1 && $from !== 1) {
|
||||
Db::name('fc_category')->where('id', $post['category_id'])->setInc('post_count');
|
||||
} elseif ($auditStatus === 2 && $from === 1) {
|
||||
Db::name('fc_category')
|
||||
->where('id', $post['category_id'])
|
||||
->where('post_count', '>', 0)
|
||||
->setDec('post_count');
|
||||
}
|
||||
}
|
||||
|
||||
// 站内信通知发布用户
|
||||
Db::name('fc_message')->insert([
|
||||
'user_id' => $post['user_id'],
|
||||
'type' => 'system',
|
||||
'title' => $auditStatus === 1 ? '信息审核通过' : '信息审核未通过',
|
||||
'content' => $auditStatus === 1
|
||||
? sprintf('您发布的信息「%s」已通过审核并上架展示。', $post['title'])
|
||||
: sprintf('您发布的信息「%s」未通过审核,原因:%s', $post['title'], $reason),
|
||||
'target_id' => $post['id'],
|
||||
'target_type'=> 'post',
|
||||
'status' => 0,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
|
||||
$changed++;
|
||||
}
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error('审核处理失败:' . $e->getMessage());
|
||||
}
|
||||
|
||||
$actionText = $auditStatus === 1 ? '审核通过' : '审核驳回';
|
||||
AdminLog::record(sprintf('%s,涉及 %d 条信息(成功 %d 条,跳过 %d 条)', $actionText, count($ids), $changed, $skipped));
|
||||
|
||||
$msg = $changed > 0
|
||||
? sprintf('%s成功(已处理 %d 条)', $actionText, $changed)
|
||||
: '所选信息已处于该状态,未重复处理';
|
||||
$this->success($msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 快捷通过接口
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function pass()
|
||||
{
|
||||
$this->request->post(['auditStatus' => 1, 'reason' => '']);
|
||||
$this->audit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 快捷驳回接口
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function reject()
|
||||
{
|
||||
$this->request->post(['auditStatus' => 2]);
|
||||
$this->audit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看信息详情或进入专属审核工作台
|
||||
*
|
||||
* @param int|null $ids 信息ID
|
||||
* @return string|\think\response\Json
|
||||
*/
|
||||
public function detail($ids = null)
|
||||
{
|
||||
$id = $this->request->param('ids', 0) ?: $this->request->param('id/d', 0);
|
||||
if (!$id) {
|
||||
$this->error('缺少参数ID');
|
||||
}
|
||||
$row = $this->model->where('id', $id)->find();
|
||||
if (!$row) {
|
||||
$this->error('信息不存在或已删除');
|
||||
}
|
||||
|
||||
// 补齐分类名称
|
||||
if ($row->category_id) {
|
||||
$category = Db::name('fc_category')->where('id', $row->category_id)->find();
|
||||
$row->category_name = $category ? $category['name'] : '未分类';
|
||||
} else {
|
||||
$row->category_name = '未分类';
|
||||
}
|
||||
|
||||
// 解析多图相册
|
||||
$mediaList = [];
|
||||
$rawMedia = $row->getData('media');
|
||||
if (!empty($rawMedia)) {
|
||||
$decoded = is_string($rawMedia) ? json_decode($rawMedia, true) : $rawMedia;
|
||||
if (is_array($decoded)) {
|
||||
$mediaList = array_values(array_filter($decoded));
|
||||
} else {
|
||||
$mediaList = array_values(array_filter(explode(',', (string)$rawMedia)));
|
||||
}
|
||||
}
|
||||
if (empty($mediaList) && !empty($row->cover)) {
|
||||
$mediaList[] = $row->cover;
|
||||
}
|
||||
|
||||
// 获取发布用户画像
|
||||
$userInfo = [
|
||||
'id' => $row->user_id,
|
||||
'nickname' => $row->user_name ?: '未知用户',
|
||||
'mobile' => '',
|
||||
'avatar' => '/assets/img/avatar.png',
|
||||
'post_count' => 0
|
||||
];
|
||||
$user = Db::name('user')->where('id', $row->user_id)->field('id,nickname,mobile,avatar')->find();
|
||||
if ($user) {
|
||||
$userInfo['nickname'] = $user['nickname'] ?: $userInfo['nickname'];
|
||||
$userInfo['mobile'] = $user['mobile'] ?: '';
|
||||
$userInfo['avatar'] = $user['avatar'] ?: $userInfo['avatar'];
|
||||
$userInfo['post_count'] = Db::name('fc_post')->where('user_id', $user['id'])->count();
|
||||
}
|
||||
|
||||
$mode = $this->request->param('mode', 'audit');
|
||||
$this->view->assign('mode', $mode);
|
||||
$this->view->assign('row', $row);
|
||||
$this->view->assign('userInfo', $userInfo);
|
||||
$this->view->assign('mediaList', $mediaList);
|
||||
$this->view->assign('queue', $this->auditQueue($row->getData()));
|
||||
|
||||
if ($mode === 'audit') {
|
||||
return $this->view->fetch('fc/post/audit');
|
||||
}
|
||||
return $this->view->fetch('fc/post/detail');
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算待审核队列的上下文(第几条、总数、上一条、下一条)
|
||||
*
|
||||
* @param array $current 当前信息数组
|
||||
* @return array
|
||||
*/
|
||||
protected function auditQueue(array $current)
|
||||
{
|
||||
$id = (int)$current['id'];
|
||||
$pendingIds = Db::name('fc_post')
|
||||
->whereNull('deletetime')
|
||||
->where('audit_status', 0)
|
||||
->order('id', 'desc')
|
||||
->column('id');
|
||||
|
||||
$total = count($pendingIds);
|
||||
$pos = array_search($id, $pendingIds, true);
|
||||
if ($pos === false) {
|
||||
return ['index' => 0, 'total' => $total, 'prev' => 0, 'next' => 0];
|
||||
}
|
||||
|
||||
$prevId = $pos > 0 ? $pendingIds[$pos - 1] : 0;
|
||||
$nextId = $pos + 1 < $total ? $pendingIds[$pos + 1] : 0;
|
||||
return [
|
||||
'index' => $pos + 1,
|
||||
'total' => $total,
|
||||
'prev' => $prevId,
|
||||
'next' => $nextId,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析请求中的 ID 数组
|
||||
*
|
||||
* @param mixed $ids 前端提交的ID
|
||||
* @return array
|
||||
*/
|
||||
protected function normalizeIds($ids)
|
||||
{
|
||||
if (is_array($ids)) {
|
||||
$arr = $ids;
|
||||
} elseif (is_string($ids)) {
|
||||
$arr = explode(',', $ids);
|
||||
} else {
|
||||
$arr = [$ids];
|
||||
}
|
||||
$arr = array_map('intval', $arr);
|
||||
$arr = array_filter($arr, function ($v) {
|
||||
return $v > 0;
|
||||
});
|
||||
return array_values(array_unique($arr));
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,14 @@
|
||||
|
||||
return [
|
||||
'Id' => 'ID',
|
||||
'SerialNo' => '序号',
|
||||
'Icon' => '图标预览',
|
||||
'Name' => '分类名称',
|
||||
'Icon_key' => '图标key',
|
||||
'Icon_key' => '图标标识/路径',
|
||||
'Color' => '主题色',
|
||||
'Sort' => '排序',
|
||||
'Enabled' => '是否启用',
|
||||
'Post_count' => '信息量',
|
||||
'Sort' => '排序权重',
|
||||
'Enabled' => '启用状态',
|
||||
'Post_count' => '发布帖子数',
|
||||
'Createtime' => '创建时间',
|
||||
'Updatetime' => '更新时间',
|
||||
'Operate' => '操作',
|
||||
|
||||
@@ -15,5 +15,5 @@ return [
|
||||
'Updatetime' => '更新时间',
|
||||
'ReplyComment' => '回复',
|
||||
'TopComment' => '置顶',
|
||||
'UnTopComment' => '取消置顶'
|
||||
'UnTopComment' => '取消'
|
||||
];
|
||||
|
||||
@@ -7,6 +7,7 @@ return [
|
||||
'Price' => '售价',
|
||||
'Origin_price' => '原价',
|
||||
'Days' => '有效天数',
|
||||
'Post_quota' => '含发布条数',
|
||||
'Tag' => '标签',
|
||||
'Sort' => '排序',
|
||||
'Enabled' => '是否启用',
|
||||
|
||||
@@ -83,18 +83,18 @@
|
||||
<div class="tab-pane fade active in" id="one">
|
||||
<div class="widget-body no-padding">
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" data-force-refresh="false"><i class="fa fa-refresh"></i> </a>
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" data-force-refresh="false">刷新</a>
|
||||
{if $Think.config.fastadmin.api_url}
|
||||
<button type="button" id="faupload-addon" class="btn btn-danger faupload btn-mini-xs" data-url="addon/local" data-chunking="false" data-mimetype="zip,fastaddon" data-multiple="false"><i class="fa fa-upload"></i>
|
||||
{:__('Local install')}
|
||||
<button type="button" id="faupload-addon" class="btn btn-danger faupload btn-mini-xs" data-url="addon/local" data-chunking="false" data-mimetype="zip,fastaddon" data-multiple="false" title="本地安装">
|
||||
安装
|
||||
</button>
|
||||
<div class="btn-group">
|
||||
<a href="#" class="btn btn-info btn-switch active btn-mini-xs" data-type="all"><i class="fa fa-list"></i> {:__('All')}</a>
|
||||
<a href="#" class="btn btn-info btn-switch btn-mini-xs" data-type="free"><i class="fa fa-gift"></i> {:__('Free')}</a>
|
||||
<a href="#" class="btn btn-info btn-switch btn-mini-xs" data-type="price"><i class="fa fa-rmb"></i> {:__('Paying')}</a>
|
||||
<a href="#" class="btn btn-info btn-switch btn-mini-xs" data-type="local" data-url="addon/downloaded"><i class="fa fa-laptop"></i> {:__('Local addon')}</a>
|
||||
<a href="#" class="btn btn-info btn-switch active btn-mini-xs" data-type="all" title="全部">全部</a>
|
||||
<a href="#" class="btn btn-info btn-switch btn-mini-xs" data-type="free" title="免费">免费</a>
|
||||
<a href="#" class="btn btn-info btn-switch btn-mini-xs" data-type="price" title="付费">付费</a>
|
||||
<a href="#" class="btn btn-info btn-switch btn-mini-xs" data-type="local" data-url="addon/downloaded" title="本地插件">本地</a>
|
||||
</div>
|
||||
<a class="btn btn-primary btn-userinfo btn-mini-xs" href="javascript:;"><i class="fa fa-user"></i> {:__('Userinfo')}</a>
|
||||
<a class="btn btn-primary btn-userinfo btn-mini-xs" href="javascript:;" title="用户信息">用户</a>
|
||||
{/if}
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover" width="100%">
|
||||
@@ -252,16 +252,13 @@
|
||||
</ul>
|
||||
</span>
|
||||
<% }else{%>
|
||||
<a href="javascript:;" class="btn btn-xs btn-info btn-upgrade" title="{:__('Upgrade')}" data-version="<%=item.version%>"><i
|
||||
class="fa fa-cloud"></i> {:__('Upgrade')}</a>
|
||||
<a href="javascript:;" class="btn btn-xs btn-info btn-upgrade" title="{:__('Upgrade')}" data-version="<%=item.version%>">升级</a>
|
||||
<% }%>
|
||||
<% }%>
|
||||
<% if(addon.config){ %>
|
||||
<a href="javascript:;" class="btn btn-xs btn-primary btn-config" title="{:__('Setting')}"><i class="fa fa-pencil"></i>
|
||||
{:__('Setting')}</a>
|
||||
<a href="javascript:;" class="btn btn-xs btn-primary btn-config" title="{:__('Setting')}">配置</a>
|
||||
<% } %>
|
||||
<a href="javascript:;" class="btn btn-xs btn-danger btn-uninstall" title="{:__('Uninstall')}"><i class="fa fa-times"></i>
|
||||
{:__('Uninstall')}</a>
|
||||
<a href="javascript:;" class="btn btn-xs btn-danger btn-uninstall" title="{:__('Uninstall')}">卸载</a>
|
||||
<% } %>
|
||||
</span>
|
||||
</script>
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
<div class="tab-pane fade active in" id="one">
|
||||
<div class="widget-body no-padding">
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" data-force-refresh="false"><i class="fa fa-refresh"></i> {:__('Refresh')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('auth/rule/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('auth/rule/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('auth/rule/del')?'':'hide'}" title="删除(含子级)" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" data-force-refresh="false">刷新</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('auth/rule/add')?'':'hide'}" title="{:__('Add')}" >添加</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('auth/rule/edit')?'':'hide'}" title="{:__('Edit')}" >编辑</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('auth/rule/del')?'':'hide'}" title="删除(含子级)" >删除</a>
|
||||
<div class="dropdown btn-group {:$auth->check('auth/rule/multi')?'':'hide'}">
|
||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
|
||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown">更多</a>
|
||||
<ul class="dropdown-menu text-left" role="menu">
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal">正常</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden">隐藏</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<a href="javascript:;" class="btn btn-danger btn-toggle-all" title="展开或收起全部层级"><i class="fa fa-plus"></i> {:__('Toggle all')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-toggle-all" title="展开或收起全部层级">展开</a>
|
||||
</div>
|
||||
<div class="rule-filter form-inline" style="margin-bottom:10px;">
|
||||
<input type="text" id="rule-keyword" class="form-control input-sm" placeholder="搜索标题或规则名" autocomplete="off">
|
||||
@@ -34,7 +34,7 @@
|
||||
<option value="normal" selected>正常</option>
|
||||
<option value="hidden">隐藏</option>
|
||||
</select>
|
||||
<button type="button" class="btn btn-primary btn-sm" id="rule-search"><i class="fa fa-search"></i> 筛选</button>
|
||||
<button type="button" class="btn btn-primary btn-sm" id="rule-search">筛选</button>
|
||||
<button type="button" class="btn btn-default btn-sm" id="rule-reset">重置</button>
|
||||
<span class="text-muted small" id="rule-count"></span>
|
||||
<span class="text-muted small" style="margin-left:8px;">删除会连同子级一起删除;权重越大越靠前。</span>
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
<div id="toolbar" class="toolbar">
|
||||
{:build_toolbar('refresh,add,edit,del')}
|
||||
<div class="dropdown btn-group {:$auth->check('category/multi')?'':'hide'}">
|
||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
|
||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown">更多</a>
|
||||
<ul class="dropdown-menu text-left" role="menu">
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal">正常</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden">隐藏</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" >刷新</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('fc/area/add')?'':'hide'}" title="{:__('Add')}" >添加</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/area/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/area/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/area/edit')?'':'hide'}" title="{:__('Edit')}" >{:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/area/del')?'':'hide'}" title="{:__('Delete')}" >{:__('Delete')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" >刷新</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('fc/banner/add')?'':'hide'}" title="{:__('Add')}" >添加</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/banner/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/banner/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/banner/edit')?'':'hide'}" title="{:__('Edit')}" >{:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/banner/del')?'':'hide'}" title="{:__('Delete')}" >{:__('Delete')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,49 +1,336 @@
|
||||
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
<style>
|
||||
.fc-form-container {
|
||||
padding: 15px 15px 0;
|
||||
}
|
||||
/* 当前选中的图标微卡片展示区 */
|
||||
.fc-current-icon-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 12px;
|
||||
padding: 8px 14px;
|
||||
min-height: 54px;
|
||||
}
|
||||
.fc-current-icon-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.fc-current-icon-info img {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
object-fit: contain;
|
||||
background: #ffffff;
|
||||
border-radius: 10px;
|
||||
padding: 4px;
|
||||
border: 1px solid #e2e8f0;
|
||||
box-shadow: 0 2px 6px rgba(0,0,0,0.04);
|
||||
}
|
||||
.fc-icon-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
/* 推荐调色板 */
|
||||
.fc-color-presets {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.fc-color-dot {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
border: 2px solid #fff;
|
||||
box-shadow: 0 0 0 1px #d5d5d5;
|
||||
transition: transform 0.15s ease;
|
||||
}
|
||||
.fc-color-dot:hover {
|
||||
transform: scale(1.2);
|
||||
}
|
||||
/* 右侧迷你小程序模拟器 */
|
||||
.fc-preview-box {
|
||||
background: linear-gradient(150deg, #f2fef7 0%, #e6fbf1 100%);
|
||||
border: 1px solid #c8f2de;
|
||||
border-radius: 14px;
|
||||
padding: 16px 14px;
|
||||
text-align: center;
|
||||
box-shadow: 0 4px 14px rgba(4, 48, 30, 0.05);
|
||||
}
|
||||
.fc-preview-title {
|
||||
font-size: 12px;
|
||||
color: #04874a;
|
||||
font-weight: 700;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.fc-preview-badge {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 18px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 0 auto 8px;
|
||||
box-shadow: 0 4px 12px rgba(4, 48, 30, 0.08);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
.fc-preview-badge img {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
object-fit: contain;
|
||||
}
|
||||
.fc-preview-name {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
||||
/* 纯插画选择模态窗口(默认严格隐藏,仅在点击按钮后展示) */
|
||||
.fc-icon-modal-wrap {
|
||||
display: none;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1999;
|
||||
}
|
||||
.fc-icon-modal-wrap.open {
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.fc-modal-overlay {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(15, 23, 42, 0.6);
|
||||
backdrop-filter: blur(2px);
|
||||
}
|
||||
.fc-modal-card {
|
||||
position: relative;
|
||||
background: #ffffff;
|
||||
border-radius: 16px;
|
||||
width: 660px;
|
||||
max-width: 95%;
|
||||
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
|
||||
padding: 18px 22px 20px;
|
||||
z-index: 2000;
|
||||
animation: fcModalZoom 0.2s ease-out;
|
||||
}
|
||||
.fc-modal-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.fc-modal-title {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: #0f172a;
|
||||
}
|
||||
.fc-modal-close {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
background: #f1f5f9;
|
||||
color: #64748b;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
font-size: 16px;
|
||||
}
|
||||
/* 纯图标网格容器 */
|
||||
.fc-modal-grid-box {
|
||||
max-height: 360px;
|
||||
overflow-y: auto;
|
||||
padding: 2px 4px 6px;
|
||||
}
|
||||
.fc-modal-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
.fc-icon-chip {
|
||||
flex: 0 0 calc(16.666% - 10px);
|
||||
height: 72px;
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
.fc-icon-chip:hover {
|
||||
border-color: #00E070;
|
||||
background: #f0fdf4;
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
.fc-icon-chip.active {
|
||||
border-color: #00E070;
|
||||
background: #e6fbf1;
|
||||
box-shadow: 0 0 0 2px #00E070;
|
||||
}
|
||||
.fc-icon-chip img {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
object-fit: contain;
|
||||
}
|
||||
@keyframes fcModalZoom {
|
||||
from { opacity: 0; transform: scale(0.95); }
|
||||
to { opacity: 1; transform: scale(1); }
|
||||
}
|
||||
</style>
|
||||
|
||||
<form id="add-form" class="form-horizontal fc-form-container" role="form" data-toggle="validator" method="POST" action="">
|
||||
<div class="row">
|
||||
<!-- 左侧核心表单区 -->
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="">
|
||||
<div class="form-group" style="margin-bottom:16px;">
|
||||
<label class="control-label col-xs-12 col-sm-3">{:__('Name')}:</label>
|
||||
<div class="col-xs-12 col-sm-9">
|
||||
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" placeholder="例如:招聘求职、房产租售、二手闲置" value="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 分类图标(纯视觉图标控件,无多余文字标签) -->
|
||||
<div class="form-group" style="margin-bottom:16px;">
|
||||
<label class="control-label col-xs-12 col-sm-3">分类图标:</label>
|
||||
<div class="col-xs-12 col-sm-9">
|
||||
<div class="fc-current-icon-box">
|
||||
<div class="fc-current-icon-info">
|
||||
<img id="current-icon-img" src="/static/icons/cat-job.png?v=2" alt="当前图标">
|
||||
</div>
|
||||
<div class="fc-icon-actions">
|
||||
<button type="button" class="btn btn-success" id="btn-open-icon-picker" style="background:#00E070;border-color:#00c860;color:#04301e;font-weight:700;">
|
||||
<i class="fa fa-th-large"></i> 挑选系统插画
|
||||
</button>
|
||||
<button type="button" id="faupload-icon_key" class="btn btn-default faupload" data-input-id="c-icon_key" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/svg+xml" data-multiple="false">
|
||||
<i class="fa fa-upload text-primary"></i> 上传图片
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 底层安全隐蔽传参 -->
|
||||
<input type="hidden" name="row[icon_key]" id="c-icon_key" value="cat-job">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 主题色设置 + 推荐调色板 -->
|
||||
<div class="form-group" style="margin-bottom:16px;">
|
||||
<label class="control-label col-xs-12 col-sm-3">{:__('Color')}:</label>
|
||||
<div class="col-xs-12 col-sm-9">
|
||||
<div class="input-group">
|
||||
<input id="c-color" data-rule="required" class="form-control" name="row[color]" type="text" value="#00E070" placeholder="例如:#00E070">
|
||||
<span class="input-group-addon" id="color-preview-addon" style="width:38px;padding:0;background:#00E070;border-color:#ccc;"></span>
|
||||
</div>
|
||||
<div class="fc-color-presets">
|
||||
<span style="font-size:11px;color:#64748b;">推荐配色:</span>
|
||||
<div class="fc-color-dot" style="background:#00E070;" title="春绿(品牌主色)" data-color="#00E070"></div>
|
||||
<div class="fc-color-dot" style="background:#FF7A59;" title="活力橙" data-color="#FF7A59"></div>
|
||||
<div class="fc-color-dot" style="background:#F5A623;" title="阳光金" data-color="#F5A623"></div>
|
||||
<div class="fc-color-dot" style="background:#2ECC71;" title="翠青绿" data-color="#2ECC71"></div>
|
||||
<div class="fc-color-dot" style="background:#3498DB;" title="晴空蓝" data-color="#3498DB"></div>
|
||||
<div class="fc-color-dot" style="background:#9B59B6;" title="典雅紫" data-color="#9B59B6"></div>
|
||||
<div class="fc-color-dot" style="background:#E67E22;" title="收获橙" data-color="#E67E22"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 排序权重 -->
|
||||
<div class="form-group" style="margin-bottom:16px;">
|
||||
<label class="control-label col-xs-12 col-sm-3">{:__('Sort')}:</label>
|
||||
<div class="col-xs-12 col-sm-9">
|
||||
<input id="c-sort" data-rule="required" class="form-control" name="row[sort]" type="number" value="10">
|
||||
<span class="help-block text-muted" style="margin-top:4px;margin-bottom:0;font-size:11px;"><i class="fa fa-info-circle"></i> 数值越小越靠前,直接决定小程序金刚区的排列次序。</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 启用状态 -->
|
||||
<div class="form-group" style="margin-bottom:10px;">
|
||||
<label class="control-label col-xs-12 col-sm-3">{:__('Enabled')}:</label>
|
||||
<div class="col-xs-12 col-sm-9">
|
||||
<input id="c-enabled" name="row[enabled]" type="hidden" value="1">
|
||||
<a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-enabled" data-yes="1" data-no="0">
|
||||
<i class="fa fa-toggle-on text-success fa-2x"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input id="c-post_count" name="row[post_count]" type="hidden" value="0">
|
||||
</div>
|
||||
|
||||
<!-- 右侧:小程序金刚区微缩呈现 -->
|
||||
<div class="col-xs-12 col-sm-4 hidden-xs">
|
||||
<div class="fc-preview-box">
|
||||
<div class="fc-preview-title">
|
||||
<i class="fa fa-mobile fa-lg"></i> 小程序金刚区·实时呈现
|
||||
</div>
|
||||
<div class="fc-preview-badge" id="preview-badge" style="background: rgba(0, 224, 112, 0.15); border: 1px solid rgba(0, 224, 112, 0.35);">
|
||||
<img id="preview-icon" src="/static/icons/cat-job.png?v=2" alt="分类图标">
|
||||
</div>
|
||||
<div class="fc-preview-name" id="preview-name">未命名分类</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Icon_key')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-icon_key" data-rule="required" class="form-control" name="row[icon_key]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Color')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-color" data-rule="required" class="form-control" name="row[color]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Sort')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-sort" data-rule="required" class="form-control" name="row[sort]" type="number" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Enabled')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
<input id="c-enabled" name="row[enabled]" type="hidden" value="1">
|
||||
<a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-enabled" data-yes="1" data-no="0" >
|
||||
<i class="fa fa-toggle-on text-success fa-2x"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Post_count')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-post_count" data-rule="required" class="form-control" name="row[post_count]" type="number" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
|
||||
<div class="form-group layer-footer" style="margin-top:16px;padding-top:14px;border-top:1px solid #f1f5f9;">
|
||||
<label class="control-label col-xs-12 col-sm-3"></label>
|
||||
<div class="col-xs-12 col-sm-9">
|
||||
<button type="submit" class="btn btn-success btn-embossed disabled" style="background:#00E070;border-color:#00c860;color:#04301e;font-weight:700;"><i class="fa fa-check"></i> 确认保存分类</button>
|
||||
<button type="reset" class="btn btn-default btn-embossed" style="margin-left:10px;">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- 纯插画选择面板(默认完全隐藏,只有主动点击按钮才唤起) -->
|
||||
<div class="fc-icon-modal-wrap" id="fc-icon-modal" style="display:none !important;">
|
||||
<div class="fc-modal-overlay"></div>
|
||||
<div class="fc-modal-card">
|
||||
<div class="fc-modal-header">
|
||||
<div class="fc-modal-title">
|
||||
<i class="fa fa-th-large text-success"></i> 选择分类插画
|
||||
</div>
|
||||
<button type="button" class="fc-modal-close" id="btn-close-icon-modal">×</button>
|
||||
</div>
|
||||
|
||||
<!-- 纯插画网格 -->
|
||||
<div class="fc-modal-grid-box">
|
||||
<div class="fc-modal-grid">
|
||||
<div class="fc-icon-chip" data-key="cat-job"><img src="/static/icons/cat-job.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-house"><img src="/static/icons/cat-house.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-goods"><img src="/static/icons/cat-goods.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-car"><img src="/static/icons/cat-car.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-service"><img src="/static/icons/cat-service.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-education"><img src="/static/icons/cat-education.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-clean"><img src="/static/icons/cat-clean.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-friend"><img src="/static/icons/cat-friend.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-pet"><img src="/static/icons/cat-pet.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-food"><img src="/static/icons/cat-food.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-digital"><img src="/static/icons/cat-digital.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-sport"><img src="/static/icons/cat-sport.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-baby"><img src="/static/icons/cat-baby.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-health"><img src="/static/icons/cat-health.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-entertainment"><img src="/static/icons/cat-entertainment.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-community"><img src="/static/icons/cat-community.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-move"><img src="/static/icons/cat-move.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-repair"><img src="/static/icons/cat-repair.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-furniture"><img src="/static/icons/cat-furniture.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-business"><img src="/static/icons/cat-business.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-law"><img src="/static/icons/cat-law.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-consult"><img src="/static/icons/cat-consult.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-vip"><img src="/static/icons/cat-vip.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-photo"><img src="/static/icons/cat-photo.png?v=2" alt="icon"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,49 +1,345 @@
|
||||
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
<style>
|
||||
.fc-form-container {
|
||||
padding: 15px 15px 0;
|
||||
}
|
||||
/* 当前选中的图标微卡片展示区 */
|
||||
.fc-current-icon-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 12px;
|
||||
padding: 8px 14px;
|
||||
min-height: 54px;
|
||||
}
|
||||
.fc-current-icon-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.fc-current-icon-info img {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
object-fit: contain;
|
||||
background: #ffffff;
|
||||
border-radius: 10px;
|
||||
padding: 4px;
|
||||
border: 1px solid #e2e8f0;
|
||||
box-shadow: 0 2px 6px rgba(0,0,0,0.04);
|
||||
}
|
||||
.fc-icon-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
/* 推荐调色板 */
|
||||
.fc-color-presets {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.fc-color-dot {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
border: 2px solid #fff;
|
||||
box-shadow: 0 0 0 1px #d5d5d5;
|
||||
transition: transform 0.15s ease;
|
||||
}
|
||||
.fc-color-dot:hover {
|
||||
transform: scale(1.2);
|
||||
}
|
||||
/* 右侧迷你小程序模拟器 */
|
||||
.fc-preview-box {
|
||||
background: linear-gradient(150deg, #f2fef7 0%, #e6fbf1 100%);
|
||||
border: 1px solid #c8f2de;
|
||||
border-radius: 14px;
|
||||
padding: 16px 14px;
|
||||
text-align: center;
|
||||
box-shadow: 0 4px 14px rgba(4, 48, 30, 0.05);
|
||||
}
|
||||
.fc-preview-title {
|
||||
font-size: 12px;
|
||||
color: #04874a;
|
||||
font-weight: 700;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.fc-preview-badge {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 18px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 0 auto 8px;
|
||||
box-shadow: 0 4px 12px rgba(4, 48, 30, 0.08);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
.fc-preview-badge img {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
object-fit: contain;
|
||||
}
|
||||
.fc-preview-name {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
||||
/* 纯插画选择模态窗口(默认严格隐藏,仅在点击按钮后展示) */
|
||||
.fc-icon-modal-wrap {
|
||||
display: none;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1999;
|
||||
}
|
||||
.fc-icon-modal-wrap.open {
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.fc-modal-overlay {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(15, 23, 42, 0.6);
|
||||
backdrop-filter: blur(2px);
|
||||
}
|
||||
.fc-modal-card {
|
||||
position: relative;
|
||||
background: #ffffff;
|
||||
border-radius: 16px;
|
||||
width: 660px;
|
||||
max-width: 95%;
|
||||
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
|
||||
padding: 18px 22px 20px;
|
||||
z-index: 2000;
|
||||
animation: fcModalZoom 0.2s ease-out;
|
||||
}
|
||||
.fc-modal-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.fc-modal-title {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: #0f172a;
|
||||
}
|
||||
.fc-modal-close {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
background: #f1f5f9;
|
||||
color: #64748b;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
font-size: 16px;
|
||||
}
|
||||
/* 纯图标网格容器 */
|
||||
.fc-modal-grid-box {
|
||||
max-height: 360px;
|
||||
overflow-y: auto;
|
||||
padding: 2px 4px 6px;
|
||||
}
|
||||
.fc-modal-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
.fc-icon-chip {
|
||||
flex: 0 0 calc(16.666% - 10px);
|
||||
height: 72px;
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
.fc-icon-chip:hover {
|
||||
border-color: #00E070;
|
||||
background: #f0fdf4;
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
.fc-icon-chip.active {
|
||||
border-color: #00E070;
|
||||
background: #e6fbf1;
|
||||
box-shadow: 0 0 0 2px #00E070;
|
||||
}
|
||||
.fc-icon-chip img {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
object-fit: contain;
|
||||
}
|
||||
@keyframes fcModalZoom {
|
||||
from { opacity: 0; transform: scale(0.95); }
|
||||
to { opacity: 1; transform: scale(1); }
|
||||
}
|
||||
</style>
|
||||
|
||||
<form id="edit-form" class="form-horizontal fc-form-container" role="form" data-toggle="validator" method="POST" action="">
|
||||
<div class="row">
|
||||
<!-- 左侧核心表单区 -->
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
|
||||
<div class="form-group" style="margin-bottom:16px;">
|
||||
<label class="control-label col-xs-12 col-sm-3">{:__('Name')}:</label>
|
||||
<div class="col-xs-12 col-sm-9">
|
||||
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}" placeholder="例如:招聘求职、房产租售、二手闲置">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 分类图标(纯视觉图标控件,无多余文字标签) -->
|
||||
<div class="form-group" style="margin-bottom:16px;">
|
||||
<label class="control-label col-xs-12 col-sm-3">分类图标:</label>
|
||||
<div class="col-xs-12 col-sm-9">
|
||||
<div class="fc-current-icon-box">
|
||||
<div class="fc-current-icon-info">
|
||||
<img id="current-icon-img" src="/static/icons/{$row.icon_key|htmlentities}.png?v=2" onerror="this.src='/static/icons/cat-job.png'" alt="当前图标">
|
||||
</div>
|
||||
<div class="fc-icon-actions">
|
||||
<button type="button" class="btn btn-success" id="btn-open-icon-picker" style="background:#00E070;border-color:#00c860;color:#04301e;font-weight:700;">
|
||||
<i class="fa fa-th-large"></i> 挑选系统插画
|
||||
</button>
|
||||
<button type="button" id="faupload-icon_key" class="btn btn-default faupload" data-input-id="c-icon_key" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/svg+xml" data-multiple="false">
|
||||
<i class="fa fa-upload text-primary"></i> 上传图片
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 底层安全隐蔽传参 -->
|
||||
<input type="hidden" name="row[icon_key]" id="c-icon_key" value="{$row.icon_key|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 主题色设置 + 推荐调色板 -->
|
||||
<div class="form-group" style="margin-bottom:16px;">
|
||||
<label class="control-label col-xs-12 col-sm-3">{:__('Color')}:</label>
|
||||
<div class="col-xs-12 col-sm-9">
|
||||
<div class="input-group">
|
||||
<input id="c-color" data-rule="required" class="form-control" name="row[color]" type="text" value="{$row.color|htmlentities}" placeholder="例如:#00E070">
|
||||
<span class="input-group-addon" id="color-preview-addon" style="width:38px;padding:0;background:{$row.color|htmlentities};border-color:#ccc;"></span>
|
||||
</div>
|
||||
<div class="fc-color-presets">
|
||||
<span style="font-size:11px;color:#64748b;">推荐配色:</span>
|
||||
<div class="fc-color-dot" style="background:#00E070;" title="春绿(品牌主色)" data-color="#00E070"></div>
|
||||
<div class="fc-color-dot" style="background:#FF7A59;" title="活力橙" data-color="#FF7A59"></div>
|
||||
<div class="fc-color-dot" style="background:#F5A623;" title="阳光金" data-color="#F5A623"></div>
|
||||
<div class="fc-color-dot" style="background:#2ECC71;" title="翠青绿" data-color="#2ECC71"></div>
|
||||
<div class="fc-color-dot" style="background:#3498DB;" title="晴空蓝" data-color="#3498DB"></div>
|
||||
<div class="fc-color-dot" style="background:#9B59B6;" title="典雅紫" data-color="#9B59B6"></div>
|
||||
<div class="fc-color-dot" style="background:#E67E22;" title="收获橙" data-color="#E67E22"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 排序权重 -->
|
||||
<div class="form-group" style="margin-bottom:16px;">
|
||||
<label class="control-label col-xs-12 col-sm-3">{:__('Sort')}:</label>
|
||||
<div class="col-xs-12 col-sm-9">
|
||||
<input id="c-sort" data-rule="required" class="form-control" name="row[sort]" type="number" value="{$row.sort|htmlentities}">
|
||||
<span class="help-block text-muted" style="margin-top:4px;margin-bottom:0;font-size:11px;"><i class="fa fa-info-circle"></i> 数值越小越靠前,直接决定小程序金刚区的排列次序。</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 启用状态 -->
|
||||
<div class="form-group" style="margin-bottom:12px;">
|
||||
<label class="control-label col-xs-12 col-sm-3">{:__('Enabled')}:</label>
|
||||
<div class="col-xs-12 col-sm-9">
|
||||
<input id="c-enabled" name="row[enabled]" type="hidden" value="{$row.enabled}">
|
||||
<a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-enabled" data-yes="1" data-no="0">
|
||||
<i class="fa fa-toggle-on text-success {eq name="$row.enabled" value="0"}fa-flip-horizontal text-gray{/eq} fa-2x"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 帖子统计信息(只读展示) -->
|
||||
<div class="form-group" style="margin-bottom:0;">
|
||||
<label class="control-label col-xs-12 col-sm-3">{:__('Post_count')}:</label>
|
||||
<div class="col-xs-12 col-sm-9">
|
||||
<p class="form-control-static" style="padding-top:7px;color:#64748b;font-weight:600;">
|
||||
<span class="label label-success" style="background:#eaf8f1;color:#04874a;">{$row.post_count|htmlentities} 篇已审核帖子</span>
|
||||
</p>
|
||||
<input id="c-post_count" type="hidden" name="row[post_count]" value="{$row.post_count|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 右侧:小程序金刚区微缩呈现 -->
|
||||
<div class="col-xs-12 col-sm-4 hidden-xs">
|
||||
<div class="fc-preview-box">
|
||||
<div class="fc-preview-title">
|
||||
<i class="fa fa-mobile fa-lg"></i> 小程序金刚区·实时呈现
|
||||
</div>
|
||||
<div class="fc-preview-badge" id="preview-badge" style="background: rgba(0, 224, 112, 0.15); border: 1px solid rgba(0, 224, 112, 0.35);">
|
||||
<img id="preview-icon" src="/static/icons/{$row.icon_key|htmlentities}.png?v=2" onerror="this.src='/static/icons/cat-job.png'" alt="分类图标">
|
||||
</div>
|
||||
<div class="fc-preview-name" id="preview-name">{$row.name|htmlentities}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Icon_key')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-icon_key" data-rule="required" class="form-control" name="row[icon_key]" type="text" value="{$row.icon_key|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Color')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-color" data-rule="required" class="form-control" name="row[color]" type="text" value="{$row.color|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Sort')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-sort" data-rule="required" class="form-control" name="row[sort]" type="number" value="{$row.sort|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Enabled')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
<input id="c-enabled" name="row[enabled]" type="hidden" value="{$row.enabled}">
|
||||
<a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-enabled" data-yes="1" data-no="0" >
|
||||
<i class="fa fa-toggle-on text-success {eq name="$row.enabled" value="0"}fa-flip-horizontal text-gray{/eq} fa-2x"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Post_count')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-post_count" data-rule="required" class="form-control" name="row[post_count]" type="number" value="{$row.post_count|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
|
||||
<div class="form-group layer-footer" style="margin-top:16px;padding-top:14px;border-top:1px solid #f1f5f9;">
|
||||
<label class="control-label col-xs-12 col-sm-3"></label>
|
||||
<div class="col-xs-12 col-sm-9">
|
||||
<button type="submit" class="btn btn-success btn-embossed disabled" style="background:#00E070;border-color:#00c860;color:#04301e;font-weight:700;"><i class="fa fa-check"></i> 确认保存修改</button>
|
||||
<button type="reset" class="btn btn-default btn-embossed" style="margin-left:10px;">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- 纯插画选择面板(默认完全隐藏,只有主动点击按钮才唤起) -->
|
||||
<div class="fc-icon-modal-wrap" id="fc-icon-modal" style="display:none !important;">
|
||||
<div class="fc-modal-overlay"></div>
|
||||
<div class="fc-modal-card">
|
||||
<div class="fc-modal-header">
|
||||
<div class="fc-modal-title">
|
||||
<i class="fa fa-th-large text-success"></i> 选择分类插画
|
||||
</div>
|
||||
<button type="button" class="fc-modal-close" id="btn-close-icon-modal">×</button>
|
||||
</div>
|
||||
|
||||
<!-- 纯插画网格 -->
|
||||
<div class="fc-modal-grid-box">
|
||||
<div class="fc-modal-grid">
|
||||
<div class="fc-icon-chip" data-key="cat-job"><img src="/static/icons/cat-job.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-house"><img src="/static/icons/cat-house.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-goods"><img src="/static/icons/cat-goods.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-car"><img src="/static/icons/cat-car.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-service"><img src="/static/icons/cat-service.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-education"><img src="/static/icons/cat-education.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-clean"><img src="/static/icons/cat-clean.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-friend"><img src="/static/icons/cat-friend.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-pet"><img src="/static/icons/cat-pet.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-food"><img src="/static/icons/cat-food.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-digital"><img src="/static/icons/cat-digital.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-sport"><img src="/static/icons/cat-sport.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-baby"><img src="/static/icons/cat-baby.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-health"><img src="/static/icons/cat-health.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-entertainment"><img src="/static/icons/cat-entertainment.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-community"><img src="/static/icons/cat-community.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-move"><img src="/static/icons/cat-move.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-repair"><img src="/static/icons/cat-repair.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-furniture"><img src="/static/icons/cat-furniture.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-business"><img src="/static/icons/cat-business.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-law"><img src="/static/icons/cat-law.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-consult"><img src="/static/icons/cat-consult.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-vip"><img src="/static/icons/cat-vip.png?v=2" alt="icon"></div>
|
||||
<div class="fc-icon-chip" data-key="cat-photo"><img src="/static/icons/cat-photo.png?v=2" alt="icon"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,19 +2,21 @@
|
||||
{:build_heading()}
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="alert alert-success-light" style="margin-bottom:15px;border-radius:8px;border-left:4px solid #00E070;background:#f2fef7;color:#04301e;">
|
||||
<i class="fa fa-info-circle fa-lg"></i>
|
||||
<strong>分类展示与运营规则说明:</strong>
|
||||
此处的分类直接联动微信小程序首页<strong>「金刚区导航」</strong>与<strong>「全部分类频道」</strong>。
|
||||
列表已默认按<strong>「排序权重」从小到大</strong>升序排列(所见即所得)。点击状态开关可<strong>一键上架/下架</strong>,点击【添加】或【编辑】可在右侧<strong>实时预览小程序端呈现效果</strong>。
|
||||
</div>
|
||||
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="one">
|
||||
<div class="widget-body no-padding">
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" >刷新</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('fc/category/add')?'':'hide'}" title="{:__('Add')}" >添加</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/category/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/category/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}">刷新</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('fc/category/add')?'':'hide'}" title="{:__('Add')}">添加</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/category/edit')?'':'hide'}" title="{:__('Edit')}">{:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/category/del')?'':'hide'}" title="{:__('Delete')}">{:__('Delete')}</a>
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('fc/category/edit')}"
|
||||
@@ -23,7 +25,6 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" >刷新</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('fc/commission/add')?'':'hide'}" title="{:__('Add')}" >添加</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/commission/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/commission/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/commission/edit')?'':'hide'}" title="{:__('Edit')}" >{:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/commission/del')?'':'hide'}" title="{:__('Delete')}" >{:__('Delete')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" >刷新</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('fc/coupon/add')?'':'hide'}" title="{:__('Add')}" >添加</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/coupon/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/coupon/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/coupon/edit')?'':'hide'}" title="{:__('Edit')}" >{:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/coupon/del')?'':'hide'}" title="{:__('Delete')}" >{:__('Delete')}</a>
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('fc/coupon/edit')}"
|
||||
|
||||
@@ -7,17 +7,17 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="fc-dash__actions">
|
||||
<a href="fc/post" title="{:__('内容管理')}" class="fc-btn addtabsit {:$auth->check('fc/post')?'':'hide'}">
|
||||
<i class="fa fa-file-text-o" aria-hidden="true"></i>{:__('内容管理')}
|
||||
<a href="fc/post" title="内容管理" class="fc-btn addtabsit {:$auth->check('fc/post')?'':'hide'}">
|
||||
内容
|
||||
</a>
|
||||
<a href="fc/withdraw" title="{:__('提现审核')}" class="fc-btn addtabsit {:$auth->check('fc/withdraw')?'':'hide'}">
|
||||
<i class="fa fa-credit-card" aria-hidden="true"></i>{:__('提现审核')}
|
||||
<a href="fc/withdraw" title="提现审核" class="fc-btn addtabsit {:$auth->check('fc/withdraw')?'':'hide'}">
|
||||
提现
|
||||
{if $metrics.withdrawAuditing > 0}
|
||||
<span class="fc-btn__badge">{$metrics.withdrawAuditing}</span>
|
||||
{/if}
|
||||
</a>
|
||||
<button type="button" class="fc-btn fc-btn--primary fc-dash__refresh">
|
||||
<i class="fa fa-refresh" aria-hidden="true"></i>{:__('刷新数据')}
|
||||
<button type="button" class="fc-btn fc-btn--primary fc-dash__refresh" title="刷新数据">
|
||||
刷新
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" >刷新</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('fc/draft/add')?'':'hide'}" title="{:__('Add')}" >添加</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/draft/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/draft/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/draft/edit')?'':'hide'}" title="{:__('Edit')}" >{:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/draft/del')?'':'hide'}" title="{:__('Delete')}" >{:__('Delete')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
<option value="month" selected>按月</option>
|
||||
<option value="year">按年</option>
|
||||
</select>
|
||||
<a href="javascript:;" class="btn btn-info btn-export-flow">导出流水</a>
|
||||
<a href="javascript:;" class="btn btn-info btn-export-report">导出营收</a>
|
||||
<a href="javascript:;" class="btn btn-info btn-export-flow" title="导出流水">流水</a>
|
||||
<a href="javascript:;" class="btn btn-info btn-export-report" title="导出营收">营收</a>
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="false"
|
||||
|
||||
@@ -170,8 +170,8 @@
|
||||
<div class="form-group layer-footer fc-modal-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-10">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled"><i class="fa fa-check"></i> 保存商家</button>
|
||||
<button type="reset" class="btn btn-default btn-embossed"><i class="fa fa-undo"></i> 重置</button>
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">保存</button>
|
||||
<button type="reset" class="btn btn-default btn-embossed">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
<div style="color: #92400E; font-size: 13px; font-weight: 600;">
|
||||
<span class="label label-warning" style="font-size: 11px; margin-right: 6px;">待审核</span> 该商户正在等待资质核验
|
||||
</div>
|
||||
<a href="javascript:;" id="btn-banner-to-audit" style="color: #D97706; font-size: 12px; font-weight: 600; text-decoration: underline;">立即前往审核</a>
|
||||
<a href="javascript:;" id="btn-banner-to-audit" title="立即前往审核" style="color: #D97706; font-size: 12px; font-weight: 600; text-decoration: underline;">审核</a>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
<!-- 底部操作栏:仅关闭与重审引导 -->
|
||||
<div class="fc-detail-footer" style="position: fixed; bottom: 0; left: 0; right: 0; background: #FFFFFF; border-top: 1px solid #E2E8F0; padding: 12px 20px; z-index: 99; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 -2px 10px rgba(0,0,0,0.05);">
|
||||
<div>
|
||||
<button type="button" class="btn btn-default btn-xs" id="btn-to-audit" style="color: #64748B;">重新审核资质</button>
|
||||
<button type="button" class="btn btn-default btn-xs" id="btn-to-audit" style="color: #64748B;" title="重新审核资质">重审</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" class="btn btn-default btn-embossed" id="btn-close" style="padding: 6px 22px;">关闭</button>
|
||||
|
||||
@@ -177,8 +177,8 @@
|
||||
<div class="form-group layer-footer fc-modal-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-10">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled"><i class="fa fa-check"></i> 保存</button>
|
||||
<button type="reset" class="btn btn-default btn-embossed"><i class="fa fa-undo"></i> 重置</button>
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">保存</button>
|
||||
<button type="reset" class="btn btn-default btn-embossed">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" >刷新</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('fc/message/add')?'':'hide'}" title="{:__('Add')}" >添加</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/message/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/message/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/message/edit')?'':'hide'}" title="{:__('Edit')}" >{:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/message/del')?'':'hide'}" title="{:__('Delete')}" >{:__('Delete')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -30,10 +30,16 @@
|
||||
<input id="c-days" data-rule="required" class="form-control" name="row[days]" type="number" value="30">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Post_quota')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-post_quota" data-rule="required;integer" class="form-control" name="row[post_quota]" type="number" value="0" placeholder="套餐附赠的发布条数(0表示不赠送)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Tag')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-tag" data-rule="required" class="form-control" data-role="tagsinput" name="row[tag]" type="text" value="">
|
||||
<input id="c-tag" class="form-control" name="row[tag]" type="text" value="" placeholder="如:推荐、热门">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -30,10 +30,16 @@
|
||||
<input id="c-days" data-rule="required" class="form-control" name="row[days]" type="number" value="{$row.days|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Post_quota')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-post_quota" data-rule="required;integer" class="form-control" name="row[post_quota]" type="number" value="{$row.post_quota|default='0'|htmlentities}" placeholder="套餐附赠的发布条数(0表示不赠送)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Tag')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-tag" data-rule="required" class="form-control" data-role="tagsinput" name="row[tag]" type="text" value="{$row.tag|htmlentities}">
|
||||
<input id="c-tag" class="form-control" name="row[tag]" type="text" value="{$row.tag|htmlentities}" placeholder="如:推荐、热门">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" >刷新</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('fc/plan/add')?'':'hide'}" title="{:__('Add')}" >添加</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/plan/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/plan/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/plan/edit')?'':'hide'}" title="{:__('Edit')}" >{:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/plan/del')?'':'hide'}" title="{:__('Delete')}" >{:__('Delete')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -229,8 +229,8 @@
|
||||
<div class="form-group layer-footer fc-modal-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-10">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled"><i class="fa fa-check"></i> 保存</button>
|
||||
<button type="reset" class="btn btn-default btn-embossed"><i class="fa fa-undo"></i> 重置</button>
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">保存</button>
|
||||
<button type="reset" class="btn btn-default btn-embossed">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -38,7 +38,14 @@
|
||||
<div class="panel panel-default" style="border: 1px solid #E2E8F0; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); margin-bottom: 15px;">
|
||||
<div class="panel-body" style="padding: 20px;">
|
||||
<div style="display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px;">
|
||||
<span class="label label-default" style="font-size: 12px; padding: 4px 8px;">{$row.category_name|default='未分类'}</span>
|
||||
<div>
|
||||
<span class="label label-default" style="font-size: 12px; padding: 4px 8px;">{$row.category_name|default='未分类'}</span>
|
||||
{if isset($row.identity_type) && $row.identity_type == 2}
|
||||
<span class="label label-warning" style="font-size: 11px; padding: 3px 6px; margin-left: 6px;">商家发布</span>
|
||||
{else /}
|
||||
<span class="label label-info" style="font-size: 11px; padding: 3px 6px; margin-left: 6px;">个人发布</span>
|
||||
{/if}
|
||||
</div>
|
||||
<div style="font-size: 20px; font-weight: 700; color: #EA580C;">
|
||||
{if $row.price > 0}
|
||||
¥ {$row.price} {if $row.price_unit}<small style="color: #64748B; font-size: 13px;">{$row.price_unit}</small>{/if}
|
||||
@@ -104,79 +111,27 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 审核专属底部操作栏:清爽三键 -->
|
||||
<div class="fc-detail-footer" style="position: fixed; bottom: 0; left: 0; right: 0; background: #FFFFFF; border-top: 1px solid #E2E8F0; padding: 12px 24px; z-index: 99; display: flex; align-items: center; justify-content: flex-end; gap: 12px; box-shadow: 0 -2px 10px rgba(0,0,0,0.05);">
|
||||
<button type="button" class="btn btn-danger btn-embossed" id="btn-reject" style="padding: 6px 22px; font-weight: 600;">驳回</button>
|
||||
<button type="button" class="btn btn-success btn-embossed" id="btn-pass" style="padding: 6px 22px; font-weight: 600;">通过</button>
|
||||
<button type="button" class="btn btn-default btn-embossed" id="btn-close" style="padding: 6px 18px;">关闭</button>
|
||||
<!-- 审核专属底部操作栏:队列导航 + 三键 -->
|
||||
<div class="fc-detail-footer" style="position: fixed; bottom: 0; left: 0; right: 0; background: #FFFFFF; border-top: 1px solid #E2E8F0; padding: 12px 24px; z-index: 99; display: flex; align-items: center; justify-content: space-between; gap: 12px; box-shadow: 0 -2px 10px rgba(0,0,0,0.05);">
|
||||
<div class="fc-audit-nav">
|
||||
<button type="button" class="btn btn-default btn-sm" id="btn-prev" {if !$queue.prev}disabled{/if}>‹ 上一条</button>
|
||||
{if $queue.index > 0}
|
||||
<span class="fc-audit-nav__pos">第 <strong>{$queue.index}</strong> / {$queue.total} 条</span>
|
||||
{else /}
|
||||
<span class="fc-audit-nav__pos text-muted">不在待审核队列</span>
|
||||
{/if}
|
||||
<button type="button" class="btn btn-default btn-sm" id="btn-next" {if !$queue.next}disabled{/if}>下一条 ›</button>
|
||||
</div>
|
||||
<div class="fc-audit-actions">
|
||||
<span class="fc-audit-kbd">快捷键:A 通过 · R 驳回 · ← → 切换</span>
|
||||
<button type="button" class="btn btn-danger btn-embossed" id="btn-reject" style="padding: 6px 22px; font-weight: 600;">驳回</button>
|
||||
<button type="button" class="btn btn-success btn-embossed" id="btn-pass" style="padding: 6px 22px; font-weight: 600;">通过</button>
|
||||
<button type="button" class="btn btn-default btn-embossed" id="btn-close" style="padding: 6px 18px;">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 审核专属交互逻辑
|
||||
*/
|
||||
$(function () {
|
||||
var postId = {$row.id};
|
||||
var lastRejectReason = {$row.audit_reason ? json_encode($row.audit_reason) : '""'};
|
||||
|
||||
function submitAudit(status, reason) {
|
||||
Fast.api.ajax({
|
||||
url: 'fc/post/audit',
|
||||
type: 'POST',
|
||||
data: {
|
||||
ids: postId,
|
||||
auditStatus: status,
|
||||
reason: reason || ''
|
||||
}
|
||||
}, function (data, ret) {
|
||||
Toastr.success(ret.msg || '操作成功');
|
||||
setTimeout(function () {
|
||||
var index = parent.Layer.getFrameIndex(window.name);
|
||||
parent.Layer.close(index);
|
||||
if (parent.$ && parent.$('#table').length) {
|
||||
parent.$('#table').bootstrapTable('refresh');
|
||||
}
|
||||
}, 400);
|
||||
return false;
|
||||
}, function (data, ret) {
|
||||
Toastr.error(ret.msg || '操作失败');
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
// 点击审核通过:弹出简短确认
|
||||
$('#btn-pass').on('click', function () {
|
||||
Layer.confirm('确认审核通过此信息吗?', {
|
||||
title: '通过确认',
|
||||
btn: ['通过', '取消']
|
||||
}, function (index) {
|
||||
Layer.close(index);
|
||||
submitAudit(1, '');
|
||||
});
|
||||
});
|
||||
|
||||
// 点击驳回:弹窗确认输入驳回原因
|
||||
$('#btn-reject').off('click').on('click', function () {
|
||||
Layer.prompt({
|
||||
title: '请输入驳回原因(将通知给发布用户)',
|
||||
formType: 2,
|
||||
value: (lastRejectReason || '')
|
||||
}, function (value, promptIndex) {
|
||||
var reason = $.trim(value);
|
||||
if (!reason) {
|
||||
Toastr.warning('驳回原因不可为空');
|
||||
return;
|
||||
}
|
||||
Layer.close(promptIndex);
|
||||
submitAudit(2, reason);
|
||||
});
|
||||
});
|
||||
|
||||
// 点击关闭弹窗
|
||||
$('#btn-close').on('click', function () {
|
||||
var index = parent.Layer.getFrameIndex(window.name);
|
||||
parent.Layer.close(index);
|
||||
});
|
||||
});
|
||||
// 队列信息供 post.js 的审核工作台使用
|
||||
window.postQueue = {:json_encode($queue)};
|
||||
</script>
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
<div style="color: #92400E; font-size: 13px; font-weight: 600;">
|
||||
<span class="label label-warning" style="font-size: 11px; margin-right: 6px;">待审核</span> 该信息正在等待人工审核处理
|
||||
</div>
|
||||
<a href="javascript:;" id="btn-banner-to-audit" style="color: #D97706; font-size: 12px; font-weight: 600; text-decoration: underline;">立即前往审核</a>
|
||||
<a href="javascript:;" id="btn-banner-to-audit" title="立即前往审核" style="color: #D97706; font-size: 12px; font-weight: 600; text-decoration: underline;">审核</a>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -106,7 +106,14 @@
|
||||
<div class="panel panel-default" style="border: 1px solid #E2E8F0; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); margin-bottom: 15px;">
|
||||
<div class="panel-body" style="padding: 20px;">
|
||||
<div style="display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px;">
|
||||
<span class="label label-default" style="font-size: 12px; padding: 4px 8px;">{$row.category_name|default='未分类'}</span>
|
||||
<div>
|
||||
<span class="label label-default" style="font-size: 12px; padding: 4px 8px;">{$row.category_name|default='未分类'}</span>
|
||||
{if isset($row.identity_type) && $row.identity_type == 2}
|
||||
<span class="label label-warning" style="font-size: 11px; padding: 3px 6px; margin-left: 6px;">商家发布</span>
|
||||
{else /}
|
||||
<span class="label label-info" style="font-size: 11px; padding: 3px 6px; margin-left: 6px;">个人发布</span>
|
||||
{/if}
|
||||
</div>
|
||||
<div style="font-size: 20px; font-weight: 700; color: #EA580C;">
|
||||
{if $row.price > 0}
|
||||
¥ {$row.price} {if $row.price_unit}<small style="color: #64748B; font-size: 13px;">{$row.price_unit}</small>{/if}
|
||||
@@ -175,7 +182,7 @@
|
||||
<!-- 详情专属底部栏:清爽关闭 + 重审引导 -->
|
||||
<div class="fc-detail-footer" style="position: fixed; bottom: 0; left: 0; right: 0; background: #FFFFFF; border-top: 1px solid #E2E8F0; padding: 12px 20px; z-index: 99; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 -2px 10px rgba(0,0,0,0.05);">
|
||||
<div>
|
||||
<button type="button" class="btn btn-default btn-xs" id="btn-to-audit" style="color: #64748B;">重审此条信息</button>
|
||||
<button type="button" class="btn btn-default btn-xs" id="btn-to-audit" style="color: #64748B;" title="重审此条信息">重审</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" class="btn btn-default btn-embossed" id="btn-close" style="padding: 6px 22px;">关闭</button>
|
||||
|
||||
@@ -236,8 +236,8 @@
|
||||
<div class="form-group layer-footer fc-modal-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-10">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled"><i class="fa fa-check"></i> 保存</button>
|
||||
<button type="reset" class="btn btn-default btn-embossed"><i class="fa fa-undo"></i> 重置</button>
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">保存</button>
|
||||
<button type="reset" class="btn btn-default btn-embossed">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -7,27 +7,18 @@
|
||||
<div class="widget-body no-padding">
|
||||
<!-- 工具栏 -->
|
||||
<div id="toolbar" class="toolbar">
|
||||
<!-- 常态操作区(统一无图标,二字动词) -->
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}">刷新</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('fc/post/add')?'':'hide'}" title="{:__('Add')}">添加</a>
|
||||
<a class="btn btn-default btn-recyclebin btn-dialog {:$auth->check('fc/post/recyclebin')?'':'hide'}" href="fc/post/recyclebin" title="{:__('Recycle bin')}">回收</a>
|
||||
|
||||
<!-- 动态批量操作栏(统一无图标,二字动词) -->
|
||||
<div id="batch-bar" class="fc-batch-bar hide" style="display:inline-block;vertical-align:middle;margin-left:12px;">
|
||||
<span class="fc-batch-bar__tag">已选 <strong id="selected-count" class="text-primary">0</strong> 项</span>
|
||||
<button type="button" class="btn btn-sm btn-success btn-audit-pass" title="通过">通过</button>
|
||||
<button type="button" class="btn btn-sm btn-danger btn-audit-reject" title="驳回">驳回</button>
|
||||
<button type="button" class="btn btn-sm btn-warning btn-offline" title="下架">下架</button>
|
||||
<button type="button" class="btn btn-sm btn-info btn-top" title="置顶">置顶</button>
|
||||
<button type="button" class="btn btn-sm btn-danger btn-del" title="删除">删除</button>
|
||||
<button type="button" class="btn btn-sm btn-link text-muted btn-clear-selection" title="取消">取消</button>
|
||||
</div>
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}">{:__('Refresh')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('fc/post/add')?'':'hide'}" title="{:__('Add')}">{:__('Add')}</a>
|
||||
<a class="btn btn-default btn-recyclebin btn-dialog {:$auth->check('fc/post/recyclebin')?'':'hide'}" href="fc/post/recyclebin" title="{:__('Recycle bin')}">回收站</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/post/del')?'':'hide'}" title="{:__('Delete')}">删除所选</a>
|
||||
</div>
|
||||
|
||||
<!-- 数据表格 -->
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('fc/post/edit')}"
|
||||
data-operate-del="{:$auth->check('fc/post/del')}"
|
||||
data-operate-top="{:$auth->check('fc/post/top')}"
|
||||
data-operate-status="{:$auth->check('fc/post/offline')}"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
<div class="widget-body no-padding">
|
||||
<div id="toolbar" class="toolbar">
|
||||
{:build_toolbar('refresh')}
|
||||
<a class="btn btn-info btn-multi btn-disabled disabled {:$auth->check('fc/post/restore')?'':'hide'}" href="javascript:;" data-url="fc/post/restore" data-action="restore"><i class="fa fa-rotate-left"></i> {:__('Restore')}</a>
|
||||
<a class="btn btn-danger btn-multi btn-disabled disabled {:$auth->check('fc/post/destroy')?'':'hide'}" href="javascript:;" data-url="fc/post/destroy" data-action="destroy"><i class="fa fa-times"></i> {:__('Destroy')}</a>
|
||||
<a class="btn btn-success btn-restoreall {:$auth->check('fc/post/restore')?'':'hide'}" href="javascript:;" data-url="fc/post/restore" title="{:__('Restore all')}"><i class="fa fa-rotate-left"></i> {:__('Restore all')}</a>
|
||||
<a class="btn btn-danger btn-destroyall {:$auth->check('fc/post/destroy')?'':'hide'}" href="javascript:;" data-url="fc/post/destroy" title="{:__('Destroy all')}"><i class="fa fa-times"></i> {:__('Destroy all')}</a>
|
||||
<a class="btn btn-info btn-multi btn-disabled disabled {:$auth->check('fc/post/restore')?'':'hide'}" href="javascript:;" data-url="fc/post/restore" data-action="restore" title="还原">还原</a>
|
||||
<a class="btn btn-danger btn-multi btn-disabled disabled {:$auth->check('fc/post/destroy')?'':'hide'}" href="javascript:;" data-url="fc/post/destroy" data-action="destroy" title="销毁">销毁</a>
|
||||
<a class="btn btn-success btn-restoreall {:$auth->check('fc/post/restore')?'':'hide'}" href="javascript:;" data-url="fc/post/restore" title="还原全部">全还</a>
|
||||
<a class="btn btn-danger btn-destroyall {:$auth->check('fc/post/destroy')?'':'hide'}" href="javascript:;" data-url="fc/post/destroy" title="销毁全部">全毁</a>
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover"
|
||||
data-operate-restore="{:$auth->check('fc/post/restore')}"
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<div class="panel panel-default panel-intro">
|
||||
{:build_heading()}
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="one">
|
||||
<div class="widget-body no-padding">
|
||||
<!-- 工具栏 -->
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}">{:__('Refresh')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-batch-pass btn-disabled disabled {:$auth->check('fc/postaudit/audit')?'':'hide'}" title="批量通过">批量通过</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-batch-reject btn-disabled disabled {:$auth->check('fc/postaudit/audit')?'':'hide'}" title="批量驳回">批量驳回</a>
|
||||
</div>
|
||||
|
||||
<!-- 审核数据表格 -->
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-audit="{:$auth->check('fc/postaudit/audit')}"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-8">
|
||||
<button type="submit" class="btn btn-success btn-embossed">{:__('保存设置')}</button>
|
||||
<button type="submit" class="btn btn-success btn-embossed">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" >刷新</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('fc/userext/add')?'':'hide'}" title="{:__('Add')}" >添加</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/userext/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/userext/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/userext/edit')?'':'hide'}" title="{:__('Edit')}" >{:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/userext/del')?'':'hide'}" title="{:__('Delete')}" >{:__('Delete')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -93,8 +93,8 @@
|
||||
<div class="form-group layer-footer fc-modal-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-10">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled"><i class="fa fa-check"></i> 保存</button>
|
||||
<button type="reset" class="btn btn-default btn-embossed"><i class="fa fa-undo"></i> 重置</button>
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">保存</button>
|
||||
<button type="reset" class="btn btn-default btn-embossed">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<div class="widget-body no-padding">
|
||||
<div id="toolbar" class="toolbar">
|
||||
{:build_toolbar('refresh,add,edit,del')}
|
||||
<a class="btn btn-info btn-classify dropdown-toggle btn-disabled disabled {:$auth->check('general/attachment/edit')?'':'hide'}"><i class="fa fa-arrow-right"></i> {:__('Classify')}</a>
|
||||
<a class="btn btn-info btn-classify dropdown-toggle btn-disabled disabled {:$auth->check('general/attachment/edit')?'':'hide'}">{:__('Classify')}</a>
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('general/attachment/edit')}"
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
<div id="toolbar" class="toolbar">
|
||||
{:build_toolbar('refresh,add,edit,del')}
|
||||
<div class="dropdown btn-group {:$auth->check('user/group/multi')?'':'hide'}">
|
||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
|
||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown">更多</a>
|
||||
<ul class="dropdown-menu text-left" role="menu">
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal">正常</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden">隐藏</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
<div id="toolbar" class="toolbar">
|
||||
{:build_toolbar('refresh,add,edit,del')}
|
||||
<div class="dropdown btn-group {:$auth->check('user/rule/multi')?'':'hide'}">
|
||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
|
||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown">更多</a>
|
||||
<ul class="dropdown-menu text-left" role="menu">
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal">正常</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden">隐藏</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<a href="javascript:;" class="btn btn-danger btn-toggle-all"><i class="fa fa-plus"></i> {:__('Toggle all')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-toggle-all" title="展开或收起全部层级">展开</a>
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('user/rule/edit')}"
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
<div id="toolbar" class="toolbar">
|
||||
{:build_toolbar('refresh,edit,del')}
|
||||
<div class="dropdown btn-group {:$auth->check('user/user/multi')?'':'hide'}">
|
||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
|
||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown">更多</a>
|
||||
<ul class="dropdown-menu text-left" role="menu">
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal">正常</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden">隐藏</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
<div id="toolbar" class="toolbar">
|
||||
{:build_toolbar('refresh,add,edit,del')}
|
||||
<div class="dropdown btn-group {:$auth->check('wechat/autoreply/multi')?'':'hide'}">
|
||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> <?= __('More') ?></a>
|
||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown">更多</a>
|
||||
<ul class="dropdown-menu text-left" role="menu">
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal">正常</a></li>
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden">隐藏</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -76,8 +76,8 @@
|
||||
<i class="fa fa-lightbulb-o"></i> <small>可直接拖动菜单排序</small>
|
||||
</div>
|
||||
<div style="padding-left:337px;">
|
||||
<a href="javascript:;" id="menuRemote" class="btn btn-success"><i class="fa fa-cloud-download"></i> 加载服务端菜单</a>
|
||||
<a href="javascript:;" id="menuSyn" class="btn btn-danger"><i class="fa fa-check"></i> 保存并发布</a>
|
||||
<a href="javascript:;" id="menuRemote" class="btn btn-success" title="加载服务端菜单">加载</a>
|
||||
<a href="javascript:;" id="menuSyn" class="btn btn-danger" title="保存并发布">发布</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -405,6 +405,10 @@ class Home extends V1
|
||||
if (preg_match('/^https?:\/\/|^\/uploads\/|^\/static\//i', $iconKey)) {
|
||||
return $iconKey;
|
||||
}
|
||||
$iconFileName = (strpos($iconKey, '.') !== false) ? $iconKey : $iconKey . '.png';
|
||||
if (file_exists(ROOT_PATH . 'public/static/icons/' . $iconFileName)) {
|
||||
return '/static/icons/' . $iconFileName;
|
||||
}
|
||||
$keyMap = [
|
||||
'cat-job' => 'cat-job.png',
|
||||
'cat-house' => 'cat-house.png',
|
||||
|
||||
@@ -45,9 +45,10 @@ class Member extends V1
|
||||
}
|
||||
|
||||
/**
|
||||
* M2 会员权益
|
||||
* M2 获取会员权益配置
|
||||
* GET /api/v1/member/benefits → {freeView,postDiscount,distRate,benefits[]}
|
||||
* 规则:读配置 member.benefit,未配置返回默认
|
||||
* 规则:读取系统真实配置 member.benefit,未配置时回落默认真实有效权益
|
||||
* @return void
|
||||
*/
|
||||
public function benefits()
|
||||
{
|
||||
@@ -55,7 +56,7 @@ class Member extends V1
|
||||
'freeView' => 20,
|
||||
'postDiscount' => '8 折',
|
||||
'distRate' => '一级 20% / 二级 10%',
|
||||
'benefits' => ['每日免费查看 20 条联系方式', '发布信息 8 折', '专属会员标识', '分销佣金加速结算'],
|
||||
'benefits' => ['每日免费查看 20 条联系方式', '发布信息 8 折', '专属会员标识', '赠送大量发布额度'],
|
||||
];
|
||||
|
||||
$cfg = $this->cfg('member.benefit', null);
|
||||
@@ -305,6 +306,10 @@ class Member extends V1
|
||||
|
||||
$list = [];
|
||||
foreach ($rows as $row) {
|
||||
// 惰性超时处理:若 pending 且已超时则自动关闭
|
||||
if ((string)$row['status'] === 'pending') {
|
||||
$row = \app\common\library\OrderClose::checkAndCloseIfExpired($row);
|
||||
}
|
||||
$list[] = [
|
||||
'id' => (int)$row['id'],
|
||||
'orderNo' => (string)$row['order_no'],
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\library\CouponService;
|
||||
use app\common\library\OrderClose;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
@@ -107,4 +109,212 @@ class Order extends V1
|
||||
|
||||
return ['balance' => $balance, 'amount' => $amount];
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /api/v1/order/cancel
|
||||
* 主动取消未支付订单
|
||||
* 入参:{orderNo} 或 {id}
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function cancel()
|
||||
{
|
||||
$user = $this->auth();
|
||||
$orderNo = trim((string)$this->input('orderNo', ''));
|
||||
$orderId = (int)$this->input('id', 0);
|
||||
|
||||
if ($orderNo === '' && $orderId <= 0) {
|
||||
$this->fail('请提供订单编号或订单ID');
|
||||
}
|
||||
|
||||
$query = Db::name('fc_order')->where('user_id', $user['id']);
|
||||
if ($orderNo !== '') {
|
||||
$query->where('order_no', $orderNo);
|
||||
} else {
|
||||
$query->where('id', $orderId);
|
||||
}
|
||||
$order = $query->find();
|
||||
|
||||
if (!$order) {
|
||||
$this->fail('订单不存在', 404);
|
||||
}
|
||||
|
||||
if ((string)$order['status'] === 'paid') {
|
||||
$this->fail('已支付订单无法取消,如需退款请联系客服');
|
||||
}
|
||||
if ((string)$order['status'] === 'closed') {
|
||||
$this->fail('订单已是关闭状态,无需重复取消');
|
||||
}
|
||||
if ((string)$order['status'] !== 'pending') {
|
||||
$this->fail('当前订单状态不支持取消');
|
||||
}
|
||||
|
||||
$closed = OrderClose::close($order, 'user_cancel');
|
||||
if (!$closed) {
|
||||
$this->fail('取消订单失败,请稍后重试');
|
||||
}
|
||||
|
||||
$this->ok([
|
||||
'orderNo' => (string)$order['order_no'],
|
||||
'status' => 'closed',
|
||||
], '订单已成功取消');
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/v1/order/detail
|
||||
* 获取订单详情
|
||||
* 入参:orderNo 或 id
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$user = $this->auth();
|
||||
$orderNo = trim((string)$this->input('orderNo', ''));
|
||||
$orderId = (int)$this->input('id', 0);
|
||||
|
||||
if ($orderNo === '' && $orderId <= 0) {
|
||||
$this->fail('请提供订单编号或订单ID');
|
||||
}
|
||||
|
||||
$query = Db::name('fc_order')->where('user_id', $user['id']);
|
||||
if ($orderNo !== '') {
|
||||
$query->where('order_no', $orderNo);
|
||||
} else {
|
||||
$query->where('id', $orderId);
|
||||
}
|
||||
$order = $query->find();
|
||||
|
||||
if (!$order) {
|
||||
$this->fail('订单不存在', 404);
|
||||
}
|
||||
|
||||
// 惰性超时检查:如果是待支付且已超时,自动关闭
|
||||
$order = OrderClose::checkAndCloseIfExpired($order);
|
||||
|
||||
$now = time();
|
||||
$timeoutSeconds = OrderClose::getTimeoutSeconds();
|
||||
$createtime = isset($order['createtime']) ? (int)$order['createtime'] : 0;
|
||||
$expireSeconds = 0;
|
||||
if ((string)$order['status'] === 'pending' && $createtime > 0) {
|
||||
$expireSeconds = max(0, ($createtime + $timeoutSeconds) - $now);
|
||||
}
|
||||
|
||||
// 状态与类型文本映射
|
||||
$statusMap = [
|
||||
'pending' => '待支付',
|
||||
'paid' => '已支付',
|
||||
'refunding' => '退款中',
|
||||
'refunded' => '已退款',
|
||||
'closed' => '已关闭',
|
||||
];
|
||||
$typeMap = [
|
||||
'post' => '信息发布',
|
||||
'member' => '开通会员',
|
||||
'recharge' => '余额充值',
|
||||
'payview' => '付费查看',
|
||||
];
|
||||
|
||||
$type = (string)$order['type'];
|
||||
$relatedId = (int)$order['related_id'];
|
||||
$relatedInfo = null;
|
||||
|
||||
// 根据业务类型获取详细关联信息
|
||||
if ($type === 'post' && $relatedId > 0) {
|
||||
$post = Db::name('fc_post')->where('id', $relatedId)->find();
|
||||
if ($post) {
|
||||
$categoryName = Db::name('fc_category')->where('id', (int)$post['category_id'])->value('name') ?: '';
|
||||
$relatedInfo = [
|
||||
'postId' => (int)$post['id'],
|
||||
'title' => (string)$post['title'],
|
||||
'categoryName' => $categoryName,
|
||||
'cover' => (string)$post['cover'],
|
||||
'price' => (float)$post['price'],
|
||||
'priceUnit' => (string)$post['price_unit'],
|
||||
'auditStatus' => (int)$post['audit_status'],
|
||||
'status' => (int)$post['status'],
|
||||
];
|
||||
}
|
||||
} elseif ($type === 'member' && $relatedId > 0) {
|
||||
$plan = Db::name('fc_plan')->where('id', $relatedId)->find();
|
||||
if ($plan) {
|
||||
$postQuota = (int)$plan['post_quota'];
|
||||
$rights = ['专属会员身份标示'];
|
||||
if ($postQuota > 0) {
|
||||
$rights[] = "赠送免费发布 {$postQuota} 条";
|
||||
}
|
||||
$rights[] = '同城专属推广推荐';
|
||||
$rights[] = '信息置顶尊享特惠';
|
||||
$relatedInfo = [
|
||||
'planId' => (int)$plan['id'],
|
||||
'name' => (string)$plan['name'],
|
||||
'days' => (int)$plan['days'],
|
||||
'originPrice' => (float)$plan['origin_price'],
|
||||
'price' => (float)$plan['price'],
|
||||
'postQuota' => $postQuota,
|
||||
'rights' => $rights,
|
||||
];
|
||||
}
|
||||
} elseif ($type === 'payview' && $relatedId > 0) {
|
||||
$post = Db::name('fc_post')->where('id', $relatedId)->find();
|
||||
if ($post) {
|
||||
$categoryName = Db::name('fc_category')->where('id', (int)$post['category_id'])->value('name') ?: '';
|
||||
$relatedInfo = [
|
||||
'postId' => (int)$post['id'],
|
||||
'title' => (string)$post['title'],
|
||||
'categoryName' => $categoryName,
|
||||
'contact' => (string)$post['contact'],
|
||||
'phone' => (string)$post['phone'],
|
||||
];
|
||||
}
|
||||
} elseif ($type === 'recharge') {
|
||||
$relatedInfo = [
|
||||
'target' => '同城便民服务钱包',
|
||||
'usage' => '可用于全平台信息发布、置顶推广及各类便民生活增值服务',
|
||||
];
|
||||
}
|
||||
|
||||
// 优惠券信息
|
||||
$couponName = '';
|
||||
if (!empty($order['coupon_id'])) {
|
||||
$couponName = (string)Db::name('fc_user_coupon')->alias('uc')
|
||||
->join('fc_coupon c', 'c.id = uc.coupon_id', 'LEFT')
|
||||
->where('uc.id', (int)$order['coupon_id'])
|
||||
->value('c.name');
|
||||
}
|
||||
|
||||
// 用户与安全信息
|
||||
$userMobile = isset($user['mobile']) ? (string)$user['mobile'] : '';
|
||||
if ($userMobile !== '' && strlen($userMobile) >= 11) {
|
||||
$userMobile = substr($userMobile, 0, 3) . '****' . substr($userMobile, 7);
|
||||
}
|
||||
|
||||
$detail = [
|
||||
'id' => (int)$order['id'],
|
||||
'orderNo' => (string)$order['order_no'],
|
||||
'type' => $type,
|
||||
'typeText' => isset($typeMap[$type]) ? $typeMap[$type] : '其它订单',
|
||||
'title' => (string)$order['title'],
|
||||
'amount' => (float)$order['amount'],
|
||||
'originAmount' => (!empty($order['origin_amount']) && (float)$order['origin_amount'] > 0) ? (float)$order['origin_amount'] : (float)$order['amount'],
|
||||
'couponAmount' => isset($order['coupon_amount']) ? (float)$order['coupon_amount'] : 0.0,
|
||||
'couponId' => isset($order['coupon_id']) ? (int)$order['coupon_id'] : 0,
|
||||
'couponName' => $couponName,
|
||||
'payType' => (string)$order['pay_type'],
|
||||
'payTypeText' => (string)$order['pay_type'] === 'balance' ? '余额支付' : '微信支付',
|
||||
'status' => (string)$order['status'],
|
||||
'statusText' => isset($statusMap[$order['status']]) ? $statusMap[$order['status']] : (string)$order['status'],
|
||||
'refundReason' => isset($order['refund_reason']) ? (string)$order['refund_reason'] : '',
|
||||
'userAccount' => $userMobile ?: (isset($user['username']) ? (string)$user['username'] : ''),
|
||||
'createdAt' => $this->iso($order['createtime']),
|
||||
'payTime' => !empty($order['paytime']) ? $this->iso($order['paytime']) : null,
|
||||
'closeTime' => ((string)$order['status'] === 'closed' && !empty($order['updatetime'])) ? $this->iso($order['updatetime']) : null,
|
||||
'expireSeconds' => $expireSeconds,
|
||||
'timeoutSeconds' => $timeoutSeconds,
|
||||
'relatedId' => $relatedId,
|
||||
'relatedInfo' => $relatedInfo,
|
||||
];
|
||||
|
||||
$this->ok($detail);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,13 +138,9 @@ class Pay extends V1
|
||||
if ((string)$order['pay_type'] !== 'wxpay') {
|
||||
$this->fail('该订单不是微信支付');
|
||||
}
|
||||
// 超时未支付自动关闭(24 小时),避免 pending 订单无限堆积
|
||||
if (!empty($order['createtime']) && (int)$order['createtime'] < time() - 86400) {
|
||||
Db::name('fc_order')->where('id', (int)$order['id'])->where('status', 'pending')->update([
|
||||
'status' => 'closed',
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
\app\common\library\CouponService::release((string)$order['order_no']);
|
||||
// 超时未支付自动关闭,避免已超时的订单继续被支付
|
||||
if (\app\common\library\OrderClose::isExpired($order)) {
|
||||
\app\common\library\OrderClose::close($order, 'timeout_auto');
|
||||
$this->fail('订单已超时关闭,请重新下单');
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ use app\common\library\CouponService;
|
||||
* GET /api/v1/post/:id P5 信息详情
|
||||
* POST /api/v1/post/:id/pay-view P6 付费查看联系方式
|
||||
* POST /api/v1/post/:id/comment P7 发表评价
|
||||
* POST /api/v1/post/comment/:id/reply P11 发布者回复评价
|
||||
* GET /api/v1/post/:id/comments P10 评价列表(详情页「用户评价」)
|
||||
*
|
||||
* 计费口径(后台「发布与费用配置」维护,真源=fc_config);
|
||||
@@ -247,12 +248,25 @@ class Post extends V1
|
||||
$order = null;
|
||||
$balanceAfter = 0;
|
||||
|
||||
$identityTypeInput = (string)$this->input('identityType', 'person');
|
||||
$identityType = ($identityTypeInput === 'merchant' || $identityTypeInput === '2') ? 2 : 1;
|
||||
if ($identityType === 2) {
|
||||
$userExt = Db::name('fc_user_ext')->where('user_id', $user['id'])->find();
|
||||
if (!$userExt || (int)$userExt['user_type'] !== 2) {
|
||||
$identityType = 1;
|
||||
}
|
||||
}
|
||||
$price = max(0, round((float)$this->input('price', 0), 2));
|
||||
$priceUnit = mb_substr(trim((string)$this->input('priceUnit', '')), 0, 16);
|
||||
$wechat = mb_substr(trim((string)$this->input('wechat', '')), 0, 64);
|
||||
$address = mb_substr(trim((string)$this->input('address', '')), 0, 128);
|
||||
|
||||
try {
|
||||
// 发布落库 + 扣款 + 订单 + 额度扣减 同一事务:任一步失败整体回滚
|
||||
Db::transaction(function () use (
|
||||
&$postId, &$order, &$balanceAfter, &$quotaLeft,
|
||||
$paid, $user, $amount, $originAmount, $couponAmount, $userCouponId, $payType,
|
||||
$now, $categoryId, $title, $content, $phone, $useQuota, $region, $cover
|
||||
$now, $categoryId, $identityType, $title, $content, $phone, $wechat, $price, $priceUnit, $address, $useQuota, $region, $cover
|
||||
) {
|
||||
$paidNow = $paid && $payType === 'balance';
|
||||
// 订单号提前生成:优惠券锁定需要绑定订单号
|
||||
@@ -277,18 +291,19 @@ class Post extends V1
|
||||
$postId = Db::name('fc_post')->insertGetId([
|
||||
'user_id' => $user['id'],
|
||||
'category_id' => $categoryId,
|
||||
'identity_type' => $identityType,
|
||||
'title' => $title,
|
||||
'content' => $content,
|
||||
'cover' => $cover,
|
||||
'media' => json_encode($this->mediaArray(), JSON_UNESCAPED_UNICODE),
|
||||
'price' => round((float)$this->input('price', 0), 2),
|
||||
'price_unit' => (string)$this->input('priceUnit', ''),
|
||||
'price' => $price,
|
||||
'price_unit' => $priceUnit,
|
||||
'area' => $region['area'],
|
||||
'district_id' => $region['district_id'],
|
||||
'address' => (string)$this->input('address', ''),
|
||||
'address' => $address,
|
||||
'contact' => (string)$this->input('contact', ''),
|
||||
'phone' => $phone,
|
||||
'wechat' => '',
|
||||
'wechat' => $wechat,
|
||||
'tags' => $this->tagsString(),
|
||||
// LBS 坐标(gcj02;未定位/为 0 时存 NULL,首页「附近」不参与距离排序)
|
||||
'lat' => $this->coord('lat', 90),
|
||||
@@ -628,18 +643,29 @@ class Post extends V1
|
||||
$list = [];
|
||||
foreach ($rows as $row) {
|
||||
$media = json_decode((string)$row['media'], true);
|
||||
$tags = [];
|
||||
if (!empty($row['tags'])) {
|
||||
$tags = array_values(array_filter(array_map('trim', explode(',', (string)$row['tags']))));
|
||||
}
|
||||
$list[] = [
|
||||
'draftId' => (int)$row['id'],
|
||||
'title' => (string)$row['title'],
|
||||
'content' => (string)$row['content'],
|
||||
'categoryId' => (int)$row['category_id'],
|
||||
'media' => is_array($media) ? $media : [],
|
||||
'contact' => (string)$row['contact'],
|
||||
'phone' => (string)$row['phone'],
|
||||
'address' => (string)$row['address'],
|
||||
'area' => (string)$row['area'],
|
||||
'areaId' => (int)$row['district_id'],
|
||||
'savedAt' => $this->iso($row['savedat']),
|
||||
'draftId' => (int)$row['id'],
|
||||
'title' => (string)$row['title'],
|
||||
'content' => (string)$row['content'],
|
||||
'categoryId' => (int)$row['category_id'],
|
||||
'identityType' => (isset($row['identity_type']) && (int)$row['identity_type'] === 2) ? 'merchant' : 'person',
|
||||
'media' => is_array($media) ? $media : [],
|
||||
'price' => (float)(isset($row['price']) ? $row['price'] : 0),
|
||||
'priceUnit' => (string)(isset($row['price_unit']) ? $row['price_unit'] : ''),
|
||||
'contact' => (string)$row['contact'],
|
||||
'phone' => (string)$row['phone'],
|
||||
'wechat' => (string)(isset($row['wechat']) ? $row['wechat'] : ''),
|
||||
'tags' => $tags,
|
||||
'address' => (string)$row['address'],
|
||||
'lat' => isset($row['lat']) && $row['lat'] !== null ? (float)$row['lat'] : null,
|
||||
'lng' => isset($row['lng']) && $row['lng'] !== null ? (float)$row['lng'] : null,
|
||||
'area' => (string)$row['area'],
|
||||
'areaId' => (int)$row['district_id'],
|
||||
'savedAt' => $this->iso($row['savedat']),
|
||||
];
|
||||
}
|
||||
$this->ok($list);
|
||||
@@ -679,19 +705,29 @@ class Post extends V1
|
||||
$content = (string)$this->input('content', '');
|
||||
$now = time();
|
||||
|
||||
$identityTypeInput = (string)$this->input('identityType', 'person');
|
||||
$identityType = ($identityTypeInput === 'merchant' || $identityTypeInput === '2') ? 2 : 1;
|
||||
|
||||
$data = [
|
||||
'user_id' => $user['id'],
|
||||
'category_id' => $categoryId,
|
||||
'title' => $title,
|
||||
'content' => $content,
|
||||
'media' => json_encode($this->mediaArray(), JSON_UNESCAPED_UNICODE),
|
||||
'contact' => (string)$this->input('contact', ''),
|
||||
'phone' => (string)$this->input('phone', ''),
|
||||
'address' => (string)$this->input('address', ''),
|
||||
'area' => (string)$this->input('area', ''),
|
||||
'district_id' => (int)$this->input('areaId', (int)$this->input('districtId', 0)),
|
||||
'savedat' => $now,
|
||||
'updatetime' => $now,
|
||||
'user_id' => $user['id'],
|
||||
'category_id' => $categoryId,
|
||||
'identity_type' => $identityType,
|
||||
'title' => $title,
|
||||
'content' => $content,
|
||||
'media' => json_encode($this->mediaArray(), JSON_UNESCAPED_UNICODE),
|
||||
'price' => max(0, round((float)$this->input('price', 0), 2)),
|
||||
'price_unit' => mb_substr(trim((string)$this->input('priceUnit', '')), 0, 16),
|
||||
'contact' => (string)$this->input('contact', ''),
|
||||
'phone' => (string)$this->input('phone', ''),
|
||||
'wechat' => mb_substr(trim((string)$this->input('wechat', '')), 0, 64),
|
||||
'tags' => $this->tagsString(),
|
||||
'address' => mb_substr(trim((string)$this->input('address', '')), 0, 128),
|
||||
'lat' => $this->coord('lat', 90),
|
||||
'lng' => $this->coord('lng', 180),
|
||||
'area' => (string)$this->input('area', ''),
|
||||
'district_id' => (int)$this->input('areaId', (int)$this->input('districtId', 0)),
|
||||
'savedat' => $now,
|
||||
'updatetime' => $now,
|
||||
];
|
||||
|
||||
if ($draftId > 0) {
|
||||
@@ -813,9 +849,11 @@ class Post extends V1
|
||||
$used = ((string)$ext['free_view_date'] === $today) ? (int)$ext['free_view_used'] : 0;
|
||||
$data['freeViewLeft'] = $isMember ? max(0, $quota - $used) : 0;
|
||||
|
||||
if ($isOwner || $paid) {
|
||||
if ($isOwner || $paid || $isMember) {
|
||||
$data['unlocked'] = true;
|
||||
$data['phone'] = (string)$post['phone'];
|
||||
$data['contact'] = (string)$post['phone'];
|
||||
$data['contactName'] = (string)(isset($post['contact']) ? $post['contact'] : '');
|
||||
$data['wechat'] = $post['wechat'] !== '' ? (string)$post['wechat'] : ('tongcheng_' . $post['id']);
|
||||
}
|
||||
|
||||
@@ -1009,6 +1047,11 @@ class Post extends V1
|
||||
$this->fail('信息不存在', 404);
|
||||
}
|
||||
|
||||
// 禁止发布者对自己的信息发表评价
|
||||
if ((int)$post['user_id'] === (int)$user['id']) {
|
||||
$this->fail('不能评价自己发布的信息');
|
||||
}
|
||||
|
||||
$now = time();
|
||||
$commentId = Db::name('fc_comment')->insertGetId([
|
||||
'post_id' => $id,
|
||||
@@ -1035,6 +1078,68 @@ class Post extends V1
|
||||
$this->ok(['commentId' => $commentId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* P11 发布者回复评价
|
||||
* POST /api/v1/post/comment/:id/reply {reply} → {id, reply, replytime}
|
||||
* 规则:仅本信息的发布者可对该信息下的评价进行回复
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function replyComment()
|
||||
{
|
||||
$user = $this->auth();
|
||||
$commentId = (int)$this->request->param('id', 0);
|
||||
if (!$commentId) {
|
||||
$commentId = (int)$this->input('commentId', 0);
|
||||
}
|
||||
if ($commentId <= 0) {
|
||||
$this->fail('评价不存在', 404);
|
||||
}
|
||||
|
||||
$reply = trim((string)$this->input('reply', ''));
|
||||
if ($reply === '') {
|
||||
$this->fail('回复内容不能为空');
|
||||
}
|
||||
if (mb_strlen($reply, 'UTF-8') > 200) {
|
||||
$this->fail('回复内容不能超过 200 个字');
|
||||
}
|
||||
|
||||
$comment = Db::name('fc_comment')->where('id', $commentId)->find();
|
||||
if (!$comment) {
|
||||
$this->fail('评价不存在', 404);
|
||||
}
|
||||
|
||||
$post = Db::name('fc_post')->where('id', $comment['post_id'])->whereNull('deletetime')->find();
|
||||
if (!$post) {
|
||||
$this->fail('对应信息不存在', 404);
|
||||
}
|
||||
|
||||
// 仅限信息发布者(楼主/商家)回复
|
||||
if ((int)$post['user_id'] !== (int)$user['id']) {
|
||||
$this->fail('只有发布者本人可以回复评价', 403);
|
||||
}
|
||||
|
||||
$now = time();
|
||||
Db::name('fc_comment')->where('id', $commentId)->update([
|
||||
'reply' => $reply,
|
||||
'replytime' => $now,
|
||||
'updatetime' => $now,
|
||||
]);
|
||||
|
||||
$this->notify(
|
||||
$comment['user_id'],
|
||||
'interact',
|
||||
'评价收到回复',
|
||||
'发布者回复了您对「' . (string)$post['title'] . '」的评价:' . $reply
|
||||
);
|
||||
|
||||
$this->ok([
|
||||
'id' => $commentId,
|
||||
'reply' => $reply,
|
||||
'replytime' => $now,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* P10 评价列表(详情页「用户评价」)
|
||||
* GET /api/v1/post/:id/comments → [{id,user,score,content,reply,createdAt}]
|
||||
@@ -1052,7 +1157,7 @@ class Post extends V1
|
||||
->join('user u', 'u.id = co.user_id', 'LEFT')
|
||||
->where('co.post_id', $id)
|
||||
->where('co.status', 1)
|
||||
->field('co.id, co.score, co.content, co.reply, co.top, co.createtime, u.nickname AS nickname')
|
||||
->field('co.id, co.user_id, co.score, co.content, co.reply, co.replytime, co.top, co.createtime, u.nickname AS nickname')
|
||||
->order('co.top desc, co.id desc')
|
||||
->select();
|
||||
|
||||
@@ -1060,10 +1165,12 @@ class Post extends V1
|
||||
foreach ($rows as $row) {
|
||||
$list[] = [
|
||||
'id' => (int)$row['id'],
|
||||
'userId' => (int)$row['user_id'],
|
||||
'user' => (string)$row['nickname'],
|
||||
'score' => (int)$row['score'],
|
||||
'content' => (string)$row['content'],
|
||||
'reply' => (string)$row['reply'],
|
||||
'replytime' => !empty($row['replytime']) ? $this->iso($row['replytime']) : '',
|
||||
'createdAt' => $this->iso($row['createtime']),
|
||||
];
|
||||
}
|
||||
@@ -1286,9 +1393,10 @@ class Post extends V1
|
||||
{
|
||||
$tags = $this->input('tags', []);
|
||||
if (is_array($tags)) {
|
||||
$tags = array_values(array_filter(array_map('trim', $tags)));
|
||||
$tags = implode(',', $tags);
|
||||
}
|
||||
return (string)$tags;
|
||||
return mb_substr(trim((string)$tags), 0, 128);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1370,6 +1478,7 @@ class Post extends V1
|
||||
'id' => $postId,
|
||||
'categoryId' => (int)$row['category_id'],
|
||||
'categoryName' => $categoryName,
|
||||
'identityType' => (isset($row['identity_type']) && (int)$row['identity_type'] === 2) ? 'merchant' : 'person',
|
||||
'title' => (string)$row['title'],
|
||||
'content' => (string)$row['content'],
|
||||
'cover' => (string)$row['cover'],
|
||||
@@ -1380,6 +1489,9 @@ class Post extends V1
|
||||
'areaId' => (int)$row['district_id'],
|
||||
'address' => (string)$row['address'],
|
||||
'contact' => $this->maskPhone($row['phone']),
|
||||
'phone' => $this->maskPhone($row['phone']),
|
||||
'contactName' => (string)(isset($row['contact']) ? $row['contact'] : ''),
|
||||
'isTop' => isset($row['is_top']) && (int)$row['is_top'] === 1,
|
||||
'views' => (int)$row['views'],
|
||||
'likes' => (int)$row['likes'],
|
||||
'isPaid' => (int)$row['is_paid'] === 1,
|
||||
|
||||
@@ -68,13 +68,53 @@ class V1 extends Api
|
||||
|
||||
/* ==================== 鉴权 ==================== */
|
||||
|
||||
/** 从 Authorization: Bearer xxx 提取 token */
|
||||
/**
|
||||
* 提取当前请求的认证 Token
|
||||
* 兼容多种请求头与环境变量,防止 Nginx/Apache 过滤 Authorization 导致 401 循环:
|
||||
* 1. Authorization: Bearer {token}
|
||||
* 2. Header: token: {token}
|
||||
* 3. Header: x-token: {token}
|
||||
* 4. $_SERVER['HTTP_AUTHORIZATION'] / $_SERVER['REDIRECT_HTTP_AUTHORIZATION']
|
||||
* 5. $_SERVER['HTTP_TOKEN']
|
||||
*
|
||||
* @return string 提取出的 Token 字符串
|
||||
*/
|
||||
protected function bearerToken()
|
||||
{
|
||||
// 1. 标准 Authorization 请求头
|
||||
$auth = $this->request->header('authorization', '');
|
||||
if ($auth && stripos($auth, 'bearer ') === 0) {
|
||||
return trim(substr($auth, 7));
|
||||
if ($auth) {
|
||||
if (stripos($auth, 'bearer ') === 0) {
|
||||
return trim(substr($auth, 7));
|
||||
}
|
||||
return trim($auth);
|
||||
}
|
||||
|
||||
// 2. 兼容 FastAdmin 原生及常规 Header(Nginx 默认会保留普通 Header)
|
||||
$token = $this->request->header('token', '');
|
||||
if ($token) {
|
||||
return trim($token);
|
||||
}
|
||||
$xToken = $this->request->header('x-token', '');
|
||||
if ($xToken) {
|
||||
return trim($xToken);
|
||||
}
|
||||
|
||||
// 3. 兼容服务器环境变量中的 Authorization(Apache/Nginx FastCGI 特殊映射)
|
||||
$serverAuth = $this->request->server('HTTP_AUTHORIZATION', $this->request->server('REDIRECT_HTTP_AUTHORIZATION', ''));
|
||||
if ($serverAuth) {
|
||||
if (stripos($serverAuth, 'bearer ') === 0) {
|
||||
return trim(substr($serverAuth, 7));
|
||||
}
|
||||
return trim($serverAuth);
|
||||
}
|
||||
|
||||
// 4. 兼容 $_SERVER['HTTP_TOKEN']
|
||||
$serverToken = $this->request->server('HTTP_TOKEN', '');
|
||||
if ($serverToken) {
|
||||
return trim($serverToken);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
@@ -21,5 +21,6 @@ return [
|
||||
'app\admin\command\FcMenu',
|
||||
'app\admin\command\FcSettle',
|
||||
'app\admin\command\FcVerifyDist',
|
||||
'app\admin\command\FcVerifyMember',
|
||||
'app\admin\command\FcSeedPosts',
|
||||
];
|
||||
|
||||
@@ -66,6 +66,12 @@ class FcAssets
|
||||
ROOT_PATH . 'public' . DS . 'assets' . DS . 'css',
|
||||
];
|
||||
|
||||
// FastAdmin 后台公共脚本(表格操作列、工具栏按钮)不在 backend 目录,需单独纳入指纹
|
||||
$files = [
|
||||
ROOT_PATH . 'public' . DS . 'assets' . DS . 'js' . DS . 'require-table.js',
|
||||
ROOT_PATH . 'public' . DS . 'assets' . DS . 'js' . DS . 'require-backend.min.js',
|
||||
];
|
||||
|
||||
$mtime = 0;
|
||||
$count = 0;
|
||||
foreach ($dirs as $dir) {
|
||||
@@ -78,6 +84,17 @@ class FcAssets
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($files as $file) {
|
||||
if (!is_file($file)) {
|
||||
continue;
|
||||
}
|
||||
$time = @filemtime($file);
|
||||
if ($time > $mtime) {
|
||||
$mtime = $time;
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
|
||||
// 最新修改时间 + 文件数量作为种子,crc32 转成纯数字(URL 安全,且兼容版本号 +1 逻辑)
|
||||
$fingerprint = sprintf('%u', crc32($mtime . '-' . $count));
|
||||
return $fingerprint;
|
||||
|
||||
@@ -29,6 +29,23 @@ class FcConfig
|
||||
return (isset($cfg[$key]) && $cfg[$key] !== '') ? $cfg[$key] : $default;
|
||||
};
|
||||
|
||||
// 解析会员权益配置(存为 JSON 字符串的 member.benefit)
|
||||
$benefitRaw = $pick('member.benefit', '');
|
||||
$benefitCfg = [];
|
||||
if ($benefitRaw) {
|
||||
$decoded = json_decode($benefitRaw, true);
|
||||
if (is_array($decoded)) {
|
||||
$benefitCfg = $decoded;
|
||||
}
|
||||
}
|
||||
$freeView = isset($benefitCfg['freeView']) ? (int)$benefitCfg['freeView'] : 20;
|
||||
$postDiscount = isset($benefitCfg['postDiscount']) ? (string)$benefitCfg['postDiscount'] : '8 折';
|
||||
$payViewPrice = $pick('fee.payView', '1');
|
||||
$benefitsArr = isset($benefitCfg['benefits']) && is_array($benefitCfg['benefits'])
|
||||
? $benefitCfg['benefits']
|
||||
: ['每日免费查看 20 条联系方式', '发布信息 8 折', '专属会员标识', '赠送大量发布额度'];
|
||||
$benefitsText = implode("\n", $benefitsArr);
|
||||
|
||||
return [
|
||||
'fc_miniapp' => [
|
||||
'name' => 'fc_miniapp',
|
||||
@@ -70,6 +87,17 @@ class FcConfig
|
||||
self::item('fc_post_yearQuota', '年卡条数', 'number', $pick('post.yearQuota', '500'), '年卡包含的发布条数', 'required;number'),
|
||||
],
|
||||
],
|
||||
'fc_member' => [
|
||||
'name' => 'fc_member',
|
||||
'title' => '会员配置',
|
||||
'active' => false,
|
||||
'list' => [
|
||||
self::item('fc_member_freeView', '每日免费查看条数', 'number', $freeView, '会员每日可免费查看联系方式条数(默认 20 条)', 'required;number'),
|
||||
self::item('fc_member_postDiscount', '单条发布折扣', 'string', $postDiscount, '付费发布时会员专享折扣,如「8折」或「8.5折」(默认 8 折)', 'required'),
|
||||
self::item('fc_fee_payView', '非会员查看价格', 'number', $payViewPrice, '非会员单条解锁联系方式费用(元,默认 1 元)', 'required;number'),
|
||||
self::item('fc_member_benefits', '会员特权清单', 'text', $benefitsText, '小程序端展示的特权清单,每行一条(支持后台自由增删与修改)'),
|
||||
],
|
||||
],
|
||||
'fc_dist' => [
|
||||
'name' => 'fc_dist',
|
||||
'title' => '分销配置',
|
||||
@@ -113,6 +141,9 @@ class FcConfig
|
||||
if ($has('fc_post_')) {
|
||||
self::savePublish($row);
|
||||
}
|
||||
if ($has('fc_member_') || $has('fc_fee_')) {
|
||||
self::saveMember($row);
|
||||
}
|
||||
if ($has('fc_dist_')) {
|
||||
self::saveDistribution($row);
|
||||
}
|
||||
@@ -254,6 +285,58 @@ class FcConfig
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员权益与联系方式查看费用配置
|
||||
*
|
||||
* @param array $row 系统配置页提交的 row 数组
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected static function saveMember(array $row)
|
||||
{
|
||||
$freeView = isset($row['fc_member_freeView']) ? max(0, (int)$row['fc_member_freeView']) : 20;
|
||||
$postDiscount = isset($row['fc_member_postDiscount']) ? trim((string)$row['fc_member_postDiscount']) : '8 折';
|
||||
if ($postDiscount === '') {
|
||||
$postDiscount = '8 折';
|
||||
}
|
||||
$payView = isset($row['fc_fee_payView']) ? max(0, round((float)$row['fc_fee_payView'], 2)) : 1;
|
||||
|
||||
$benefitsRaw = isset($row['fc_member_benefits']) ? trim((string)$row['fc_member_benefits']) : '';
|
||||
$benefits = [];
|
||||
if ($benefitsRaw !== '') {
|
||||
$lines = preg_split('/[\r\n]+/', $benefitsRaw);
|
||||
foreach ($lines as $line) {
|
||||
$line = trim($line);
|
||||
if ($line !== '') {
|
||||
$benefits[] = $line;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empty($benefits)) {
|
||||
$benefits = [
|
||||
'每日免费查看 ' . $freeView . ' 条联系方式',
|
||||
'发布信息 ' . $postDiscount . ' 专属优惠',
|
||||
'专属会员标识',
|
||||
'赠送大量发布额度',
|
||||
];
|
||||
}
|
||||
|
||||
$current = [];
|
||||
$raw = Db::name('fc_config')->where('key', 'member.benefit')->value('value');
|
||||
if ($raw) {
|
||||
$decoded = json_decode($raw, true);
|
||||
if (is_array($decoded)) {
|
||||
$current = $decoded;
|
||||
}
|
||||
}
|
||||
$current['freeView'] = $freeView;
|
||||
$current['postDiscount'] = $postDiscount;
|
||||
$current['benefits'] = $benefits;
|
||||
|
||||
self::put('member.benefit', $current, 'member', '会员权益配置');
|
||||
self::put('fee.payView', $payView, 'fee', '非会员单条查看联系方式价格');
|
||||
}
|
||||
|
||||
/**
|
||||
* 分销参数
|
||||
*
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\library;
|
||||
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
|
||||
/**
|
||||
* 订单取消与超时关闭服务
|
||||
*
|
||||
* 统一处理主动取消与超时自动关闭:
|
||||
* 1. 状态由 pending 原子更新为 closed
|
||||
* 2. 自动释放被锁定的优惠券
|
||||
* 3. 关联业务的回收处理(如未支付的发布贴置为关闭,防止未支付生效)
|
||||
* 4. 触发站内信通知
|
||||
*/
|
||||
class OrderClose
|
||||
{
|
||||
/** 默认订单超时时间(秒):30分钟 */
|
||||
const DEFAULT_TIMEOUT_SECONDS = 1800;
|
||||
|
||||
/**
|
||||
* 获取系统待支付订单超时时长(秒)
|
||||
* 优先读取配置 trade.order_timeout 或 order.timeout_minutes(单位:分钟),默认 30 分钟
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function getTimeoutSeconds()
|
||||
{
|
||||
$minutes = Db::name('fc_config')->where('key', 'order.timeout_minutes')->value('value');
|
||||
if ($minutes === null || $minutes === '') {
|
||||
$minutes = Db::name('fc_config')->where('key', 'trade.order_timeout')->value('value');
|
||||
}
|
||||
$val = (int)$minutes;
|
||||
if ($val > 0) {
|
||||
return $val * 60;
|
||||
}
|
||||
return self::DEFAULT_TIMEOUT_SECONDS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断订单是否超时
|
||||
*
|
||||
* @param array $order fc_order 行
|
||||
* @param int|null $now 当前时间戳
|
||||
* @return bool
|
||||
*/
|
||||
public static function isExpired(array $order, $now = null)
|
||||
{
|
||||
if (empty($order) || (string)$order['status'] !== 'pending') {
|
||||
return false;
|
||||
}
|
||||
$now = $now ?: time();
|
||||
$createtime = isset($order['createtime']) ? (int)$order['createtime'] : 0;
|
||||
if ($createtime <= 0) {
|
||||
return false;
|
||||
}
|
||||
$timeout = self::getTimeoutSeconds();
|
||||
return ($now - $createtime) >= $timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭订单(原子操作,支持主动取消或超时自动关闭)
|
||||
*
|
||||
* @param array $order fc_order 行(至少含 id、order_no、user_id、type、status、related_id)
|
||||
* @param string $reason 关闭原因:user_cancel(用户主动取消)、timeout_auto(超时自动关闭)、admin_cancel(后台取消)
|
||||
* @return bool 是否成功关闭
|
||||
*/
|
||||
public static function close(array $order, $reason = 'user_cancel')
|
||||
{
|
||||
$orderId = isset($order['id']) ? (int)$order['id'] : 0;
|
||||
$orderNo = isset($order['order_no']) ? (string)$order['order_no'] : '';
|
||||
if ($orderId <= 0 || $orderNo === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$now = time();
|
||||
$closed = false;
|
||||
|
||||
try {
|
||||
Db::transaction(function () use ($orderId, $orderNo, $order, $reason, $now, &$closed) {
|
||||
// 条件更新,保证只有 pending 状态的订单才能转为 closed,天然防并发与重复关闭
|
||||
$affected = Db::name('fc_order')
|
||||
->where('id', $orderId)
|
||||
->where('status', 'pending')
|
||||
->update([
|
||||
'status' => 'closed',
|
||||
'refund_reason' => ($reason === 'user_cancel' ? '用户主动取消' : ($reason === 'timeout_auto' ? '超时未支付自动关闭' : '管理员关闭')),
|
||||
'updatetime' => $now,
|
||||
]);
|
||||
|
||||
if (!$affected) {
|
||||
$closed = false;
|
||||
return;
|
||||
}
|
||||
|
||||
$closed = true;
|
||||
|
||||
// 1. 释放优惠券(若有)
|
||||
CouponService::release($orderNo);
|
||||
|
||||
// 2. 关联业务的回收处理
|
||||
$type = isset($order['type']) ? (string)$order['type'] : '';
|
||||
$relatedId = isset($order['related_id']) ? (int)$order['related_id'] : 0;
|
||||
|
||||
// 若是未付款的发布信息,将关联的草稿或帖子置为下架/关闭,避免未付款直接审核显示
|
||||
if ($type === 'post' && $relatedId > 0) {
|
||||
Db::name('fc_post')
|
||||
->where('id', $relatedId)
|
||||
->where('user_id', (int)$order['user_id'])
|
||||
->where('audit_status', 0) // 仅当尚未审核通过时
|
||||
->update([
|
||||
'status' => 0, // 设为下架/关闭
|
||||
'updatetime' => $now,
|
||||
]);
|
||||
}
|
||||
|
||||
// 3. 发送站内消息通知
|
||||
$userId = isset($order['user_id']) ? (int)$order['user_id'] : 0;
|
||||
if ($userId > 0) {
|
||||
$title = $reason === 'user_cancel' ? '订单已取消' : '订单已超时关闭';
|
||||
$orderTitle = isset($order['title']) ? (string)$order['title'] : '同城订单';
|
||||
$content = $reason === 'user_cancel'
|
||||
? "您的订单【{$orderTitle}】(订单号:{$orderNo})已主动取消。"
|
||||
: "您的订单【{$orderTitle}】(订单号:{$orderNo})因超过支付时效已自动关闭,锁定的优惠券已退回。";
|
||||
|
||||
Db::name('fc_message')->insert([
|
||||
'user_id' => $userId,
|
||||
'type' => 'system',
|
||||
'title' => $title,
|
||||
'content' => $content,
|
||||
'isread' => 0,
|
||||
'readtime' => null,
|
||||
'createtime' => $now,
|
||||
]);
|
||||
}
|
||||
});
|
||||
} catch (\Throwable $e) {
|
||||
Log::record("订单关闭失败:订单 {$orderNo},原因:{$e->getMessage()}", 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
return $closed;
|
||||
}
|
||||
|
||||
/**
|
||||
* 惰性检查并在超时时代为关闭
|
||||
*
|
||||
* @param array $order fc_order 行
|
||||
* @return array 最新订单数据
|
||||
*/
|
||||
public static function checkAndCloseIfExpired(array $order)
|
||||
{
|
||||
if (empty($order) || (string)$order['status'] !== 'pending') {
|
||||
return $order;
|
||||
}
|
||||
|
||||
if (self::isExpired($order)) {
|
||||
if (self::close($order, 'timeout_auto')) {
|
||||
$order['status'] = 'closed';
|
||||
$order['updatetime'] = time();
|
||||
}
|
||||
}
|
||||
|
||||
return $order;
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,8 @@ return [
|
||||
'api/v1/home/locate' => 'api/Home/locate',
|
||||
|
||||
/* =============== 三、用户端 · 信息发布与详情(长路径优先) =============== */
|
||||
'api/v1/post/:id/pay-view' => 'api/Post/payView',
|
||||
'api/v1/post/:id/pay-view' => 'api/Post/payView',
|
||||
'api/v1/post/comment/:id/reply' => 'api/Post/replyComment',
|
||||
'api/v1/post/:id/comment' => 'api/Post/comment',
|
||||
'api/v1/post/:id/comments' => 'api/Post/comments',
|
||||
'api/v1/post/create' => 'api/Post/create',
|
||||
@@ -99,6 +100,8 @@ return [
|
||||
* · 本组均为静态路径,与上面的 message/:id(\d+)及下面的 post/:id 无交叉。
|
||||
*/
|
||||
'api/v1/order/recharge' => 'api/Order/recharge',
|
||||
'api/v1/order/cancel' => 'api/Order/cancel',
|
||||
'api/v1/order/detail' => 'api/Order/detail',
|
||||
'api/v1/pay/prepay' => 'api/Pay/prepay',
|
||||
'api/v1/pay/status' => 'api/Pay/status',
|
||||
'api/v1/pay/notify' => 'api/Pay/notifyCallback',
|
||||
|
||||
在新工单中引用
屏蔽一个用户