admin_topics_314

This commit is contained in:
dengbw
2023-03-14 10:36:46 +08:00
committed by lccsw
parent b46362fdf1
commit e8de4c179f
4 changed files with 201 additions and 8 deletions
-2
View File
@@ -14,7 +14,6 @@ Class Topics extends AppBase
private $moduleAry = array(
array('name' => '文本模块', 'tag' => 'text'),
array('name' => '广告模块', 'tag' => 'ad'),
array('name' => '报名模块', 'tag' => 'enroll'),
array("name" => "按钮模块", "tag" => "button")
);
@@ -26,7 +25,6 @@ Class Topics extends AppBase
$this->load->model('topics/topic_module_text_model', 'mdModuleText');
$this->load->model('topics/topic_module_ad_model', 'mdModuleAd');
$this->load->model('topics/topic_module_enroll_model', 'mdModuleEnroll');
$this->load->model('topics/topic_module_enrolldata_model', 'mdModuleEnrolldata');
$this->load->model('topics/topic_module_button_model', 'mdModuleButton');
$this->load->model('topics/topic_user_log_model', 'mdUserLog');
$this->load->model("sys/sys_admin_model", 'mdSysAdmin');
+4 -4
View File
@@ -83,7 +83,7 @@
$("#ad_img_url").attr('src', _img_url);
layer.open({
type: 1,
area: ['50%', '38%'], //宽高
area: ['50%', '33%'], //宽高
content: $('#ad-modal'),
title: _title,
shade: false,
@@ -327,7 +327,7 @@
style="display: none;" type="number" class="form-control"
v-model="item.order_view" placeholder="请输入排序值">
</td>
<td class="text-center" v-if="item.jump_type==1">报名弹窗</td>
<td class="text-center" v-if="item.jump_type==1">授权手机号</td>
<td class="text-center" v-else>{{item.link}}</td>
<td class="text-right">
<a href="javascript:void(0);" style="margin-top:2px;"
@@ -370,7 +370,7 @@
</div>
</div>
</div>
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
<div class="form-group" style="margin-left: 0px;margin-right: 0px;display: none">
<label class="col-sm-2 control-label">跳转</label>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" value="0" v-model="ad_item.jump_type"> 链接</label>
@@ -378,7 +378,7 @@
</div>
<div class="col-sm-8">
<div class="radio"><label><input type="radio" value="1" v-model="ad_item.jump_type">
报名弹窗<span class="f12 clr999">(报名模块需设成弹窗展示)</span></label>
授权手机号</label>
</div>
</div>
</div>
+1 -2
View File
@@ -119,8 +119,7 @@
<div class="radio"><label><input type="radio" value="1" v-model="params.module_type">图片按钮</label></div>
</div>
<div class="col-sm-2">
<div class="radio"><label><input type="radio" value="2" v-model="params.module_type">报名弹窗<span
class="f12 clr999">(报名模块需设成弹窗展示)</span></label></div>
<div class="radio"><label><input type="radio" value="2" v-model="params.module_type">授权手机号</label></div>
</div>
</div>
<div class="form-group">
+196
View File
@@ -0,0 +1,196 @@
<?php
defined('WXAPP_APP') OR exit('No direct script access allowed');
ini_set('display_errors', 'On');
error_reporting(E_ERROR);
require_once APPPATH . 'controllers/wxapp/Wxapp.php';
/**
* Notes:定制专题首页
* Created on: 2023/3/09 14:24
* Created by: dengbw
*/
class Topics extends Wxapp
{
private $cf_id = 7;//自主报名
function __construct($inputs, $app_key)
{
parent::__construct($inputs, $app_key);
$this->login_white = [];//登录白名单
$this->check_status = [];//用户状态校验
$this->check_mobile = [];//需要手机号
$this->check_headimg = [];//授权微信信息
$this->load->model('topics/topics_model', 'mdTopics');
$this->load->model('topics/topic_modules_model', 'mdTopicModules');
$this->load->model('topics/topic_module_text_model', 'mdModuleText');
$this->load->model('topics/topic_module_ad_model', 'mdModuleAd');
$this->load->model('topics/topic_module_button_model', 'mdModuleButton');
$this->load->model('receiver/receiver_clues_model', 'mdReceiverClues');
}
/**
* Notes:专题请情页
* Created on: 2023/3/09 11:26
* Created by: dengbw
* @return array
* @throws Hd_exception
*/
protected function get()
{
$params = $this->input_param();
$id = intval($params['id']);//活动id
$re = $this->mdTopics->get(['id' => $id, 'app_id' => $this->app_id]);
if (!$re) {
throw new Hd_exception('专题不存在', API_CODE_FAIL);
}
$list = $mButton = [];
if ($re['module_ids']) {
$where = is_numeric($re['module_ids']) ? ['id' => $re['module_ids']] : ["id in ({$re['module_ids']})" => null];
$where['status'] = 1;
$res = $this->mdTopicModules->select($where, 'sort desc', 0, 0, 'id,type,jsondata');
foreach ($res as $row_topic) {
$mid = $row_topic['id'];
$type = $row_topic['type'];
$json_topic = json_decode($row_topic['jsondata'], true);
$title_img = "";
$title_icon = "";
if ($json_topic['title_img']) {
$title_img = build_qiniu_image_url($json_topic['title_img']);
} else {
$title_icon = "https://qs.haodian.cn/wechat_app/xingxuanka/special/tt-tip2.png";
}
switch ($type) {
case "ad"://广告
$module = $this->mdModuleAd->get(array('module_id' => $mid));
$module_json = $module['img_json'] ? json_decode($module['img_json'], true) : array();
$ads = [];
foreach ($module_json as $ad) {
$url = strval($ad['link']);
$img = $ad['img'] ? build_qiniu_image_url($ad['img']) : '';
$ads[] = [
'type' => $type,
'img' => $img,
'url' => $url ? $url : '',
'jump_type' => intval($ad['jump_type']),
'title' => $ad['title']
];
}
$title_img = "";
$title_icon = "";
if ($json_topic['title_img']) {
$title_img = build_qiniu_image_url($json_topic['title_img']);
} else {
$title_icon = "https://qs.haodian.cn/wechat_app/xingxuanka/special/tt-tip2.png";
}
$list[] = [
"type" => $type,
'id' => $mid,
'title' => $module['title'] ? $module['title'] : '',
"title_img" => $title_img,
"title_icon" => $title_icon,
"title_color" => $json_topic["title_color"] ? $json_topic["title_color"] : "#fff",//背景色,
"title_bgcolor" => $json_topic["title_bgcolor"] ? $json_topic["title_bgcolor"] : "#fe7c35",//背景色
'bg_img' => $json_topic['bg_img'] ? build_qiniu_image_url($json_topic['bg_img']) : "",
'bg_color' => $json_topic["bg_color"] ? $json_topic["bg_color"] : (2 == $module['style'] ? '#FFF' : ''),
"border_color" => strval($json_topic['border_color']),
'descrip' => $module['descrip'] ? $module['descrip'] : '',
'content' => '',
'style' => $module['style'],
'ads' => $ads,
];
break;
case "text"://文本类型
$module = $this->mdModuleText->get(array('module_id' => $mid));
$list[] = array(
"type" => $type,
'id' => $mid,
'title' => $module['title'] ? $module['title'] : '',
"title_img" => $title_img,
"title_icon" => $title_icon,
"title_color" => $json_topic["title_color"] ? $json_topic["title_color"] : "#fff",//背景色,
"title_bgcolor" => $json_topic["title_bgcolor"] ? $json_topic["title_bgcolor"] : "#ee5b15",//背景色
'bg_img' => $json_topic['bg_img'] ? build_qiniu_image_url($json_topic['bg_img']) : "",
'bg_color' => $json_topic["bg_color"] ? $json_topic["bg_color"] : '#ff0',
"border_color" => strval($json_topic['border_color']),
'descrip' => $module['descrip'] ? $module['descrip'] : '',
'content' => $module['content'] ? $module['content'] : '',
'style' => 0,
'ads' => [],
);
break;
case "button"://按钮类型
$module = $this->mdModuleButton->get(['module_id' => $mid]);
$jsondata = $module['jsondata'] ? json_decode($module['jsondata'], true) : array();
$mButton = [
'url' => $jsondata['url'] ? $jsondata['url'] : '',
'type' => $module['type'],
'title' => $jsondata['title'] ? $jsondata['title'] : '',
'img' => $jsondata['img'] ? build_qiniu_image_url($jsondata['img']) : '',
'color' => $jsondata['color'] ? $jsondata['color'] : '',
'descrip' => $module['descrip'] ? $module['descrip'] : '',
];
break;
default:
}
}
}
$data = [
'id' => $re['id'],
'title' => $re['title'],
'bg_img' => build_qiniu_image_url($re['bg_img']),
'bg_color' => $re['bg_color'],
'list' => $list,
'mButton' => $mButton
];
return $data;
}
/**
* Notes:提交报名资料
* Created on: 2023/3/10 14:24
* Created by: dengbw
* @throws Hd_exception
*/
protected function post()
{
$id = $this->input_param('id');
$mobile = $this->session['mobile'];
$nickname = $this->session['nickname'];
if (!$id || !$mobile) {
throw new Hd_exception('参数错误', API_CODE_INVILD_PARAM);
}
$this->load->library('receiver/clues_entity');
$cf_title = $this->clues_entity->cf_title($this->cf_id);
$log_msg = '用户报名';
$cf_title && $log_msg = "用户通过【{$cf_title}】报名";
$uname = $nickname ? $nickname : '用户';
$row = $this->mdReceiverClues->get(['mobile' => $mobile]);
if ($row) {
$update = ['en_time' => date('Y-m-d H:i:s')];
$this->mdReceiverClues->update($update, ['id' => $row['id']]);
//增加日志
$this->clues_entity->add_log($row['id'], $this->session['uid'], $uname, $log_msg);
throw new Hd_exception('预约报名成功了!', API_CODE_SUCCESS);
}
$add_data = [
'name' => $nickname ? $nickname : '',
'mobile' => $mobile,
'cf_uid' => $this->session['uid'],
'cf_id' => $this->cf_id,
'app_id' => $this->app_id,
'out_id' => $id,
'if_driver' => 1,
'cf_platform' => 'wxapp',
'en_time' => date('Y-m-d H:i:s'),
'c_time' => time()
];
$id = $this->mdReceiverClues->add($add_data);
if ($id) {//增加日志
$this->clues_entity->add_log($id, $this->session['uid'], $uname, $log_msg);
}
throw new Hd_exception('预约报名成功!', API_CODE_SUCCESS);
}
}