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
305 lines
9.3 KiB
PHP
305 lines
9.3 KiB
PHP
<?php
|
||
/**
|
||
* +----------------------------------------------------------------------
|
||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||
* +----------------------------------------------------------------------
|
||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||
* +----------------------------------------------------------------------
|
||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||
* +----------------------------------------------------------------------
|
||
* | Author: CRMEB Team <admin@crmeb.com>
|
||
* +----------------------------------------------------------------------
|
||
*/
|
||
|
||
namespace crmeb\services\wechat\client\miniprogram;
|
||
|
||
|
||
use crmeb\services\wechat\client\BaseClient;
|
||
use EasyWeChat\Kernel\HttpClient\Response;
|
||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||
use Symfony\Contracts\HttpClient\ResponseInterface;
|
||
|
||
/**
|
||
* 直播
|
||
* Class LiveClient
|
||
* @author 等风来
|
||
* @email 136327134@qq.com
|
||
* @date 2023/9/15
|
||
* @package crmeb\services\wechat\client\miniprogram
|
||
*/
|
||
class LiveClient extends BaseClient
|
||
{
|
||
/**
|
||
* 添加直播间参数
|
||
* @var array
|
||
*/
|
||
protected array $createData = [
|
||
'name' => '', // 房间名字
|
||
'coverImg' => '', // 通过 uploadfile 上传,填写 mediaID
|
||
'startTime' => 0, // 开始时间
|
||
'endTime' => 0, // 结束时间
|
||
'anchorName' => '', // 主播昵称
|
||
'anchorWechat' => '', // 主播微信号
|
||
'shareImg' => '', //通过 uploadfile 上传,填写 mediaID
|
||
'feedsImg' => '', //通过 uploadfile 上传,填写 mediaID
|
||
'isFeedsPublic' => 1, // 是否开启官方收录,1 开启,0 关闭
|
||
'type' => 1, // 直播类型,1 推流 0 手机直播
|
||
'screenType' => 0, // 1:横屏 0:竖屏
|
||
'closeLike' => 0, // 是否 关闭点赞 1 关闭
|
||
'closeGoods' => 0, // 是否 关闭商品货架,1:关闭
|
||
'closeComment' => 0, // 是否开启评论,1:关闭
|
||
'closeReplay' => 1, // 是否关闭回放 1 关闭
|
||
'closeShare' => 0, // 是否关闭分享 1 关闭
|
||
'closeKf' => 0 // 是否关闭客服,1 关闭
|
||
];
|
||
|
||
/**
|
||
* 获取直播房间
|
||
* @param int $start
|
||
* @param int $limit
|
||
* @return Response|ResponseInterface
|
||
* @throws TransportExceptionInterface
|
||
* @author 等风来
|
||
* @email 136327134@qq.com
|
||
* @date 2023/9/15
|
||
*/
|
||
public function getRooms(int $start = 0, int $limit = 10): ResponseInterface|Response
|
||
{
|
||
$params = [
|
||
'start' => $start,
|
||
'limit' => $limit,
|
||
];
|
||
|
||
return $this->api->postJson('wxa/business/getliveinfo', $params);
|
||
}
|
||
|
||
/**
|
||
* 获取直播回放
|
||
* @param int $roomId
|
||
* @param int $start
|
||
* @param int $limit
|
||
* @return Response|ResponseInterface
|
||
* @throws TransportExceptionInterface
|
||
* @author 等风来
|
||
* @email 136327134@qq.com
|
||
* @date 2023/9/15
|
||
*/
|
||
public function getPlaybacks(int $roomId, int $start = 0, int $limit = 10): ResponseInterface|Response
|
||
{
|
||
$params = [
|
||
'action' => 'get_replay',
|
||
'room_id' => $roomId,
|
||
'start' => $start,
|
||
'limit' => $limit,
|
||
];
|
||
|
||
return $this->api->postJson('wxa/business/getliveinfo', $params);
|
||
}
|
||
|
||
/**
|
||
* 创建直播间
|
||
* @param array $data
|
||
* @return Response|ResponseInterface
|
||
* @throws TransportExceptionInterface
|
||
* @author 等风来
|
||
* @email 136327134@qq.com
|
||
* @date 2023/9/15
|
||
*/
|
||
public function createRoom(array $data): ResponseInterface|Response
|
||
{
|
||
$params = array_merge($this->createData, $data);
|
||
return $this->api->postJson('wxaapi/broadcast/room/create', $params);
|
||
}
|
||
|
||
/**
|
||
* 直播间导入商品
|
||
* @param int $room_id
|
||
* @param $ids
|
||
* @return Response|ResponseInterface
|
||
* @throws TransportExceptionInterface
|
||
* @author 等风来
|
||
* @email 136327134@qq.com
|
||
* @date 2023/9/15
|
||
*/
|
||
public function roomAddGoods(int $room_id, $ids): ResponseInterface|Response
|
||
{
|
||
$params = [
|
||
'ids' => $ids,
|
||
'roomId' => $room_id
|
||
];
|
||
return $this->api->postJson('wxaapi/broadcast/room/addgoods', $params);
|
||
}
|
||
|
||
/**
|
||
* 获取商品列表信息
|
||
* @param int $status
|
||
* @param int $page
|
||
* @param int $limit
|
||
* @return Response|ResponseInterface
|
||
* @throws TransportExceptionInterface
|
||
* @author 等风来
|
||
* @email 136327134@qq.com
|
||
* @date 2023/9/15
|
||
*/
|
||
public function getGoodsList(int $status, int $page = 0, int $limit = 30): ResponseInterface|Response
|
||
{
|
||
$params = [
|
||
'offset' => $page * $limit,
|
||
'limit' => $limit,
|
||
'status' => $status
|
||
];
|
||
return $this->api->get('wxaapi/broadcast/goods/getapproved', $params);
|
||
}
|
||
|
||
/**
|
||
* 获取商品详情
|
||
* @param array $ids
|
||
* @return Response|ResponseInterface
|
||
* @throws TransportExceptionInterface
|
||
* @author 等风来
|
||
* @email 136327134@qq.com
|
||
* @date 2023/9/15
|
||
*/
|
||
public function getGooodsInfo(array $ids): ResponseInterface|Response
|
||
{
|
||
$params = [
|
||
'goods_ids' => $ids
|
||
];
|
||
return $this->api->get('wxa/business/getgoodswarehouse', $params);
|
||
}
|
||
|
||
/**
|
||
* 商品添加并审核
|
||
* @param string $coverImgUrl
|
||
* @param string $name
|
||
* @param int $priceType
|
||
* @param string $url
|
||
* @param string $price
|
||
* @param string $price2
|
||
* @return Response|ResponseInterface
|
||
* @throws TransportExceptionInterface
|
||
* @author 等风来
|
||
* @email 136327134@qq.com
|
||
* @date 2023/9/15
|
||
*/
|
||
public function addGoods(string $coverImgUrl, string $name, int $priceType, string $url, string $price, string $price2 = ''): ResponseInterface|Response
|
||
{
|
||
$params = [
|
||
'goodsInfo' => [
|
||
'coverImgUrl' => $coverImgUrl,
|
||
'name' => $name,
|
||
'priceType' => $priceType,
|
||
'price' => $price,
|
||
'url' => $url
|
||
]
|
||
];
|
||
if ($priceType != 1) $params['goodsInfo']['price2'] = $price2;
|
||
return $this->api->postJson('wxaapi/broadcast/goods/add', $params);
|
||
}
|
||
|
||
/**
|
||
* 撤回审核
|
||
* @param int $goodsId
|
||
* @param int $auditId
|
||
* @return Response|ResponseInterface
|
||
* @throws TransportExceptionInterface
|
||
* @author 等风来
|
||
* @email 136327134@qq.com
|
||
* @date 2023/9/15
|
||
*/
|
||
public function resetauditGoods(int $goodsId, int $auditId): ResponseInterface|Response
|
||
{
|
||
$params = [
|
||
'goodsId' => $goodsId,
|
||
'auditId' => $auditId
|
||
];
|
||
return $this->api->postJson('wxaapi/broadcast/goods/resetaudit', $params);
|
||
}
|
||
|
||
/**
|
||
* 重新提交审核
|
||
* @param int $goodsId
|
||
* @return Response|ResponseInterface
|
||
* @throws TransportExceptionInterface
|
||
* @author 等风来
|
||
* @email 136327134@qq.com
|
||
* @date 2023/9/15
|
||
*/
|
||
public function auditGoods(int $goodsId): ResponseInterface|Response
|
||
{
|
||
$params = [
|
||
'goodsId' => $goodsId
|
||
];
|
||
return $this->api->postJson('wxaapi/broadcast/goods/autdit', $params);
|
||
}
|
||
|
||
/**
|
||
* 删除商品
|
||
* @param int $goodsId
|
||
* @return Response|ResponseInterface
|
||
* @throws TransportExceptionInterface
|
||
* @author 等风来
|
||
* @email 136327134@qq.com
|
||
* @date 2023/9/15
|
||
*/
|
||
public function deleteGoods(int $goodsId): ResponseInterface|Response
|
||
{
|
||
$params = [
|
||
'goodsId' => $goodsId
|
||
];
|
||
return $this->api->postJson('wxaapi/broadcast/goods/delete', $params);
|
||
}
|
||
|
||
/**
|
||
* 更新商品
|
||
* @param int $goodsId
|
||
* @param string $coverImgUrl
|
||
* @param string $name
|
||
* @param int $priceType
|
||
* @param string $url
|
||
* @param string $price
|
||
* @param string $price2
|
||
* @return Response|ResponseInterface
|
||
* @throws TransportExceptionInterface
|
||
* @author 等风来
|
||
* @email 136327134@qq.com
|
||
* @date 2023/9/15
|
||
*/
|
||
public function updateGoods(int $goodsId, string $coverImgUrl, string $name, int $priceType, string $url, string $price, string $price2 = ''): ResponseInterface|Response
|
||
{
|
||
$params = ['goodsInfo' => [
|
||
'goodsId' => $goodsId,
|
||
'coverImgUrl' => $coverImgUrl,
|
||
'name' => $name,
|
||
'priceType' => $priceType,
|
||
'price' => $price,
|
||
'url' => $url
|
||
]];
|
||
if ($priceType != 1) $params['goodsInfo']['price2'] = $price2;
|
||
return $this->api->postJson('wxaapi/broadcast/goods/update', $params);
|
||
}
|
||
|
||
/**
|
||
* 获取成员列表
|
||
* @param int $role
|
||
* @param int $page
|
||
* @param int $limit
|
||
* @param string $keyword
|
||
* @return Response|ResponseInterface
|
||
* @throws TransportExceptionInterface
|
||
* @author 等风来
|
||
* @email 136327134@qq.com
|
||
* @date 2023/9/15
|
||
*/
|
||
public function getRoleList(int $role = 2, int $page = 0, int $limit = 30, string $keyword = ''): ResponseInterface|Response
|
||
{
|
||
$params = [
|
||
'role' => $role,
|
||
'offset' => $page * $limit,
|
||
'limit' => $limit,
|
||
'keyword' => $keyword
|
||
];
|
||
return $this->api->get('wxaapi/broadcast/role/getrolelist', $params);
|
||
}
|
||
}
|