hrjy 3 yıl önce
ebeveyn
işleme
9a9ceaf458

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

@@ -3,6 +3,8 @@ namespace app\admin\controller\auction;
 
 use app\admin\controller\AuthController;
 use app\admin\controller\Union;
+use app\models\auction\AuctionTime;
+use app\models\user\User;
 use crmeb\services\{ExpressService,
     JsonService,
     MiniProgramService,
@@ -189,25 +191,47 @@ class AuctionProduct extends AuthController
 
     }
 
+    /**
+     * 修改商品所属人页面
+     * @param $id
+     * @return string
+     * @throws \Exception
+     */
+    public function belonging($id)
+    {
+        $f = [];
+        $f[] = Form::input('account', '输入用户账号或者ID' );
+        $f[] = Form::hidden('id', $id );
+        $form = Form::make_post_form('修改', $f, Url::buildUrl('belonging_save'));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+
+    }
+
+    /**
+     * 修改商品所属人
+     * @param $account
+     * @param $id
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function belonging_save($account, $id)
+    {
+        if (!$account) return  Json::fail('不能为空');
+        $user = User::where('account|uid', '=', $account)->find();
+        if (!$user) return  Json::fail('用户不存在');
+        $product = \app\admin\model\auction\AuctionProduct::find($id);
+        if ($product['is_admin'] != 1 and $product['is_show'] == 1){
+            AuctionTime::where('product_id', $product['id'])->delete();// 删除上架信息
+        }
+        $product['is_show'] = 0;
+        $product['uid'] = $user['uid'];
+        $res = $product->save();
+        if ($res) return  Json::success('修改成功');
+        return  Json::fail('修改失败');
+    }
 
-//    public function edit($id)
-//    {
-//        if (!$id) Json::fail('数据不存在');
-//
-//
-//        $list = \app\admin\model\auction\Auction::get($id);
-//        if (!$list) Json::fail('数据不存在');
-//
-//        $f = array();
-//        $f[] = Form::input('id', 'ID', $list->getData('id'))->disabled(1);
-//        $f[] = Form::input('nickname', '名称', $list->getData('nickname'));
-//        $f[] = Form::uploadImageOne('image', '图片','/index.php/admin/widget.images/upload',$list->getData('image'));
-//        $f[] = Form::radio('is_promoter', '推广员',$list->getData('status'))->options([['value' => 1, 'label' => '启用'], ['value' => 0, 'label' => '禁用']]);
-//        $f[] = Form::dateTime('time', '推广员',$list->getData('add_time'));
-//
-//        $form = Form::make_post_form('添加用户通知', $f, Url::buildUrl('update', array('uid' => $id)), 5);
-//        $this->assign(compact('form'));
-//        return $this->fetch('public/form-builder');
-//    }
 
 }

+ 7 - 5
app/admin/model/auction/AuctionOrder.php

@@ -100,12 +100,14 @@ class AuctionOrder extends BaseModel
             }elseif ($item['status'] == 3){
                 $status ='完成';
             }
-            if ($item['is_gs']  == 0 and $item['status'] == 0){
+            if ($item['status'] == 0){
                 $is_gs = '过期订单';
-            }elseif ($item['is_gs'] == 0){
-                $is_gs ='未挂售';
-            }elseif ($item['is_gs'] == 1){
-                $is_gs ='已挂售';
+            }else{
+                if ($item['is_gs'] == 0){
+                    $is_gs ='未挂售';
+                }elseif ($item['is_gs'] == 1){
+                    $is_gs ='已挂售';
+                }
             }
             $export[] = [
                 $item['order_id'],

+ 4 - 1
app/admin/view/auction/auction_product/index.php

@@ -110,6 +110,9 @@
                         {{#  } }}
                     </script>
                     <script type="text/html" id="act">
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('修改所属人','{:Url('belonging')}?id={{d.id}}',{h:500,w:500})">
+                            所属
+                        </button>
                         <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event='edit'>
                             编辑
                         </button>
@@ -147,7 +150,7 @@
             {field: 'time', title: '挂售时间', templet: '#time', align: 'center'},
             {field: 'frozen', title: '冻结状态', templet: '#frozen', align: 'center'},
             {field: 'create_time', title: '创建时间', templet: '#create_time', align: 'center'},
-            {field: 'right', title: '操作', align: 'center', toolbar: '#act'},
+            {field: 'right', title: '操作', align: 'center', toolbar: '#act',width: '10%'},
         ];
     });
     //点击事件绑定

+ 1 - 1
app/api/controller/auction/AuctionController.php

@@ -108,7 +108,7 @@ class AuctionController
         if (!$data['id']) return app('json')->fail('数据传入错误');
         $auction = Auction::find($data['id']);
         $booking = AuctionBooking::where([['auction_id', '=',$auction['id']], ['frequency', '=', $auction['frequency']]])->find();
-        $radd_time = strtotime($auction['radd_time']) - 1800; // 提前五分钟进场
+        $radd_time = strtotime($auction['radd_time']) - 360; // 提前五分钟进场
 
         if (!$booking){
             return app('json')->fail('未预约');

+ 13 - 6
app/models/auction/AuctionOrder.php

@@ -75,12 +75,15 @@ class AuctionOrder extends BaseModel
                 $list = self::where([['uid', '=', $uid], ['status', '=', 3], ['is_gs', '=', 1]])->page($data['page'], $data['limit'])->select(); //完成订单
             }else if($data['type'] == 4) {
 
-                $list = self::alias('a')
-                    ->field('a.*,p.frozen')
-                    ->where([['a.uid', '=', $uid], ['a.status', '=', 3],['a.is_gs', '=', 0]])
-                    ->leftJoin('auction_product p', 'p.id = a.product_id')
+                $list = AuctionProduct::where([['uid', '=', $uid], ['is_show', '=', 0]])
                     ->page($data['page'], $data['limit'])
-                    ->select(); //待挂售订单
+                    ->select();
+                if ($list){
+                    foreach ($list as $k => $v){
+                        $list[$k]['product_id'] = $v['id'];
+                        $list[$k]['is_gs'] = 0;
+                    }
+                }
             }else{
                 $list = self::where([['uid', '=', $uid], ['status', '<', 1]])->page($data['page'], $data['limit'])->select(); //过期订单
             }
@@ -203,7 +206,11 @@ class AuctionOrder extends BaseModel
 
             if ($user['spread_uid']) {
                 $spread = $userModel->where('uid', $user['spread_uid'])->find();
-                $spread['green_time'] = strtotime(date('Y-m-d', strtotime('+1 day'))); // 开启明天的绿色通道
+                if ($spread['green_time'] !=  strtotime(date('Y-m-d', strtotime('+1 day')))){
+                    $spread['green_time'] = strtotime(date('Y-m-d', strtotime('+1 day'))); // 开启明天的绿色通道
+                    $spread->save();
+                }
+
             }
             $orderCount = AuctionOrder::where([['uid', '=',  $user['uid']], ['status','=', 3]])->count();
             if ($orderCount >= 5){

+ 1 - 1
app/models/auction/AuctionProduct.php

@@ -70,7 +70,7 @@ class AuctionProduct extends BaseModel
                 ->leftJoin('auction_product p', 'a.product_id = p.id')
                 ->where([['a.product_id', 'in', $productId], ['a.frequency', '=', $auction['frequency']], ['a.status', '=', 3]])
                 ->select();
-        };
+        }
 
         $a = [];
         $b = [];