64 lines
1.6 KiB
PHP
64 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller\Home;
|
|
|
|
use app\BaseController;
|
|
use app\common\model\WishList\WishList as ModelWishList;
|
|
use app\common\model\LoveStory\LoveStory as ModelLoveStory;
|
|
use app\Request;
|
|
use think\Validate;
|
|
use think\exception\ValidateException;
|
|
use think\facade\Filesystem;
|
|
use app\common\arw\adjfut\src\Excel;
|
|
use app\common\arw\adjfut\src\UploadFile;
|
|
use think\facade\Db;
|
|
use app\common\exception\Tool;
|
|
use think\facade\Env;
|
|
|
|
|
|
class Home extends BaseController
|
|
{
|
|
/**
|
|
* 获取首页数据
|
|
*/
|
|
public function getHomeData(Request $request): array
|
|
{
|
|
$params = $request->param();
|
|
$con = [];
|
|
|
|
$loveStoryList = ModelLoveStory::where($con)
|
|
->field([
|
|
'love_story_id',
|
|
'love_story_title',
|
|
'love_story_author',
|
|
'love_story_place',
|
|
'love_story_date',
|
|
'love_story_cover',
|
|
])
|
|
->order('love_story_sort', 'asc')
|
|
->limit(3)
|
|
->select();
|
|
|
|
|
|
$wishList = ModelWishList::where($con)
|
|
->field([
|
|
'wish_list_id',
|
|
'wish_list_name',
|
|
'wish_list_author',
|
|
'wish_list_status',
|
|
'wish_list_create_time',
|
|
'wish_list_sort'
|
|
])
|
|
->order('wish_list_sort', 'desc')
|
|
->limit(3)
|
|
->select();
|
|
|
|
return msg(0, "获取心愿单列表成功!", [
|
|
'data' => [
|
|
'wishList' => $wishList,
|
|
'loveStoryList' => $loveStoryList
|
|
]
|
|
]);
|
|
}
|
|
}
|