rabin 2 years ago
parent
commit
754c0da251

+ 7 - 1
app/factory/admin/Order.php

@@ -71,7 +71,13 @@ class Order extends Core
                         if ($order['address_id']) {
                             $order['address'] = Dever::load('passport/address')->getOne($order['uid'], $order['address_id']);
 
-                            $v['type_info']['name'] = $order['address']['contact'];
+                            if ($order['address']) {
+                                $v['type_info']['name'] = $order['address']['contact'];
+                            } else {
+                                $user = Dever::db('passport/user')->find($order['uid']);
+                                $v['type_info']['name'] = $user['username'];
+                            }
+                            
                         } else {
                             $user = Dever::db('passport/user')->find($order['uid']);
                             $v['type_info']['name'] = $user['username'];

+ 1 - 1
app/mshop/lib/Core.php

@@ -12,7 +12,7 @@ class Core
 
         $this->uid = Dever::load('passport/user')->check(false);
         if ($this->uid <= 0) {
-            $this->uid = 4;
+            $this->uid = 1;
         }
         if ($this->uid) {
             $this->user = Dever::db('shop/member')->find($this->uid);

+ 11 - 6
app/shop/database/user_money.php

@@ -9,8 +9,8 @@ $status = array
 
 $manage_status = array
 (
-    //1 => '待入账',
-    2 => '已入账',
+    //1 => '待审核',
+    2 => '已审核',
     3 => '已作废',
 );
 
@@ -79,6 +79,8 @@ return array
             'desc'      => '用户信息',
             'match'     => 'is_string',
             'update'    => 'text',
+            'list'      =>'Dever::load("shop/lib/money.showUser", {uid})',
+            'list_order' => 2,
         ),
 
         'order_num'      => array
@@ -90,6 +92,9 @@ return array
             'match'     => 'is_string',
             'update'    => 'text',
             'search'    => 'fulltext',
+            'list_name' => '流水号<br />交易时间',
+            'list'      =>'"{order_num}<br />".date(\'Y-m-d H:i\', {cdate})',
+            'list_order' => 1,
         ),
 
         'type'      => array
@@ -124,9 +129,9 @@ return array
             'desc'      => '金额',
             'match'     => 'is_numeric',
             'update'    => 'text',
-            //'list_name' => '金额<br />操作后余额',
-            //'list'      =>'Dever::load("bill/lib/cash.order_num#cash", {id})',
-            //'list_order' => 4,
+            'list_name' => '交易金额<br />账户余额',
+            'list'      =>'Dever::load("shop/lib/money.getCash", {id})',
+            'list_order' => 4,
         ),
 
         'yue'      => array
@@ -232,7 +237,7 @@ return array
         'insert' => false,
         'delete' => false,
         'edit' => false,
-        'excel' => $excel,
+        //'excel' => $excel,
         'button' => $button,
         'mul' => $mul,
         'list_button' => $list_button,

+ 83 - 0
app/shop/src/My.php

@@ -44,6 +44,89 @@ class My extends Core
 		return $this->data;
 	}
 
+	# 获取钱包记录表
+	public function getCash()
+	{
+		$this->data['config'] = Dever::db('main/sell_config')->find();
+		$this->data['user'] = $this->user;
+		$this->data['type'] = Dever::db('shop/user_money')->config['set']['type'];
+        $this->data['status'] = Dever::db('shop/user_money')->config['set']['status'];
+
+        $where['mid'] = $this->uid;
+        $type = Dever::input('type');
+        if ($type) {
+            $where['type'] = $type;
+        }
+        $day = Dever::input('day');
+        $this->data['list'] = Dever::db('shop/user_money')->getData($where);
+        if ($this->data['list']) {
+            foreach ($this->data['list'] as $k => $v) {
+                $this->data['list'][$k]['type_name'] = Dever::status($this->data['type'], $v['type']);
+                $this->data['list'][$k]['status_name'] = Dever::status($this->data['status'], $v['status']);
+                if ($v['type'] == 11) {
+                    $tixian = Dever::db('bill/tixian')->find($v['type_id']);
+                    if ($tixian && $tixian['status'] == 2) {
+                        $this->data['list'][$k]['status_name'] .= '(已发放)';
+                    } else {
+                        $this->data['list'][$k]['status_name'] .= '(待发放)';
+                    }
+                }
+                $this->data['list'][$k]['cdate'] = date('Y-m-d H:i', $v['cdate']);
+                if ($v['cash'] > 0) {
+                    $this->data['list'][$k]['cash'] = '+' . $v['cash'];
+                }
+            }
+        }
+
+		return $this->data;
+	}
+
+	public function getCashView()
+    {
+        $where['mid'] = $this->uid;
+        $where['id'] = Dever::input('id');
+        $this->data['info'] = Dever::db('shop/user_money')->find($where);
+
+        $config = Dever::db('shop/user_money')->config['set'];
+
+        if ($this->data['info']) {
+            $this->data['info']['type_name'] = Dever::status($config['type'], $this->data['info']['type']);
+            $this->data['info']['status_name'] = Dever::status($config['status'], $this->data['info']['status']);
+
+            $this->data['info']['cdate'] = date('Y-m-d H:i', $this->data['info']['cdate']);
+            if ($this->data['info']['cash'] > 0) {
+                $this->data['info']['cash'] = '+' . $this->data['info']['cash'];
+            }
+            if ($this->data['info']['type'] == 11) {
+                $tixian = Dever::db('bill/tixian')->find($this->data['info']['type_id']);
+                if ($tixian && $tixian['status'] == 2) {
+                    $this->data['info']['status_name'] .= '(已发放)';
+                } else {
+                    $this->data['info']['status_name'] .= '(待发放)';
+                }
+            }
+        }
+
+        return $this->data;
+    }
+
+	# 钱包充值
+	public function payCash()
+	{
+		$num = Dever::input('num');
+		if ($num <= 0) {
+			Dever::alert('请输入充值金额');
+		}
+
+		return Dever::load('shop/lib/money')->pay($this->uid, $num);
+	}
+
+	# 提现
+	public function tixian()
+	{
+		
+	}
+
 	public function getBindInfo()
 	{
 		# 获取代理商绑定信息

+ 20 - 0
main/database/sell_config.php

@@ -101,6 +101,26 @@ return array
             'update'    => 'text',
         ),
 
+        'cash'       => array
+        (
+            'type'      => 'text-255',
+            'name'      => '钱包提示',
+            'default'   => '',
+            'desc'      => '平台佣金比例',
+            'match'     => 'option',
+            'update'    => 'editor',
+        ),
+
+        'cash_tx'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '钱包提现手续费-输入1就是百分之1',
+            'default'   => '8',
+            'desc'      => '钱包提现手续费',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
         'phone'      => array
         (
             'type'      => 'varchar-100',

+ 25 - 1
main/lib/Core.php

@@ -14,7 +14,7 @@ class Core
     {
         $this->uid = Dever::load('passport/user')->check(false);
         if ($this->uid <= 0) {
-            $this->uid = 12;
+            $this->uid = 1;
         }
         if ($this->uid) {
             $this->user = Dever::load('passport/api')->info($this->uid);
@@ -43,4 +43,28 @@ class Core
             Dever::alert('操作失败');
         }
     }
+
+    # 获取记录的月份列表
+    public function month($table)
+    {
+        $data = Dever::db($table)->find(array('order' => array('id' => 'asc')));
+        if ($data) {
+            $month = date('Ym', $data['cdate']);
+            $cur = date('Ym');
+            if ($month == $cur) {
+                $result[] = $month;
+                return $result;
+            } else {
+                $result = array();
+                for ($i = $month; $i < $cur; $i++) {
+                    if ($i > 12) {
+
+                    }
+                    $result[] = $i;
+                }
+
+                return $result;
+            }
+        }
+    }
 }

+ 22 - 0
service/agent/lib/Tool.php

@@ -578,4 +578,26 @@ class Tool
 
         return 'ok';
     }
+
+    # 同步代理商订单里的区域
+    public function syncArea_api()
+    {
+        $data = Dever::db('bill/sell')->getChildData();
+
+        if ($data) {
+            foreach ($data as $k => $v) {
+                if ($v['type_id'] && $v['type_id'] > 0) {
+                    $order = Dever::db('agent/order')->find($v['type_id']);
+                    if ($order) {
+                        $child_mid = Dever::load('invite/api')->getRelation($order['mid'], $v['mid']);
+                        if ($child_mid) {
+                            Dever::db('bill/sell')->update(array('where_id' => $v['id'], 'child_mid' => $child_mid));
+                        }
+                    }
+                }
+            }
+        }
+
+        return 'ok';
+    }
 }

+ 8 - 5
service/agent/src/My.php

@@ -171,12 +171,15 @@ class My extends Core
             Dever::db('agent/member')->update(array('where_id' => $id, 'shop_id' => $shop_id, 'is_shop' => 1));
             $insert['mid'] = $id;
             $insert['new_shop_id'] = $shop_id;
-            if($this->data['info']['shop_id']){
-                $insert['old_shop_id'] = $this->data['info']['shop_id'];
-            }else{
-                $insert['old_shop_id'] = '';
+            $info = Dever::db('agent/member_shop_log')->find($insert);
+            if (!$info) {
+                if($this->data['info']['shop_id']){
+                    $insert['old_shop_id'] = $this->data['info']['shop_id'];
+                }else{
+                    $insert['old_shop_id'] = '';
+                }
+                Dever::db('agent/member_shop_log')->insert($insert);
             }
-            Dever::db('agent/member_shop_log')->insert($insert);
         } else {
             Dever::alert('这不是您的子账户');
         }

+ 12 - 1
service/bill/database/tixian.php

@@ -74,6 +74,17 @@ return array
             //'list'        => true,
         ),
 
+        'type'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '提现类型',
+            'default'   => '1',
+            'desc'      => '提现类型',
+            'match'     => 'is_numeric',
+            'search'    => 'select',
+            'option'    => $type,
+        ),
+
         'mid'      => array
         (
             'type'      => 'int-11',
@@ -89,7 +100,7 @@ return array
                 'result' => 'id',
                 'search' => 'mid',
             ),
-            'list_name' => '代理商信息',
+            'list_name' => '提现用户信息',
             'list'      => 'Dever::load("agent/lib/member.getOne", {mid}, "agent/member", true)',
             'list_order' => 3,
         ),

+ 15 - 0
service/bill/lib/Tixian.php

@@ -6,6 +6,21 @@ use Dever;
 
 class Tixian
 {
+    public function getInfo($type, $type_id)
+    {
+        if ($type == 1) {
+            return Dever::load("agent/lib/member.getOne", $type_id, "agent/member", true);
+        }
+        if ($type == 2) {
+            $shop = Dever::db('shop/info')->find($type_id);
+            return $shop['name'] . '<br />' . $shop['sid'];
+        }
+        if ($type == 3) {
+            $user = Dever::db('passport/user')->find($type_id);
+            return $user['username'] . '<br />' . $user['mobile'];
+        }
+    }
+
     public function up($mid, $ycash, $cash,$sign)
     {
         $member = Dever::db('agent/member')->find(array('id' => $mid, 'clear' => true));

+ 2 - 2
service/option/database/account.php

@@ -328,7 +328,7 @@ return array
             'order'     => 'desc',
             'desc'      => '上传时间',
             'search'    => 'date,order',
-            'list'      => '"{up_date}" ? date("Y-m-d H:i", {up_date}) : "-"',
+            'list'      => '("{up_date}" ? date("Y-m-d H:i", {up_date}) : "-") . "<br />" . (date("Y-m-d H:i", {cdate}))',
             'list_order' => 2,
         ),
 
@@ -404,7 +404,7 @@ return array
             'desc'      => '',
             # 只有insert时才生效
             'insert'    => true,
-            //'search'    => 'date',
+            'search'    => 'date',
             //'list'      => 'date("Y-m-d H:i", {cdate})',
             //'list_order' => 2,
         ),