hrjy 3 anni fa
parent
commit
56113b8115

+ 9 - 12
.idea/workspace.xml

@@ -5,21 +5,11 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="9df7b838-09db-466a-bed4-3e1ac8c3624d" name="变更" comment="commit">
-      <change afterPath="$PROJECT_DIR$/public/static/img/down.jpg" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/public/static/img/downLoad.png" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/public/static/img/live_weixin.png" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/app/admin/controller/auction/Auction.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/admin/controller/auction/Auction.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/app/admin/controller/auction/AuctionOrder.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/admin/controller/auction/AuctionOrder.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/app/admin/controller/auction/AuctionProduct.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/admin/controller/auction/AuctionProduct.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/app/admin/controller/system/SystemStore.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/admin/controller/system/SystemStore.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/app/admin/model/auction/AuctionProduct.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/admin/model/auction/AuctionProduct.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/app/admin/view/system/system_store/add.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/admin/view/system/system_store/add.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/app/admin/view/system/system_store/index.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/admin/view/system/system_store/index.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/app/admin/view/system/system_store/select_address.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/admin/view/system/system_store/select_address.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/app/api/controller/PublicController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/api/controller/PublicController.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/app/api/controller/auction/AuctionController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/api/controller/auction/AuctionController.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/app/api/controller/auction/AuctionProductController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/api/controller/auction/AuctionProductController.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/app/models/auction/AuctionOrder.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/models/auction/AuctionOrder.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
@@ -155,7 +145,7 @@
       <workItem from="1657240542957" duration="117000" />
       <workItem from="1657247426337" duration="7039000" />
       <workItem from="1657326818073" duration="7198000" />
-      <workItem from="1657500150633" duration="4910000" />
+      <workItem from="1657500150633" duration="6917000" />
     </task>
     <task id="LOCAL-00001" summary="commit">
       <created>1655962607195</created>
@@ -213,7 +203,14 @@
       <option name="project" value="LOCAL" />
       <updated>1657263227422</updated>
     </task>
-    <option name="localTasksCounter" value="9" />
+    <task id="LOCAL-00009" summary="commit">
+      <created>1657505307060</created>
+      <option name="number" value="00009" />
+      <option name="presentableId" value="LOCAL-00009" />
+      <option name="project" value="LOCAL" />
+      <updated>1657505307060</updated>
+    </task>
+    <option name="localTasksCounter" value="10" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">

+ 18 - 36
app/admin/controller/auction/Auction.php

@@ -8,7 +8,6 @@ use app\admin\model\auction\AuctionProduct as model;
 use app\admin\model\store\StoreProductAttrResult;
 use app\admin\model\store\StoreProductAttrValue;
 use app\admin\model\User;
-use app\models\auction\AuctionTime;
 use app\models\store\StoreProduct;
 use app\models\store\StoreProductAttr;
 use crmeb\services\{ExpressService,
@@ -86,10 +85,10 @@ class Auction extends AuthController
             }
             return $menus;
         })->filterable(1)->col(12);
-        $f[] = Form::dateTimes('add_time', '预约开始时间');
-        $f[] = Form::dateTimes('end_time', '预约结束时间');
-        $f[] = Form::dateTimes('radd_time', '入场时间');
-        $f[] = Form::dateTimes('rend_time', '结束时间');
+        $f[] = Form::dateTimes('add_time', '认购开始时间');
+        $f[] = Form::dateTimes('end_time', '认购结束时间');
+        $f[] = Form::dateTimes('radd_time', '支付开始时间');
+        $f[] = Form::dateTimes('rend_time', '支付结束时间');
         $f[] = Form::input('sort', '排序', '0');
         $f[] = Form::input('sort', '排序', '0')->col(12);
         $f[] = Form::input('goods_time', '放货时间(分钟)', '0')->col(12);
@@ -153,10 +152,10 @@ class Auction extends AuthController
             'image.require' => '图片不能为空',
             'status.require' => '状态不能为空',
             'anticipate.require' => '请填写预约价格',
-            'add_time.require' => '请选择预约开始时间价格',
-            'end_time.require' => '请选择预约结束时间价格',
-            'radd_time.require' => '请选择进场时间',
-            'rend_time.require' => '请选择结束时间',
+            'add_time.require' => '请选择认购开始时间价格',
+            'end_time.require' => '请选择认购结束时间价格',
+            'radd_time.require' => '请选择支付开始时间',
+            'rend_time.require' => '请选择支付结束时间',
             'auction_gu_id.require' => '请选择绑定场馆',
             'site.require' => '请选择开场日期',
             'goods_time.require' => '请输入放货时间',
@@ -241,10 +240,10 @@ class Auction extends AuthController
         }
 
 
-        $f[] = Form::dateTimes('add_time', '预约开始时间', $data->getData('add_time'));
-        $f[] = Form::dateTimes('end_time', '预约结束时间', $data->getData('end_time'));
-        $f[] = Form::dateTimes('radd_time', '入场时间', $data->getData('radd_time'));
-        $f[] = Form::dateTimes('rend_time', '结束时间', $data->getData('rend_time'));
+        $f[] = Form::dateTimes('add_time', '认购开始时间', $data->getData('add_time'));
+        $f[] = Form::dateTimes('end_time', '认购结束时间', $data->getData('end_time'));
+        $f[] = Form::dateTimes('radd_time', '支付开始时间', $data->getData('radd_time'));
+        $f[] = Form::dateTimes('rend_time', '支付结束时间', $data->getData('rend_time'));
         $f[] = Form::input('sort', '排序', $data->getData('sort'))->col(12);
         $f[] = Form::input('goods_time', '放货时间(分钟)', $data->getData('goods_time'))->col(12);
 
@@ -310,10 +309,10 @@ class Auction extends AuthController
             'image.require' => '图片不能为空',
             'status.require' => '状态不能为空',
             'anticipate.require' => '请填写预约价格',
-            'add_time.require' => '请选择预约开始时间价格',
-            'end_time.require' => '请选择预约结束时间价格',
-            'radd_time.require' => '请选择进场时间',
-            'rend_time.require' => '请选择结束时间',
+            'add_time.require' => '请选择认购开始时间价格',
+            'end_time.require' => '请选择认购结束时间价格',
+            'radd_time.require' => '请选择支付开始时间',
+            'rend_time.require' => '请选择支付结束时间',
             'auction_gu_id.require' => '请选择绑定场馆',
             'site.require' => '请选择开场日期',
             'goods_time.require' => '请输入放货时间',
@@ -446,15 +445,7 @@ class Auction extends AuthController
         $auction_gu = \app\admin\model\auction\AuctionGu::where('id' ,$auction['auction_gu_id'])->find();
         $data['uid'] = $auction_gu['uid'];
         $model = new model();
-        $res = $model->insertGetId($data);
-        $datas = \app\models\auction\AuctionProduct::bs($res);// 获取挂售详情
-        // 新增挂售时间段
-        AuctionTime::create([
-            'uid' => $data['uid'],
-            'product_id' => $res,
-            'auction_id' => $data['auction_id'],
-            'add_time' => strtotime($datas['gs_time'])
-        ]);
+        $res = $model->save($data);
         if ($res){
             return Json::success('添加成功!');
         }else{
@@ -520,16 +511,7 @@ class Auction extends AuthController
         $auction = \app\admin\model\auction\Auction::where('id' ,$data['auction_id'])->find();
         $auction_gu = \app\admin\model\auction\AuctionGu::where('id' ,$auction['auction_gu_id'])->find();
         $data['uid'] = $auction_gu['uid'];
-        $model = new model();
-        $res = $model->insertGetId($data);
-        $datas = \app\models\auction\AuctionProduct::bs($res);// 获取挂售详情
-        // 新增挂售时间段
-        AuctionTime::create([
-            'uid' => $data['uid'],
-            'product_id' => $res,
-            'auction_id' => $data['auction_id'],
-            'add_time' => strtotime($datas['gs_time'])
-        ]);
+        $res = model::create($data);
         if ($res){
             return Json::success('修改成功!');
         }else{

+ 3 - 19
app/admin/controller/auction/AuctionProduct.php

@@ -102,15 +102,7 @@ class AuctionProduct extends AuthController
         $auction_gu = \app\admin\model\auction\AuctionGu::where('id' ,$auction['auction_gu_id'])->find();
         $data['uid'] = $auction_gu['uid'];
         $model = new model();
-        $res = $model->insertGetId($data);
-        $datas = \app\models\auction\AuctionProduct::bs($res);// 获取挂售详情
-        // 新增挂售时间段
-        AuctionTime::create([
-            'uid' => $auction_gu['uid'],
-            'product_id' => $res,
-            'auction_id' => $data['auction_id'],
-            'add_time' => strtotime($datas['gs_time'])
-        ]);
+        $res = $model->save($data);
         if ($res){
             return Json::success('添加成功!');
         }else{
@@ -165,6 +157,7 @@ class AuctionProduct extends AuthController
         }
     }
 
+
     public function edit($id)
     {
         if (!$id) Json::fail('数据不存在');
@@ -288,16 +281,7 @@ class AuctionProduct extends AuthController
         ]);
         $data['slider_image'] = json_encode($data['slider_image']);
         $data['description'] = htmlspecialchars($data['description']);
-        $model = new model();
-        $res = $model->insertGetId($data);
-        $datas = \app\models\auction\AuctionProduct::bs($res);// 获取挂售详情
-        // 新增挂售时间段
-        AuctionTime::create([
-            'uid' => $data['uid'],
-            'product_id' => $res,
-            'auction_id' => $data['auction_id'],
-            'add_time' => strtotime($datas['gs_time'])
-        ]);
+        $res = model::create($data);
         if ($res){
             return Json::success('修改成功!');
         }else{

+ 9 - 5
app/admin/model/auction/AuctionProduct.php

@@ -63,12 +63,16 @@ class AuctionProduct extends BaseModel
         $data['data'] = $model->select()->toArray();
         foreach ($data['data'] as $k => $v)
         {
-            $time = AuctionTime::where('product_id', $v['id'])->find();
-            if ($time){
-                $data['data'][$k]['time'] = date('Y-m-d', $time['add_time']);
+            if ($v['is_admin'] == 2){
+                $time = AuctionTime::where('product_id', $v['id'])->find();
+                if ($time){
+                    $data['data'][$k]['time'] = date('Y-m-d', $time['add_time']);
+                }else{
+                    $data['data'][$k]['time'] = '未上架';
+
+                }
             }else{
-                $data['data'][$k]['time'] = '未上架';
-
+                $data['data'][$k]['time'] = date('Y-m-d', time());
             }
         }
         return $data;

+ 12 - 2
app/api/controller/auction/AuctionController.php

@@ -76,12 +76,21 @@ class AuctionController
         }
         $product = AuctionProduct::alias('a')
             ->field('a.*')
-            ->where([['a.uid', '<>', $request->uid()], ['a.is_show', '=', 1], ['b.add_time', '=', strtotime('today')], ['a.auction_id', '=', $data['id']]])
+            ->where([['a.uid', '<>', $request->uid()], ['a.is_show', '=', 1], ['b.add_time', '=', strtotime('today')], ['a.auction_id', '=', $data['id']], ['succeed_time', '<', strtotime('today')]])
             ->leftJoin('auction_time b', 'a.id = b.product_id')
             ->limit(1)
             ->orderRaw('rand()')
             ->select();
-        if (count($product) == 0) return app('json')->fail('商品已认购完');;
+        if (count($product) == 0) {
+            $product = AuctionProduct::where([['uid', '<>', $request->uid()], ['is_admin', '=', 1],['is_show', '=', 1], ['auction_id', '=', $data['id']], ['succeed_time', '<', strtotime('today')]])
+                ->limit(1)
+                ->orderRaw('rand()')
+                ->select();
+            if (count($product) == 0) {
+                return app('json')->fail('商品已认购完');
+            }
+
+        }
         $user = User::find($request->uid());
         if ($user['is_auth'] != 2) return app('json')->fail('未实名认证');
         if ($user['shop_integral'] <= 0) return app('json')->fail('账户内没有购物券,无法进行预约');
@@ -101,6 +110,7 @@ class AuctionController
                 'price' => $product[0]['hanging_price'],
                 'frequency' => $auction['frequency']
             ]);
+            AuctionProduct::where('id', $product[0]['id'])->update(['succeed_time' => strtotime('today')]);
             AuctionBooking::booking($user['uid'], $auction);
             UserBill::expend('预约认购', $user['uid'], 'anticipate','reduce_anticipate', $auction['anticipate'], 0, $user['anticipate'], '预约扣除广告值'); // 写入记录
             Db::commit();

+ 2 - 0
app/models/auction/AuctionOrder.php

@@ -300,6 +300,7 @@ class AuctionOrder extends BaseModel
                         $user['anticipate'] += $dedu; // 卖家增加广告值
                         $fz['deduction'] = $fz['anticipate'];
                         $fz['status'] = 2;
+                        $product['succeed_time'] = 0;
 
                         $user->save();
                         \app\models\user\User::where('uid', $v['uid'])->update(['status' => 0, 'freeze_time' => strtotime('+1 day')]); // 冻结用户
@@ -331,6 +332,7 @@ class AuctionOrder extends BaseModel
                             $user['anticipate'] += $dedu; // 卖家增加广告值
                             $booking['deduction'] = $booking['anticipate'];
                             $booking['status'] = 2;
+                            $product['succeed_time'] = 0;
 
                             $user->save();
                             \app\models\user\User::where('uid', $v['uid'])->update(['status' => 0, 'freeze_time' => strtotime('+1 day')]); // 冻结用户