You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.9 KiB
85 lines
2.9 KiB
<?php
|
|
namespace app\controller;
|
|
|
|
use app\BaseController;
|
|
use app\model\AwardsRecords;
|
|
use app\model\RotationChart;
|
|
use app\model\User as UserModel;
|
|
use think\facade\Request;
|
|
|
|
class Index extends BaseController
|
|
{
|
|
public function index()
|
|
{
|
|
return '<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:) </h1><p> ThinkPHP V' . \think\facade\App::version() . '<br/><span style="font-size:30px;">14载初心不改 - 你值得信赖的PHP框架</span></p><span style="font-size:25px;">[ V6.0 版本由 <a href="https://www.yisu.com/" target="yisu">亿速云</a> 独家赞助发布 ]</span></div><script type="text/javascript" src="https://tajs.qq.com/stats?sId=64890268" charset="UTF-8"></script><script type="text/javascript" src="https://e.topthink.com/Public/static/client.js"></script><think id="ee9b1aa918103c4fc"></think>';
|
|
}
|
|
|
|
public function hello($name = 'ThinkPHP6')
|
|
{
|
|
return 'hello,' . $name;
|
|
}
|
|
|
|
/**
|
|
* 轮播图
|
|
*/
|
|
public function rotationChart()
|
|
{
|
|
|
|
$data = Request::param();
|
|
|
|
$limit = $data['limit'] ?? 11;
|
|
|
|
$RotationChart = new RotationChart();
|
|
|
|
$list = $RotationChart
|
|
->field('image,url')
|
|
->where('status',1)
|
|
->order('create_time desc')
|
|
->paginate($limit);
|
|
|
|
$data = $list->toArray()['data'];
|
|
|
|
foreach ($data as &$item) {
|
|
$item['image'] = get_image_url($item['image']);
|
|
$item['url'] = get_jump_url($item['url']);
|
|
}
|
|
|
|
return $this->renderSuccess('数据返回成功',[
|
|
'list' => $data,
|
|
'total' => $list->total()
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 获取首页中间记录
|
|
* @return array
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function awardRecords()
|
|
{
|
|
|
|
$data = Request::param();
|
|
|
|
$limit = $data['limit'] ?? 10;
|
|
|
|
$records = new AwardsRecords();
|
|
|
|
$list = $records->field('user_id,awards_amount')->order('create_time desc')->paginate($limit);
|
|
|
|
$data = $list->toArray()['data'];
|
|
|
|
foreach ($data as &$item) {
|
|
$item['user_id'] .= "XX";
|
|
$user = UserModel::field('phone')->find($item['user_id']);
|
|
$item['phone'] = format_phone_number($user['phone']);
|
|
$item['awards_amount'] = number_format($item['awards_amount']);
|
|
}
|
|
|
|
return $this->renderSuccess('数据返回成功',[
|
|
'list' => $data,
|
|
'total' => $list->total()
|
|
]);
|
|
}
|
|
}
|
|
|