Browse Source

生活圈下单支付

Panda 2 weeks ago
parent
commit
ab07814f6d

+ 1 - 1
application/api/controller/Hotel.php

@@ -209,7 +209,7 @@ class Hotel extends Api
         return $this->success('提交成功',[
             'order_no' => $data['order_no'],
             'pay_amount' => $data['pay_amount'],
-            'order_type' => 'hotel_order',
+            'order_type' => 'hotel_canteen_order',
         ]);
     }
 

+ 6 - 2
application/api/controller/HotelCanteen.php

@@ -128,7 +128,7 @@ class HotelCanteen extends Api
             'get_to_time' => strtotime($params['get_to_time']),
             'sex' => $params['sex'],
             'remark' => $params['remark'] ?? '',
-            'order_no' => createUniqueNo('H', $user_id),
+            'order_no' => createUniqueNo('C', $user_id),
             'pay_amount' => bcmul($info['price'], 1, 2),
             'status' => 1,
             'create_time' => time()
@@ -137,7 +137,11 @@ class HotelCanteen extends Api
             return $this->error('订单创建失败');
         }
 
-        return $this->success('提交成功');
+        return $this->success('提交成功',[
+            'order_no' => $data['order_no'],
+            'pay_amount' => $data['pay_amount'],
+            'order_type' => 'hotel_order',
+        ]);
     }
 
     // 订单列表

+ 42 - 0
application/api/controller/OfflineShop.php

@@ -3,6 +3,7 @@
 namespace app\api\controller;
 
 use app\common\controller\Api;
+use app\common\model\HotelCanteenRoomModel;
 use app\common\model\OfflineShopModel;
 use app\common\model\OfflineTypeModel;
 use app\utils\DataUtil;
@@ -120,4 +121,45 @@ class OfflineShop extends Api
         Db::name('offline_shop')->where('id',$params['shop_id'])->update(['star'=>$star]);
         return $this->success('评价成功');
     }
+
+    /**
+     * 提交订单
+     * @return true
+     */
+    public function orderSubmit()
+    {
+        $params = $this->request->param();
+        if (empty($params['shop_id'])) {
+            return $this->error('参数缺失');
+        }
+        if (empty($params['money'])) {
+            return $this->error('请填写支付金额');
+        }
+        $user_id = $this->auth->id;
+
+        $model = new OfflineShopModel();
+        $info = $model->getDetail(params: ['id'=>$params['shop_id']]);
+        if (!$info){
+            return $this->error('门店信息有误');
+        }
+
+        // 开始报名
+        $data = [
+            'shop_id' => $info['id'],
+            'user_id' => $user_id,
+            'order_no' => createUniqueNo('C', $user_id),
+            'pay_amount' => bcmul($params['money'], 1, 2),
+            'status' => 1,
+            'create_time' => time()
+        ];
+        if (!Db::name('offline_shop_order')->insertGetId($data)) {
+            return $this->error('订单创建失败');
+        }
+
+        return $this->success('提交成功',[
+            'order_no' => $data['order_no'],
+            'pay_amount' => $data['pay_amount'],
+            'order_type' => 'offline_shop_order',
+        ]);
+    }
 }

+ 5 - 1
application/api/controller/UniversityEvent.php

@@ -154,7 +154,11 @@ class UniversityEvent extends Api
             return $this->error('订单创建失败');
         }
         Db::commit();
-        return $this->success('报名成功');
+        return $this->success('提交成功',[
+            'order_no' => $data['order_no'],
+            'pay_amount' => $data['pay_amount'],
+            'order_type' => 'university_event_apply',
+        ]);
 
 //        // 创建支付订单
 //        $remark    = '老年大学活动报名';

+ 1 - 1
application/common/model/OfflineShopModel.php

@@ -20,7 +20,7 @@ class OfflineShopModel extends BaseModel
     protected $createTime = 'createtime';
     protected $updateTime = 'updatetime';
 
-    protected int $is_status_search = 0;// 默认使用 status = 1 筛选
+    protected int $is_status_search = 1;// 默认使用 status = 1 筛选
     protected int $is_delete_search = 0;// 默认使用 is_delete = 0 筛选
 
     /**