feat(stats): 新增自录转化统计模块
支持后台用户手动录入个人业绩与账户消耗,独立计算转化指标,接入 DataScope 数据权限。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\adminapi\controller\stats;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\stats\PersonalYejiLists;
|
||||
use app\adminapi\logic\stats\PersonalYejiLogic;
|
||||
use app\adminapi\validate\stats\PersonalYejiValidate;
|
||||
|
||||
class PersonalYejiController extends BaseAdminController
|
||||
{
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new PersonalYejiLists());
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$params = (new PersonalYejiValidate())->post()->goCheck('add');
|
||||
$result = PersonalYejiLogic::add($params, $this->adminId, (string) ($this->adminInfo['name'] ?? ''));
|
||||
if ($result === false) {
|
||||
return $this->fail(PersonalYejiLogic::getError());
|
||||
}
|
||||
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$params = (new PersonalYejiValidate())->post()->goCheck('edit');
|
||||
$result = PersonalYejiLogic::edit($params, $this->adminId, (string) ($this->adminInfo['name'] ?? ''), $this->adminInfo);
|
||||
if ($result === false) {
|
||||
return $this->fail(PersonalYejiLogic::getError());
|
||||
}
|
||||
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
|
||||
public function detail()
|
||||
{
|
||||
$params = (new PersonalYejiValidate())->goCheck('detail');
|
||||
$detail = PersonalYejiLogic::detail((int) $params['id'], $this->adminId, $this->adminInfo);
|
||||
if ($detail === []) {
|
||||
return $this->fail('记录不存在或无权查看');
|
||||
}
|
||||
|
||||
return $this->data($detail);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$params = (new PersonalYejiValidate())->post()->goCheck('delete');
|
||||
$result = PersonalYejiLogic::delete((int) $params['id'], $this->adminId, $this->adminInfo);
|
||||
if ($result === false) {
|
||||
return $this->fail(PersonalYejiLogic::getError());
|
||||
}
|
||||
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user