Files
huangjingfen/pro_v3.5.1_副本/app/controller/out/Product.php
apple 434aa8c69d 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

300 lines
9.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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\out;
use app\Request;
use app\services\product\category\StoreProductCategoryServices;
use app\services\product\product\StoreProductServices;
use think\annotation\Inject;
/**
* 商品类
* Class StoreProductController
* @package app\api\controller\store
*/
class Product
{
/**
* 商品services
* @var StoreProductServices
*/
#[Inject]
protected StoreProductServices $productServices;
/**
* 分类services
* @var StoreProductCategoryServices
*/
#[Inject]
protected StoreProductCategoryServices $categoryServices;
/**
* 分类列表
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function categoryList(Request $request)
{
$where = $request->getMore([
['is_show', ''],
['pid', ''],
['cate_name', ''],
]);
$where['pid'] = -2;
$data = $this->categoryServices->getCategoryList($where);
return app('json')->success($data);
}
/**
* 获取分类
* @param $id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function categoryInfo($id)
{
$info = $this->categoryServices->getInfo((int)$id);
return app('json')->success($info);
}
/**
* 新建分类
* @param Request $request
* @return mixed
*/
public function categoryCreate(Request $request)
{
$data = $request->postMore([
['pid', 0],
['cate_name', ''],
['pic', ''],
['big_pic', ''],
['sort', 0],
['is_show', 0]
]);
$cateId = $this->categoryServices->createData($data)->id;
return app('json')->success('添加成功', ['id' => $cateId]);
}
/**
* 修改分类
* @param Request $request
* @param $id
* @return mixed
*/
public function categoryUpdate(Request $request, $id)
{
$data = $request->postMore([
['pid', 0],
['cate_name', ''],
['pic', ''],
['big_pic', ''],
['sort', 0],
['is_show', 0]
]);
$this->categoryServices->editData($id, $data);
return app('json')->success('修改成功');
}
/**
* 删除分类
* @param $id
* @return mixed
*/
public function categoryDelete($id)
{
$this->categoryServices->del((int)$id);
return app('json')->success('删除成功');
}
/**
* 修改分类状态
* @param $id
* @param $is_show
* @return mixed
*/
public function categorySetShow($id, $is_show)
{
$this->categoryServices->setShow($id, $is_show);
return app('json')->success('设置成功');
}
/**
* 商品列表
* @param Request $request
* @return mixed
*/
public function productList(Request $request)
{
$where = $request->getMore([
['cate_id', ''],
['store_name', ''],
['type', 1, '', 'status'],
['is_live', 0],
['is_new', ''],
['is_vip_product', ''],
['is_presale_product', ''],
['store_label_id', '']
]);
$where['is_show'] = 1;
$where['is_del'] = 0;
if ($where['cate_id'] !== '') {
if ($this->categoryServices->value(['id' => $where['cate_id']], 'pid')) {
$where['sid'] = $where['cate_id'];
} else {
$where['cid'] = $where['cate_id'];
}
}
unset($where['cate_id']);
if ($where['store_name']) {//搜索
$where['pid'] = 0;
}
$list = $this->productServices->searchList($where);
foreach ($list['list'] as &$item) {
$item['pages_url'] = '/pages/goods_details/index?id=' . $item['id'];
}
$list['pages_url'] = '/pages/goods/goods_list/index';
return app('json')->success($list);
}
/**
* 新增商品
* @param Request $request
* @param int $id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function productSave(Request $request, int $id = 0)
{
$data = $request->postMore([
['product_type', 0],//商品类型
['supplier_id', 0],//供应商ID
['cate_id', []],
['store_name', ''],
['store_info', ''],
['keyword', ''],
['unit_name', '件'],
['recommend_image', ''],
['slider_image', []],
['is_sub', []],//佣金是单独还是默认
['sort', 0],
['sales', 0],
['ficti', 100],
['give_integral', 0],
['is_show', 0],
['is_hot', 0],
['is_benefit', 0],
['is_best', 0],
['is_new', 0],
['mer_use', 0],
['is_postage', 0],
['is_good', 0],
['description', ''],
['spec_type', 0],
['video_open', 0],
['video_link', ''],
['items', []],
['attrs', []],
['recommend', []],//商品推荐
['activity', []],
['coupon_ids', []],
['label_id', []],
['command_word', ''],
['tao_words', ''],
['type', 0, '', 'is_copy'],
['delivery_type', []],//物流设置
['freight', 1],//运费设置
['postage', 0],//邮费
['temp_id', 0],//运费模版
['recommend_list', []],
['brand_id', []],
['soure_link', ''],
['bar_code', ''],
['code', ''],
['is_support_refund', 1],//是否支持退款
['is_presale_product', 0],//预售商品开关
['presale_time', []],//预售时间
['presale_day', 0],//预售发货日
['is_vip_product', 0],//是否付费会员商品
['product_clear', ['is_general_product']],//商品用户可见,普通,采购商,付费会员可见
['auto_on_time', 0],//自动上架时间
['auto_off_time', 0],//自动下架时间
['custom_form', []],//自定义表单
['store_label_id', []],//商品标签
['ensure_id', []],//商品保障服务区
['specs', []],//商品参数
['specs_id', 0],//商品参数ID
['is_limit', 0],//是否限购
['limit_type', 0],//限购类型
['limit_num', 0],//限购数量
['share_content', ''],//分享文案
['min_qty', 1],//起购数量
['presale_status', 0],//预售结束后状态
['is_send_gift', 0],//商品是否支持送礼
['send_gift_price', 0],//商品送礼附加费用
]);
$this->productServices->saveData($id, $data);
return app('json')->success(!$id ? '保存商品信息成功' : '修改商品信息成功');
}
/**
* 商品详情
* @param $id
* @return mixed
*/
public function productInfo($id)
{
return app('json')->success($this->productServices->getInfo((int)$id));
}
/**
* 设置商品状态
* @param $id
* @param $is_show
* @return mixed
*/
public function productSetShow($id, $is_show)
{
$this->productServices->setShow([$id], $is_show);
return app('json')->success('设置成功');
}
/**
* 同步库存
* @return void
*/
public function uploadStock(Request $request)
{
[$items] = $request->postMore([['items', []]], true);
foreach ($items as $item) {
if (!isset($item['bar_code']) || !isset($item['qty'])) {
return app('json')->fail('请检查属性编码或库存数量');
}
}
if (count($items) > 100) {
return app('json')->fail('同步条数不能超过100');
}
$this->productServices->syncStock($items);
return app('json')->success('操作成功');
}
}