作者 开飞机的舒克

后台修改

<?php
return [
'Title' => '名称',
'Radar_id' => '所属维度',
'User_id' => '所属老师',
'Score' => '积分',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'User.username' => '用户名',
'Radar.title' => '维度名称'
'Title' => '名称',
'Radar_id' => '所属维度',
'User_id' => '所属老师',
'Score' => '积分',
'Createtime' => '创建时间',
'Updatetime' => '更新时间'
];
... ...
<?php
return [
'Item_id' => '项目id',
'Images' => '图片',
'Details' => '详情',
'Is_sift' => '是否为精选',
'Is_sift 0' => '否',
'Is_sift 1' => '是',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'Item.title' => '名称'
];
... ... @@ -25,7 +25,8 @@ class Study extends Model
// 追加属性
protected $append = [
'gender_text'
'gender_text',
'team_rank'
];
... ... @@ -43,7 +44,17 @@ class Study extends Model
return isset($list[$value]) ? $list[$value] : '';
}
public function getTeamRankAttr($value,$data){
$list = $this->where('team_id',$data['team_id'])->order('earn_score','desc')->column('id');
$order = 0;
foreach ($list as $k=> $v){
if($data['id'] == $v){
$order = $k+1;
break;
}
}
return $order;
}
public function grade()
... ...
<?php
namespace app\admin\validate\item;
use think\Validate;
class Details extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
<?php
namespace app\api\controller;
use app\common\controller\Api;
/**
* 定时任务
* @ApiWeigh (94)
*/
class Crontab extends Api
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = ['*'];
/**
* @ApiTitle (首页)
*/
public function index(){
$res = db('study')->field('earn_score')->select();
function sort($res){
$len = count($res);
for ($i = 0; $i < $len - 1; $i++) {//循环比对的轮数
for ($j = 0; $j < $len - $i - 1; $j++) {//当前轮相邻元素循环对比
if ($res[$j] < $res[$j + 1]) {//如果前边的小于后边的
$tmp = $res[$j];//交换数据
$res[$j] = $res[$j + 1];
$res[$j + 1] = $tmp;
}
}
}
return $res;
}
$this->success('更新成功',sort($res));
}
}
\ No newline at end of file
... ... @@ -59,6 +59,7 @@ class Index extends Api
$list['name'] = $sid['name'];
$list['score_num'] = $v['sum_score'];
$list['rank'] = $k + 1;
break;
}
}
$this->success('获取成功', $list);
... ...
... ... @@ -4935,7 +4935,7 @@
</div>
<div class="col-md-6" align="right">
Generated on 2023-03-11 13:32:27 <a href="./" target="_blank">校园活动</a>
Generated on 2023-03-11 17:28:01 <a href="./" target="_blank">校园活动</a>
</div>
</div>
... ...