dever 6 éve
szülő
commit
6fe283e749
4 módosított fájl, 115 hozzáadás és 8 törlés
  1. 18 0
      journal/database/content.php
  2. 36 8
      journal/database/order.php
  3. 28 0
      journal/lib/Manage.php
  4. 33 0
      journal/lib/Pay.php

+ 18 - 0
journal/database/content.php

@@ -49,6 +49,7 @@ return array
     'lang' => '内页管理',
     'menu' => false,
     'gettype' => $type,
+    'text' => $text,
     # 数据结构
     'struct' => array
     (
@@ -360,4 +361,21 @@ return array
             '预览' => array('fast', 'main/preview.get?type=4&id=' . Dever::input('search_option_info_id')),
         ),
     ),
+
+    # request 请求接口定义
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'asc', 'id' => 'desc'),
+            'page' => array(10, 'list'),
+            'col' => '*',
+        ),
+    )
 );

+ 36 - 8
journal/database/order.php

@@ -20,6 +20,11 @@ $product = function()
     return Dever::db('journal/info')->state();
 };
 
+$buy = function()
+{
+    return Dever::db('journal/buy_num')->state();
+};
+
 return array
 (
     # 表名
@@ -57,7 +62,7 @@ return array
             'match'     => 'is_string',
             'update'    => 'text',
             'search'    => 'fulltext',
-            //'list'        => true,
+            'list'        => true,
             //'list'        => '"{order_id}" ? "{order_id}" : "{code}"',
         ), 
 
@@ -71,7 +76,7 @@ return array
             'update'    => 'text',
             'search'    => 'fulltext',
             'list_name' => '订单信息',
-            //'list'      => 'Dever::load("journal/lib/manage.showOrderUser", "{id}")',
+            'list'      => 'Dever::load("journal/lib/manage.showOrderUser", "{id}")',
         ),
 
         'uid'       => array
@@ -84,6 +89,16 @@ return array
             'update'    => 'text',
         ),
 
+        'source_uid'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '邀请人',
+            'default'   => '',
+            'desc'      => '邀请人',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
         'product_id'        => array
         (
             'type'      => 'int-11',
@@ -97,6 +112,19 @@ return array
             //'list'        => true,
         ),
 
+        'buy_id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买本数',
+            'default'   => '',
+            'desc'      => '购买本数',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $buy,
+            'search'    => 'select',
+            //'list'        => true,
+        ),
+
         'type'      => array
         (
             'type'      => 'int-11',
@@ -246,18 +274,18 @@ return array
 
     'manage' => array
     (
-        //'delete' => false,
-        //'edit' => false,
-        //'insert' => false,
+        'delete' => false,
+        'edit' => false,
+        'insert' => false,
 
         'button' => array
         (
-            '导出订单' => array('location', 'service/lib/manage.out'),
+            //'导出订单' => array('location', 'journal/lib/manage.out'),
         ),
 
         'list_button' => array(
-            'edit' => array('退款', 'tk_time,tk_desc,tk_admin', '{status} > 1'),
-            'delete' => array('删除', '', '{status} == 1'),
+            //'edit' => array('退款', 'tk_time,tk_desc,tk_admin', '{status} > 1'),
+            //'delete' => array('删除', '', '{status} == 1'),
         ),
     ),
 

+ 28 - 0
journal/lib/Manage.php

@@ -6,6 +6,34 @@ use Dever;
 
 class Manage
 {
+    public function showOrderUser($id)
+    {
+        $info = Dever::db('journal/order')->one($id);
+
+        $table = array();
+
+        $user = Dever::db('passport/user')->one($info['uid']);
+
+        $table['用户名'] = $user['username'];
+        $table['手机号'] = $user['mobile'];
+        //$table['产品名'] = $info['name'];
+        if ($info['type'] == 1) {
+            $table['支付方式'] = '购买';
+            $table['支付金额'] = $info['cash'];
+        } else {
+            $table['支付方式'] = '兑换';
+            $table['兑换码'] = $info['code'];
+        }
+        //$table['购买数量'] = $info['num'];
+        
+        if ($info['source_uid'] && $info['source_uid'] != $info['uid']) {
+            $user = Dever::db('passport/user')->one($info['source_uid']);
+            $table['邀请人'] = $user['username'];
+        }
+
+        return Dever::table($table);
+    }
+
 	private function search($table = 'content/article')
 	{
 		$keyword = Dever::input('keyword');

+ 33 - 0
journal/lib/Pay.php

@@ -0,0 +1,33 @@
+<?php
+namespace Journal\Lib;
+
+use Dever;
+
+class Pay
+{
+	/**
+	 * 支付成功后,调取的接口
+	 *
+	 * @return mixed
+	 */
+	public function act($param)
+	{
+		$product_id = $param['pay_product_id'];
+        $uid = $param['pay_uid'];
+        $cash = $param['pay_cash'];
+        $order_id = $param['pay_order_id'];
+        $status = $param['pay_status'];
+        $msg = $param['pay_msg'];
+
+        $order = Dever::db('journal/order')->one(array('order_id' => $order_id, 'uid' => $uid));
+
+		if ($status == 2 && $order) {
+            Dever::db('journal/order')->update(array('where_id' => $order['id'], 'status' => 2));
+        } else {
+        	Dever::db('journal/order')->update(array('where_id' => $order['id'], 'status' => 3));
+        }
+
+        # 订阅
+        Dever::load('act/lib/subscribe')->submit($uid, $product_id);
+	}
+}