فهرست منبع

Merge branch 'master' of ssh://git.dever.cc:10022/dever-product/churen

rabin 3 سال پیش
والد
کامیت
1798f3348c
4فایلهای تغییر یافته به همراه99 افزوده شده و 11 حذف شده
  1. 40 9
      learn/active/database/code.php
  2. 22 1
      learn/active/database/info.php
  3. 32 1
      learn/active/lib/Excel.php
  4. 5 0
      learn/active/src/User.php

+ 40 - 9
learn/active/database/code.php

@@ -18,10 +18,22 @@ $act_status = array
     4 => '活动开始',
     5 => '活动结束',
 );
+$active = function()
+{
+    $array = array();
+    $data = Dever::db('active/info')->state();
+    if($data)
+    {
+        $array += $data;
+    }
+    return $array;
+};
 $excel = false;
 if (Dever::load('manage/auth')->checkFunc('active.code', 'editExcelCode', '数据导出')) {
     $excel[] = array('数据导出','数据导出','active/lib/excel.out_active_code');
 }
+$button = array();
+$button['导入订单'] = array('fast', '', 'import&project=upload&call=active/lib/excel.import');
 return array
 (
     # 表名
@@ -55,13 +67,15 @@ return array
             'match'     => 'is_string',
             'update'    => 'hidden',
             'value'     => Dever::input('search_option_active_id'),
-             'search'    => array
-            (
-                'api' => 'active/info-getSearch',
-                'col' => 'col',
-                'result' => 'id',
-                'search' => 'active_id',
-            ),
+            'option'    => $active,
+            'search'    => 'select',
+            //  'search'    => array
+            // (
+            //     'api' => 'active/info-getSearch',
+            //     'col' => 'col',
+            //     'result' => 'id',
+            //     'search' => 'active_id',
+            // ),
             'list'      => "Dever::load('active/lib/manage.active#active_name',{active_id})",
         ),
 
@@ -129,6 +143,18 @@ return array
             'list'      => true,
         ),
 
+        'seat_num'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '座位号',
+            'default'   => '',
+            'desc'      => '座位号',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
         'act_status'        => array
         (
             'type'      => 'tinyint-1',
@@ -138,8 +164,8 @@ return array
             'match'     => 'is_numeric',
             // 'update'    => 'radio',
             'option'    => $act_status,
-            'search'    => 'select',
-            'list'      => true,
+            // 'search'    => 'select',
+            // 'list'      => true,
         ),
 
         'status'        => array
@@ -253,6 +279,11 @@ return array
         'delete' => false,
         'edit' => false,
         'excel' => $excel,
+        'button' => $button,
+        'list_button' => array
+        (
+            'fast' => array('添加座位号', '"code&where_id={id}&col=seat_num&oper_save_jump=code&oper_table=code&oper_parent=code"'),
+        ),
     ),
 
     'request' => array

+ 22 - 1
learn/active/database/info.php

@@ -43,6 +43,12 @@ $refund_type = array
     2 => '可以退款',
 );
 
+$sit_type = array
+(
+    1 => '不显示',
+    2 => '显示',
+);
+
 $role = function()
 {
     $array = array();
@@ -268,7 +274,7 @@ return array
             'default'   => '1',
             'desc'      => '状态',
             'match'     => 'is_numeric',
-            'update'    => 'radio',
+            // 'update'    => 'radio',
             'option'    => $online,
             // 'search'    => 'select',
             'list'      => $search_auth == 1 ? true : false,
@@ -453,6 +459,7 @@ return array
             // 'place'     => '759*562',
             'tab'       => 3,
         ),
+
         'refund_type'        => array
         (
             'type'      => 'tinyint-1',
@@ -467,6 +474,20 @@ return array
             'tab'       => 3,
         ),
 
+        'sit_type'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否显示座位号',
+            'default'   => '1',
+            'desc'      => '是否显示座位号',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $sit_type,
+            // 'search'    => 'select',
+            // 'list'      => true,
+            'tab'       => 3,
+        ),
+
         'desc'      => array
         (
             'type'      => 'text-1000',

+ 32 - 1
learn/active/lib/Excel.php

@@ -51,7 +51,7 @@ Class Excel {
     #活动核销码导出
     public function out_active_code($data)
     {
-        $header = array('活动名称', '参加人姓名', '参加人手机号', '购买人姓名', '购买人手机号', '领取日期');
+        $header = array('活动名称', '参加人姓名', '参加人手机号', '购买人姓名', '购买人手机号', '领取日期','座位号');
         $body = array();
         foreach ($data as $k => $v) {
             $active_name = '';
@@ -81,6 +81,10 @@ Class Excel {
             if ($v['cdate']) {
                 $cdate = date('Y-m-d H:i:s',$v['cdate']);
             }
+            $seat_num = '';
+            if ($v['seat_num']) {
+                $seat_num = $v['seat_num'];
+            }
             $d = array
             (
                 $active_name,
@@ -89,10 +93,37 @@ Class Excel {
                 $buy_name,
                 $buy_mobile,
                 $cdate,
+                $seat_num,
             );
             $body[] = $d;
         }
         $file = Dever::input('excel_name');
         return Dever::excelExport($body, $header, $file);
     }
+    public function import($file)
+    {
+        $file = Dever::local($file);
+        $data = Dever::excelImport($file,0);
+        // print_R($data);die;
+        if ($data) {
+            $res = array();
+            foreach($data as $k=>$v){
+                if ($k>=2) {
+                    
+                    $active_name = $v['A'];
+                    $mobile = trim($v['C']);
+                    // $seat_num = $v['G'];
+                    if (isset($v['G']) && $v['G']) {
+                        $active = Dever::db('active/info')->find(array('name'=>$active_name));
+                        $user = Dever::db('active/user')->find(array('mobile'=>$mobile));
+                        $code = Dever::db('active/code')->find(array('active_id'=>$active['id'],'join_uid'=>$user['id']));
+                        $where['where_id'] = $code['id'];
+                        $where['seat_num'] = $v['G'];
+                        Dever::db('active/code')->update($where);
+                    }
+                }
+                
+            }
+        }
+    }
 }

+ 5 - 0
learn/active/src/User.php

@@ -153,6 +153,11 @@ Class User extends Core
             } elseif ($v['type'] == 2) {
                 $data['info'][$k]['type_name'] = '来自手动发放';
             }
+            if($active['sit_type'] == 2) {
+                $data['info'][$k]['seat_num'] = '查看座位号:'.$v['seat_num'];
+            } else {
+                $data['info'][$k]['seat_num'] = '';
+            }
     	}
     	return $data;
     }