Your Name il y a 3 ans
Parent
commit
831b7bd8cd

+ 1 - 1
app/shop/database/sell_order.php

@@ -250,7 +250,7 @@ return array
             (
             (
                 'api' => 'passport/address-one',
                 'api' => 'passport/address-one',
                 'col' => 'contact',
                 'col' => 'contact',
-                'result' => 'uid',
+                'result' => 'address_id',
             ),
             ),
             'list'      => $search_option_shop_type == 1 ? 'Dever::load("shop/lib/manage.user", {id})' : 'Dever::load("passport/address-one#contact", {address_id})',
             'list'      => $search_option_shop_type == 1 ? 'Dever::load("shop/lib/manage.user", {id})' : 'Dever::load("passport/address-one#contact", {address_id})',
             'list_order' => 5,
             'list_order' => 5,

+ 32 - 2
learn/active/database/code.php

@@ -5,6 +5,11 @@ $status = array
     2 => '已核销',
     2 => '已核销',
     3 => '已作废',
     3 => '已作废',
 );
 );
+$type = array
+(
+    1 => '分享领取',
+    2 => '手动添加',
+);
 $act_status = array
 $act_status = array
 (
 (
     1 => '未开始',
     1 => '未开始',
@@ -45,6 +50,7 @@ return array
             'desc'      => '活动名称',
             'desc'      => '活动名称',
             'match'     => 'is_string',
             'match'     => 'is_string',
             'update'    => 'hidden',
             'update'    => 'hidden',
+            'value'     => Dever::input('search_option_active_id'),
              'search'    => array
              'search'    => array
             (
             (
                 'api' => 'active/info-getSearch',
                 'api' => 'active/info-getSearch',
@@ -114,7 +120,7 @@ return array
             'default'   => '',
             'default'   => '',
             'desc'      => '核销码',
             'desc'      => '核销码',
             'match'     => 'is_string',
             'match'     => 'is_string',
-            'update'    => 'text',
+            // 'update'    => 'text',
             'search'    => 'fulltext',
             'search'    => 'fulltext',
             'list'      => true,
             'list'      => true,
         ),
         ),
@@ -144,6 +150,18 @@ return array
             'list'      => true,
             'list'      => true,
         ),
         ),
 
 
+        'type'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '核销码来自哪的状态',
+            'default'   => '1',
+            'desc'      => '核销码来自哪的状态',
+            'match'     => 'is_numeric',
+            'option'    => $type,
+            // 'search'    => 'select',
+            // 'list'      => true,
+        ),
+
         'pic'       => array
         'pic'       => array
         (
         (
             'type'      => 'text-255',
             'type'      => 'text-255',
@@ -151,7 +169,7 @@ return array
             'default'   => '',
             'default'   => '',
             'desc'      => '二维码',
             'desc'      => '二维码',
             'match'     => 'option',
             'match'     => 'option',
-            'update'    => 'image',
+            // 'update'    => 'image',
             'key'       => '1',
             'key'       => '1',
             // 'place'     => '759*562',
             // 'place'     => '759*562',
         ),
         ),
@@ -190,6 +208,18 @@ return array
             // 'list_order'  => 8,
             // 'list_order'  => 8,
         ),
         ),
 
 
+        'content'       => array
+        (
+            'type'      => 'text-255',
+            'name'      => '填写手机号-多个换行隔开,如手机号重复将不会录入到库中',
+            'default'   => '',
+            'desc'      => '填写手机号',
+            'match'     => 'is_string',
+            'update'    => 'textarea',
+            'value'     => '',
+            // 'show'      => 'type=2',
+        ),
+
         'state'     => array
         'state'     => array
         (
         (
             'type'      => 'tinyint-1',
             'type'      => 'tinyint-1',

+ 3 - 0
learn/active/database/info.php

@@ -60,6 +60,9 @@ if ($search_auth == 1) {
     if (Dever::load('manage/auth')->checkFunc('active.info', 'editworld', '自定义字段设置')) {
     if (Dever::load('manage/auth')->checkFunc('active.info', 'editworld', '自定义字段设置')) {
         $list_button['list1'] = array('自定义字段设置', '"info_field&search_option_active_id={id}&oper_table=info"');
         $list_button['list1'] = array('自定义字段设置', '"info_field&search_option_active_id={id}&oper_table=info"');
     }
     }
+    if (Dever::load('manage/auth')->checkFunc('active.info', 'editcode', '生成核销码')) {
+        $list_button['fast_add'] = array('生成核销码', '"create_code&search_option_active_id={id}"');
+    }
 } else {
 } else {
     if (Dever::load('manage/auth')->checkFunc('active.info_1', 'editOff', '核销活动')) {
     if (Dever::load('manage/auth')->checkFunc('active.info_1', 'editOff', '核销活动')) {
         // $button['核销活动'] = array('fast',1,'info_code');
         // $button['核销活动'] = array('fast',1,'info_code');

+ 66 - 0
learn/active/lib/Order.php

@@ -29,4 +29,70 @@ Class Order
         $w['where_id'] = $data['id'];
         $w['where_id'] = $data['id'];
         Dever::db('active/order')->update($w);
         Dever::db('active/order')->update($w);
     }
     }
+    #生成核销码
+    public function insertCode($id,$name,$data)
+    {
+        $active_id = Dever::param('active_id',$data);
+        $content = Dever::param('content',$data);
+        $contents = Dever::split($content);
+        $active = Dever::db('active/info')->find($active_id);
+        if ($contents) {
+            foreach ($contents as $k => $v) {
+                $user = Dever::db('active/user')->find(array('mobile'=>$v));
+                if ($user) {
+                    $member = Dever::load('active/lib/user')->agent($user);
+                    $code = Dever::db('active/code')->getOne(array('active_id'=>$active_id,'join_uid'=>$user['id'],'status'=>'1,2'));
+                    if ($code) {
+                        Dever::alert('您已领取过了');
+                    }                 }
+            }
+        }
+    }
+    public function createCode($id,$name,$data) 
+    {
+        $active_id = Dever::param('active_id',$data);
+        $content = Dever::param('content',$data);
+        $contents = Dever::split($content);
+        $active = Dever::db('active/info')->find($active_id);
+        if ($contents) {
+            foreach ($contents as $k => $v) {
+                $user = Dever::db('active/user')->find(array('mobile'=>$v));
+                if ($user) {
+                    $member = Dever::load('active/lib/user')->agent($user);
+                    if ($member && $active['status'] == 2) {
+                        $this->user($active_id,$user['id']);
+                    } 
+                } else {
+                    $member = Dever::db('agent/member')->find(array('mobile'=>$v));
+                    if ($member) {
+                        $insert['name'] = $member['name'];
+                        $insert['mobile'] = $v;
+                        $insert['idcard'] = $member['idcard'];
+                        $insert['pass'] = $member['password'];
+                        $insert['old_pwd'] = $member['old_pwd'];
+                        $insert['old_salt'] = $member['old_salt'];
+                        $uid = Dever::db('active/user')->insert($insert);
+                        $this->user($active_id,$uid);
+                    } else {
+                        $insert['name'] = substr($v, 0, 3).'****'.substr($v, 7);
+                        $insert['mobile'] = $v;
+                        $uid = Dever::db('active/user')->insert($insert);
+                        $this->user($active_id,$uid);
+                    }
+                }
+            }
+            return 'ok';
+        }
+    }
+    private function user($active_id,$uid)
+    {
+        $w['active_id'] = $active_id;
+        $w['join_uid'] = $uid;
+        $w['write_code'] = Dever::load('active/home')->getCode();
+        $w['type'] = 2;
+        if ($uid && $uid >=1) {
+            Dever::db('active/code')->insert($w);
+        }
+        // Dever::db('active/creat_code')->insert($w);
+    }
 }
 }

+ 9 - 6
learn/active/src/User.php

@@ -110,12 +110,15 @@ Class User extends Core
     		} else {
     		} else {
     			$data['info'][$k]['status_name'] = '已核销';
     			$data['info'][$k]['status_name'] = '已核销';
     		}
     		}
-    		if ($v['join_uid'] == $v['buy_uid']) {
-    			$data['info'][$k]['type_name'] = '来自自行购买订单';
-    		} else {
-    			$data['info'][$k]['type_name'] = '来自好友分享领取订单';
-    		}
-    		
+            if ($v['type'] == 1) {
+                if ($v['join_uid'] == $v['buy_uid']) {
+                    $data['info'][$k]['type_name'] = '来自自行购买订单';
+                } else {
+                    $data['info'][$k]['type_name'] = '来自好友分享领取订单';
+                }
+            } elseif ($v['type'] == 2) {
+                $data['info'][$k]['type_name'] = '来自手动发放';
+            }
     	}
     	}
     	return $data;
     	return $data;
     }
     }