From ea623995297856fa5e004cf320d8e905b8819302 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Thu, 26 Oct 2023 15:21:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=A1=E6=81=AF=E8=A1=A8=E5=8D=95=E6=94=B6?= =?UTF-8?q?=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/weliam_smartcity/api/Enroll.php | 112 ++++++++++ .../core/class/FormTemplate.class.php | 51 +++++ .../core/class/Menus_store.class.php | 12 +- .../core/class/Menus_sys.class.php | 8 +- .../core/model/MerchantDataEnt.mod.php | 41 ++++ .../member/campusActivities.ctrl.php | 33 +++ .../campus_activities/commentIndex.html | 4 +- .../member/campus_activities/enroll_list.html | 102 +++++++++ .../member/campus_activities/index.html | 3 + .../web/controller/agentset/diyForm.ctrl.php | 6 +- .../view/default/agentset/diy_form/edit.html | 1 + .../view/default/agentset/diy_form/list.html | 14 +- .../agentset/diy_form/template_config.html | 204 +++++++++--------- 13 files changed, 480 insertions(+), 111 deletions(-) create mode 100644 addons/weliam_smartcity/api/Enroll.php create mode 100644 addons/weliam_smartcity/core/class/FormTemplate.class.php create mode 100644 addons/weliam_smartcity/core/model/MerchantDataEnt.mod.php create mode 100644 addons/weliam_smartcity/sys/view/default/member/campus_activities/enroll_list.html diff --git a/addons/weliam_smartcity/api/Enroll.php b/addons/weliam_smartcity/api/Enroll.php new file mode 100644 index 0000000..9b5d8a8 --- /dev/null +++ b/addons/weliam_smartcity/api/Enroll.php @@ -0,0 +1,112 @@ + $template_type, 'uniacid' => $_W['uniacid'], 'aid' => $_W['aid']]; + + $diyFrom = pdo_getall(PDO_NAME . 'diyform' , $where , ['id','info'],'','create_time desc',1); + if (!$diyFrom) $this->renderError('未设置报名表单'); + + $diyFromInfo = json_decode(base64_decode($diyFrom[0]['info']) , true); + + $data = [ + 'diyform' => $diyFromInfo, //页面的配置信息 + 'template_type' => $template_type, + 'diyformid' => $diyFrom[0]['id'] + ]; + + $this->renderSuccess('数据返回成功',$data); + } + + /** + * 保存填写模板数据 + */ + public function saveDiyForm() + { + global $_W, $_GPC; + + try { + + $mid = $_W['mid']; + $diyformid = $_GPC['diyformid']; + $form_data = $_GPC['form_data']; + $template_type = $_GPC['template_type']; + $activities_id = $_GPC['activities_id']; + + if (empty($diyformid) || !is_numeric($diyformid)) throw new Exception('表单id不能为空'); + if (empty($form_data)) throw new Exception('表单数据不能为空'); + if (empty($template_type)) throw new Exception('模板类型不能为空'); + if (!in_array($template_type,array_keys(FormTemplate::$template_type))) throw new Exception('模板类型数据错误'); + if (empty($activities_id) || !is_numeric($activities_id)) throw new Exception('活动id不能为空'); + + $activitiesData = FormTemplate::getTemplateTableData($template_type,$activities_id); + if (empty($activitiesData)) throw new Exception('该活动不存在'); + + $query = pdo_get(PDO_NAME . 'member_enroll',['template_type' => $template_type,'mid' => $mid,'activities_id' => $activities_id],'id'); + if ($query) throw new Exception('已报名该活动'); + + $diyFormInfo = html_entity_decode($form_data); + $diyFormInfo = base64_encode($diyFormInfo); + + $insert = [ + 'uniacid' => $_W['uniacid'], + 'mid' => $mid, + 'diyformid' => $diyformid, + 'form_data' => $diyFormInfo, + 'template_type' => $template_type, + 'activities_id' => $activities_id, + 'create_time' => date("Y-m-d H:i:s",time()) + ]; + + pdo_insert(PDO_NAME . 'member_enroll',$insert); + + $this->renderSuccess('报名成功'); + } catch (Exception $e) { + $this->renderError($e->getMessage()); + } + } + + /** + * 取消报名 + */ + public function cancelEnroll() + { + global $_W, $_GPC; + + $mid = $_W['mid']; + $enroll_id = $_GPC['enroll_id']; + + if (empty($enroll_id)) $this->renderError('enroll_id is null'); + $query = pdo_get(PDO_NAME . 'member_enroll',['id' => $enroll_id, 'mid' => $mid]); + if (!$query) $this->renderError('报名信息不存在'); + + pdo_delete(PDO_NAME . 'member_enroll',$enroll_id); + + $this->renderSuccess('已取消'); + } + + /** + * 报名列表 + */ + public function getUserEnrollList() + { + global $_W, $_GPC; + + $mid = $_W['mid']; + + + + } +} \ No newline at end of file diff --git a/addons/weliam_smartcity/core/class/FormTemplate.class.php b/addons/weliam_smartcity/core/class/FormTemplate.class.php new file mode 100644 index 0000000..2f24c3a --- /dev/null +++ b/addons/weliam_smartcity/core/class/FormTemplate.class.php @@ -0,0 +1,51 @@ + '校园活动', + 2 => '培训体验课', + 3 => '平台活动' + ]; + + /** + * 模板关联数据表 + * @var string[] + */ + public static $template_relation = [ + 1 => 'member_campus_activities', + 2 => '', + 3 => '' + ]; + + /** + * 获取活动关联id + * @param $template_type + * @param $activities_id + * @return array|false|mixed + */ + public static function getTemplateTableData($template_type,$activities_id) + { + $table_name = self::$template_relation[$template_type]; + if (empty($table_name)) return []; + $res = pdo_get(PDO_NAME . $table_name,['id' => $activities_id]); + return $res ?: []; + } + + /** + * 返回模板信息 + * @param $id + * @param $template_type + * @return array|false|mixed + */ + public static function getDiyFormData($id,$template_type = 1) + { + $res = pdo_get(PDO_NAME . 'diyform',['id' => $id,'template_type' => $template_type]); + return $res ? : []; + } +} \ No newline at end of file diff --git a/addons/weliam_smartcity/core/class/Menus_store.class.php b/addons/weliam_smartcity/core/class/Menus_store.class.php index 0ddcfa5..81572b5 100644 --- a/addons/weliam_smartcity/core/class/Menus_store.class.php +++ b/addons/weliam_smartcity/core/class/Menus_store.class.php @@ -119,12 +119,12 @@ class Menus_store extends Menus { } } - $frames['setting']['title'] = '   设置'; - $frames['setting']['items'] = array(); - $frames['setting']['items']['divform']['url'] = web_url('agentset/diyForm/index'); - $frames['setting']['items']['divform']['title'] = '自定义表单'; - $frames['setting']['items']['divform']['actions'] = ['ac' , 'diyForm' , 'do' , ['index' ,'add', 'edit']]; - $frames['setting']['items']['divform']['active'] = ''; +// $frames['setting']['title'] = '   设置'; +// $frames['setting']['items'] = array(); +// $frames['setting']['items']['divform']['url'] = web_url('agentset/diyForm/index'); +// $frames['setting']['items']['divform']['title'] = '自定义表单'; +// $frames['setting']['items']['divform']['actions'] = ['ac' , 'diyForm' , 'do' , ['index' ,'add', 'edit']]; +// $frames['setting']['items']['divform']['active'] = ''; diff --git a/addons/weliam_smartcity/core/class/Menus_sys.class.php b/addons/weliam_smartcity/core/class/Menus_sys.class.php index c997ccb..23668bc 100644 --- a/addons/weliam_smartcity/core/class/Menus_sys.class.php +++ b/addons/weliam_smartcity/core/class/Menus_sys.class.php @@ -568,10 +568,10 @@ class Menus_sys extends Menus { // $frames['setting']['items']['tags']['actions'] = array('ac', 'agentSetTags', 'do', 'tags'); // $frames['setting']['items']['tags']['active'] = ''; -// $frames['setting']['items']['divform']['url'] = web_url('agentset/diyForm/index'); -// $frames['setting']['items']['divform']['title'] = '自定义表单'; -// $frames['setting']['items']['divform']['actions'] = ['ac' , 'diyForm' , 'do' , ['index' ,'add', 'edit']]; -// $frames['setting']['items']['divform']['active'] = ''; + $frames['setting']['items']['divform']['url'] = web_url('agentset/diyForm/index'); + $frames['setting']['items']['divform']['title'] = '自定义表单'; + $frames['setting']['items']['divform']['actions'] = ['ac' , 'diyForm' , 'do' , ['index' ,'add', 'edit']]; + $frames['setting']['items']['divform']['active'] = ''; // if(IMS_FAMILY == 'wl'){ // $frames['setting']['items']['enclosure']['url'] = web_url('setting/shopset/enclosure'); diff --git a/addons/weliam_smartcity/core/model/MerchantDataEnt.mod.php b/addons/weliam_smartcity/core/model/MerchantDataEnt.mod.php new file mode 100644 index 0000000..e9ea968 --- /dev/null +++ b/addons/weliam_smartcity/core/model/MerchantDataEnt.mod.php @@ -0,0 +1,41 @@ + $storeid]; + + if (!empty($data['cc_id'])) { + $save_data['cc_id'] = $data['cc_id']; + } + if (!empty($data['introduction'])) { + $save_data['introduction'] = $data['introduction']; + } + if (!empty($data['business'])) { + $save_data['business'] = $data['business']; + } + if (!empty($data['advantage'])) { + $save_data['advantage'] = $data['advantage']; + } + + $query = pdo_get(PDO_NAME . 'wlmerchant_merchantdataent',['storeid' => $storeid]); + + if ($query) { + $save_data['update_time'] = date("Y-m-d H:i:s",time()); + + pdo_update(PDO_NAME . 'wlmerchant_merchantdataent',$save_data,['id' => $query['id']]); + } else { + $save_data['create_time'] = date("Y-m-d H:i:s",time()); + + pdo_insert(PDO_NAME . 'wlmerchant_merchantdataent',$save_data); + } + } + +} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/controller/member/campusActivities.ctrl.php b/addons/weliam_smartcity/sys/controller/member/campusActivities.ctrl.php index a02e0c2..8533226 100644 --- a/addons/weliam_smartcity/sys/controller/member/campusActivities.ctrl.php +++ b/addons/weliam_smartcity/sys/controller/member/campusActivities.ctrl.php @@ -198,4 +198,37 @@ class campusActivities_WeliamController { wl_message('删除失败', referer(), 'error'); } + + public function enrollList() + { + global $_W, $_GPC; + + $where = []; + + $where = []; + $pindex = max(1, intval($_GPC['page'])); + $psize = 10; + + if (!empty($_GPC['activities_id'])) $where['activities_id'] = $_GPC['activities_id']; + if (!empty($_GPC['template_type'])) $where['template_type'] = $_GPC['template_type']; + if (!empty($_GPC['title'])) { + $formIdArr = []; + $diyFormData = pdo_getall(PDO_NAME . 'diyform',['title%' => $_GPC['title']],'id'); + foreach ($diyFormData as $diyFormRow) $formIdArr[] = $diyFormRow['id']; + $where['diyformid#'] = $formIdArr ? implode(",",$formIdArr) : '0'; + } + + $enrollData = Util::getNumData("*", PDO_NAME . 'member_enroll', $where, 'id desc', $pindex, $psize, 1); + $list = $enrollData[0]; + $pager = $enrollData[1]; + + foreach ($list as &$item) { + Member::getMemberInfo($item,$item['mid']); + $item['temp_type_str'] = FormTemplate::$template_type[$item['template_type']]; + $diyForm = FormTemplate::getDiyFormData($item['diyformid'],$item['template_type']); + $item['template_title'] = $diyForm ? $diyForm['title'] : ''; + } + + include wl_template('member/campus_activities/enroll_list'); + } } \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/campus_activities/commentIndex.html b/addons/weliam_smartcity/sys/view/default/member/campus_activities/commentIndex.html index 4aa3bfe..713a02e 100644 --- a/addons/weliam_smartcity/sys/view/default/member/campus_activities/commentIndex.html +++ b/addons/weliam_smartcity/sys/view/default/member/campus_activities/commentIndex.html @@ -2,6 +2,7 @@
@@ -15,7 +16,8 @@ - + +
diff --git a/addons/weliam_smartcity/sys/view/default/member/campus_activities/enroll_list.html b/addons/weliam_smartcity/sys/view/default/member/campus_activities/enroll_list.html new file mode 100644 index 0000000..a9e2abe --- /dev/null +++ b/addons/weliam_smartcity/sys/view/default/member/campus_activities/enroll_list.html @@ -0,0 +1,102 @@ +{php include wl_template('common/header');} + + +
+
+ +
+
+ + + + + + + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ + + + + + + + + + + + {loop $list $row} + + + + + + + + {/loop} + +
活动id参与用户模板标题填写内容报名时间
{php echo $row['activities_id'];} + {if $row['avatar']} + + {/if} + {$row['nickname']} + {php echo $row['template_title'];}{php echo $row['form_data'];}{php echo $row['create_time'];}
+
+
+
+ +
+
+ {$pager} +
+
+
+
+ +{php include wl_template('common/footer');} \ No newline at end of file diff --git a/addons/weliam_smartcity/sys/view/default/member/campus_activities/index.html b/addons/weliam_smartcity/sys/view/default/member/campus_activities/index.html index 48ff2fb..01eb312 100644 --- a/addons/weliam_smartcity/sys/view/default/member/campus_activities/index.html +++ b/addons/weliam_smartcity/sys/view/default/member/campus_activities/index.html @@ -18,6 +18,7 @@
@@ -32,6 +33,7 @@ +
@@ -129,6 +131,7 @@ 驳回 {/if} {/if} + 报名记录 编辑 删除 diff --git a/addons/weliam_smartcity/web/controller/agentset/diyForm.ctrl.php b/addons/weliam_smartcity/web/controller/agentset/diyForm.ctrl.php index e49eeb4..15fbe83 100644 --- a/addons/weliam_smartcity/web/controller/agentset/diyForm.ctrl.php +++ b/addons/weliam_smartcity/web/controller/agentset/diyForm.ctrl.php @@ -23,11 +23,14 @@ class DiyForm_WeliamController{ if(is_store()) $where .= " AND a.sid = {$_W['storeid']} "; if($title) $where .= " AND a.title LIKE '%{$title}%'"; //列表信息获取 - $field = "a.id,a.title,a.create_time,a.update_time,b.storename"; + $field = "a.id,a.title,a.create_time,a.update_time,a.template_type,b.storename"; $sql = "SELECT {$field} FROM ".tablename(PDO_NAME."diyform") ." as a LEFT JOIN ".tablename(PDO_NAME."merchantdata") ." as b ON a.sid = b.id {$where}"; $list = pdo_fetchall($sql." ORDER BY a.update_time DESC,a.create_time DESC limit {$pageStart},{$pageIndex}"); + foreach ($list as &$itemVal) { + $itemVal['template_type_title'] = FormTemplate::$template_type[$itemVal['template_type']]; + } //总数信息获取 $countSql = str_replace($field,"count(*)",$sql); $total = pdo_fetchcolumn($countSql); @@ -64,6 +67,7 @@ class DiyForm_WeliamController{ //信息拼装 $params = [ 'title' => $data['base']['title'] ? : '自定义表单', + 'template_type' => $data['base']['template_type'] ? : 1, 'info' => base64_encode(json_encode($data,JSON_UNESCAPED_UNICODE)), 'update_time' => time() ]; diff --git a/addons/weliam_smartcity/web/view/default/agentset/diy_form/edit.html b/addons/weliam_smartcity/web/view/default/agentset/diy_form/edit.html index dd8efca..0b3e72b 100644 --- a/addons/weliam_smartcity/web/view/default/agentset/diy_form/edit.html +++ b/addons/weliam_smartcity/web/view/default/agentset/diy_form/edit.html @@ -475,6 +475,7 @@ base:{ title: '自定义表单',//表单名称 align: 'left', + template_type: 1, }, list:{}, }, diff --git a/addons/weliam_smartcity/web/view/default/agentset/diy_form/list.html b/addons/weliam_smartcity/web/view/default/agentset/diy_form/list.html index bce5f1c..1024b3f 100644 --- a/addons/weliam_smartcity/web/view/default/agentset/diy_form/list.html +++ b/addons/weliam_smartcity/web/view/default/agentset/diy_form/list.html @@ -33,7 +33,8 @@ ID 标题 - 所属商户 + + 模板类型 创建时间 最近编辑 操作 @@ -46,9 +47,16 @@ {$item['title']} {if $item['storename']} - + {else} - + + {/if} + {if $item['template_type'] == 1} + + {elseif $item['template_type'] == 2} + + {elseif $item['template_type'] == 3} + {/if} {php echo date("Y-m-d H:i:s",$item['create_time']);} diff --git a/addons/weliam_smartcity/web/view/default/agentset/diy_form/template_config.html b/addons/weliam_smartcity/web/view/default/agentset/diy_form/template_config.html index 8b7b383..8b0d094 100644 --- a/addons/weliam_smartcity/web/view/default/agentset/diy_form/template_config.html +++ b/addons/weliam_smartcity/web/view/default/agentset/diy_form/template_config.html @@ -9,6 +9,18 @@
+
+
模板类型
+
+
+ +
+
+
标题对齐
@@ -64,18 +76,18 @@
-
-
认证内容显示
-
- - - 当此表单作为商户认证表单时,是否显示把此项内容显示在商户资质中。 -
-
+ + + + + + + + + + + +
@@ -126,18 +138,18 @@
-
-
认证内容显示
-
- - - 当此表单作为商户认证表单时,是否显示把此项内容显示在商户资质中。 -
-
+ + + + + + + + + + + +
@@ -165,18 +177,18 @@
-
-
认证内容显示
-
- - - 当此表单作为商户认证表单时,是否显示把此项内容显示在商户资质中。 -
-
+ + + + + + + + + + + + @@ -204,18 +216,18 @@ -
-
认证内容显示
-
- - - 当此表单作为商户认证表单时,是否显示把此项内容显示在商户资质中。 -
-
+ + + + + + + + + + + + @@ -241,18 +253,18 @@ -
-
认证内容显示
-
- - - 当此表单作为商户认证表单时,是否显示把此项内容显示在商户资质中。 -
-
+ + + + + + + + + + + +
是否必传
@@ -300,18 +312,18 @@
-
-
认证内容显示
-
- - - 当此表单作为商户认证表单时,是否显示把此项内容显示在商户资质中。 -
-
+ + + + + + + + + + + + @@ -368,18 +380,18 @@ -
-
认证内容显示
-
- - - 当此表单作为商户认证表单时,是否显示把此项内容显示在商户资质中。 -
-
+ + + + + + + + + + + + @@ -407,17 +419,17 @@ -
-
认证内容显示
-
- - - 当此表单作为商户认证表单时,是否显示把此项内容显示在商户资质中。 -
-
+ + + + + + + + + + + + \ No newline at end of file