dever 5 years ago
parent
commit
72de2ceda2
4 changed files with 4 additions and 242 deletions
  1. 2 76
      act/src/Order.php
  2. 1 1
      code/database/info.php
  3. 1 1
      code/lib/Manage.php
  4. 0 164
      main/src/Content.php

+ 2 - 76
act/src/Order.php

@@ -303,82 +303,6 @@ class Order extends Core
     # 开始兑换
     public function checkCode()
     {
-        if (!$this->data['uid']) {
-            Dever::alert('错误的用户信息');
-        }
-
-        $code = Dever::input('code');
-
-        if ($code) {
-            $code = trim($code);
-            $code = str_replace("\n", '', $code);
-
-            $journal_id = Dever::input('journal_id');
-            if (strstr($journal_id, 'preview_')) {
-                $journal_id = str_replace('preview_', '', $journal_id);
-            }
-
-            if (!$journal_id) {
-                Dever::alert('请传入正确的小刊ID');
-            }
-
-            if (strpos($code, 'M') === 0) {
-                Dever::setInput('set_product_id', $journal_id);
-                $code = substr($code, 1);
-                $code = Dever::uid($code, 'decode');
-                $code = $code / 10000000;
-                $info = Dever::db('code/info')->one($code);
-                
-            } else {
-                $info = Dever::db('code/info')->one(array('code' => $code));
-            }
-
-            if (!$info) {
-                Dever::alert('兑换码不存在');
-            }
-
-            if ($info['type'] == 3) {
-                Dever::alert('兑换码已被使用');
-            }
-
-            if ($info['state'] != 1) {
-                Dever::alert('兑换码已作废');
-            }
-
-            if ($info['type'] == 4) {
-                Dever::alert('兑换码已作废');
-            }
-
-            if ($info['type'] == 2 && $this->data['uid'] != $info['uid']) {
-                //Dever::alert('兑换码已被领取');
-            }
-
-            if ($info['product_id'] > 0 && $info['product_id'] != $journal_id) {
-                Dever::alert('请正确使用小刊兑换码');
-            }
-
-            if (isset($info['order_id']) && $info['order_id']) {
-                $order_info = $this->getOrder($info['order_id']);
-                if (!$order_info) {
-                    Dever::alert('您要使用的兑换码还未支付');
-                }
-
-                if ($order_info && $order_info['status'] != 2) {
-                    Dever::alert('您要使用的兑换码还未支付');
-                }
-            }
-
-            if ($info['product_id']) {
-                $product = Dever::db('journal/info')->one($info['product_id']);
-                $this->data['product'] = $product;
-
-                return $this->data;
-            }
-
-        } else {
-            Dever::alert('请输入正确的兑换码');
-        }
-
         return 'ok';
     }
 
@@ -453,9 +377,11 @@ class Order extends Core
                 Dever::alert('兑换码已作废');
             }
 
+            /*
             if ($info['type'] == 2 && $this->data['uid'] != $info['uid']) {
                 //Dever::alert('兑换码已被领取');
             }
+            */
 
             if ($info['product_id'] > 0 && $info['product_id'] != $journal_id) {
                 Dever::alert('请正确使用小刊兑换码');

+ 1 - 1
code/database/info.php

@@ -200,7 +200,7 @@ return array
 			'default' 	=> '0',
 			'desc' 		=> '用户信息',
 			'match' 	=> 'is_numeric',
-			'list'		=> 'Dever::load("code/lib/manage.showUserInfo", "{create_uid}", "{uid}", "{ldate}")',
+			'list'		=> 'Dever::load("code/lib/manage.showUserInfo", "{create_uid}", "{uid}", "{ldate}", "{type}")',
 		),
 
 		'order_id'      => array

+ 1 - 1
code/lib/Manage.php

@@ -40,7 +40,7 @@ class Manage
 			$user = Dever::load('passport/user-one', $create_uid);
 			$table['创建人'] = $user['username'] . '('.$create_uid.')';
 		}
-		if ($uid && $uid > 0) {
+		if ($type == 3 && $uid && $uid > 0) {
 			$user = Dever::load('passport/user-one', $uid);
 			if ($user) {
 				$table['领取人'] = $user['username'] . '('.$uid.')';

+ 0 - 164
main/src/Content.php

@@ -7,136 +7,6 @@ use Main\Lib\Core;
 
 class Content extends Core
 {
-    /*
-    public function del()
-    {
-        $uid = Dever::input('uid');
-        Dever::db('passport/user')->delete($uid);
-        $info = Dever::db('passport/wechat')->state(array('uid' => $uid));
-        if ($info) {
-            foreach ($info as $k => $v) {
-                Dever::db('passport/wechat')->delete($v['id']);
-            }
-        }
-
-        return 'ok';
-    }
-    */
-
-    public function score_code_actact()
-    {
-        $where['status'] = 2;
-        $where['product_id'] = 15;
-        $where['type'] = 3;
-        $where['buy_id'] = Dever::input('buy_id', 48);
-        $uid = Dever::input('uid');
-        $test = Dever::input('test');
-        if ($uid > 0) {
-            $where['uid'] = $uid;
-        }
-        $id = array
-        (
-            48 => 10,
-            49 => 100,
-            50 => 300,
-            51 => 600
-        );
-        $buy = Dever::db('journal/buy_num')->one($where['buy_id']);
-        $info = Dever::db('journal/info')->one($where['product_id']);
-        $data = Dever::db('journal/order')->state($where);
-        $time = Dever::maketime('2019-01-29 14:44:30');
-        if ($data) {
-            if ($test == 1) {
-                print_r($data);die;
-            }
-            foreach ($data as $k => $v) {
-                if ($v['cdate'] < $time && isset($id[$v['buy_id']]) && $id[$v['buy_id']]) {
-                    if ($v['type'] == 3) {
-
-                        $w['code'] = $v['code'];
-                        $o = Dever::db('code/info')->one($w);
-                        print_r($buy);
-                        if ($o) {
-                            $up['product_num'] = $buy['num'];
-                            $up['where_id'] = $o['id'];
-                            Dever::db('code/info')->update($up);
-                        }
-
-                        print_r($o);
-                        print_r($v);
-                    }
-
-
-                }
-            }
-        }
-    }
-
-    # 跑积分
-    public function score_actact()
-    {
-        $where['status'] = 2;
-        $where['product_id'] = 15;
-        $where['type'] = Dever::input('type', 1);
-        $where['buy_id'] = Dever::input('buy_id', 48);
-        $uid = Dever::input('uid');
-        $test = Dever::input('test');
-        if ($uid > 0) {
-            $where['uid'] = $uid;
-        }
-        $id = array
-        (
-            48 => 10,
-            49 => 100,
-            50 => 300,
-            51 => 600
-        );
-        $info = Dever::db('journal/info')->one($where['product_id']);
-        $data = Dever::db('journal/order')->state($where);
-        $time = Dever::maketime('2019-01-29 14:44:30');
-        if ($data) {
-            print_r($data);die;
-            if ($test == 1) {
-                print_r($data);die;
-            }
-            foreach ($data as $k => $v) {
-                if ($v['uid'] != 25371 && $v['uid'] != 25555 && $v['cdate'] < $time && isset($id[$v['buy_id']]) && $id[$v['buy_id']]) {
-                    $num = $id[$v['buy_id']] - 1;
-                    $score = $num * $info['score'];
-
-                    $user = Dever::db('score/user')->one(array('uid' => $v['uid']));
-                    if ($user) {
-                        $update['where_id'] = $user['id'];
-                        $update['score'] = $user['score'] + $score;
-
-                        
-                        //$user_log = Dever::db('score/user_log')->one(array('uid' => $v['uid'], 'num' => $score, 'status' => 1));
-                        $user_log = false;
-
-                        if (!$user_log) {
-                            if ($v['type'] == 1) {
-                                Dever::score($v['uid'], 'buy_journal', '购买小刊', 'act/lib/score.submit?method=pay&type=4&id=' . $v['product_id'], $score, false);
-                            } elseif ($v['type'] == 3) {
-
-                                $w['type'] = 2;
-                                $w['code'] = $v['code'];
-                                $w['status'] = 2;
-                                $o = Dever::db('journal/order')->one($w);
-
-                                if ($o) {
-                                    Dever::score($o['uid'], 'dh_journal', '兑换小刊', 'act/lib/score.submit?method=code&type=4&id=' . $o['product_id'], $score, false);
-                                }
-                            }
-                        }
-                        print_r($v);
-                    }
-                }
-            }
-        }
-
-        return 'ok';
-    }
-
     public function test_redis()
     {
         # 测试缓存
@@ -181,40 +51,6 @@ class Content extends Core
         echo 'ok';die;
     }
 
-    public function test()
-    {
-        $journal = Dever::db('journal/info')->one(8);
-        # 发模板消息
-        $uid = Dever::input('uid');
-        $user = Dever::db('passport/user')->one($uid);
-        $wechat = Dever::db('passport/wechat')->one(array('uid' => $uid));
-
-        print_r($wechat);die;
-        if ($wechat && Dever::project('wechat_applet')) {
-            $send['key'] = 'buy_journal';
-            $send['project_id'] = 1;
-            $send['touser'] = $wechat['openid'];
-            $send['page'] = Dever::config('base')->applet_index . '?scene=' . Dever::login($uid) . ',' . '4,' . $order['product_id'];
-            $send['data'] = json_encode(array
-            (
-                'keyword1' => array('value' => date('Y年m月d日 H:i', $order['cdate'])),
-                'keyword2' => array('value' => '购买成功,您获得了 '.$journal['name'].' 的阅读资格!'),
-            ));
-            $send['form_id'] = Dever::load('act/lib/form')->get($uid, 2);
-
-            if ($send['form_id']) {
-                Dever::load('wechat_applet/msg.send', $send);
-            }
-        }
-
-        # 发短信
-        if (isset($user['mobile']) && $user['mobile'] && Dever::project('sms')) {
-            $send = array();
-            $send['name'] = $journal['name'];
-            Dever::load('sms/api.send', 'buy_journal', $user['mobile'], $send);
-        }
-    }
-
     # 开屏广告
     public function ad()
     {