Просмотр исходного кода

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

rabin 3 лет назад
Родитель
Сommit
8d3d98b236

+ 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',
         ),
     ),
 );

+ 1 - 1
learn/active/lib/Cron.php

@@ -10,7 +10,7 @@ Class Cron{
     	$time = time();
     	if ($data) {
     		foreach ($data as $k => $v) {
-    			if ($v['cdate'] && $time-$v['cdate']>300) {
+    			if ($v['cdate'] && $time-$v['cdate']>900) {
     				Dever::db('active/order')->update(array('where_id'=>$v['id'],'set_status'=>3));
     			}
     		}

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

@@ -481,7 +481,6 @@ Class Manage
                 } elseif (($type == 2 && $price != $data['price']) || $type == 3) {
                     $where['status'] = 5;
                     $ids = Dever::db('active/order')->update($where);
-                    return $ids;
                 }
                 if ($type == 2) {
                     $insert['status'] = 2;
@@ -489,6 +488,9 @@ Class Manage
                     $insert['audit_admin'] = $admin['id'];
                     Dever::db('active/info_refund')->update($insert);
                 }
+                if (isset($ids) && $ids){
+                    return $ids;
+                }
             }
         }
     }
@@ -517,33 +519,4 @@ Class Manage
         $w['where_id'] = $data['id'];
         Dever::db('active/order')->update($w);
     }
-    public function xiu_api()
-    {
-        $data = Dever::db('active/order')->state();
-        foreach ($data as $k => $v) {
-            if (!$v['refund_num'] || $v['refund_num']<=0) {
-                $w['refund_num'] = 0;
-            } else {
-                $w['refund_num'] =$v['refund_num'];
-            }
-            if (!$v['code_num'] || $v['code_num'] <= 0) {
-                $w['code_num'] = -1;
-            }
-            if (!$v['no_num']) {
-                $w['no_num'] = 0;
-            }
-            #已使用的数量
-            $code = Dever::db('active/code')->getCode(array('order_id'=>$v['id'],'status'=>'1,2'));
-            $w['code_num'] = count($code);
-            if ($w['code_num'] == 0) {
-                $w['code_num'] = -1;
-            }
-            #待核销的数量
-            $no_code = Dever::db('active/code')->getCode(array('order_id'=>$v['id'],'status'=>1));
-            $w['no_num'] = count($no_code);
-            $w['where_id'] = $v['id'];
-            Dever::db('active/order')->update($w);
-        }
-        return 'ok';
-    }
 }

+ 11 - 5
learn/active/src/Home.php

@@ -25,16 +25,17 @@ Class Home extends Core
             }
 			if ($v['act_status'] == 2) {
 				if ($v['sign_end']) {
-					$day = floor(($v['sign_end'] - time())/86400);
+					$day = floor(($v['sign_end'] - strtotime(date('Y-m-d').'23:59:59'))/86400);
 					if ($day < 0){
 						$data['info'][$k]['day'] = '';
 					} else {
+						$day +=1;
 						$data['info'][$k]['day'] = '剩余'.$day.'天';
 					}
 					
 				} else {
-					$day = floor(($v['act_start'] - time())/86400);
-					if ($day >= 0) {
+					$day = floor(($v['act_start'] - strtotime(date('Y-m-d').'23:59:59'))/86400);
+					if ($day > 0) {
 						$data['info'][$k]['day'] = '剩余'.$day.'天';
 					} else {
 						$data['info'][$k]['day'] = '';
@@ -57,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']));
 				
@@ -88,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'];
@@ -150,7 +156,7 @@ Class Home extends Core
         if (!$order_id){
     		Dever::alert('订单id不存在');
     	}
-    	$data['user'] = Dever::load('passport/reg')->getSign($user['id']);
+    	$data['user'] = Dever::load('passport/reg')->getSign($uid);
 		$user = Dever::db('active/user')->find($uid);
        	
         $info = Dever::db('active/info')->find($active_id);