Your Name пре 3 година
родитељ
комит
93172d9443
3 измењених фајлова са 41 додато и 5 уклоњено
  1. 18 0
      learn/active/database/info.php
  2. 20 2
      learn/active/lib/Cron.php
  3. 3 3
      learn/active/lib/Manage.php

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

@@ -37,6 +37,11 @@ $col_set = array
 (
     'idcard' => '身份证号',
 );
+$refund_type = array
+(
+    1 => '不可以退款',
+    2 => '可以退款',
+);
 
 $role = function()
 {
@@ -448,6 +453,19 @@ return array
             // 'place'     => '759*562',
             'tab'       => 3,
         ),
+        'refund_type'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否可以退款',
+            'default'   => '1',
+            'desc'      => '是否可以退款',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $refund_type,
+            // 'search'    => 'select',
+            // 'list'      => true,
+            'tab'       => 3,
+        ),
 
         'desc'      => array
         (

+ 20 - 2
learn/active/lib/Cron.php

@@ -110,9 +110,27 @@ Class Cron{
                         $insert['old_salt'] = $member['old_salt'];
                         $insert['clear'] = true;
                         $uid = Dever::db('active/user')->insert($insert);
-                        Dever::db('active/order')->update(array('where_id' => $v['id'], 'uid' => $uid));
+                        $ids = Dever::db('active/order')->update(array('where_id' => $v['id'], 'uid' => $uid));
                     } else {
-                        Dever::db('active/order')->update(array('where_id' => $v['id'], 'uid' => $user['id']));
+                        $uid = $user['id'];
+                        $ids = Dever::db('active/order')->update(array('where_id' => $v['id'], 'uid' => $user['id']));
+                    }
+                    if ($v['status'] == 2 && $uid) {
+                        $code = Dever::db('active/code')->find(array('active_id'=> $v['active_id'],'join_uid'=>$uid));
+                        if (!$code) {
+                            $w['active_id'] = $v['active_id'];
+                            $w['join_uid'] = $uid;
+                            $w['buy_uid'] = $uid;
+                            $w['order_id'] = $v['id'];
+                            $w['write_code'] = Dever::load('active/home')->getCode();
+                            $code_id = Dever::db('active/code')->insert($w);
+                            if ($code_id) {
+                                $where['where_id'] = $v['id'];
+                                $where['code_num'] = 1;
+                                $where['no_num'] = 1;
+                                Dever::db('active/order')->update($where);
+                            }
+                        }
                     }
                 } 
             }

+ 3 - 3
learn/active/lib/Manage.php

@@ -329,7 +329,7 @@ Class Manage
             );
         }
         $button = array();
-        if ($info['status'] == 2 && $info['code_num'] < 1 && time() < $active['act_start'] ) {
+        if ($info['status'] == 2 && $info['code_num'] < 1 && time() < $active['act_start'] && $active['refund_type'] == 2 ) {
             
             if (Dever::load('manage/auth')->checkFunc('active.order', 'editrefund', '全额退款')) {
                 $purl = Dever::url('active/lib/manage.refund&id='.$id);
@@ -341,7 +341,7 @@ Class Manage
                 );
             }
         }
-        if ($info['status'] > 1 && $no_code > 0 && $info['status'] != 3 && time()<$active['act_start']) {
+        if ($info['status'] > 1 && $no_code > 0 && $info['status'] != 3 && time()<$active['act_start'] && $active['refund_type'] == 2) {
             if (Dever::load('manage/auth')->checkFunc('active.order', 'editrefund1', '未使用退款')) {
                 $purl = Dever::url('project/database/update?project=active&table=info_refund&search_option_order_id='.$info['id'].'&col=num,order_id', 'manage');
                 $button[] = array
@@ -409,7 +409,7 @@ Class Manage
                 }
                 $active = Dever::db('active/info')->find($v['active_id']);
                 $m = '';
-                if ($v['status'] == 1 && time()<$active['act_start']) {
+                if ($v['status'] == 1 && time()<$active['act_start'] && $active['refund_type'] == 2) {
                     $url = Dever::url('lib/manage.setOrder&order_id=' . $v['order_id'].'&code_id='.$v['id'], 'active');
                     $m = '<a href="javascript:;" onclick="load( \''.$url.'\')" class="layui-btn">退款</a>';
                 }