dever 6 rokov pred
rodič
commit
b47319adf6
2 zmenil súbory, kde vykonal 36 pridanie a 1 odobranie
  1. 1 1
      journal/lib/Pay.php
  2. 35 0
      main/src/Content.php

+ 1 - 1
journal/lib/Pay.php

@@ -66,7 +66,7 @@ class Pay
                         '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($this->data['uid'], 2);
+                    $send['form_id'] = Dever::load('act/lib/form')->get($uid, 2);
 
                     if ($send['form_id']) {
                         Dever::load('wechat_applet/msg.send', $send);

+ 35 - 0
main/src/Content.php

@@ -20,6 +20,40 @@ class Content extends Core
 
         return 'ok';
     }
+
+    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'] = 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 home()
@@ -29,6 +63,7 @@ class Content extends Core
         //9 ZTBiZWN5dW9ublpnSzR2dmlXUUc5MWJJQWk5d3pFQmx0TEp6a0VJVkU4NG5HVTYtcjhFNTdfdnc=
         # 栏目
         //$this->data['push_menu'] = Dever::load('push/lib/data')->get('menu', '头部导航');
+
         $this->data['menu'] = Dever::db('content/cate')->getAll();
 
         # 焦点图