lizhen 1 周之前
父節點
當前提交
55fc2ea911

+ 12 - 9
addons/unishop/controller/Order.php

@@ -351,7 +351,7 @@ class Order extends Base
     public function cancel()
     {
         $order_id = input('order_id', 0);
-        $order_id = \addons\unishop\extend\Hashids::decodeHex($order_id);
+//        $order_id = \addons\unishop\extend\Hashids::decodeHex($order_id);
 
         $orderModel = new \addons\unishop\model\Order();
         $order = $orderModel->where(['id' => $order_id, 'user_id' => $this->auth->id])->find();
@@ -394,7 +394,7 @@ class Order extends Base
     public function payed_cancel()
     {
         $order_id = input('order_id', 0);
-        $order_id = \addons\unishop\extend\Hashids::decodeHex($order_id);
+//        $order_id = \addons\unishop\extend\Hashids::decodeHex($order_id);
 
         $orderModel = new \addons\unishop\model\Order();
         $order = $orderModel->where(['id' => $order_id, 'user_id' => $this->auth->id])->find();
@@ -614,7 +614,7 @@ class Order extends Base
     public function delete()
     {
         $order_id = input('order_id', 0);
-        $order_id = \addons\unishop\extend\Hashids::decodeHex($order_id);
+//        $order_id = \addons\unishop\extend\Hashids::decodeHex($order_id);
 
         $orderModel = new \addons\unishop\model\Order();
         $order = $orderModel->where(['id' => $order_id, 'user_id' => $this->auth->id])->find();
@@ -648,7 +648,7 @@ class Order extends Base
     public function received()
     {
         $order_id = input('order_id', 0);
-        $order_id = \addons\unishop\extend\Hashids::decodeHex($order_id);
+//        $order_id = \addons\unishop\extend\Hashids::decodeHex($order_id);
 
         $orderModel = new \addons\unishop\model\Order();
         $order = $orderModel->where(['id' => $order_id, 'user_id' => $this->auth->id])->find();
@@ -687,9 +687,9 @@ class Order extends Base
         $anonymous = input('anonymous', 0);
         $comment = input('comment');
         $order_id = input('order_id', 0);
-        $order_id = \addons\unishop\extend\Hashids::decodeHex($order_id);
+//        $order_id = \addons\unishop\extend\Hashids::decodeHex($order_id);
         $product_id = input('product_id');
-        $product_id = \addons\unishop\extend\Hashids::decodeHex($product_id);
+//        $product_id = \addons\unishop\extend\Hashids::decodeHex($product_id);
 
         $orderProductModel = new \addons\unishop\model\OrderProduct();
         $orderProduct = $orderProductModel->where(['product_id' => $product_id, 'order_id' => $order_id, 'user_id' => $this->auth->id])->find();
@@ -897,6 +897,9 @@ class Order extends Base
                     } else {
                         $product['evaluate'] = false;
                     }*/
+                    $product_find = Db::name('unishop_product')->where('id', $product['product_id'])->find();
+                    $product['info'] = $product_find['info'];
+                    $product['activetime'] = $product_find['activetime'];
                 }
 
 //                unset($order['evaluate']);
@@ -988,7 +991,7 @@ class Order extends Base
     public function refundInfo()
     {
         $order_id = input('order_id');
-        $order_id = \addons\unishop\extend\Hashids::decodeHex($order_id);
+//        $order_id = \addons\unishop\extend\Hashids::decodeHex($order_id);
 
         $orderModel = new \addons\unishop\model\Order();
         $order = $orderModel
@@ -1047,7 +1050,7 @@ class Order extends Base
     public function refund()
     {
         $order_id = input('order_id');
-        $order_id = Hashids::decodeHex($order_id);
+//        $order_id = Hashids::decodeHex($order_id);
         $orderModel = new \addons\unishop\model\Order();
         $order = $orderModel->where(['id' => $order_id, 'user_id' => $this->auth->id])->find();
 
@@ -1137,7 +1140,7 @@ class Order extends Base
             $this->error(__('Please fill in the express number'));
         }
 
-        $orderId = Hashids::decodeHex($orderId);
+//        $orderId = Hashids::decodeHex($orderId);
         $orderModel = new \addons\unishop\model\Order();
         $order = $orderModel
             ->where(['id' => $orderId, 'user_id' => $this->auth->id])

+ 4 - 4
addons/unishop/controller/Pay.php

@@ -99,7 +99,7 @@ class Pay extends Base
     {
 
         $orderId = $this->request->request('order_id', 0);
-        $orderId = Hashids::decodeHex($orderId);
+//        $orderId = Hashids::decodeHex($orderId);
 
         $orderModel = new \addons\unishop\model\Order();
         $order = $orderModel->where(['id' => $orderId])->find();
@@ -267,7 +267,7 @@ class Pay extends Base
     public function offline()
     {
         $orderId = $this->request->get('order_id', 0);
-        $orderId = Hashids::decodeHex($orderId);
+//        $orderId = Hashids::decodeHex($orderId);
 
         $orderModel = new \addons\unishop\model\Order();
         $order = $orderModel->where(['id' => $orderId])->find();
@@ -326,7 +326,7 @@ class Pay extends Base
     public function alipay()
     {
         $orderId = $this->request->request('order_id', 0);
-        $orderId = Hashids::decodeHex($orderId);
+//        $orderId = Hashids::decodeHex($orderId);
 
         $orderModel = new \addons\unishop\model\Order();
         $order = $orderModel->where(['id' => $orderId])->find();
@@ -444,7 +444,7 @@ class Pay extends Base
         $user = $oauth->user();
 
         $order_id = $this->request->request('state', 0);
-        $orderId = Hashids::decodeHex($order_id);
+        $orderId = $order_id;
 
         $orderModel = new \addons\unishop\model\Order();
         $order = $orderModel->where(['id' => $orderId])->find();

+ 3 - 3
addons/unishop/controller/Product.php

@@ -200,7 +200,7 @@ class Product extends Base
     public function favorite()
     {
         $id = input('id', 0);
-        $id = \addons\unishop\extend\Hashids::decodeHex($id);
+//        $id = \addons\unishop\extend\Hashids::decodeHex($id);
 
         $user_id = $this->auth->id;
         $favoriteModel = Favorite::get(function ($query) use ($id, $user_id) {
@@ -219,7 +219,7 @@ class Product extends Base
             $product = $product->getData();
             $data['image'] = $product['image'];
             $data['market_price'] = $product['market_price'];
-            $data['product_id'] = Hashids::encodeHex($product['id']);
+            $data['product_id'] = Hashids::$product['id'];
             $data['sales_price'] = $product['sales_price'];
             $data['title'] = $product['title'];
             $favoriteModel->snapshot = json_encode($data);
@@ -301,7 +301,7 @@ class Product extends Base
         $page = input('page', 1);
         $pageSize = input('pagesize', 20);
         $productId = input('product_id');
-        $productId = \addons\unishop\extend\Hashids::decodeHex($productId);
+//        $productId = \addons\unishop\extend\Hashids::decodeHex($productId);
 
         // 评价信息
         $evaluate = (new Evaluate)->alias('e')

+ 2 - 0
addons/unishop/extend/Hashids.php

@@ -31,6 +31,7 @@ class Hashids
 
     public static function encodeHex($str, $hashLength = 5)
     {
+        return $str;
         $salt = Config::getByName('salt')['value'];
 
         $hashids = self::getInstanceHashids($salt, $hashLength);
@@ -40,6 +41,7 @@ class Hashids
 
     public static function decodeHex($str, $hashLength = 5)
     {
+        return $str;
         $salt = Config::getByName('salt')['value'];
 
         $hashids = self::getInstanceHashids($salt, $hashLength);

+ 5 - 1
addons/unishop/model/Order.php

@@ -5,6 +5,7 @@ namespace addons\unishop\model;
 
 use addons\unishop\extend\Hashids;
 use addons\unishop\extend\Snowflake;
+use think\Db;
 use think\Hook;
 use think\Model;
 use traits\model\SoftDelete;
@@ -153,7 +154,7 @@ class Order extends Model
      */
     public function getOrderIdAttr($value, $data)
     {
-        return Hashids::encodeHex($data['id']);
+        return $data['id'];
     }
 
     /**
@@ -436,6 +437,9 @@ class Order extends Model
                 } else {
                     $product['refund'] = false;
                 }*/
+                $product_find = Db::name('unishop_product')->where('id', $product['product_id'])->find();
+                $product['info'] = $product_find['info'];
+                $product['activetime'] = $product_find['activetime'];
             }
 
         }

+ 2 - 1
addons/unishop/model/OrderProduct.php

@@ -42,7 +42,8 @@ class OrderProduct extends Model
 
     public function getIdAttr($value, $data)
     {
-        return Hashids::encodeHex($data['product_id']);
+        return $data['product_id'];
+//        return Hashids::encodeHex($data['product_id']);
     }
 
     public function getOrderProductIdAttr($value, $data)

+ 0 - 2
addons/unishop/model/Product.php

@@ -78,7 +78,6 @@ class Product extends Model
      */
     public function getProductIdAttr($value, $data) {
         return $data['id'];
-//        return Hashids::encodeHex($data['id']);
     }
 
     /**
@@ -155,7 +154,6 @@ class Product extends Model
         $data['info'] = $product['info'];
         $data['spec'] = $spec;
         $data['number'] = $number;
-//        $data['id'] = Hashids::encodeHex($product['id']);
         $data['id'] = $product['id'];
 
         $data['total_price'] = bcmul($data['sales_price'],$number,2);

+ 2 - 2
application/admin/lang/zh-cn/unishop/product.php

@@ -3,8 +3,8 @@
 return [
     'Category_id'    => '分类ID',
     'Category name'    => '分类名称',
-    'Title'          => '产品标题',
-    'Info'          => '产品简介',
+    'Title'          => '活动标题',
+    'Info'          => '活动地址',
     'Activetime'          => '活动时间',
     'Image'          => '主图',
     'Images'         => '组图',