dever 6 years ago
parent
commit
9249ca944e
3 changed files with 86 additions and 7 deletions
  1. 27 5
      doc/apidoc.php
  2. 59 0
      vip/database/order.php
  3. 0 2
      vip/src/Buy.php

+ 27 - 5
doc/apidoc.php

@@ -489,10 +489,10 @@
  */
 
 /**
- * @api {get} wonderful/main/?l=view.vip 查看会员配置信息
+ * @api {get} wonderful/main/?l=vip.config 查看会员配置信息
  * @apiVersion 1.0.0
- * @apiName view.vip
- * @apiGroup Content
+ * @apiName vip.config
+ * @apiGroup Vip
  *
  * @apiDescription 查看会员配置信息
  *
@@ -510,9 +510,31 @@
  * @apiSuccess {String}   vip_time.cash 优惠价、支付价格
  * @apiSuccess {String}   vip_time.price 原价
  * @apiSuccess {String}   vip_time.type 1为普通售价、2为超值售价
-
  * @apiSuccess {String}   mobile 当前登录用户的手机号
- 
+
+ */
+
+/**
+ * @api {get} wonderful/main/?l=vip.buy_action 发起支付
+ * @apiVersion 1.0.0
+ * @apiName vip.buy_action
+ * @apiGroup Vip
+ *
+ * @apiDescription 发起支付:请注意,如果是苹果支付,请在发起苹果支付之后,将苹果返回的验证数据,传入该接口
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {String} mobile 手机号
+ * @apiParam {String} buy_id 时效id
+ * @apiParam {String} type 支付类型 wechat微信、alipay支付宝
+ * @apiParam {String} receipt 当header中的source_type为ios时,请传入该参数,参数的值为苹果支付后返回的参数,即可发起支付验证。
+*
+ * @apiSuccess {Object[]} pay 微信支付返回的数据,支付宝后续添加
+ * @apiSuccess {String}   pay.time 服务器时间戳
+ * @apiSuccess {String}   pay.nonce_str 随机字符串
+ * @apiSuccess {String}   pay.prepay_id 统一下单接口返回的 prepay_id 参数值,通过'prepay_id=' + prepay_id 拼装成package
+ * @apiSuccess {String}   pay.sign_type 签名算法
+ * @apiSuccess {String}   pay.sign 签名
+ * @apiSuccess {String}   pay.yes 苹果支付时显示改参数,1为支付成功2为支付失败
  */
 
 /**

+ 59 - 0
vip/database/order.php

@@ -34,6 +34,23 @@ $seller = function()
     return Dever::db('code/seller')->state();
 };
 
+# 获取小刊分类权限
+$auth = Dever::tops();
+$cate = function() use ($auth)
+{
+    $array = array();
+    if ($auth) {
+        $info = Dever::db('journal/cate')->getIds(array('ids' => $auth));
+    } else {
+        $info = Dever::db('journal/cate')->state();
+    }
+    if($info)
+    {
+        $array += $info;
+    }
+    return $array;
+};
+
 return array
 (
     # 表名
@@ -75,6 +92,29 @@ return array
             //'list'        => '"{order_id}" ? "{order_id}" : "{code}"',
         ), 
 
+        'cate_journal'     => array
+        (
+            'name'      => '小刊',
+            'default'   => '',
+            'desc'      => '小刊',
+            'search'    => 'linkage',
+            'search_col' => 'cate_id,product_id',
+            'option'    => Dever::url('lib/manage.search_cate_journal', 'journal'),
+        ),
+
+        'cate_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小刊分类',
+            'default'   => '1',
+            'desc'      => '小刊分类',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $cate,
+            //'search'    => 'select',
+            'list'      => true,
+        ),
+
         'name'      => array
         (
             'type'      => 'varchar-80',
@@ -104,6 +144,16 @@ return array
             'update'    => 'text',
         ),
 
+        'buy_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '时效id',
+            'default'   => '',
+            'desc'      => '时效id',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
         'mobile'        => array
         (
             'type'      => 'varchar-300',
@@ -296,6 +346,15 @@ return array
         ),
     ),
 
+    'top' => Dever::config('base')->top,
+
+    # 增加这个,为了给当前的list增加一个option
+    'top_option' => array
+    (
+        'value' => $auth,
+        'col' => 'cate_id',
+    ),
+
     'manage' => array
     (
         'delete' => false,

+ 0 - 2
vip/src/Buy.php

@@ -84,8 +84,6 @@ class Buy extends Base
             Dever::alert('请传入正确的信息');
         }
 
-        $user = Dever::db('passport/user')->one($uid);
-
         if ($type == 'wechat') {
             $wechat = Dever::db('passport/wechat')->one(array('uid' => $uid, 'type' => 2));
         } elseif ($type != 'alipay') {