dever 3 years ago
parent
commit
61107c145a

+ 7 - 5
app/goods/lib/Info.php

@@ -549,7 +549,7 @@ class Info
     private function sku($data, &$info)
     {
         # 获取销售属性
-        if ($data['is_sell'] == 2) {
+        if ($data['is_sell'] > 1) {
             if ($data['option']) {
                 $value = explode(',', $data['value']);
                 foreach($data['option'] as $k => $v) {
@@ -568,10 +568,12 @@ class Info
                 }
                 unset($data['option']);
             }
-            
-            $info['sell_attr'][] = $data;
-        } elseif ($data['is_sell'] == 3) {
-            $info['option_attr'][] = $data;
+
+            if ($data['is_sell'] == 2) {
+                $info['sell_attr'][] = $data;
+            } elseif ($data['is_sell'] == 3) {
+                $info['option_attr'][] = $data;
+            }
         }
     }
 

+ 3 - 1
app/goods/lib/Manage.php

@@ -212,7 +212,9 @@ class Manage
             $info = $class->info($info);
             if ($info && isset($info['attr'])) {
                 foreach ($info['attr'] as $k => $v) {
-                    $table[$v['name']] = $v['value_string'];
+                    if ($v['value_string']) {
+                        $table[$v['name']] = $v['value_string'];
+                    }
                 }
             }
         }

+ 7 - 6
app/goods/lib/Sku.php

@@ -256,8 +256,8 @@ class Sku
         if (isset($info['option_attr']) && $info['option_attr']) {
             $option_head .= '<th>属性名称</th>';
             foreach ($info['option_attr'] as $k => $v) {
-                if (isset($v['option'])) {
-                    $option_attr = array_merge($option_attr, $v['option']);
+                if (isset($v['option_sku'])) {
+                    $option_attr = array_merge($option_attr, $v['option_sku']);
                 }
             }
         }
@@ -399,15 +399,16 @@ class Sku
         $html = $head . $body;
 
         if ($update) {
-            $html = $prefix . '<table class="layui-table">' . $html . '</table>';
+            $html = '<table class="layui-table">' . $html . '</table>';
         } else {
             $html = '<table class="layui-table">' . $html . '</table>';
         }
 
         if ($option_attr) {
-            //print_r($option_attr);die;
+            $html = $prefix . $html;
             foreach ($option_attr as $k => $v) {
 
+                $id = array();
                 $option_body .= '<tr data-row="' .($k+1). '">';
 
                 if ($parent_goods) {
@@ -415,8 +416,8 @@ class Sku
                 }
 
                 $rows = 1;
-                $option_body .= '<td width="50" rowspan="'.$rows.'">'.$v['parent_name'] . '-' . $v['name'].'</td>';
-                $id = array
+                $option_body .= '<td width="50" rowspan="'.$rows.'">'. $v['parent_name'].'->'. $v['name'].'</td>';
+                $id[] = array
                 (
                     'id' => $v['id'],
                     'attr_id' => $v['info_id'],

+ 1 - 0
app/shop/database/feedback.php

@@ -104,6 +104,7 @@ return array
 			'desc' 		=> '是否回复',
 			'match' 	=> 'is_numeric',
 			'update'    => 'radio',
+			'search'	=> 'select',
             'option'    => $type,
             'list'		=> true,
             'edit'		=> true,

+ 12 - 228
app/shop/database/sell_order.php

@@ -15,41 +15,17 @@ $pay_method = array
     3 => '礼品卡',
 );
 
-$code_status = array
-(
-    1 => '已下单',
-    2 => '待自提',
-    3 => '已自提',
-);
-
-$ps_status = array
-(
-    1 => '已下单',
-    2 => '待配送',
-    3 => '配送中',
-    4 => '已收货',
-);
-
 $status = array
 (
-    1 => '待支付',
-    2 => '待处理',
-    3 => '配送中',
-    4 => '已完成',
-    5 => '已取消',
-    6 => '申请全部退款',
-    7 => '申请部分退款',
-    8 => '退货退款',
-    9 => '部分退款',
-    10 => '仅退款',
-    11 => '已过期',
-);
-
-$tk_status = array
-(
-    1 => '待审核',
-    2 => '审核通过',
-    3 => '审核未通过',
+    1 => '待支付',//买家待支付
+    2 => '待处理',//买家已支付,待商家处理
+    3 => '配送中',//商家已处理,配送中或者已配货
+    4 => '已完成',//买家已确认
+    5 => '已取消',//买家已取消
+    6 => '已退款',//买家退款,当status==2时,买家可以申请退款
+    7 => '仅退款',//商家退款
+    8 => '退货退款',//商家退款
+    11 => '已过期',//长时间未支付,自动过期
 );
 
 return array
@@ -60,8 +36,6 @@ return array
     'lang' => '销售订单',
     'order' => 100,
     'status' => $status,
-    'ps_status' => $ps_status,
-    'code_status' => $code_status,
     'pay_method' => $pay_method,
     'method' => $method,
     # 数据结构
@@ -110,28 +84,6 @@ return array
             'list'      => 'Dever::load("shop/lib/manage.user", {id})',
         ),
 
-        'parent_uid'       => array
-        (
-            'type'      => 'int-11',
-            'name'      => '邀请人',
-            'default'   => '0',
-            'desc'      => '请选择用户',
-            'match'     => 'is_numeric',
-            //'update'    => 'text',
-            //'search'  => 'select',
-            /*
-            'search'    => array
-            (
-                'api' => 'passport/user-all',
-                'col' => 'username',
-                'result' => 'id',
-            ),
-            */
-            //'list_name' => '订单详情',
-            //'list'      => 'Dever::load("goods/lib/manage.order", {id})',
-            //'list'      => '{parent_uid} > 0 ? Dever::load("passport/user-one#username", {parent_uid}) : "无邀请人"',
-        ),
-
         'mobile'        => array
         (
             'type'      => 'varchar-300',
@@ -221,15 +173,6 @@ return array
             'match'     => 'option',
         ),
 
-        'coupon_id'      => array
-        (
-            'type'      => 'int-11',
-            'name'      => '用户使用的优惠券id',
-            'default'   => '',
-            'desc'      => '用户的优惠券id',
-            'match'     => 'option',
-        ),
-
         'user_coupon_id'      => array
         (
             'type'      => 'int-11',
@@ -253,94 +196,10 @@ return array
         'code'        => array
         (
             'type'      => 'varchar-100',
-            'name'      => '自提码',
-            'default'   => '',
-            'desc'      => '自提码',
-            'match'     => 'is_numeric',
-        ),
-
-        'code_status'        => array
-        (
-            'type'      => 'int-11',
-            'name'      => '自提状态',
-            'default'   => '1',
-            'desc'      => '自提状态',
-            'match'     => 'is_numeric',
-            'update'    => 'radio',
-            'option'    => $code_status,
-        ),
-
-        'ps_code'        => array
-        (
-            'type'      => 'varchar-100',
-            'name'      => '物流号',
-            'default'   => '',
-            'desc'      => '物流号',
-            'match'     => 'is_string',
-        ),
-
-        'ps_status'        => array
-        (
-            'type'      => 'int-11',
-            'name'      => '配送状态',
-            'default'   => '1',
-            'desc'      => '配送状态',
-            'match'     => 'is_numeric',
-            'update'    => 'radio',
-            'option'    => $ps_status,
-        ),
-
-        'ps_id'        => array
-        (
-            'type'      => 'int-11',
-            'name'      => '配送服务商id',
-            'default'   => '1',
-            'desc'      => '配送服务商id',
-            'match'     => 'is_numeric',
-            //'update'    => 'select',
-            //'option'    => $ps_service,
-        ),
-
-        'ps_cash'        => array
-        (
-            'type'      => 'varchar-100',
-            'name'      => '配送金额',
-            'default'   => '',
-            'desc'      => '配送金额',
-            'match'     => 'is_string',
-        ),
-
-        'pay_id'      => array
-        (
-            'type'      => 'varchar-100',
-            'name'      => '支付订单ID',
+            'name'      => '自提码或者核销码',
             'default'   => '',
-            'desc'      => '付款订单id',
-            'match'     => 'is_string',
-            //'update'    => 'text',
-            //'search'    => 'fulltext',
-            //'list'        => true,
-        ),
-
-        'pay_status'        => array
-        (
-            'type'      => 'tinyint-1',
-            'name'      => '支付状态',
-            'default'   => '1',
-            'desc'      => '请选择支付状态',
+            'desc'      => '自提码或者核销码',
             'match'     => 'is_numeric',
-            'option'    => $pay_status,
-            'list'      => true,
-        ),
-
-        'pay_price'      => array
-        (
-            'type'      => 'varchar-50',
-            'name'      => '付款金额',
-            'default'   => '',
-            'desc'      => '付款金额',
-            'match'     => 'option',
-            'update'    => 'text',
         ),
 
         'pay_method'        => array
@@ -365,81 +224,6 @@ return array
             'update'    => 'textarea',
         ),
 
-        'note'     => array
-        (
-            'type'      => 'tinyint-1',
-            'name'      => '是否发送状态提醒-1未发送,2已发送',
-            'default'   => '1',
-            'desc'      => '请选择状态',
-            'match'     => 'is_numeric',
-        ),
-
-        'notice'        => array
-        (
-            'type'      => 'int-11',
-            'name'      => '模板消息提醒次数',
-            'default'   => '0',
-            'desc'      => '模板消息提醒次数',
-            'match'     => 'is_numeric',
-        ),
-
-        'tk_pic'     => array
-        (
-            'type'      => 'varchar-150',
-            'name'      => '退款截图',
-            'default'   => '',
-            'desc'      => '退款截图',
-            'match'     => 'is_string',
-            'update'    => 'image',
-            'key'       => 1
-        ),
-
-        'tk_time'       => array
-        (
-            'type'      => 'int-11',
-            'name'      => '退款时间',
-            'default'   => '',
-            'desc'      => '退款时间',
-            'match'     => 'option',
-            //'list'        => true,
-            //'update'    => 'date',
-            'callback'  => 'maketime',
-            'show'      => 'status=5',
-        ),
-
-        'tk_admin'      => array
-        (
-            'type'      => 'int-11',
-            'name'      => '退款审核人',
-            'default'   => '1',
-            'desc'      => '退款审核人',
-            'match'     => 'option',
-            //'list'        => true,
-            'show'      => 'status=5',
-        ),
-
-        'tk_desc'       => array
-        (
-            'type'      => 'varchar-300',
-            'name'      => '退款备注',
-            'default'   => '',
-            'desc'      => '退款备注',
-            'match'     => 'option',
-            'update'    => 'textarea',
-            //'show'        => 'status=5',
-        ),
-
-        'tk_status'        => array
-        (
-            'type'      => 'tinyint-1',
-            'name'      => '申请退款状态',
-            'default'   => '1',
-            'desc'      => '申请退款状态',
-            'match'     => 'option',
-            'update'    => 'radio',
-            'option'    => $tk_status,
-        ),
-
         'area'       => array
         (
             'type'      => 'varchar-500',
@@ -541,7 +325,7 @@ return array
         (
             'fast_list' => array('查看详情', '"sell_order_goods&project=shop&order_id={id}&page_type=1"'),
 
-            'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin,tk_status', '{status} == 6'),
+            //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin,tk_status', '{status} == 6'),
             //'delete' => array('删除', '', '{status} == 1'),
         ),
     ),

+ 2 - 2
app/shop/database/sell_order_goods.php

@@ -4,8 +4,8 @@ $status = array
 (
     1 => '正常',
     2 => '缺货',
-    3 => '申请退款',
-    4 => '退款',
+    3 => '退款',
+    4 => '退款退货',
 );
 
 return array

+ 160 - 0
app/shop/database/sell_order_ps.php

@@ -0,0 +1,160 @@
+<?php
+
+$status = array
+(
+    1 => '待处理',
+    2 => '配送中',
+    3 => '已配送',
+    4 => '未配送',
+);
+
+return array
+(
+    # 表名
+    'name' => 'sell_order_ps',
+    # 显示给用户看的名称
+    'lang' => '订单配送表',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'uid'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '用户名',
+            'default'   => '0',
+            'desc'      => '请选择用户',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            //'search'  => 'select',
+            'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+            'list'      => '{uid} > 0 ? Dever::load("passport/user-find#username", {uid}) : "匿名用户"',
+        ),
+
+        'shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属门店',
+            'default'   => '',
+            'desc'      => '所属门店',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_shop_id'),
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
+        ),
+
+        'order_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '订单表id',
+            'default'   => '',
+            'desc'      => '订单表id',
+            'match'     => 'is_numeric',
+        ),
+
+        'service_id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '配送服务商id',
+            'default'   => '-1',
+            'desc'      => '配送服务商id',
+            'match'     => 'is_numeric',
+            //'update'    => 'select',
+            //'option'    => $ps_service,
+        ),
+
+        'order_num'        => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '配送订单号',
+            'default'   => '',
+            'desc'      => '配送订单号',
+            'match'     => 'is_string',
+        ),
+
+        'price'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '配送金额',
+            'default'   => '',
+            'desc'      => '配送金额',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'        => true,
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '配送数量',
+            'default'   => '',
+            'desc'      => '配送数量',
+            'match'     => 'is_numeric',
+            'search'    => 'select',
+            'list'        => true,
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '状态',
+            'match'     => 'is_numeric',
+            //'update'  => 'select',
+            'option'    => $status,
+            'search'    => 'select',
+            'list'      => true,
+            'edit'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            //'insert'    => true,
+            'search'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 41 - 39
app/shop/lib/Sell.php

@@ -9,24 +9,13 @@ use Dever;
 class Sell
 {
     # 发起支付
-	public function action($method, $pay_method, $user, $shop, $name, $num, $goods, $price, $address_id, $invoice_id, $info, $card, $coupon_id, $user_coupon_id, $parent_uid = false, $cart = false, $refer = '')
+	public function action($method, $pay_method, $user, $shop, $name, $num, $goods, $price, $address_id, $invoice_id, $info, $card, $user_coupon_id, $cart = false, $refer = '')
     {
         if (!$user) {
             Dever::alert('错误的用户信息');
         }
 
         $uid = $user['id'];
-
-        if (!$parent_uid && Dever::project('invite')) {
-            $parent = Dever::load('invite/api')->getParent($uid, 1);
-            if ($parent) {
-                $parent_uid = $parent['uid'];
-            }
-        }
-        
-        if ($parent_uid) {
-            $order_data['parent_uid'] = $parent_uid;
-        }
         
         $order_data['shop_id'] = $shop['id'];
         $order_data['uid'] = $uid;
@@ -50,17 +39,11 @@ class Sell
         if ($card) {
         	$order_data['card_code_id'] = $card['id'];
         }
-        if ($coupon_id) {
-        	$order_data['coupon_id'] = $coupon_id;
-        }
         if ($user_coupon_id) {
             $order_data['user_coupon_id'] = $user_coupon_id;
         }
 
         $order_data['order_num'] = $this->getOrderId();
-        $order_data['pay_id'] = $order_data['order_num'];
-        $order_data['pay_status'] = 1;
-        $order_data['pay_price'] = 0;
         $id = Dever::db('shop/sell_order')->insert($order_data);
 
         if (!$id) {
@@ -84,7 +67,7 @@ class Sell
         if ($card || $price <= 0) {
 
         	$param['pay_product_id'] = $id;
-        	$param['pay_order_id'] = $order_data['pay_id'];
+        	$param['pay_order_id'] = $order_data['order_num'];
         	$param['pay_status'] = 2;
         	$param['pay_cash'] = $price;
         	$param['pay_msg'] = '';
@@ -95,7 +78,7 @@ class Sell
                 $this->dropCart($uid, $goods, $shop['id']);
             }
             # 使用优惠券
-            $this->useCoupon($coupon_id, $user_coupon_id);
+            $this->useCoupon($user_coupon_id);
         	return 'ok';
         }
 
@@ -108,7 +91,7 @@ class Sell
             'name' => $order_data['name'],
             'cash' => $price,
             'product_id' => $id,
-            'order_id' => $order_data['pay_id'],
+            'order_id' => $order_data['order_num'],
             'refer' => $refer,
         );
 
@@ -123,7 +106,7 @@ class Sell
             $this->dropCart($uid, $goods, $shop['id']);
         }
         # 使用优惠券
-        $this->useCoupon($coupon_id, $user_coupon_id);
+        $this->useCoupon($user_coupon_id);
         return $result;
     }
 
@@ -137,7 +120,7 @@ class Sell
         }
     }
 
-    public function useCoupon($coupon_id, $user_coupon_id)
+    public function useCoupon($user_coupon_id)
     {
         if ($user_coupon_id) {
             Dever::db('shop/user_coupon')->update(array('where_id' => $user_coupon_id, 'status' => 2));
@@ -160,12 +143,13 @@ class Sell
     	$param = array
         (
             'project_id' => 1,
-            'account_id' => 5,
+            'channel_id' => 1,
+            'system_source' => 5,
             'uid' => $order['uid'],
             'name' => $order['name'],
             'cash' => $order['price'],
             'product_id' => $id,
-            'order_id' => $order['pay_id'],
+            'order_id' => $order['order_num'],
             'refer' => $refer,
         );
 
@@ -207,41 +191,59 @@ class Sell
         $msg = $send['pay_msg'];
 
         $order = Dever::db('shop/sell_order')->one(array('id' => $product_id, 'time' => time()));
-        if ($order && $order['pay_status'] == 1) {
+        if ($order && $order['status'] == 1) {
 
             if ($status == 2) {
                 # 减少库存 增加销量
                 $this->updateSell($order);
 
-                # 发消息
-                if (Dever::project('message')) {
-                    Dever::load('message/lib/data')->push(-1, $order['uid'], '订购成功通知', '购买成功', 1);
-                }
-
                 # 生成自提码或者取件码
                 $update['code'] = $this->getCode();
                 if ($order['method'] == 1) {
-                	$update['code_status'] = 2;
+                    $msg = '您有一件自提商品已订购成功,取件码:' . $update['code'];
                 } else {
-                	$update['ps_status'] = 2;
+                    $msg = '您有一件外送商品已订购成功,核销码:' . $update['code'];
+                    # 分配配送信息
+                    $this->updatePs($order);
+                }
 
-                    # 先在这里分配配送吧
-                    $update['ps_cash'] = 0;
-                    $update['ps_id'] = 1;
+                # 发消息
+                if (Dever::project('message')) {
+                    $shop = Dever::db('shop/info')->one($order['shop_id']);
+                    $msg_param['type'] = 1;//消息类型1是订单消息
+                    $msg_param['id'] = $order['id'];
+                    $msg_param['name'] = $shop['name'];
+                    $msg_param = Dever::json_encode($msg_param);
+                    Dever::load('message/lib/data')->push(-1, $order['uid'], '订购成功通知', $msg, 1, 1, false, $msg_param);
                 }
             }
 
-            $update['pay_status'] = $status;
             $update['status'] = 2;
             $update['where_id'] = $order['id'];
-            $update['pay_time'] = time();
-            $update['pay_price'] = $cash;
             Dever::db('shop/sell_order')->update($update);
         }
 
         return 'ok';
     }
 
+    # 添加配送信息
+    public function updatePs($order)
+    {
+        $where['order_id'] = $order['id'];
+        $data = Dever::db('shop/sell_order_ps')->find($where);
+
+        if (!$data) {
+            $insert = $where;
+            $insert['uid'] = $order['uid'];
+            $insert['shop_id'] = $order['shop_id'];
+            $insert['service_id'] = -1;
+            $insert['price'] = 0;
+            $insert['num'] = $order['num'];
+
+            Dever::db('shop/sell_order_ps')->insert($insert);
+        }
+    }
+
     # 减少库存,增加销量
     public function updateSell($order)
     {

+ 1 - 1
app/shop/src/Buy.php

@@ -396,7 +396,7 @@ class Buy extends Core
             $this->data['card'] = false;
         }
 
-        $pay = Dever::load('shop/lib/sell')->action($this->data['method'], $this->data['pay_method'], $this->user, $this->shop, $this->data['name'], $this->data['num'], $this->data['list'], $this->data['price'], $address_id, $invoice_id, $info, $this->data['card'], $this->data['coupon_id'], $this->data['user_coupon_id'], $parent_uid, $cart, $refer);
+        $pay = Dever::load('shop/lib/sell')->action($this->data['method'], $this->data['pay_method'], $this->user, $this->shop, $this->data['name'], $this->data['num'], $this->data['list'], $this->data['price'], $address_id, $invoice_id, $info, $this->data['card'], $this->data['user_coupon_id'], $cart, $refer);
         return $pay;
     }
 

+ 36 - 33
app/shop/src/My.php

@@ -176,9 +176,22 @@ class My extends Core
         if ($info['status'] == 2) {
             $info['status_name'] = '支付成功';
         }
+        if ($info['status'] == 3) {
+            if ($info['method'] == 1) {
+                $info['status_name'] = '已配货';
+            } else {
+                $info['status_name'] = '配送中';
+            }
+        }
 
-        if ($info['method'] == 2 && $info['status'] > 1) {
-            # 如果是外送,需要读取外送单号
+        if ($info['method'] == 2) {
+            $info['ps_info'] = Dever::db('shop/sell_order_ps')->find(array('order_id' => $info['id']));
+            if ($info['ps_info']) {
+                $info['ps_info']['service_name'] = '商家自送';
+                if ($info['ps_info']['service_id'] > 0) {
+                    //暂时还没有
+                }
+            }
         }
 
         $info['goods'] = Dever::db('shop/sell_order_goods')->select(array('order_id' => $info['id']));
@@ -241,7 +254,7 @@ class My extends Core
         if (!$this->data) {
             Dever::alert('订单不存在');
         }
-        if ($this->data['status'] == 2 || $this->data['status'] == 3) {
+        if ($this->data['status'] == 2) {
             Dever::db('shop/sell_order')->update(array('where_id' => $id, 'status' => 6));
 
             # 退款到原支付账户
@@ -251,48 +264,38 @@ class My extends Core
         }
     }
 
-    # 部分退款退货
-    public function order_tui_goods()
+    # 我的消息列表
+    public function msg()
     {
-        $id = Dever::input('order_id');
-        $user_goods_id = Dever::input('user_goods_id');
-
-        $this->data = Dever::db('shop/sell_order')->find(array('uid' => $this->uid, 'id' => $id));
-        if (!$this->data) {
-            Dever::alert('订单不存在');
-        }
-        if ($this->data['status'] == 2 || $this->data['status'] == 3) {
-            Dever::db('shop/sell_order')->update(array('where_id' => $id, 'status' => 7));
-
-            $goods_id = explode(',', $user_goods_id);
+        $data = Dever::load('message/lib/data')->read($this->uid, false, true);
 
-            foreach ($goods_id as $k => $v) {
-                Dever::db('shop/sell_order_goods')->update(array('where_id' => $v, 'status' => 3));
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $data[$k]['cdate_string'] = Dever::ddate($v['cdate']);
+                if ($v['param']) {
+                    $data[$k]['param'] = Dever::json_decode($v['param']);
+                }
             }
-
-            # 退款到原支付账户
-            return 'ok';
-        } else {
-            Dever::alert('当前订单状态不允许退货退款');
         }
+        return $data;
     }
 
-    # 我的消息列表
-    public function msg()
+    # 删除消息
+    public function msg_delete()
     {
-        $data = Dever::load('message/lib/data')->read($this->uid);
+        $id = Dever::input('id');
+        $data = Dever::load('message/lib/data')->view($this->uid, $id);
 
         if ($data) {
-            foreach ($data as $k => $v) {
-                $data[$k]['cdate_string'] = Dever::ddate($v['cdate']);
-                $type = Dever::db('message/type')->one($v['type']);
-                $data[$k]['type_name'] = $type['name'];
-            }
+            $data['cdate_string'] = Dever::ddate($data['cdate']);
+            $type = Dever::db('message/type')->one($data['type']);
+            $data['type_name'] = $type['name'];
         }
+
         return $data;
     }
 
-    # 查看我的消息
+    # 查看我的消息 废弃
     public function view_msg()
     {
         $id = Dever::input('id');
@@ -356,7 +359,7 @@ class My extends Core
         $data['truename'] = Dever::input('truename');
         $data['content'] = Dever::input('content');
 
-        return Dever::load('shop/feedback')->insert($data);
+        return Dever::db('shop/feedback')->insert($data);
     }
 
     # 领取优惠券