支持后台用户手动录入个人业绩与账户消耗,独立计算转化指标,接入 DataScope 数据权限。 Co-authored-by: Cursor <cursoragent@cursor.com>
63 lines
2.0 KiB
PHP
63 lines
2.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace app\adminapi\controller\stats;
|
|
|
|
use app\adminapi\controller\BaseAdminController;
|
|
use app\adminapi\lists\stats\PersonalAccountCostLists;
|
|
use app\adminapi\logic\stats\PersonalAccountCostLogic;
|
|
use app\adminapi\validate\stats\PersonalAccountCostValidate;
|
|
|
|
class PersonalAccountCostController extends BaseAdminController
|
|
{
|
|
public function lists()
|
|
{
|
|
return $this->dataLists(new PersonalAccountCostLists());
|
|
}
|
|
|
|
public function add()
|
|
{
|
|
$params = (new PersonalAccountCostValidate())->post()->goCheck('add');
|
|
$result = PersonalAccountCostLogic::add($params, $this->adminId, (string) ($this->adminInfo['name'] ?? ''));
|
|
if ($result === false) {
|
|
return $this->fail(PersonalAccountCostLogic::getError());
|
|
}
|
|
|
|
return $this->success('添加成功', [], 1, 1);
|
|
}
|
|
|
|
public function edit()
|
|
{
|
|
$params = (new PersonalAccountCostValidate())->post()->goCheck('edit');
|
|
$result = PersonalAccountCostLogic::edit($params, $this->adminId, (string) ($this->adminInfo['name'] ?? ''), $this->adminInfo);
|
|
if ($result === false) {
|
|
return $this->fail(PersonalAccountCostLogic::getError());
|
|
}
|
|
|
|
return $this->success('编辑成功', [], 1, 1);
|
|
}
|
|
|
|
public function detail()
|
|
{
|
|
$params = (new PersonalAccountCostValidate())->goCheck('detail');
|
|
$detail = PersonalAccountCostLogic::detail((int) $params['id'], $this->adminId, $this->adminInfo);
|
|
if ($detail === []) {
|
|
return $this->fail('记录不存在或无权查看');
|
|
}
|
|
|
|
return $this->data($detail);
|
|
}
|
|
|
|
public function delete()
|
|
{
|
|
$params = (new PersonalAccountCostValidate())->post()->goCheck('delete');
|
|
$result = PersonalAccountCostLogic::delete((int) $params['id'], $this->adminId, $this->adminInfo);
|
|
if ($result === false) {
|
|
return $this->fail(PersonalAccountCostLogic::getError());
|
|
}
|
|
|
|
return $this->success('删除成功', [], 1, 1);
|
|
}
|
|
}
|