增加门店和轮播

This commit is contained in:
lcc
2024-08-08 16:36:11 +08:00
parent 7236d11dd2
commit 5c2713ae31
5 changed files with 216 additions and 123 deletions
+48 -4
View File
@@ -4,8 +4,9 @@ defined('BASEPATH') or exit('No direct script access allowed');
class SsApi
{
const CF_PLATFORM = "SYSTOPIC";
const CLUES_METHOD = 'openApi/clues';
const STATUS_METHOD = 'openApi/status';
const CLUES_METHOD = 'openApi/clues'; //提交线索
const STATUS_METHOD = 'openApi/status'; //获取报名状态
const BIZ_METHOD = 'openApi/biz'; //门店信息
private $app_id = '1c156bb57cd6984a';
private $sign_key = '71fd71173b776766a2ae1209d9a2c2ed';
private $api_url = 'https://api.haodian.cn/hd/app/'; //空间站报名数据接口
@@ -75,8 +76,8 @@ class SsApi
public function getStatus($out_ids)
{
if(is_array($out_ids)){
$out_ids = implode(',',$out_ids);
if (is_array($out_ids)) {
$out_ids = implode(',', $out_ids);
}
$data = [
'out_ids' => $out_ids,
@@ -112,6 +113,49 @@ class SsApi
}
}
public function getBiz($biz_id, $cache = true)
{
$cacheKey = "SYTSTOPIC_SSAPI_BIZ_{$biz_id}";
$redis = &load_cache();
if ($cache) {
$bizInfo = $redis->get($cacheKey);
if ($bizInfo) {
return ['code' => 1, 'msg' => 'success', 'data' => $bizInfo];
}
}
//数据缓存
$data = [
'biz_id' => $biz_id,
'nonce_str' => random_string('alpha'),
'app_id' => $this->app_id,
];
$data['sign'] = $this->sign($data);
$client = new GuzzleHttp\Client();
$options = [
\GuzzleHttp\RequestOptions::HEADERS => ['Content-Type' => 'application/json'],
];
$url = $this->api_url . self::BIZ_METHOD.'?'.http_build_query($data);
try {
debug_log("[info]#请求地址:" . $url, $this->log_path);
$response = $client->get($url, $options);
debug_log("[info]#返回信息:" . $response->getBody(), $this->log_path);
if ($response->getStatusCode() != 200) {
debug_log("[error]#" . $response->getStatusCode(), $this->log_path);
return ['code' => 0, 'msg' => '网络错误:' . $response->getStatusCode()];
}
$reqInfo = json_decode($response->getBody(), true);
if (!$reqInfo || $reqInfo['code'] != 200) {
$msg = $reqInfo ? $reqInfo['msg'] : '';
return ['code' => 0, 'msg' => '请求失败:' . $msg];
}
$redis->save($cacheKey, $reqInfo['data'], 60 * 60);
return ['code' => 1, 'msg' => 'success', 'data' => $reqInfo['data']];
} catch (Exception $e) {
debug_log("[error]#" . $e->getMessage(), $this->log_path);
return ['code' => 0, 'msg' => $e->getMessage()];
}
}
private function sign($param)
{
unset($param['sign']);
@@ -11,6 +11,7 @@ class Market_sytopic_module_model extends HD_Model
const TYPE_GRID = 4; //网格排列表
const TYPE_HORIZONTAL = 5; // 横排
const TYPE_ARTICLE = 6; // 文章
const TYPE_ENROLL_BANNER = 7; // 报名轮播图
const TYPE_ARRAY = [
// self::TYPE_BANNER => '主图',
@@ -19,6 +20,7 @@ class Market_sytopic_module_model extends HD_Model
self::TYPE_HORIZONTAL => '横排报名',
self::TYPE_SWIPER_BANNER => '轮播图',
self::TYPE_ARTICLE => '富文本',
self::TYPE_ENROLL_BANNER => '横排轮播图',
];
public function __construct()
@@ -28,8 +30,8 @@ class Market_sytopic_module_model extends HD_Model
public function getTopicModelIds($topicId)
{
$where = ['topicId' => $topicId, 'status' => 0];
$modelList = $this->map('id','type',$where, 'sort desc,type asc', 1, 100, 'id,type');
$where = ['topicId' => $topicId, 'status' => 0, 'type!=' => self::TYPE_ENROLL_BANNER];
$modelList = $this->map('id', 'type', $where, 'sort desc,type asc', 1, 100, 'id,type');
return $modelList ?: [];
}
@@ -28,6 +28,30 @@ class Market_sytopic_module_option_model extends HD_Model
return $lists;
}
/**
* 获取头部轮播
* @param $topicId
* @return array
*/
public function getTypeEnrollBannerList($topicId)
{
$this->load->model('market/market_sytopic_module_model');
$moduleModel = new Market_sytopic_module_model();
$modelList = $moduleModel->select(['type'=>$moduleModel::TYPE_ENROLL_BANNER],'','','','id');
$lists = [];
if ($modelList) {
$modelIdsStr = implode(',', array_column($modelList,'id'));
$where = ['topicId' => $topicId, 'status' => 0, "moduleId in ({$modelIdsStr})" => null];
$modelOptionsList = $this->select($where, "FIELD (moduleId,{$modelIdsStr})", 1, 100);
foreach ($modelOptionsList as $item) {
$lists[] = [
'banner' => $item['banner'] ? build_qiniu_image_url($item['banner']) : ''
];
}
}
return $lists;
}
//格式化数据
private function formItem($type, $item)
{
@@ -13,7 +13,9 @@ class Welcome extends Wx
parent::__construct();
$this->load->model('market/Market_sytopic_module_option_model', 'module_option_model');
$this->load->model('market/Market_sytopic_enroll_model', 'sytopic_enroll_model');
$this->load->model('market/market_sylive_organization_model','organization_model');
$this->load->library('qiniu');
$this->load->library("ssApi");
$this->skey = $this->input->get_post('skey');
$param = $this->myencryption->base64url_decode($this->skey);
$this->a_id = intval($param[self::SIGN_TOP_KEY]);//活动id
@@ -38,11 +40,25 @@ class Welcome extends Wx
'isAdmin' => $this->user_model->checkTopicIsAdmin($this->uid, $this->a_id),
'channelName' => $channelRow ? $channelRow['uname'] : '',
'channelHeadImg' => $channelRow['headimg'] ?: 'https://img.liche.cn/liche/market/202407/p_e1065373f27937f69142c28ce975a398.png',
'channelTel' => $channelRow ? $channelRow['mobile'] : '',
'banner' => $jsonData['banner'] ? build_qiniu_image_url($jsonData['banner']) : '',
'bgColor' => $jsonData['bg_color'] ?: '',
];
$moduleLists = $this->module_option_model->getTopicModelOptionsList($this->a_id);
$this->data['modules'] = array_values($moduleLists);
$this->data['logoList'] = $this->module_option_model->getTypeEnrollBannerList($this->a_id);
//获取门店信息
$orgRow = $this->organization_model->get(['organizationId'=>$row['organizationId']]);
$ssBizId = (int)$orgRow['comments'];
$biz = [];
if($ssBizId){
$ssApi = new SsApi();
$req = $ssApi->getBiz($ssBizId);
if($req['code']){
$biz = $req['data'];
}
}
$info['biz'] = $biz;
$this->data['info'] = $info;
//获取配置信息
$wx_info = $this->share_info([], $row);//微信分享
+124 -117
View File
@@ -1,4 +1,4 @@
<link rel="stylesheet" href="/css/h5/market/sytopic/h5.css?20240806">
<link rel="stylesheet" href="/css/h5/market/sytopic/h5.css?20240809">
<body>
<div id="app" style="min-height: 100vh;background-color:<?= $info['bgColor'] ?: '#f6f6f6' ?>" class="relative">
@@ -56,63 +56,72 @@
</div>
<!-- 20240807 信息模块 -->
<div v-if="0" class="card-module-1">
<div v-if="0" class="absolute left-0 top-0 right-0" style="margin-top: -10vw;">
<van-notice-bar left-icon="" background="transparent" color="#f8e26a" :scrollable="false" style="padding-left: 0;">
<van-swipe
vertical
class="notice-swipe"
:autoplay="3000"
:show-indicators="false"
>
<van-swipe-item><span class="font-24 bg-000-op50 ulib-r750 pt5 pb5 pl15 pr15 inline-block"><van-icon name="point-gift" class="mr5"></van-icon>张三1领取了51000元大礼包</span></van-swipe-item>
<van-swipe-item><span class="font-24 bg-000-op50 ulib-r750 pt5 pb5 pl15 pr15 inline-block"><van-icon name="point-gift" class="mr5"></van-icon>张三1领取了51000元大礼包</span></van-swipe-item>
<van-swipe-item><span class="font-24 bg-000-op50 ulib-r750 pt5 pb5 pl15 pr15 inline-block"><van-icon name="point-gift" class="mr5"></van-icon>张三1领取了51000元大礼包</span></van-swipe-item>
</van-swipe>
</van-notice-bar>
</div>
<div class="inner30 pb0">
<div class="fn-flex fn-flex-between fn-flex-middle font-28">
<div class="fn-flex fn-flex-middle fn-flex-item">
<h3 class="font-32 text-middle" style="line-height: 1.4;"><span>汽车之家空间站·厦门站</span><span class="bg-f8e26a inline-block ulib-r750 pl10 pr10 pt2 pb2 font-24 ml10">官方</span></h3>
</div>
<div style="width: 25vw;" class="text-right"><a class="color-999" href="">厦门共2家<van-icon name="arrow" ></van-icon></a></div>
</div>
<div class="fn-flex fn-flex-between fn-flex-middle mt25">
<div>
<p class="font-24">营业时间:08:00-20:00</p>
<div @click.stop="openLocation" class="fn-flex fn-flex-middle color-666 font-24 mt15">
<p class="text-nowrap" style="width: 50vw;">福建省厦门市湖里区翔远福建省厦门市湖里区翔远</p>
<van-icon name="arrow" ></van-icon>
<div class="card-module-1">
<div class="inner30 pb0 mb20">
<div class="fn-flex fn-flex-between fn-flex-middle font-28">
<div class="fn-flex fn-flex-middle fn-flex-item">
<h3 class="font-32 text-middle" style="line-height: 1.4;">
<span>{{info.biz.biz_name}}</span>
<span class="bg-f8e26a inline-block ulib-r750 pl10 pr10 pt2 pb2 font-24 ml10">官方</span>
</h3>
</div>
<!--
<div style="width: 25vw;" class="text-right">
<a class="color-999" href="">
厦门共2家
<van-icon name="arrow"></van-icon>
</a>
</div>
-->
</div>
<div class="fn-flex fn-flex-between fn-flex-middle">
<div>
<div @click.stop="openLocation" class="fn-flex fn-flex-middle color-666 font-24 mt15">
<p class="text-nowrap" style="width: 50vw;">{{info.biz.address}}</p>
<van-icon name="arrow"></van-icon>
</div>
</div>
<div style="margin-top: -20px">
<ul class="fn-flex fn-flex-middle text-center font-24 color-555">
<li class="ml20 mr20">
<a class="color-555" :href="'tel:'+info.channelTel">
<i class="inline-block d-icon-10"></i>
<p>电话</p>
</a>
</li>
<li class="ml20 mr20" @click="showGwEnroll()">
<i class="inline-block d-icon-11"></i>
<p>咨询</p>
</li>
</ul>
</div>
</div>
</div>
<div>
<ul class="fn-flex fn-flex-middle text-center font-24 color-555">
<li class="ml20 mr20"><a class="color-555" href="tel:15000001111"><i class="inline-block d-icon-10"></i><p>电话</p></a></li>
<li class="ml20 mr20" @click="show_signup_agent_bottom=true"><i class="inline-block d-icon-11"></i><p>咨询</p></li>
</ul>
</div>
</div>
</div>
<div v-if="logo_list.length>0" class="mt40">
<div v-if="logo_list.length>4" class="swiper swiperlogo">
<div class="swiper-wrapper">
<div class="swiper-slide" v-for="(item, index) in logo_list" :key="index"><a :href="item.url?item.url:'javascript:void(0)'">
<img :src="item.img" alt="" />
</a></div>
</div>
</div>
<div v-else class="ml30">
<ul class="fn-flex fn-flex-middle">
<li class="mr20" v-for="(item, index) in logo_list" :key="index"><a :href="item.url?item.url:'javascript:void(0)'">
<van-image width="20.8vw" height="27.6vw" :src="item.img"></van-image>
</a></li>
</ul>
<div v-if="logo_list.length>0" class="mt40">
<div v-if="logo_list.length>4" class="swiper swiperlogo">
<div class="swiper-wrapper">
<div class="swiper-slide" v-for="(item, index) in logo_list" :key="index">
<a href="javascript:void(0)">
<img :src="item.banner" alt=""/>
</a>
</div>
</div>
</div>
<div v-else class="ml30">
<ul class="fn-flex fn-flex-middle">
<li class="mr20" v-for="(item, index) in logo_list" :key="index">
<a href="javascript:void(0)">
<van-image width="20.8vw" height="27.6vw" :src="item.banner"></van-image>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<template v-for="(item,k) in modules" v-if="modules">
@@ -405,47 +414,57 @@
</van-popup>
<!-- 报名弹窗 - 底部显示 - 经纪人 20240806 -->
<van-popup v-model="show_signup_agent_bottom" position="bottom" :style="{ 'min-height': '30%', 'background-color': 'transparent' }">
<div class="ulib-rt30 bg-fff fn-flex overflowhidden w100vw" style="margin:0;">
<div class="fn-flex fn-flex-center fn-flex-middle wp30" style="flex-direction: column;background-image: linear-gradient(to bottom, #f7f2ca,#fbfae8);">
<div class="text-center pl5 pr5" style="width: 100%;">
<van-image class="bds-2-fff" round width="12vw" height="12vw" src="https://img01.yzcdn.cn/vant/cat.jpeg"></van-image>
<p class="font-28 mt10 text-nowrap">林则徐林则徐林则徐林则徐林则徐林则徐</p>
</div>
<div class="text-center pl5 pr5 mt50" style="width: 100%;">
<span class="bg-fff ulib-r750 inline-block pt5 pb5 pl15 pr15 font-24">成交经纪人</span>
<p class="font-22 mt10 color-888 text-nowrap">厦门汽车空间站</p>
</div>
</div>
<div class="inner30 fn-flex-item">
<h3 class="text-center font-36 pt10 pb10 mb15">百城车展焕新季</h3>
<div class="box-shadow-darkGray inner10 ulib-r20 mb30 relative" style="background-color: #fffff8;">
<div class="fn-flex fn-flex-center fn-flex-middle">
<div class="wp33">
<van-image src="/img/car.png"></van-image>
</div>
<div class=" ml20 fn-flex fn-flex-center" style="flex-direction: column;">
<h3 class="font-32 text-nowrap">蔚来ES7</h3>
<p class="ulib-r750 color-888 font-22 mt10"><span>指导价</span><span class="ml5">13.36 - 17.39</span></p>
</div>
<van-popup v-model="show_signup_agent_bottom" position="bottom"
:style="{ 'min-height': '30%', 'background-color': 'transparent' }">
<div class="ulib-rt30 bg-fff fn-flex overflowhidden w100vw" style="margin:0;">
<div class="fn-flex fn-flex-center fn-flex-middle wp30"
style="flex-direction: column;background-image: linear-gradient(to bottom, #f7f2ca,#fbfae8);">
<div class="text-center pl5 pr5" style="width: 100%;">
<van-image class="bds-2-fff" round width="12vw" height="12vw"
:src="info.channelHeadImg"></van-image>
<p class="font-28 mt10 text-nowrap">{{info.channelName}}</p>
</div>
<div class="text-center pl5 pr5 mt50" style="width: 100%;">
<span class="bg-fff ulib-r750 inline-block pt5 pb5 pl15 pr15 font-24">成交经纪人</span>
<p class="font-22 mt10 color-888 text-nowrap">厦门汽车空间站</p>
</div>
</div>
<div class="inner30 fn-flex-item">
<h3 class="text-center font-36 pt10 pb10 mb15">百城车展焕新季</h3>
<div class="box-shadow-darkGray inner10 ulib-r20 mb30 relative" style="background-color: #fffff8;">
<div class="fn-flex fn-flex-center fn-flex-middle">
<div class="wp33">
<van-image src="/img/car.png"></van-image>
</div>
<div class=" ml20 fn-flex fn-flex-center" style="flex-direction: column;">
<h3 class="font-32 text-nowrap">蔚来ES7</h3>
<p class="ulib-r750 color-888 font-22 mt10"><span>指导价</span><span class="ml5">13.36 - 17.39</span>
</p>
</div>
</div>
<div class="msg-arrow absolute box-middle"></div>
</div>
<div class="bg-f1 ulib-r20 mb30">
<van-field v-model="form.name" label="" placeholder="请输入您的姓名"></van-field>
</div>
<div class="bg-f1 ulib-r20 mb30">
<van-field v-model="form.phone" label="" placeholder="请输入您的常用手机号"></van-field>
</div>
<div class="bg-f1 ulib-r20 mb30">
<van-field v-model="form.code" label="" placeholder="请输入手机验证码">
<template #button>
<p class="color-666 font-26">发送验证码</p>
</template>
</van-field>
</div>
<div>
<button class="btn ulib-r20 bg-f8e26a block font-30 wp100 pt20 pb20 mt50">提交</button>
</div>
</div>
<div class="msg-arrow absolute box-middle"></div>
</div>
<div class="bg-f1 ulib-r20 mb30"><van-field v-model="form.name" label="" placeholder="请输入您的姓名" ></van-field></div>
<div class="bg-f1 ulib-r20 mb30"><van-field v-model="form.phone" label="" placeholder="请输入您的常用手机号" ></van-field></div>
<div class="bg-f1 ulib-r20 mb30"><van-field v-model="form.code" label="" placeholder="请输入手机验证码" >
<template #button>
<p class="color-666 font-26">发送验证码</p>
</template>
</van-field></div>
<div>
<button class="btn ulib-r20 bg-f8e26a block font-30 wp100 pt20 pb20 mt50">提交</button>
</div>
</div>
</div>
</van-popup>
</div>
@@ -479,25 +498,7 @@
counttime: 60000,
show_retry: false,
showType: 1, // 1 活动标题 2立即咨询
logo_list: [{ // 品牌logo 20240807
img: '/img/logo-1.png',
url: 'http://www.baidu.com'
},{
img: '/img/logo-2.png',
url: ''
},{
img: '/img/logo-2.png',
url: ''
},{
img: '/img/logo-2.png',
url: ''
},{
img: '/img/logo-2.png',
url: ''
},{
img: '/img/logo-2.png',
url: ''
}],
logo_list: <?=json_encode($logoList);?>,
location_info: { // 地理位置信息 20240807
lat: 23.099994,
lng: 113.324520,
@@ -507,9 +508,15 @@
}
},
mounted() {
// this.initSwpier(); // 20240807
this.initSwpier(); // 20240807
},
methods: {
showGwEnroll(){
this.showPopChannel = true
this.showPopCarInfo = false
this.show_signup_bottom = true
this.showType = 1
},
showEnroll(type, row, showPopChannel, showType) {
this.showPopChannel = false
this.showPopCarInfo = false
@@ -603,8 +610,8 @@
bindCarPrev() {
this.$refs.carswiper.prev();
},
initSwpier(){ //品牌logo轮播初始化 20240807
if(this.logo_list.length>4){
initSwpier() { //品牌logo轮播初始化 20240807
if (this.logo_list.length > 4) {
var swiper = new Swiper(".swiperlogo", {
slidesPerView: 4,
spaceBetween: 10,
@@ -618,8 +625,8 @@
});
}
},
openLocation(){ //打开地图位置 20240807
if(this.location_info.lat&&this.location_info.lng){
openLocation() { //打开地图位置 20240807
if (this.location_info.lat && this.location_info.lng) {
wx.openLocation({
latitude: this.location_info.lat,
longitude: this.location_info.lng,