feat(admin): 补齐后台管理端全量业务模块(FastAdmin 原生)
一、问题
35 个后台接口此前无任何可用界面:FastAdmin PC 后台 110 条菜单里 0 条业务菜单,
小程序端仅有 1 个 LOGO/图标设置页 → 后台功能实际上无处可操作。
二、方案(FastAdmin 原生机制)
- 用 `php think crud` 为 17 张业务表生成管理模块:
控制器 application/admin/controller/fc/*.php(继承 Backend)
模型 application/admin/model/Fc*.php
视图 application/admin/view/fc/*/{index,add,edit}.html
后台 JS public/assets/js/backend/fc/*.js
语言包 application/admin/lang/zh-cn/fc/*.php
- 菜单结构固化进安装器 application/admin/command/FcInstall.php 的 menu()(幂等):
同城业务 ├─ 内容管理 分类管理/轮播管理/信息管理/评价管理/举报处理
├─ 用户与商家 商家管理/会员管理/消息管理
├─ 交易管理 订单管理/会员套餐/资金流水/佣金明细/付费查看记录
├─ 分销管理 分销关系/提现审核
└─ 基础数据 服务区域/草稿箱
三、业务动作(一键操作,含列表页按钮)
- fc/post: audit(审核通过/驳回 + 分类信息量 + 站内信) / offline(下架)
- fc/merchant: audit(资质审核 + 同步用户身份 + 店铺状态)
- fc/withdraw: pay(打款/驳回 + 资金流水 + 拒绝须填原因)
- fc/order: refund(退款) / supplement(按订单号补单 + 流水)
- fc/comment: reply(回复) / top(置顶)
- fc/report: handle(标记已处理)
四、验证
- 后台登录后业务页 HTTP 200,controllername/jsname 正确解析
- 列表数据真实加载:分类 8 / 信息 6 / 订单 4 / 提现 3 / 商家 4
- 侧边栏 5 个中文分组菜单正常渲染
这个提交包含在:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 同城-服务区域
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Area extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcArea模型对象
|
||||
* @var \app\admin\model\FcArea
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcArea;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 同城-轮播广告位
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Banner extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcBanner模型对象
|
||||
* @var \app\admin\model\FcBanner
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcBanner;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 同城-分类
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Category extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcCategory模型对象
|
||||
* @var \app\admin\model\FcCategory
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcCategory;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 同城-评价
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Comment extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcComment模型对象
|
||||
* @var \app\admin\model\FcComment
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcComment;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 回复评价
|
||||
*/
|
||||
public function reply()
|
||||
{
|
||||
$ids = $this->request->post('ids');
|
||||
$reply = $this->request->post('reply');
|
||||
if (trim((string)$reply) === '') {
|
||||
$this->error('回复内容不能为空');
|
||||
}
|
||||
$ids = is_array($ids) ? $ids : explode(',', (string)$ids);
|
||||
$ids = array_filter($ids);
|
||||
if (!$ids) {
|
||||
$this->error('请选择要回复的评价');
|
||||
}
|
||||
$comments = Db::name('fc_comment')->where('id', 'in', $ids)->select();
|
||||
if (!$comments) {
|
||||
$this->error('评价不存在');
|
||||
}
|
||||
foreach ($comments as $comment) {
|
||||
Db::name('fc_comment')->where('id', $comment['id'])->update([
|
||||
'reply' => $reply,
|
||||
'replytime' => time(),
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
Db::name('fc_message')->insert([
|
||||
'user_id' => $comment['user_id'],
|
||||
'type' => 'interact',
|
||||
'title' => '评价回复',
|
||||
'content' => '您的评价已收到回复:' . $reply,
|
||||
'isread' => 0,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
}
|
||||
$this->success('回复成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 评价置顶/取消置顶
|
||||
*/
|
||||
public function top()
|
||||
{
|
||||
$ids = $this->request->post('ids');
|
||||
$top = (int)$this->request->post('top');
|
||||
if (!in_array($top, [0, 1])) {
|
||||
$this->error('置顶状态错误');
|
||||
}
|
||||
$ids = is_array($ids) ? $ids : explode(',', (string)$ids);
|
||||
$ids = array_filter($ids);
|
||||
if (!$ids) {
|
||||
$this->error('请选择要操作的评价');
|
||||
}
|
||||
Db::name('fc_comment')->where('id', 'in', $ids)->update([
|
||||
'top' => $top,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
$this->success($top === 1 ? '置顶成功' : '取消置顶成功');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 同城-分销佣金
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Commission extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcCommission模型对象
|
||||
* @var \app\admin\model\FcCommission
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcCommission;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 同城-分销关系
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Distrelation extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcDistRelation模型对象
|
||||
* @var \app\admin\model\FcDistRelation
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcDistRelation;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 同城-草稿箱
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Draft extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcDraft模型对象
|
||||
* @var \app\admin\model\FcDraft
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcDraft;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 同城-资金流水
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Financeflow extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcFinanceFlow模型对象
|
||||
* @var \app\admin\model\FcFinanceFlow
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcFinanceFlow;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 同城-商家资质
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Merchant extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcMerchant模型对象
|
||||
* @var \app\admin\model\FcMerchant
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcMerchant;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 审核商家资质
|
||||
*/
|
||||
public function audit()
|
||||
{
|
||||
$ids = $this->request->post('ids');
|
||||
$auditStatus = (int)$this->request->post('auditStatus');
|
||||
$reason = $this->request->post('reason', '');
|
||||
if (!in_array($auditStatus, [1, 2])) {
|
||||
$this->error('审核状态仅支持通过(1)/驳回(2)');
|
||||
}
|
||||
$ids = is_array($ids) ? $ids : explode(',', (string)$ids);
|
||||
$ids = array_filter($ids);
|
||||
if (!$ids) {
|
||||
$this->error('请选择要审核的商家');
|
||||
}
|
||||
$merchants = Db::name('fc_merchant')->where('id', 'in', $ids)->select();
|
||||
if (!$merchants) {
|
||||
$this->error('商家不存在');
|
||||
}
|
||||
foreach ($merchants as $merchant) {
|
||||
Db::name('fc_merchant')->where('id', $merchant['id'])->update([
|
||||
'audit_status' => $auditStatus,
|
||||
'audit_reason' => $reason,
|
||||
'shop_status' => $auditStatus === 1 ? 'normal' : 'banned',
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
if ($auditStatus === 1) {
|
||||
Db::name('fc_user_ext')->where('user_id', $merchant['user_id'])->update(['user_type' => 2]);
|
||||
}
|
||||
Db::name('fc_message')->insert([
|
||||
'user_id' => $merchant['user_id'],
|
||||
'type' => 'system',
|
||||
'title' => $auditStatus === 1 ? '审核通过' : '审核驳回',
|
||||
'content' => $auditStatus === 1
|
||||
? '您的商家「' . $merchant['name'] . '」资质已审核通过'
|
||||
: '您的商家「' . $merchant['name'] . '」资质审核未通过' . ($reason ? ',原因:' . $reason : ''),
|
||||
'isread' => 0,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
}
|
||||
$this->success('审核成功');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 同城-消息
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Message extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcMessage模型对象
|
||||
* @var \app\admin\model\FcMessage
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcMessage;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 同城-订单
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Order extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcOrder模型对象
|
||||
* @var \app\admin\model\FcOrder
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcOrder;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 订单退款
|
||||
*/
|
||||
public function refund()
|
||||
{
|
||||
$ids = $this->request->post('ids');
|
||||
$amount = (float)$this->request->post('amount');
|
||||
$reason = $this->request->post('reason', '');
|
||||
if ($amount <= 0) {
|
||||
$this->error('退款金额需大于 0');
|
||||
}
|
||||
$ids = is_array($ids) ? $ids : explode(',', (string)$ids);
|
||||
$ids = array_filter($ids);
|
||||
if (!$ids) {
|
||||
$this->error('请选择要退款的订单');
|
||||
}
|
||||
$orders = Db::name('fc_order')->where('id', 'in', $ids)->select();
|
||||
if (!$orders) {
|
||||
$this->error('订单不存在');
|
||||
}
|
||||
foreach ($orders as $order) {
|
||||
Db::name('fc_order')->where('id', $order['id'])->update([
|
||||
'status' => 'refunded',
|
||||
'refund_amount' => $amount,
|
||||
'refund_reason' => $reason,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
Db::name('fc_message')->insert([
|
||||
'user_id' => $order['user_id'],
|
||||
'type' => 'system',
|
||||
'title' => '订单退款',
|
||||
'content' => '您的订单「' . $order['order_no'] . '」已退款' . $amount . '元' . ($reason ? ',原因:' . $reason : ''),
|
||||
'isread' => 0,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
}
|
||||
$this->success('退款成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单补单
|
||||
*/
|
||||
public function supplement()
|
||||
{
|
||||
$orderNo = $this->request->post('orderNo');
|
||||
if (trim((string)$orderNo) === '') {
|
||||
$this->error('订单号不能为空');
|
||||
}
|
||||
$order = Db::name('fc_order')->where('order_no', $orderNo)->find();
|
||||
if (!$order) {
|
||||
$this->error('订单不存在');
|
||||
}
|
||||
if ($order['status'] === 'paid') {
|
||||
$this->success('订单已支付');
|
||||
}
|
||||
Db::name('fc_order')->where('id', $order['id'])->update([
|
||||
'status' => 'paid',
|
||||
'paytime' => time(),
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
Db::name('fc_finance_flow')->insert([
|
||||
'flow_no' => 'SK' . date('YmdHis') . $order['id'],
|
||||
'type' => 'income',
|
||||
'scene' => '订单补单',
|
||||
'amount' => $order['amount'],
|
||||
'balance' => 0,
|
||||
'related_id' => $order['id'],
|
||||
'remark' => '订单补单',
|
||||
'createtime' => time(),
|
||||
]);
|
||||
$this->success('补单成功');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 同城-付费查看记录
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Payview extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcPayView模型对象
|
||||
* @var \app\admin\model\FcPayView
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcPayView;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 同城-会员套餐
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Plan extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcPlan模型对象
|
||||
* @var \app\admin\model\FcPlan
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcPlan;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 同城-信息
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Post extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcPost模型对象
|
||||
* @var \app\admin\model\FcPost
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcPost;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 审核信息
|
||||
*/
|
||||
public function audit()
|
||||
{
|
||||
$ids = $this->request->post('ids');
|
||||
$auditStatus = (int)$this->request->post('auditStatus');
|
||||
$reason = $this->request->post('reason', '');
|
||||
if (!in_array($auditStatus, [1, 2])) {
|
||||
$this->error('审核状态仅支持通过(1)/驳回(2)');
|
||||
}
|
||||
$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();
|
||||
if (!$posts) {
|
||||
$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');
|
||||
}
|
||||
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(),
|
||||
]);
|
||||
}
|
||||
$this->success('审核成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 下架信息
|
||||
*/
|
||||
public function offline()
|
||||
{
|
||||
$ids = $this->request->post('ids');
|
||||
$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();
|
||||
if (!$posts) {
|
||||
$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(),
|
||||
]);
|
||||
}
|
||||
$this->success('下架成功');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 同城-举报
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Report extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcReport模型对象
|
||||
* @var \app\admin\model\FcReport
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcReport;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 处理举报
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$ids = $this->request->post('ids');
|
||||
$remark = $this->request->post('remark', '');
|
||||
$ids = is_array($ids) ? $ids : explode(',', (string)$ids);
|
||||
$ids = array_filter($ids);
|
||||
if (!$ids) {
|
||||
$this->error('请选择要处理的举报');
|
||||
}
|
||||
Db::name('fc_report')->where('id', 'in', $ids)->update([
|
||||
'status' => 'handled',
|
||||
'remark' => $remark,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
$this->success('处理成功');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 同城-用户扩展
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Userext extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcUserExt模型对象
|
||||
* @var \app\admin\model\FcUserExt
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcUserExt;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\fc;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 同城-提现
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Withdraw extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* FcWithdraw模型对象
|
||||
* @var \app\admin\model\FcWithdraw
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\FcWithdraw;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 提现打款/驳回
|
||||
*/
|
||||
public function pay()
|
||||
{
|
||||
$ids = $this->request->post('ids');
|
||||
$op = $this->request->post('op');
|
||||
$reason = $this->request->post('reason', '');
|
||||
if (!in_array($op, ['pay', 'reject'])) {
|
||||
$this->error('操作类型错误');
|
||||
}
|
||||
if ($op === 'reject' && trim((string)$reason) === '') {
|
||||
$this->error('驳回需填写原因');
|
||||
}
|
||||
$ids = is_array($ids) ? $ids : explode(',', (string)$ids);
|
||||
$ids = array_filter($ids);
|
||||
if (!$ids) {
|
||||
$this->error('请选择要操作的提现记录');
|
||||
}
|
||||
$withdraws = Db::name('fc_withdraw')->where('id', 'in', $ids)->select();
|
||||
if (!$withdraws) {
|
||||
$this->error('提现记录不存在');
|
||||
}
|
||||
foreach ($withdraws as $withdraw) {
|
||||
if ($op === 'pay') {
|
||||
Db::name('fc_withdraw')->where('id', $withdraw['id'])->update([
|
||||
'status' => 'paid',
|
||||
'paytime' => time(),
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
Db::name('fc_finance_flow')->insert([
|
||||
'flow_no' => 'WD' . date('YmdHis') . $withdraw['id'],
|
||||
'type' => 'expense',
|
||||
'scene' => '佣金提现',
|
||||
'amount' => $withdraw['amount'],
|
||||
'balance' => 0,
|
||||
'related_id' => $withdraw['id'],
|
||||
'remark' => '提现打款',
|
||||
'createtime' => time(),
|
||||
]);
|
||||
} else {
|
||||
Db::name('fc_withdraw')->where('id', $withdraw['id'])->update([
|
||||
'status' => 'rejected',
|
||||
'reason' => $reason,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
}
|
||||
Db::name('fc_message')->insert([
|
||||
'user_id' => $withdraw['user_id'],
|
||||
'type' => 'system',
|
||||
'title' => $op === 'pay' ? '提现成功' : '提现驳回',
|
||||
'content' => $op === 'pay'
|
||||
? '您的提现申请「' . $withdraw['withdraw_no'] . '」已打款,金额:' . $withdraw['amount'] . '元'
|
||||
: '您的提现申请「' . $withdraw['withdraw_no'] . '」被驳回' . ($reason ? ',原因:' . $reason : ''),
|
||||
'isread' => 0,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
}
|
||||
$this->success($op === 'pay' ? '打款成功' : '驳回成功');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户