Your Name 3 年之前
父節點
當前提交
97f4174396
共有 3 個文件被更改,包括 44 次插入3 次删除
  1. 41 0
      learn/active/lib/OffCore.php
  2. 2 2
      learn/active/src/Off.php
  3. 1 1
      learn/active/src/User.php

+ 41 - 0
learn/active/lib/OffCore.php

@@ -0,0 +1,41 @@
+<?php
+
+namespace Active\Lib;
+
+use Dever;
+
+class OffCore
+{
+    protected $uid = -1;
+    protected $use = array();
+    protected $check = true;
+    public $data = array();
+
+    public function __construct()
+    {
+        $this->uid = Dever::load('passport/user')->check(false);
+        if ($this->uid <= 0) {
+            // $this->uid = 1;
+        }
+        if ($this->check) {
+            $this->checkLogin();
+        }
+        
+        if ($this->uid) {
+            $this->user = Dever::db('active/info_off')->find($this->uid);
+            // $this->user['uid'] = $this->user['id'];
+        }
+        if ($this->check) {
+            if ($this->user) {
+                $this->user['uid'] = $this->user['id'];
+            } 
+        }
+    }
+
+    public function checkLogin()
+    {
+        if (!$this->uid || $this->uid <= 0) {
+            Dever::alert('请先登录', -2);
+        }
+    }
+}

+ 2 - 2
learn/active/src/Off.php

@@ -2,9 +2,9 @@
 namespace Active\Src;
 
 use Dever;
-use Active\Lib\OffCroe;
+use Active\Lib\OffCore;
 
-Class Off extends OffCroe
+Class Off extends OffCore
 {
 	#核销首页
 	public function getHome()

+ 1 - 1
learn/active/src/User.php

@@ -26,7 +26,7 @@ Class User extends Croe
     	$code = Dever::db('active/code')->state(array('order_id'=>$order_id));
     	$data = Dever::db('active/order')->find($order_id);
     	if ($data['status'] < 2) {
-    		Dever::alert('订单还没有支付')
+    		Dever::alert('订单还没有支付');
     	}
     	if ($data['num'] <= count($code)) {
     		Dever::alert('已领完');