Files
ntonpower/app/index/model/Join.php
2026-10-14 14:00:29 +08:00

70 lines
2.0 KiB
PHP

<?php
declare (strict_types = 1);
namespace app\index\model;
/**
*
*/
class Join extends BaseModel
{
/**
* 获取首页品牌矩阵
* @param $data
* @param $languageId
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getJoinList($languageId,$data):array
{
$where = [
'site_id' => $languageId,
'status' => 0,
];
if (isset($data['join_type_id']) && $data['join_type_id'] != 0) {
$where['join_type_id'] = $data['join_type_id'];
}
return $this->where($where)->order('sort','desc')->select()->toArray();
}
/**
* 获取品牌矩阵分类
* @param $languageId
* @param $data
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getJoinTypeList($languageId,$data):array
{
$result = JoinType::where('site_id',$languageId)->select()->toArray();
if (!empty($result)) {
foreach ($result as $key => $item) {
$result[$key]['is_display'] = !empty($data) ? isset($data['join_type_id']) && $data['join_type_id'] == $item['id'] : $item['id'] == 0;
}
return $result;
}
return [];
}
/**
* @param $languageId
* @param $data
* @return array|string[]
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getJoinBanner($languageId,$data):array
{
$space = AdvertiseSpace::where('name',$data)->select()->toArray();
if (!empty($space)) {
return $this->getBanner($languageId,$space[0]['id']);
}
return ['image' => ''];
}
}