dever 5 years ago
parent
commit
834be37187
2 changed files with 16 additions and 20 deletions
  1. 13 11
      database/order.php
  2. 3 9
      lib/Pay.php

+ 13 - 11
database/order.php

@@ -1,5 +1,5 @@
 <?php
-
+$system_source = Dever::config('base')->system_source;
 $config = array
 (
 	# 表名
@@ -144,16 +144,18 @@ $config = array
 			'list'		=> true,
 		),
 
-		'source'		=> array
-		(
-			'type' 		=> 'int-11',
-			'name' 		=> '来源',
-			'default' 	=> '',
-			'desc' 		=> '来源',
-			'match' 	=> 'is_numeric',
-			'update'	=> 'text',
-			//'list'		=> true,
-		),
+		'system_source'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '所属平台',
+            'default'   => '1',
+            'desc'      => '所属平台',
+            'match'     => 'is_numeric',
+            'option'    => $system_source,
+            'update'    => 'radio',
+            'search'    => 'select',
+            'list'      => true,
+        ),
 
 		'status'		=> array
 		(

+ 3 - 9
lib/Pay.php

@@ -9,7 +9,7 @@ use Dever;
 class Pay
 {
     # 发起支付
-	public function action($parent_uid, $uid, $id, $sku, $num, $address_id, $source, $type = false, $type_id = false)
+	public function action($parent_uid, $uid, $id, $sku, $num, $address_id, $system_source, $type = false, $type_id = false)
     {
         if (!$uid) {
             Dever::alert('错误的用户信息');
@@ -17,8 +17,6 @@ class Pay
 
         $goods = Dever::load('goods/lib/info')->getPayInfo($id, $sku);
         $shop = Dever::db('goods/shop')->one($goods['shop_id']);
-
-        $user = Dever::db('passport/user')->one($uid);
         
         if ($parent_uid) {
             $order_data['parent_uid'] = $parent_uid;
@@ -33,7 +31,7 @@ class Pay
         $order_data['name'] = $goods['name'];
         $order_data['cash'] = $goods['price'];
         $order_data['num'] = $num;
-        $order_data['source'] = $source;
+        $order_data['system_source'] = $system_source;
         $order_data['order_id'] = $this->getOrderId();
         $id = Dever::db('goods/order')->insert($order_data);
 
@@ -41,20 +39,16 @@ class Pay
             Dever::alert('支付失败');
         }
 
-        $refer = 'test';
-
         $param = array
         (
             'project_id' => 1,
             'channel_id' => $shop['channel_id'],
-            'system_source' => $source,
+            'system_source' => $system_source,
             'uid' => $uid,
-            'username' => $user['username'],
             'name' => $order_data['name'],
             'cash' => $order_data['cash'] * $order_data['num'],
             'product_id' => $goods['id'],
             'order_id' => $order_data['order_id'],
-            'refer' => $refer
         );
 
         $receipt = Dever::input('receipt');