Your Name 3 年之前
父節點
當前提交
33316b8535
共有 2 個文件被更改,包括 26 次插入2 次删除
  1. 20 1
      learn/active/database/info_field.php
  2. 6 1
      learn/active/src/Home.php

+ 20 - 1
learn/active/database/info_field.php

@@ -4,6 +4,11 @@ $type = array
     1 => '文本框',
     2 => '下拉框',
 );
+$is_must = array
+(
+    1 => '必填项',
+    2 => '选填项',
+);
 $id = Dever::input('search_option_active_id');
 return array
 (
@@ -54,6 +59,20 @@ return array
             'list'      => true,
         ),
 
+        'is_must'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否必填',
+            'default'   => '1',
+            'desc'      => '是否必填',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $is_must,
+            'search'    => 'select',
+            'list'      => true,
+            //'edit'        => true,
+        ),
+
         'type'        => array
         (
             'type'      => 'tinyint-1',
@@ -127,7 +146,7 @@ return array
             ),
             'type' => 'all',
             'order' => array('reorder' => 'desc','type'=>'asc'),
-            'col' => 'id,name,type',
+            'col' => 'id,name,type,is_must',
         ),
     ),
 );

+ 6 - 1
learn/active/src/Home.php

@@ -58,6 +58,11 @@ Class Home extends Core
 		$this->data['info']['banner'] = explode(',', $this->data['info']['banner']);
 		$this->data['info']['field'] = Dever::db('active/info_field')->getList(array('active_id'=>$id,'state'=>1));
 		foreach($this->data['info']['field'] as $k => $v){
+			if ($v['is_must'] == 1) {
+				$this->data['info']['field'][$k]['is_must_name'] = '必填项';
+			} else {
+				$this->data['info']['field'][$k]['is_must_name'] = '选填项';
+			}
 			if($v['type'] == 2) {
 				$this->data['info']['field'][$k]['value_name']= Dever::db('active/info_field_value')->getList(array('active_id'=>$id,'field_id'=>$v['id']));
 				
@@ -89,7 +94,7 @@ Class Home extends Core
 			if (!$data['name']) {
 				Dever::alert('姓名不存在');
 			}
-			// Dever::load('active/lib/manage')->checkMcode($data['mobile']);
+			Dever::load('active/lib/manage')->checkMcode($data['mobile']);
 			$user = Dever::db('active/user')->find(array('mobile'=>$data['mobile']));
 			if ($user) {
 				$uid = $user['id'];