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
162 lines
4.6 KiB
PHP
162 lines
4.6 KiB
PHP
<?php
|
||
declare (strict_types=1);
|
||
|
||
namespace app\services\user\channel;
|
||
|
||
use app\dao\user\channel\ChannelMerchantIdentityDao;
|
||
use app\dao\user\UserBillDao;
|
||
use app\services\BaseServices;
|
||
use crmeb\exceptions\AdminException;
|
||
use crmeb\services\FormBuilder as Form;
|
||
use think\annotation\Inject;
|
||
use think\facade\Route as Url;
|
||
|
||
/**
|
||
* 采购商身份服务
|
||
* Class ChannelMerchantIdentityServices
|
||
* @package app\services\user\channel
|
||
* @mixin ChannelMerchantIdentityDao
|
||
*/
|
||
class ChannelMerchantIdentityServices extends BaseServices
|
||
{
|
||
/**
|
||
* @var ChannelMerchantIdentityDao
|
||
*/
|
||
#[Inject]
|
||
protected ChannelMerchantIdentityDao $dao;
|
||
|
||
|
||
/**
|
||
* 获取采购商身份列表
|
||
* @param array $where
|
||
* @return array
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
*/
|
||
public function getList(array $where)
|
||
{
|
||
[$page, $limit] = $this->getPageValue();
|
||
$list = $this->dao->getList($where, $page, $limit);
|
||
$count = $this->dao->count($where);
|
||
return compact('list', 'count');
|
||
}
|
||
|
||
/**
|
||
* 获取所有采购商身份
|
||
* @param array $where
|
||
* @return array
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
*/
|
||
public function getAllIdentities(array $where = [])
|
||
{
|
||
$where['is_del'] = 0;
|
||
return $this->dao->search($where,false)->column('name,id');
|
||
}
|
||
|
||
/**
|
||
* 添加采购商身份
|
||
* @param array $data
|
||
* @return bool
|
||
*/
|
||
public function add(array $data)
|
||
{
|
||
if ($this->dao->isNameExist($data['name'])) {
|
||
throw new AdminException('该身份名称已存在');
|
||
}
|
||
// if ($this->dao->isLevelExist($data['level'])) {
|
||
// throw new AdminException('该等级已存在');
|
||
// }
|
||
$data['add_time'] = time();
|
||
$res = $this->dao->save($data);
|
||
return $res != false;;
|
||
}
|
||
|
||
/**
|
||
* 编辑采购商身份
|
||
* @param int $id
|
||
* @param array $data
|
||
* @return bool
|
||
*/
|
||
public function edit(int $id, array $data)
|
||
{
|
||
if ($this->dao->isNameExist($data['name'], $id)) {
|
||
throw new AdminException('该身份名称已存在');
|
||
}
|
||
// if ($this->dao->isLevelExist($data['level'], $id)) {
|
||
// throw new AdminException('该等级已存在');
|
||
// }
|
||
$res = $this->dao->update($id, $data);
|
||
return $res != false;
|
||
}
|
||
|
||
/**
|
||
* 删除采购商身份
|
||
* @param int $id
|
||
* @return bool
|
||
*/
|
||
public function delete(int $id)
|
||
{
|
||
return $this->dao->delete($id);
|
||
}
|
||
|
||
/**
|
||
* 获取采购商身份表单
|
||
* @param array $data
|
||
* @return array
|
||
* @throws \FormBuilder\Exception\FormBuilderException
|
||
*/
|
||
public function getForm(array $data = [])
|
||
{
|
||
$f = [];
|
||
$f[] = Form::input('name', '身份名称:', $data['name'] ?? '')->required();
|
||
$f[] = Form::number('discount', '享受折扣:', $data['discount'] ?? 100)->info('采购商采购商品的折扣(1-100)例:95折输入95')->min(0)->max(100)->precision(0)->required();
|
||
$f[] = Form::radio('is_show', '是否显示:', $data['is_show'] ?? 1)->options([
|
||
['label' => '显示', 'value' => 1],
|
||
['label' => '隐藏', 'value' => 0],
|
||
]);
|
||
return $f;
|
||
}
|
||
|
||
/**
|
||
* 获取创建数据表单
|
||
* @param int $id
|
||
* @return array
|
||
* @throws \FormBuilder\Exception\FormBuilderException
|
||
*/
|
||
public function createForm(int $id = 0)
|
||
{
|
||
if ($id) {
|
||
$info = $this->dao->get($id);
|
||
$info = $info ? $info->toArray() : [];
|
||
$action = Url::buildUrl('/channel/identity/' . $id)->build();
|
||
$title = '编辑采购商身份';
|
||
$method = 'PUT';
|
||
} else {
|
||
$info = [];
|
||
$action = Url::buildUrl('/channel/identity')->build();
|
||
$title = '添加采购商身份';
|
||
$method = 'POST';
|
||
}
|
||
return create_form($title, $this->getForm($info), $action, $method);
|
||
}
|
||
|
||
/**
|
||
* 设置状态
|
||
* @param int $id
|
||
* @param int $status
|
||
* @return \crmeb\basic\BaseModel
|
||
* User: liusl
|
||
* DateTime: 2025/3/27 上午9:59
|
||
*/
|
||
public function setStatus(int $id, int $status)
|
||
{
|
||
if (!$id) {
|
||
return $this->fail('参数错误');
|
||
}
|
||
return $this->dao->update($id, ['is_show' => $status]);
|
||
}
|
||
}
|