rabin 6 years ago
parent
commit
7f0d0fbb7e
2 changed files with 18 additions and 3 deletions
  1. 5 1
      buy/src/Base.php
  2. 13 2
      buy/src/Buy.php

+ 5 - 1
buy/src/Base.php

@@ -80,7 +80,11 @@ class Base
             $cate['logotxt'] = '<img src="'.$cate['logo'].'" />' . $cate['name'];
 
             $url = urlencode($this->url('list'));
-            $cate['login'] = 'location.href=\'' . Dever::url('request.auth?account='.$this->account.'&source='.$this->source.'&refer=' . $url, 'oauth') . '\'';
+            $system_id = 1;
+            if ($this->cate == 2) {
+                $system_id = 2;
+            }
+            $cate['login'] = 'location.href=\'' . Dever::url('request.auth?account='.$this->account.'&system='.$system_id.'&source='.$this->source.'&refer=' . $url, 'oauth') . '\'';
 
             $info = Dever::db('journal/info')->getOne($cate['journal_id']);
 

+ 13 - 2
buy/src/Buy.php

@@ -306,6 +306,8 @@ class Buy extends Base
 
         $buy_id = Dever::input('buy_id');
         $journal_id = Dever::input('journal_id');
+        $account_id = 2;
+        $system_id = 1;
 
         if (!$buy_id) {
             Dever::alert('请传入正确的支付ID');
@@ -321,8 +323,17 @@ class Buy extends Base
             Dever::alert('请传入正确的小刊ID');
         }
 
+        if ($this->cate == 2) {
+            $system_id = 2;
+            $account_id = 7;
+        }
+
         $user = Dever::db('passport/user')->one($uid);
-        $wechat = Dever::db('passport/wechat')->one(array('uid' => $uid, 'type' => 2));
+        $wechat_where = array('uid' => $uid, 'type' => 2);
+        if ($system_id == 2) {
+            $wechat_where['system_id'] = $system_id;
+        }
+        $wechat = Dever::db('passport/wechat')->one($wechat_where);
 
         //$order_id = $this->createOrder('JP');
         $order_data['cate_id'] = $this->cate;
@@ -370,7 +381,7 @@ class Buy extends Base
         //$refer = 'callback.success';
         $param = array
         (
-            'account_id' => 2,
+            'account_id' => $account_id,
             'project_id' => 3,
             'uid' => $uid,
             'username' => $user['username'],