98 lines
2.3 KiB
PHP
98 lines
2.3 KiB
PHP
<?php
|
|
namespace app\api\controller;
|
|
|
|
use app\api\logic\ItemLogic;
|
|
use app\api\validate\{ItemValidate};
|
|
|
|
use app\api\lists\item\{ItemRecordLists};
|
|
|
|
|
|
/**
|
|
* 项目控制器
|
|
* Class ItemController
|
|
* @package app\shopapi\controller
|
|
*/
|
|
class ItemController extends BaseApiController
|
|
{
|
|
|
|
/**
|
|
* @notes 首页数据
|
|
* @return Json
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @author BD
|
|
* @date 2024/02/22 10:54
|
|
*/
|
|
public function index()
|
|
{
|
|
$params = $this->request->get();
|
|
$params['user_id'] = $this->userId;
|
|
$result = ItemLogic::getIndexData($params);
|
|
return $this->data($result);
|
|
}
|
|
|
|
/**
|
|
* @notes 项目详情
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/02/22 10:54
|
|
*/
|
|
public function detail()
|
|
{
|
|
$params = $this->request->get();
|
|
$params['user_id'] = $this->userId;
|
|
$result = ItemLogic::detail($params);
|
|
if (false === $result) {
|
|
return $this->fail(ItemLogic::getError());
|
|
}
|
|
return $this->data($result);
|
|
}
|
|
|
|
/**
|
|
* @notes 合同详情
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/02/22 10:54
|
|
*/
|
|
public function contract()
|
|
{
|
|
$params = $this->request->get();
|
|
$params['user_id'] = $this->userId;
|
|
$result = ItemLogic::contract($params);
|
|
if (false === $result) {
|
|
return $this->fail(ItemLogic::getError());
|
|
}
|
|
return $this->data($result);
|
|
}
|
|
|
|
/**
|
|
* @notes 投资
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/02/22 10:54
|
|
*/
|
|
public function invest()
|
|
{
|
|
$params = (new ItemValidate())->post()->goCheck('invest', [
|
|
'user_id' => $this->userId,
|
|
]);
|
|
$result = ItemLogic::invest($params);
|
|
if (false === $result) {
|
|
return $this->fail(ItemLogic::getError());
|
|
}
|
|
return $this->data($result);
|
|
}
|
|
|
|
/**
|
|
* @notes 投资记录
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/2/23 18:55
|
|
*/
|
|
public function recordLists()
|
|
{
|
|
return $this->dataLists(new ItemRecordLists());
|
|
}
|
|
|
|
} |