增加产品模块
This commit is contained in:
@@ -15,6 +15,8 @@ use think\facade\Env;
|
||||
use think\facade\Request;
|
||||
use app\model\Cms\TemplateSiteConfig;
|
||||
use app\model\Cms\Friendlink;
|
||||
use app\model\Cms\Services;
|
||||
use app\model\Cms\Products;
|
||||
use app\model\Tenant\Tenant;
|
||||
|
||||
class Index extends BaseController
|
||||
@@ -452,7 +454,7 @@ class Index extends BaseController
|
||||
}
|
||||
|
||||
try {
|
||||
// 1. 通过域名获取租户ID
|
||||
// 通过域名获取租户ID
|
||||
$tid = BaseController::getTenantIdByDomain($baseUrl);
|
||||
|
||||
if (empty($tid)) {
|
||||
@@ -463,12 +465,28 @@ class Index extends BaseController
|
||||
]);
|
||||
}
|
||||
|
||||
// 2. 获取站点基础信息 (normalinfos)
|
||||
// 获取站点基础信息 (normalinfos)
|
||||
$normalInfos = SystemSiteSetting::where('tid', $tid)
|
||||
->field('sitename,logo,logow,ico,description,copyright,companyname,icp,companyintroduction')
|
||||
->find();
|
||||
|
||||
// 3. 获取友情链接列表
|
||||
// 获取特色服务列表
|
||||
$servicesList = Services::where('delete_time', null)
|
||||
->where('tid', $tid)
|
||||
->order('sort', 'asc')
|
||||
->field('id,title,desc,thumb,url')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
// 获取企业产品列表
|
||||
$productsList = Products::where('delete_time', null)
|
||||
->where('tid', $tid)
|
||||
->order('sort', 'asc')
|
||||
->field('id,title,desc,content,thumb,url')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
// 获取友情链接列表
|
||||
$friendlinkList = Friendlink::where('delete_time', null)
|
||||
->where('tid', $tid)
|
||||
->where('status', 1)
|
||||
@@ -484,17 +502,18 @@ class Index extends BaseController
|
||||
->field('contact_phone,contact_email,address,worktime')
|
||||
->find();
|
||||
|
||||
// 4. 合并返回
|
||||
// 合并返回
|
||||
return json([
|
||||
'code' => 200,
|
||||
'msg' => 'success',
|
||||
'data' => [
|
||||
'normal' => $normalInfos ?: (object) [],
|
||||
'normal' => $normalInfos ?: (object) [],
|
||||
'contact' => $contact ?: (object) [],
|
||||
'services' => $servicesList,
|
||||
'products' => $productsList,
|
||||
'links' => $friendlinkList
|
||||
]
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return json([
|
||||
'code' => 500,
|
||||
|
||||
Reference in New Issue
Block a user