Files
huangjingfen/pro_v3.5.1_副本/app/controller/supplier/file/SystemAttachment.php

232 lines
7.1 KiB
PHP
Raw Normal View History

feat(fsgx): 完成全部24项开发任务 Phase1-7 Phase1 后端核心: - 新增 fsgx_v1.sql 迁移脚本(is_queue_goods/frozen_points/available_points/no_assess) - SystemConfigServices 返佣设置扩展(周期人数/分档比例/范围/时机) - StoreOrderCreateServices 周期循环佣金计算 - StoreOrderTakeServices 佣金发放后同步冻结积分 - StoreProductServices/StoreProduct 保存 is_queue_goods Phase2 后端接口: - GET /api/hjf/brokerage/progress 佣金周期进度 - GET /api/hjf/assets/overview 资产总览 - HjfPointsServices 每日 frozen_points 0.4‰ 释放定时任务 - PUT /adminapi/hjf/member/{uid}/no_assess 不考核接口 - GET /adminapi/hjf/points/release_log 积分日志接口 Phase3 前端清理: - hjfCustom.js 路由精简(仅保留 points/log) - hjfQueue.js/hjfMember.js API 清理/重定向至 CRMEB 原生接口 - pages.json 公排→推荐佣金/佣金记录/佣金规则 Phase4-5 前端改造: - queue/status.vue 推荐佣金进度页整体重写 - 商品详情/订单确认/支付结果页文案与逻辑改造 - 个人中心/资产页/引导页/规则页文案改造 - HjfQueueProgress/HjfRefundNotice/HjfAssetCard 组件改造 - 推广中心嵌入佣金进度摘要 - hjfMockData.js 全量更新(公排字段→佣金字段) Phase6 Admin 增强: - 用户列表新增 frozen_points/available_points 列及不考核操作按钮 - hjfPoints.js USE_MOCK=false 对接真实积分日志接口 Phase7 配置文档: - docs/fsgx-phase7-config-checklist.md 后台配置与全链路验收清单 Made-with: Cursor
2026-03-23 22:32:19 +08:00
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\supplier\file;
use app\controller\supplier\AuthController;
use app\services\other\CacheServices;
use app\services\system\admin\SystemAdminServices;
use app\services\system\attachment\SystemAttachmentServices;
use think\annotation\Inject;
/**
* 图片管理类
* Class SystemAttachment
* @package app\controller\store\file
*/
class SystemAttachment extends AuthController
{
/**
* @var SystemAttachmentServices
*/
#[Inject]
protected SystemAttachmentServices $service;
/**
* 显示列表
* @return mixed
*/
public function index()
{
$where = $this->request->getMore([
['pid', 0],
['file_type', 1]
]);
$where['type'] = 4;
$where['relation_id'] = $this->supplierId;
return app('json')->success($this->service->getImageList($where));
}
/**
* 删除指定资源
*
* @param string $ids
* @return \think\Response
*/
public function delete()
{
[$ids] = $this->request->postMore([
['ids', '']
], true);
$this->service->del($ids);
return app('json')->success('删除成功');
}
/**
* 图片上传
* @param int $upload_type
* @param int $type
* @return mixed
*/
public function upload($upload_type = 0, $type = 0)
{
[$pid, $file] = $this->request->postMore([
['pid', 0],
['file', 'file'],
], true);
$res = $this->service->storeUpload((int)$pid, $file, (int)$this->supplierId, 4, $upload_type);
return app('json')->success('上传成功', ['src' => $res]);
}
/**
* 移动图片
* @return mixed
*/
public function moveImageCate()
{
$data = $this->request->postMore([
['pid', 0],
['images', '']
]);
$this->service->move($data);
return app('json')->success('移动成功');
}
/**
* 修改文件名
* @param $id
* @return mixed
*/
public function update($id)
{
$realName = $this->request->post('real_name', '');
if (!$realName) {
return app('json')->fail('文件名称不能为空');
}
$this->service->update($id, ['real_name' => $realName]);
return app('json')->success('修改成功');
}
/**
* 获取上传类型
* @return mixed
*/
public function uploadType()
{
$data['upload_type'] = (string)sys_config('upload_type', 1);
return app('json')->success($data);
}
/**
* 视频分片上传
* @return mixed
*/
public function videoUpload()
{
$data = $this->request->postMore([
['chunkNumber', 0],//第几分片
['currentChunkSize', 0],//分片大小
['chunkSize', 0],//总大小
['totalChunks', 0],//分片总数
['file', 'file'],//文件
['md5', ''],//MD5
['filename', ''],//文件名称
['pid', 0],//分类ID
]);
$fileHandle = $this->request->file($data['file']);
if (!$fileHandle) return $this->fail('上传信息为空');
$res = $this->service->videoUpload($data, $fileHandle, 4, (int)$this->supplierId);
return app('json')->success($res);
}
/**
* 保存云端视频记录
* @return mixed
*/
public function saveVideoAttachment()
{
$data = $this->request->postMore([
['path', ''],//视频地址
['cover_image', ''],//封面地址
['pid', 0],//分类ID
['upload_type', 1],//上传类型
]);
$res = $this->service->saveOssVideoAttachment($data, 4, (int)$this->supplierId, (int)$data['upload_type']);
return app('json')->success($res);
}
/**获取扫码上传页面链接以及参数
* @return \think\Response
*/
public function scanUploadQrcode(CacheServices $services)
{
[$pid] = $this->request->getMore([
['pid', 0]
], true);
$uploadToken = md5(time());
$upload_file_size_max = config('upload.filesize');//文件上传大小kb
$services->setDbCache($this->supplierId . '_supplier_scan_upload', $uploadToken, 68400);
$url = sys_config('site_url') . '/app/upload?pid=' . $pid . '&cache=' . $this->supplierId . '_supplier_scan_upload&type=4&relation_id=' . $this->supplierId . '&upload_file_size_max=' . $upload_file_size_max . '&token=' . $uploadToken;
return app('json')->success(['url' => $url]);
}
/**删除二维码
* @return \think\Response
*/
public function removeUploadQrcode(CacheServices $services)
{
$services->delectDbCache($this->supplierId . '_supplier_scan_upload');
return app('json')->success();
}
/**获取扫码上传的图片数据
* @param $scan_token
* @return \think\Response
*/
public function scanUploadImage($scan_token)
{
return app('json')->success($this->service->scanUploadImage($scan_token));
}
/**网络图片上传
* @return \think\Response
*/
public function onlineUpload()
{
$data = $this->request->postMore([
['pid', 0],
['images', []]
]);
$this->service->onlineUpload($data, 4, (int)$this->supplierId);
return app('json')->success('上传完成');
}
/**获取上传信息
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getAdminsData()
{
/** @var SystemAdminServices $adminServices */
$adminServices = app()->make(SystemAdminServices::class);
$data['is_way'] = $adminServices->value(['id' => $this->supplierId], 'is_way');
$data['upload_file_size_max'] = config('upload.filesize');//文件上传大小kb
return app('json')->success($data);
}
/**保存上传信息
* @param int $is_way
* @return \think\Response
*/
public function setAdminsData(int $is_way = 0)
{
/** @var SystemAdminServices $adminServices */
$adminServices = app()->make(SystemAdminServices::class);
if (!in_array($is_way, [0, 1, 2])) return app('json')->fail('参数有误!');
$res = $adminServices->update($this->supplierId, ['is_way' => $is_way]);
if ($res) return app('json')->success('ok');
else return app('json')->fail('保存失败');
}
}