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 @@
| 活动id | +参与用户 | +模板标题 | +填写内容 | +报名时间 | +
|---|---|---|---|---|
| {php echo $row['activities_id'];} | +
+ {if $row['avatar']}
+ |
+ {php echo $row['template_title'];} | +{php echo $row['form_data'];} | +{php echo $row['create_time'];} | +