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.

80 lines
1.8 KiB

<?php
namespace app\project\logic;
use app\project\model\ProjectQuestionConfig;
use app\project\model\ProjectQuestion;
class Question extends Base
{
/**
* 常见问题-轮播图+客服
* @date 2022-12-16
*/
public function getQuestionConfig()
{
$config_model = new ProjectQuestionConfig();
// 查找设置
$data = $config_model->getOneData([
['uid', '=', $this->mid]
], 'carousel,service_hotline,service_time');
// 轮播图
$carousel = [];
foreach ($data['carousel'] as $k=>$v){
$carousel[$k]['image'] = $v['img_path'];
$carousel[$k]['link_url'] = $v['url'];
}
return sendSuccessArray([
'carousel' => $carousel,
'service_hotline' => $data['service_hotline'],
'service_time' => $data['service_time']
]);
}
/**
* 获取列表
* @param int $page 第X页
* @date 2022-12-16
*/
public function listQuestion($page)
{
$question_model = new ProjectQuestion();
$where = [
['uid', '=', $this->mid],
// 已发布
['is_publish', '=', 1],
];
$list = $question_model->getDataList($where, $page, 'id,title', 'id desc', 20);
return sendSuccessArray([
// 列表
'list' => $list
]);
}
/**
* 常见问题--详情
* @param int $question_id 问题ID
* @date 2022-12-16
*/
public function getQuestion($question_id)
{
$question_model = new ProjectQuestion();
$where = [
['id', '=', $question_id]
];
$data = $question_model->getOneData($where, 'id,title,content');
return sendSuccessArray([
// 常见问题
'question' => $data
]);
}
}