Files
huangjingfen/pro_v3.5.1_副本/app/controller/api/v1/other/Qrcode.php

126 lines
5.7 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\api\v1\other;
use app\Request;
use app\services\order\StoreOrderServices;
use app\services\other\QrcodeServices;
use think\annotation\Inject;
/**
* 登录
* Class Login
* @package app\api\controller
*/
class Qrcode
{
/**
* @var QrcodeServices
*/
#[Inject]
protected QrcodeServices $services;
/**
* 获取商品、秒杀、砍价、分销等海报二维码
* @param Request $request
* @param $type
* @param $id
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getQrcode(Request $request, $type, $id)
{
$id = (int)$id;
$uid = $request->hasMacro('user') ? (int)$request->uid() : 0;
$user = $request->hasMacro('user') ? $request->user() : [];
$is_promoter = $user['is_promoter'] ?? 1;
$name = $third_type = $link = '';
switch ($type) {
case -1://分销
$third_type = 'spread-' . $uid;
$name = 'spread-' . $uid . '_' . $is_promoter . '.jpg';
$link = '/pages/index/index?spid=' . $uid;
break;
case 0://普通商品
$name = 'product_' . $id . '_' . $uid . '_' . $is_promoter . '.jpg';
$third_type = 'product-' . $id . '-' . $uid;
$link = '/pages/goods_details/index?id=' . $id . '&spid=' . $uid;
break;
case 1://秒杀
$time = $request->param('time', '');
$status = $request->param('status', '');
$name = 'seckill_' . $id . '_' . $uid . '.jpg';
$third_type = 'seckill-' . $id . '-' . $uid . '-' . $time . '-' . $status;
$link = '/pages/activity/goods_details/index?type=1&id=' . $id . '&time=' . $time . '&status=' . $status . '&spid=' . $uid;
break;
case 2://砍价
$third_type = 'bargain-' . $id . '-' . $uid;
$name = 'bargain_' . $id . '_' . $uid . '_' . $is_promoter . '.jpg';
$link = '/pages/activity/goods_bargain_details/index?id=' . $id . '&spid=' . $uid;
break;
case 3://拼团
$third_type = 'combination-' . $id . '-' . $uid;
$name = 'combination_' . $id . '_' . $uid . '_' . $is_promoter . '.jpg';
$link = '/pages/activity/goods_details/index?type=3&id=' . $id . '&spid=' . $uid;
break;
case 4://积分
$third_type = 'integral-' . $id . '-' . $uid;
$name = 'integral_' . $id . '_' . $uid . '_' . $is_promoter . '.jpg';
$link = '/pages/activity/goods_details/index?type=4&id=' . $id . '&spid=' . $uid;
break;
case 6://预售
$third_type = 'presale-' . $id . '-' . $uid;
$name = 'presale_' . $id . '_' . $uid . '_' . $is_promoter . '.jpg';
$link = '/pages/activity/goods_details/index?type=6&id=' . $id . '&spid=' . $uid;
break;
case 7://新人专享
$third_type = 'newcomer-' . $id . '-' . $uid;
$name = 'newcomer_' . $id . '_' . $uid . '_' . $is_promoter . '.jpg';
$link = '/pages/activity/goods_details/index?type=7&id=' . $id . '&spid=' . $uid;
break;
case 90://用户码
$code = $user['bar_code'];
$third_type = 'user-' . $code . '-' . $uid;
$name = 'user_' . $code . '_' . $uid . '.jpg';
$id = $code;
$link = '/pages/admin/order_cancellation/index?auth=3&code=' . $code;
break;
case 91://核销码
$order_id = $request->param('order_id', '');
/** @var StoreOrderServices $orderServices */
$orderServices = app()->make(StoreOrderServices::class);
$code = $orderServices->value(['order_id' => $order_id], 'verify_code');
$third_type = 'write-off-' . $code . '-' . $uid;
$name = 'write_off_' . $code . '_' . $uid . '.jpg';
$id = $code;
$link = '/pages/admin/order_cancellation/index?auth=3&code=' . $code;
break;
}
if (sys_config('share_qrcode', 0) && request()->isWechat()) {
if ($type == -1 && sys_config('spread_share_forever', 0)) {
$wechatUrl = $this->services->getForeverQrcode($third_type, $uid)->url;
} else {
$wechatUrl = $this->services->getTemporaryQrcode($third_type, $uid)->url;
}
} else {
$wechatUrl = $this->services->getWechatQrcodePath($name, $link);
}
$routineUrl = $this->services->getRoutineQrcodePath((int)$id, (int)$uid, (int)$type, $name);
return app('json')->success(['routineUrl' => $routineUrl, 'wechatUrl' => $wechatUrl, 'site_name' => sys_config('site_name'), 'nickname' => $user['nickname'] ?? '']);
}
}