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
125 lines
4.5 KiB
PHP
125 lines
4.5 KiB
PHP
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||
// +----------------------------------------------------------------------
|
||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||
// +----------------------------------------------------------------------
|
||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||
// +----------------------------------------------------------------------
|
||
// | Author: CRMEB Team <admin@crmeb.com>
|
||
// +----------------------------------------------------------------------
|
||
|
||
namespace crmeb\services;
|
||
|
||
use think\facade\Config;
|
||
use Endroid\QrCode\Color\Color;
|
||
use Endroid\QrCode\Encoding\Encoding;
|
||
use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelLow;
|
||
use Endroid\QrCode\QrCode;
|
||
use Endroid\QrCode\Label\Label;
|
||
use Endroid\QrCode\Logo\Logo;
|
||
use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin;
|
||
use Endroid\QrCode\Writer\PngWriter;
|
||
|
||
/**
|
||
* Class UtilService
|
||
* @package crmeb\services
|
||
*/
|
||
class UtilService
|
||
{
|
||
/**
|
||
* 获取小程序二维码是否生成
|
||
* @param $url
|
||
* @return array
|
||
*/
|
||
public static function remoteImage($url)
|
||
{
|
||
$curl = curl_init();
|
||
curl_setopt($curl, CURLOPT_URL, $url);
|
||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||
$result = curl_exec($curl);
|
||
$result = json_decode($result, true);
|
||
if (is_array($result)) return ['status' => false, 'msg' => $result['errcode'] . '---' . $result['errmsg']];
|
||
return ['status' => true];
|
||
}
|
||
|
||
/**
|
||
* 修改 https 和 http 移动到common
|
||
* @param $url $url 域名
|
||
* @param int $type 0 返回https 1 返回 http
|
||
* @return string
|
||
*/
|
||
public static function setHttpType($url, $type = 0)
|
||
{
|
||
$domainTop = substr($url, 0, 5);
|
||
if ($type) {
|
||
if ($domainTop == 'https') $url = 'http' . substr($url, 5, strlen($url));
|
||
} else {
|
||
if ($domainTop != 'https') $url = 'https:' . substr($url, 5, strlen($url));
|
||
}
|
||
return $url;
|
||
}
|
||
|
||
|
||
/**
|
||
* 获取二维码
|
||
* @param $url
|
||
* @param $name
|
||
* @return array|bool|string
|
||
*/
|
||
public static function getQRCodePath(string $url, string $name, string $savePath = 'wechat')
|
||
{
|
||
if (!strlen(trim($url)) || !strlen(trim($name))) return false;
|
||
try {
|
||
$uploadType = sys_config('upload_type');
|
||
// 没有选择默认使用本地上传
|
||
if (!$uploadType) $uploadType = 1;
|
||
$uploadType = (int)$uploadType;
|
||
$siteUrl = sys_config('site_url');
|
||
if (!$siteUrl) return '请前往后台设置->系统设置->网站域名 填写您的域名格式为:http://域名';
|
||
$info = [];
|
||
$outfiles = Config::get('qrcode.cache_dir') . '/' . $savePath;
|
||
$root_outfile = root_path('public/' . $outfiles);
|
||
if (!is_dir($root_outfile))
|
||
mkdir($root_outfile, 0777, true);
|
||
|
||
// Create QR code
|
||
$writer = new PngWriter();
|
||
$qrCode = QrCode::create($url)
|
||
->setEncoding(new Encoding('UTF-8'))
|
||
->setErrorCorrectionLevel(new ErrorCorrectionLevelLow())
|
||
->setSize(300)
|
||
->setMargin(10)
|
||
->setRoundBlockSizeMode(new RoundBlockSizeModeMargin())
|
||
->setForegroundColor(new Color(0, 0, 0))
|
||
->setBackgroundColor(new Color(255, 255, 255));
|
||
$writer->write($qrCode)->saveToFile($root_outfile . $name);
|
||
|
||
if ($uploadType === 1) {
|
||
$info["code"] = 200;
|
||
$info["name"] = $name;
|
||
$info["dir"] = '/' . $outfiles . '/' . $name;
|
||
$info["time"] = time();
|
||
$info['size'] = 0;
|
||
$info['type'] = 'image/png';
|
||
$info["image_type"] = 1;
|
||
$info['thumb_path'] = '/' . $outfiles . '/' . $name;
|
||
return $info;
|
||
} else {
|
||
$upload = UploadService::init($uploadType);
|
||
$content = file_get_contents($root_outfile . $name);
|
||
|
||
$res = $upload->to($outfiles)->validate()->stream($content, $name);
|
||
if ($res === false) {
|
||
return $upload->getError();
|
||
}
|
||
$info = $upload->getUploadInfo();
|
||
$info['image_type'] = $uploadType;
|
||
return $info;
|
||
}
|
||
} catch (\Exception $e) {
|
||
return $e->getMessage();
|
||
}
|
||
}
|
||
}
|