fix: 修改上下个数据返回

This commit is contained in:
lwh 2023-05-10 11:36:28 +08:00
parent 29c3238e85
commit 0fc12ea164
6 changed files with 54 additions and 9 deletions

View File

@ -30,8 +30,8 @@ class CompanyProfile extends BaseController
{
$select = ModelCompanyProfile::field([
'company_profile_img',
'company_profile_color',
'company_profile_content',
'company_profile_order'
])
->order('company_profile_order', 'asc')
->select();

View File

@ -59,6 +59,17 @@ class Classes extends BaseController
->where('classes_id', $params['classes_id'])
->find();
// 上下个数据返回
$last_next = Tool::getLastNextData(
ModelClasses::class,
$find->classes_sort,
[
'field' => ['classes_id', 'classes_name'],
]
);
$find['prve'] = $last_next[0];
$find['next'] = $last_next[1];
return msg(0, '获取班型详情成功!', ['data' => $find]);
}
}

View File

@ -57,6 +57,17 @@ class EnrolIntro extends BaseController
->where('enrol_intro_id', $params['enrol_intro_id'])
->find();
// 上下个数据返回
$last_next = Tool::getLastNextData(
ModelEnrolIntro::class,
$find->enrol_intro_sort,
[
'field' => ['enrol_intro_id', 'enrol_intro_title'],
]
);
$find['prve'] = $last_next[0];
$find['next'] = $last_next[1];
return msg(0, '获取招生简介详情成功!', ['data' => $find]);
}
}

View File

@ -30,8 +30,7 @@ class InfoArticle extends BaseController
'idx|文章类型id' => 'require',
]);
$type = ModelinfoArticleType::
field([
$type = ModelinfoArticleType::field([
'info_article_type_id',
'info_article_type_name' => 'name',
])
@ -40,15 +39,15 @@ class InfoArticle extends BaseController
$params['info_article_type_id'] = null;
foreach ($type as $key => $value) {
if($key == $params['idx']){
if ($key == $params['idx']) {
$params['info_article_type_id'] = $value['info_article_type_id'];
}
}
if(!$params['info_article_type_id']) throwErrorMsg("传值不正确!");
if (!$params['info_article_type_id']) throwErrorMsg("传值不正确!");
$query = ModelinfoArticle::where('b.info_article_type_id',$params['info_article_type_id'])
$query = ModelinfoArticle::where('b.info_article_type_id', $params['info_article_type_id'])
->field([
'a.info_article_id',
'a.info_article_type_guid',
@ -83,6 +82,18 @@ class InfoArticle extends BaseController
->where('info_article_id', $params['info_article_id'])
->find();
// 上下个数据返回
$last_next = Tool::getLastNextData(
ModelinfoArticle::class,
$find->info_article_sort,
[
'field' => ['info_article_id', 'info_article_title'],
]
);
$find['prve'] = $last_next[0];
$find['next'] = $last_next[1];
return msg(0, '获取资讯文章详情成功!', ['data' => $find]);
}
}

View File

@ -34,7 +34,7 @@ class JointAchievement extends BaseController
])
->order('joint_achievement_sort', 'asc');
return msg("获取联考成绩列表成功!",$query);
return msg("获取联考成绩列表成功!", $query);
}
/**
@ -57,6 +57,17 @@ class JointAchievement extends BaseController
->where('joint_achievement_id', $params['joint_achievement_id'])
->find();
// 上下个数据返回
$last_next = Tool::getLastNextData(
ModelJointAchievement::class,
$find->joint_achievement_sort,
[
'field' => ['joint_achievement_id', 'joint_achievement_title'],
]
);
$find['prve'] = $last_next[0];
$find['next'] = $last_next[1];
return msg(0, '获取联考成绩详情成功!', ['data' => $find]);
}
}

View File

@ -107,10 +107,11 @@ class Teachers extends BaseController
]
);
$find['prve'] = $last_next[0];
$find['next'] = $last_next[1];
return msg(0, '获取教师详情成功!', [
'data' => $find,
'last' => $last_next[0],
'next' => $last_next[1],
]);
}
}