diff --git a/addons/weliam_smartcity/api/Enroll.php b/addons/weliam_smartcity/api/Enroll.php index c9ed6fe..8401463 100644 --- a/addons/weliam_smartcity/api/Enroll.php +++ b/addons/weliam_smartcity/api/Enroll.php @@ -64,11 +64,13 @@ class EnrollModuleUniapp extends Uniapp if ($info['is_required'] == '1') { if (empty($info['data'])) throw new Exception($info['title'] . " 为必填项"); } + FormTemplate::serializeTitle($info['data'],$info['title']); $enroll_data[] = [ 'name' => $info['title'], 'value' => $info['data'] ]; } + var_dump($enroll_data);die; if (empty($enroll_data)) throw new Exception('请填写至少一项'); $diyform = pdo_get(PDO_NAME . 'diyform',['id' => $diyformid],'info'); diff --git a/addons/weliam_smartcity/core/class/FormTemplate.class.php b/addons/weliam_smartcity/core/class/FormTemplate.class.php index 2f24c3a..7d421a3 100644 --- a/addons/weliam_smartcity/core/class/FormTemplate.class.php +++ b/addons/weliam_smartcity/core/class/FormTemplate.class.php @@ -23,6 +23,12 @@ class FormTemplate 3 => '' ]; + /** + * 次类型数据加密存储 + * @var string[] + */ + public static $template_id_arr = ['datetime','city','img','checkbox']; + /** * 获取活动关联id * @param $template_type @@ -37,6 +43,25 @@ class FormTemplate return $res ?: []; } + /** + * 是否已报名 + * @param $relation + * @param $activities_id + * @return array|false|mixed + */ + public static function isEnroll($relation,$activities_id) + { + $template_type = array_search($relation,self::$template_relation); + if ($template_type === false) return []; + + $where = [ + 'template_type' => $template_type, + 'activities_id' => $activities_id + ]; + $res = pdo_get(PDO_NAME . 'member_enroll',$where); + return $res ?: []; + } + /** * 返回模板信息 * @param $id @@ -48,4 +73,24 @@ class FormTemplate $res = pdo_get(PDO_NAME . 'diyform',['id' => $id,'template_type' => $template_type]); return $res ? : []; } + + + /** + * 加密 + */ + public static function serializeTitle(&$value,$title) + { + if (in_array($title,self::$template_id_arr)) { + $value = serialize($value); + } + } + /** + * 解密 + */ + public static function unserializeTitle(&$value,$title) + { + if (in_array($title,self::$template_id_arr)) { + $value = unserialize($value); + } + } } \ No newline at end of file