hrjy 3 yıl önce
ebeveyn
işleme
6578fd7298

+ 2 - 1
app/admin/controller/auction/Auction.php

@@ -152,7 +152,8 @@ class Auction extends AuthController
     public function get_auction($id)
     {
         if (!$id) Json::fail('数据不存在');
-        $info = \app\admin\model\auction\Auction::find($id)->toArray();
+        $model = new \app\admin\model\auction\Auction();
+        $info = $model->find($id);
 
         $data['productInfo'] = $info;
         return JsonService::successful($data);

+ 1 - 1
app/admin/controller/auction/AuctionBooking.php

@@ -223,7 +223,7 @@ class AuctionBooking extends AuthController
     {
         if (!$id) Json::fail('没有数据');
         $data = model::find($id);
-        if ($data['status'] < 1) Json::fail('已退回,请勿重复提交');
+        if ($data['status'] < 1 or $data['status'] == 2) Json::fail('无法退回');
 
         $userModel = new User();
         $user = $userModel->where('uid', $data['uid'])->find();

+ 1 - 0
app/admin/controller/auction/AuctionGu.php

@@ -149,6 +149,7 @@ class AuctionGu extends AuthController
     public function update()
     {
         $data = Util::postMore([
+            'id',
             'name',
             'image',
             'sort',

+ 9 - 4
app/admin/controller/auction/AuctionProduct.php

@@ -89,9 +89,11 @@ class AuctionProduct extends AuthController
             'sort',
             'auction_id',
             'hanging_price',
-            'slider_image'
+            'slider_image',
+            'description'
         ]);
         $data['slider_image'] = json_encode($data['slider_image']);
+        $data['description'] = htmlspecialchars($data['description']);
         $model = new model();
         $res = $model->save($data);
         if ($res){
@@ -151,8 +153,9 @@ class AuctionProduct extends AuthController
         $model = new model();
         $info = $model->find($id);
         $info['slider_image'] = is_string($info['slider_image']) ? json_decode($info['slider_image'], true) : [];
-
-        return JsonService::successful($info);
+        $info['description'] = htmlspecialchars_decode($info['description']);
+        $data['productInfo'] = $info;
+        return JsonService::successful($data);
     }
 
     public function update($id)
@@ -169,9 +172,11 @@ class AuctionProduct extends AuthController
             'sort',
             'auction_id',
             'hanging_price',
-            'slider_image'
+            'slider_image',
+            'description'
         ]);
         $data['slider_image'] = json_encode($data['slider_image']);
+        $data['description'] = htmlspecialchars($data['description']);
         $res = model::update($data);
         if ($res){
             return Json::success('修改成功!');

+ 98 - 23
app/admin/view/auction/auction/edit.php

@@ -179,18 +179,15 @@
                                             </div>
                                         </div>
                                     </div>
-                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
-                                        <div class="grid-demo grid-demo-bg1">
-                                            <div class="layui-form-item">
-                                                <label class="layui-form-label">绑定会馆</label>
-                                                <div class="layui-input-inline">
-                                                    <select id="auction_gu_id" name="auction_gu_id" lay-verify="title" v-model="formData.auction_gu_id">
-                                                        {foreach $auction as $key=>$vo }
-                                                        <option value="{$vo.id}">{$vo.name}<option>
-                                                            {/foreach}
-                                                    </select>
-                                                </div>
-                                            </div>
+                                    <div class="layui-form-item">
+                                        <label class="layui-form-label">场馆</label>
+                                        <div class="layui-input-inline">
+                                            <select id="auction_gu_id" name="auction_gu_id" lay-verify="title" v-model="formData.auction_gu_id">
+                                                <option value="">请选择场馆</option>
+                                                {foreach $auction as $key=>$vo }
+                                                <option value="{$vo.id}">{$vo.name}<option>
+                                                    {/foreach}
+                                            </select>
                                         </div>
                                     </div>
 
@@ -318,6 +315,24 @@
             return false;
         });
     });
+</script>
+<script>
+
+    var id = {$id};
+    layui.use('laydate', function(){
+        var laydate = layui.laydate;
+
+        laydate.render({
+            elem: '#time'
+            ,type: 'time'
+            ,range: true
+        });
+        laydate.render({
+            elem: '#rtime'
+            ,type: 'time'
+            ,range: true
+        });
+    })
 
     new Vue({
         el: '#app',
@@ -340,7 +355,6 @@
                 anticipate: '',
                 sort: '',
                 auction_gu_id:''
-
             },
             rule: { //多图选择规则
                 slider_image: {
@@ -483,6 +497,8 @@
             getProductInfo: function () {
                 var that = this;
                 that.requestGet(that.U({c:"auction.auction",a:'get_auction',q:{id:that.id}})).then(function (res) {
+                    that.$set(that,'cateList',res.data.cateList);
+                    that.$set(that,'tempList',res.data.tempList);
                     var productInfo = res.data.productInfo || {};
                     if(productInfo.id && that.id){
                         that.$set(that,'formData',productInfo);
@@ -781,18 +797,29 @@
                 var that = this;
                 that.generate(1);
             },
+            generate: function (type = 0) {
+                var that = this;
+                this.requestPost(that.U({c:"store.StoreProduct",a:'is_format_attr',p:{id:that.id,type:type}}), {attrs:this.formData.items}).then(function (res) {
+                    that.$set(that.formData, 'attrs', res.data.value);
+                    that.$set(that, 'formHeader', res.data.header);
+                    if (that.id && that.formData.is_sub == 1 && that.formData.spec_type == 1) {
+                        that.formHeader.push({title:'一级返佣(元)'});
+                        that.formHeader.push({title:'二级级返佣(元)'});
+                    }
+                }).catch(function (res) {
+                    return that.showMsg(res.msg);
+                });
+            },
             handleSubmit:function () {
                 var that = this;
                 var time = $('#time').val();
                 var rtime = $('#rtime').val();
-                var status = $('#status').val();
                 var auction_gu_id = $('#auction_gu_id').val();
-                that.formData.uid = auction_gu_id;
-                that.formData.status = status;
                 that.formData.time = time;
                 that.formData.rtime = rtime;
+                that.formData.auction_gu_id = auction_gu_id;
                 if (!that.formData['auction_gu_id']){
-                    return that.showMsg('绑定会馆');
+                    return that.showMsg('绑定会馆');
                 }
                 if (!that.formData['nickname']){
                     return that.showMsg('请填写名称');
@@ -807,8 +834,8 @@
                 if (!that.formData['rtime']){
                     return that.showMsg('请选择进场时间');
                 }
-                $('#submit').attr('disabled', 'disabled').text('修改中...');
-                that.requestPost(that.U({c:'auction.auction',a:'update',p:{id:that.id}}),that.formData).then(function (res) {
+                that.formData.description = that.getContent();
+                that.requestPost(that.U({c:'auction.auction',a:'save',p:{id:that.id}}),that.formData).then(function (res) {
                     that.confirm();
                 }).catch(function (res) {
                     that.showMsg(res.msg);
@@ -819,8 +846,8 @@
                 var that = this;
                 layui.use(['layer'], function () {
                     var layer = layui.layer;
-                    layer.confirm(that.id ? '修改成功是否返回产品列表' : '修改成功是否返回产品列表', {
-                        btn: ['返回列表',that.id ? '继续修改' : '继续修改'] //按钮
+                    layer.confirm(that.id ? '修改成功是否返回产品列表' : '添加成功是否返回产品列表', {
+                        btn: ['返回列表',that.id ? '继续修改' : '继续添加'] //按钮
                     }, function(){
                         location.href = that.U({c:'auction.auction',a:'index'});
                     }, function(){
@@ -856,6 +883,15 @@
                 newItems.splice(dst, 0, ...newItems.splice(src, 1))
                 this.formData.activity = newItems;
             },
+            getRuleList:function (type) {
+                var that = this;
+                that.requestGet(that.U({c:'store.StoreProduct',a:'get_rule'})).then(function (res) {
+                    that.$set(that,'ruleList',res.data);
+                    if(type !== undefined){
+                        that.render();
+                    }
+                });
+            },
             addRule:function(){
                 return this.createFrame('添加商品规则',this.U({c:'store.StoreProductRule',a:'create'}));
             },
@@ -878,14 +914,53 @@
         },
         mounted: function () {
             var that = this;
+            axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
             that.getProductInfo();
-            window.changeIMG = that.changeIMG;
             window.$vm = that;
+            window.changeIMG = that.changeIMG;
+            window.insertEditor = that.insertEditor;
+            window.insertEditorVideo = that.insertEditorVideo;
+            window.successFun = function(){
+                that.getRuleList(1);
+            }
+            $(that.$refs.filElem).change(function () {
+                var inputFile = this.files[0];
+                that.requestPost(that.U({c:"widget.video",a:'get_signature'})).then(function (res) {
+                    AdminUpload.upload(res.data.uploadType,{
+                        token: res.data.uploadToken || '',
+                        file: inputFile,
+                        accessKeyId: res.data.accessKey || '',
+                        accessKeySecret: res.data.secretKey || '',
+                        bucketName: res.data.storageName || '',
+                        region: res.data.storageRegion || '',
+                        domain: res.data.domain || '',
+                        uploadIng:function (progress) {
+                            that.upload.videoIng = true;
+                            that.progress = progress;
+                        }
+                    }).then(function (res) {
+                        //成功
+                        that.$set(that.formData, 'video_link', res.url);
+                        that.progress = 0;
+                        that.upload.videoIng = false;
+                        return that.showMsg('上传成功');
+                    }).catch(function (err) {
+                        //失败
+                        console.info(err);
+                        return that.showMsg('上传错误请检查您的配置');
+                    });
+                }).catch(function (res) {
+                    return that.showMsg(res.msg || '获取密钥失败,请检查您的配置');
+                });
+            })
         }
     });
 </script>
 </body>
 </html>
 <script>
-
+    import Layout from "../../../../../public/static/plug/iview/dist/iview";
+    export default {
+        components: {Layout}
+    }
 </script>

+ 0 - 4
app/admin/view/auction/auction_gu/edit.php

@@ -602,9 +602,6 @@
             insertEditorVideo: function (src) {
                 this.um.setContent('<div><video style="width: 99%" src="'+src+'" class="video-ue" controls="controls" width="100"><source src="'+src+'"></source></video></div><br>',true);
             },
-            getContent: function () {
-                return this.um.getContent();
-            },
             /**
              * 监听radio字段
              */
@@ -729,7 +726,6 @@
                     return that.showMsg('请上传图片');
                 }
 
-                that.formData.description = that.getContent();
                 $('#submit').attr('disabled', 'disabled').text('修改中...');
                 that.requestPost(that.U({c:'auction.auction_gu',a:'update',p:{id:that.id}}),that.formData).then(function (res) {
                     that.confirm();

+ 1 - 1
app/admin/view/auction/auction_order/create.php

@@ -159,7 +159,7 @@
                                                 <label class="layui-form-label">商品名称<i class="red">*</i></label>
                                                 <div class="layui-input-block">
                                                     <input type="text" name="nickname" lay-verify="title" autocomplete="off"
-                                                           placeholder="场馆名称" class="layui-input" v-model="formData.name" maxlength="100">
+                                                           placeholder="商城名称" class="layui-input" v-model="formData.name" maxlength="100">
                                                 </div>
                                             </div>
                                         </div>

+ 11 - 11
app/admin/view/auction/auction_product/create.php

@@ -159,7 +159,7 @@
                                                 <label class="layui-form-label">商品名称<i class="red">*</i></label>
                                                 <div class="layui-input-block">
                                                     <input type="text" name="nickname" lay-verify="title" autocomplete="off"
-                                                           placeholder="场馆名称" class="layui-input" v-model="formData.name" maxlength="100">
+                                                           placeholder="商品名称" class="layui-input" v-model="formData.name" maxlength="100">
                                                 </div>
                                             </div>
                                         </div>
@@ -276,11 +276,6 @@
                                             </div>
                                         </div>
                                     </div>
-                                    <div class="layui-tab-item">
-                                        <div class="layui-row layui-col-space15">
-                                            <textarea type="text/plain" name="description" id="myEditor" style="width:100%;">{{formData.description}}</textarea>
-                                        </div>
-                                    </div>
                                     <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
                                         <div class="grid-demo grid-demo-bg1">
                                             <div class="layui-form-item">
@@ -291,6 +286,10 @@
                                             </div>
                                         </div>
                                     </div>
+                                    <label class="layui-form-label" style="left: +1%">商品详情:</label>
+                                    <div class="layui-row layui-col-space15">
+                                        <textarea type="text/plain" name="description" id="myEditor" style="width:100%;">{{formData.description}}</textarea>
+                                    </div>
 
 
                                 </div>
@@ -342,15 +341,15 @@
             formData: {
                 description: '',
                 name: '',
-                is_show: 1,
+                is_show: '',
                 image:'',
                 price:'',
-                deduct: 1.2,
-                rise: 2.7,
+                deduct: '',
+                rise: '',
                 info: '',
-                sort: 0,
+                sort: '',
                 auction_id: '',
-                hanging_price:'',
+                hanging_price: '',
                 slider_image: []
 
             },
@@ -833,6 +832,7 @@
                 }
 
                 that.formData.auction_id = auction_id;
+                that.formData.description = that.getContent();
                 that.requestPost(that.U({c:'auction.auctionProduct',a:'save',p:{id:that.id}}),that.formData).then(function (res) {
                     that.confirm();
                 }).catch(function (res) {

+ 84 - 23
app/admin/view/auction/auction_product/edit.php

@@ -276,11 +276,6 @@
                                             </div>
                                         </div>
                                     </div>
-                                    <div class="layui-tab-item">
-                                        <div class="layui-row layui-col-space15">
-                                            <textarea type="text/plain" name="description" id="myEditor" style="width:100%;">{{formData.description}}</textarea>
-                                        </div>
-                                    </div>
                                     <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
                                         <div class="grid-demo grid-demo-bg1">
                                             <div class="layui-form-item">
@@ -291,7 +286,10 @@
                                             </div>
                                         </div>
                                     </div>
-
+                                    <label class="layui-form-label" style="left: +1%">商品详情:</label>
+                                    <div class="layui-row layui-col-space15">
+                                        <textarea type="text/plain" name="description" id="myEditor" style="width:100%;">{{formData.description}}</textarea>
+                                    </div>
 
                             </div>
 
@@ -314,17 +312,18 @@
     var id = {$id};
     layui.use('laydate', function(){
         var laydate = layui.laydate;
-    })
-    //Demo
-    layui.use('form', function(){
-        var form = layui.form;
 
-        //监听提交
-        form.on('submit(formDemo)', function(data){
-            layer.msg(JSON.stringify(data.field));
-            return false;
+        laydate.render({
+            elem: '#time'
+            ,type: 'time'
+            ,range: true
         });
-    });
+        laydate.render({
+            elem: '#rtime'
+            ,type: 'time'
+            ,range: true
+        });
+    })
 
     new Vue({
         el: '#app',
@@ -340,7 +339,7 @@
             formData: {
                 description: '',
                 name: '',
-                is_show: 1,
+                is_show: '',
                 image:'',
                 price:'',
                 deduct: '',
@@ -493,13 +492,11 @@
             getProductInfo: function () {
                 var that = this;
                 that.requestGet(that.U({c:"auction.auction_product",a:'get_list',q:{id:that.id}})).then(function (res) {
-
-                    var productInfo = res.data || {};
+                    var productInfo = res.data.productInfo || {};
                     if(productInfo.id && that.id){
                         that.$set(that,'formData',productInfo);
                         that.generate();
                     }
-
                     that.getRuleList();
                     that.init();
                 }).catch(function (res) {
@@ -761,6 +758,7 @@
                         });
                         that.eeventRadio();
                     });
+
                 })
             },
             requestPost: function (url, data) {
@@ -793,9 +791,23 @@
                 var that = this;
                 that.generate(1);
             },
+            generate: function (type = 0) {
+                var that = this;
+                this.requestPost(that.U({c:"store.StoreProduct",a:'is_format_attr',p:{id:that.id,type:type}}), {attrs:this.formData.items}).then(function (res) {
+                    that.$set(that.formData, 'attrs', res.data.value);
+                    that.$set(that, 'formHeader', res.data.header);
+                    if (that.id && that.formData.is_sub == 1 && that.formData.spec_type == 1) {
+                        that.formHeader.push({title:'一级返佣(元)'});
+                        that.formHeader.push({title:'二级级返佣(元)'});
+                    }
+                }).catch(function (res) {
+                    return that.showMsg(res.msg);
+                });
+            },
             handleSubmit:function () {
                 var that = this;
                 var auction_id = $('#auction_id').val();
+                console.log(auction_id);
                 if (that.formData.name === ''){
                     return that.showMsg('请输入商品名称');
                 }
@@ -816,8 +828,8 @@
                 }
 
                 that.formData.auction_id = auction_id;
-                $('#submit').attr('disabled', 'disabled').text('保存中...');
-                that.requestPost(that.U({c:'auction.auction_product',a:'update',p:{id:that.id}}),that.formData).then(function (res) {
+                that.formData.description = that.getContent();
+                that.requestPost(that.U({c:'auction.auctionProduct',a:'save',p:{id:that.id}}),that.formData).then(function (res) {
                     that.confirm();
                 }).catch(function (res) {
                     that.showMsg(res.msg);
@@ -865,6 +877,15 @@
                 newItems.splice(dst, 0, ...newItems.splice(src, 1))
                 this.formData.activity = newItems;
             },
+            getRuleList:function (type) {
+                var that = this;
+                that.requestGet(that.U({c:'store.StoreProduct',a:'get_rule'})).then(function (res) {
+                    that.$set(that,'ruleList',res.data);
+                    if(type !== undefined){
+                        that.render();
+                    }
+                });
+            },
             addRule:function(){
                 return this.createFrame('添加商品规则',this.U({c:'store.StoreProductRule',a:'create'}));
             },
@@ -887,14 +908,54 @@
         },
         mounted: function () {
             var that = this;
+            axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
             that.getProductInfo();
-            window.changeIMG = that.changeIMG;
             window.$vm = that;
+            window.changeIMG = that.changeIMG;
+            window.insertEditor = that.insertEditor;
+            window.insertEditorVideo = that.insertEditorVideo;
+            window.successFun = function(){
+                that.getRuleList(1);
+            }
+            $(that.$refs.filElem).change(function () {
+                var inputFile = this.files[0];
+                that.requestPost(that.U({c:"widget.video",a:'get_signature'})).then(function (res) {
+                    AdminUpload.upload(res.data.uploadType,{
+                        token: res.data.uploadToken || '',
+                        file: inputFile,
+                        accessKeyId: res.data.accessKey || '',
+                        accessKeySecret: res.data.secretKey || '',
+                        bucketName: res.data.storageName || '',
+                        region: res.data.storageRegion || '',
+                        domain: res.data.domain || '',
+                        uploadIng:function (progress) {
+                            that.upload.videoIng = true;
+                            that.progress = progress;
+                        }
+                    }).then(function (res) {
+                        //成功
+                        that.$set(that.formData, 'video_link', res.url);
+                        that.progress = 0;
+                        that.upload.videoIng = false;
+                        return that.showMsg('上传成功');
+                    }).catch(function (err) {
+                        //失败
+                        console.info(err);
+                        return that.showMsg('上传错误请检查您的配置');
+                    });
+                }).catch(function (res) {
+                    return that.showMsg(res.msg || '获取密钥失败,请检查您的配置');
+                });
+            })
         }
+
     });
 </script>
 </body>
 </html>
 <script>
-
+    import Layout from "../../../../../public/static/plug/iview/dist/iview";
+    export default {
+        components: {Layout}
+    }
 </script>

+ 96 - 0
app/api/controller/auction/AuctionController.php

@@ -6,6 +6,7 @@ namespace app\api\controller\auction;
 use app\models\auction\Auction;
 use app\models\auction\AuctionBooking;
 use app\models\auction\AuctionGu;
+use app\models\auction\AuctionPay;
 use app\models\user\User;
 use app\models\user\UserBill;
 use app\Request;
@@ -215,6 +216,11 @@ class AuctionController
 
     }
 
+    /**
+     * 用户管理会馆
+     * @param Request $request
+     * @return mixed
+     */
     public function user_gu(Request $request)
     {
         $data = UtilService::getMore([
@@ -229,6 +235,96 @@ class AuctionController
     }
 
 
+    /**
+     * 添加收款方式
+     * @param Request $request
+     * @return void
+     */
+    public function pay(Request $request)
+    {
+        $data = UtilService::postMore([
+            ['payment'],
+            ['image'],
+            ['bank'],
+            ['name'],
+            ['type']
+        ], $request);
+        if (!$data['type'])  return app('json')->fail('数据传入错误');
+        $data['uid'] =$request->uid();
+        $model = new AuctionPay();
+        $pay = $model->where([['uid', '=', $request->uid()], ['type', '=', $data['type']]])->find();
+        if (!empty($pay)){
+            if ($data['type'] == 1 ){
+                // 微信收款方式
+                if (!$data['payment'])  return app('json')->fail('微信账号不能为空');
+                if (!$data['image'])  return app('json')->fail('二维码不能为空');
+                if (!$data['name'])  return app('json')->fail('姓名不能为空');
+                $pay['payment'] = $data['payment'];
+                $pay['image'] = $data['image'];
+                $pay['name'] = $data['name'];
+            }elseif ($data['type'] == 2){
+                // 支付宝收款方式
+                if (!$data['payment'])  return app('json')->fail('支付宝账号不能为空');
+                if (!$data['name'])  return app('json')->fail('姓名不能为空');
+                $pay['payment'] = $data['payment'];
+                $pay['name'] = $data['name'];
+            }elseif ($data['type'] == 3){
+                // 银行卡收款方式
+                if (!$data['payment'])  return app('json')->fail('银行卡号不能为空');
+                if (!$data['name'])  return app('json')->fail('姓名不能为空');
+                if (!$data['bank'])  return app('json')->fail('开户行');
+                $pay['payment'] = $data['payment'];
+                $pay['image'] = $data['image'];
+                $pay['bank'] = $data['name'];
+
+            }
+            $res = $pay->save();
+            if ($res) return app('json')->successful('修改成功');
+            return app('json')->fail('修改失败');
+        }else{
+            if ($data['type'] == 1 ){
+                // 微信收款方式
+                if (!$data['payment'])  return app('json')->fail('微信账号不能为空');
+                if (!$data['image'])  return app('json')->fail('二维码不能为空');
+                if (!$data['name'])  return app('json')->fail('姓名不能为空');
+
+            }elseif ($data['type'] == 2){
+                // 支付宝收款方式
+                if (!$data['payment'])  return app('json')->fail('支付宝账号不能为空');
+                if (!$data['name'])  return app('json')->fail('姓名不能为空');
+
+            }elseif ($data['type'] == 3){
+                // 银行卡收款方式
+                if (!$data['payment'])  return app('json')->fail('银行卡号不能为空');
+                if (!$data['name'])  return app('json')->fail('姓名不能为空');
+                if (!$data['bank'])  return app('json')->fail('开户行不能为空');
+            }
+            $res = $model->save($data);
+            if ($res) return app('json')->successful('添加成功');
+            return app('json')->fail('添加失败');
+        }
+    }
+
+    public function pay_list(Request $request)
+    {
+        $model = new AuctionPay();
+        $list = $model->where('uid', $request->uid())->select();
+
+        $list = empty($list)? []: $list->toArray();
+        $data = [];
+        foreach ($list as $k => $v){
+            if ($v['type'] == 1){
+                $data['wx'] = $v;
+            }elseif ($v['type'] == 2){
+                $data['zfb'] = $v;
+            }elseif ($v['type'] == 3){
+                $data['bank'] = $v;
+            }
+        }
+        return app('json')->successful($data);
+    }
+
+
 
 
 

+ 40 - 5
app/api/controller/auction/AuctionProductController.php

@@ -84,9 +84,8 @@ class AuctionProductController
 
         $count = AuctionOrder::whereBetweenTime('create_time', day(),today())->where('product_id', 'in', $product_ids)->count();
 
-        $config = SystemConfig::where('menu_name', 'auction_number')->find();
-        halt((int)$config['value']);
-        if ($count >= $config['value']) return app('json')->fail('单场购买数量已到达最大');
+//        $config = SystemConfig::where('menu_name', 'auction_number')->find();
+//        if ($count >= $config['value']) return app('json')->fail('单场购买数量已到达最大');
 
         if ($product['uid'] == $request->uid()) return app('json')->fail('无法购买自己商品');
         if ($product){
@@ -94,7 +93,7 @@ class AuctionProductController
             // 查询商品是否以卖出
             $order = AuctionOrder::where('product_id', $data['product_id'])->where('status', '>', 0)->whereBetweenTime('create_time', date('Y-m-d H:i:s', strtotime(date('Y-m-d'))), date('Y-m-d H:i:s', strtotime('+1 day')))->find();
             if ($order){
-                return app('json')->fail('商品卖出');
+                return app('json')->fail('商品卖出');
             }
             $res = AuctionOrder::create([
                 'uid' => $request->uid(),
@@ -134,6 +133,7 @@ class AuctionProductController
             [['type', 'd'], 0],
             [['page', 'd'], 0],
             [['limit', 'd'], 0],
+            ['order_id']
         ]);
 
         return app('json')->successful(AuctionOrder::userOrder($data,$request->uid()));
@@ -176,7 +176,10 @@ class AuctionProductController
     public function seller(Request $request)
     {
         $data = UtilService::getMore([
-            ['type', 0]
+            ['type', 0],
+            [['page', 'd'], 0],
+            [['limit', 'd'], 0],
+            ['order_id']
         ]);
 
         return app('json')->successful(AuctionOrder::seller_list($data,$request->uid()));
@@ -225,4 +228,36 @@ class AuctionProductController
 
     }
 
+    public function details(Request $request)
+    {
+        $data = UtilService::getMore([
+            ['product_id']
+        ]);
+        if (!$data['product_id']) return app('json')->fail('数据传入错误');
+        $details = AuctionProduct::where('id', $data['product_id'])->find();
+
+        if (empty($details)) return app('json')->fail('商品不存在');
+        $details['slider_image'] = is_string($details['slider_image']) ? json_decode($details['slider_image'], true) : [];
+        $auction = Auction::where('id', $details['auction_id'])->find();
+        $details['time'] = $auction['radd_time'].'-'.$auction['rend_time'];
+        $details = $details->toArray();
+        return app('json')->successful($details);
+    }
+
+    public function belong(Request $request)
+    {
+        $data = UtilService::getMore([
+            ['product_id']
+        ]);
+        if (!$data['product_id']) return app('json')->fail('数据传入错误');
+        $order = AuctionOrder::alias('a')
+            ->field('u.nickname,u.avatar,a.create_time')
+            ->leftJoin('user u', 'a.collection_id = u.uid')
+            ->where('a.product_id', $data['product_id'])->where('a.status', 3)->select();
+
+        $order = empty($order)? [] : $order->toArray();
+        return app('json')->successful($order);
+    }
+
+
 }

+ 32 - 0
app/common.php

@@ -525,3 +525,35 @@ if (!function_exists('array_unique_fb')) {
         return $out;
     }
 }
+
+if (!function_exists('day')) {
+    /**
+     *时间
+     * @param $array
+     * @return array
+     */
+    function day()
+    {
+        $day = date('Y-m-d H:i:s', strtotime(date('Y-m-d', time())));
+
+
+        return $day;
+
+    }
+}
+
+if (!function_exists('today')) {
+    /**
+     *时间
+     * @param $array
+     * @return array
+     */
+    function today()
+    {
+        $today = date('Y-m-d H:i:s', strtotime(date('Y-m-d', strtotime('+1day'))));
+
+
+        return $today;
+
+    }
+}

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

@@ -68,7 +68,7 @@ class Auction extends BaseModel
         foreach ($list as $k => $v){
             if ($v['day_time'] < time()){
                 $find = self::find($v['id']);
-                $find['day_time'] = strtotime(date('Y-m-d 11:59:59'));
+                $find['day_time'] = strtotime(date('Y-m-d 23:59:59'));
                 $find['frequency'] = $v['frequency'] + 1;
                 $find->save();
             }

+ 46 - 17
app/models/auction/AuctionOrder.php

@@ -41,19 +41,40 @@ class AuctionOrder extends BaseModel
      */
     public static function userOrder($data,$uid)
     {
-        if ($data['type'] == 1){
-            $list = self::where([['uid', '=', $uid], ['status', '=', 1]])->page($data['page'], $data['limit'])->select()->toArray(); //待上传订单
-
-        }else if($data['type'] == 2){
-            $list = self::where([['uid', '=', $uid], ['status', '=', 2]])->page($data['page'], $data['limit'])->select()->toArray(); //待审核订单
-
-        }else if($data['type'] == 3) {
-            $list = self::where([['uid', '=', $uid], ['status', '=', 3]])->page($data['page'], $data['limit'])->select()->toArray(); //完成订单
+        if ($data['order_id']){
+            $list = self::alias('a')
+                ->field('a.*,u.nickname,u.avatar')
+                ->leftJoin('user u', 'a.collection_id = u.uid')
+                ->where('a.order_id', $data['order_id'])->find(); //详细订单
+            $pay = AuctionPay::where('uid', $list['collection_id'])->select();
+
+            if ($pay){
+                foreach ($pay as $k => $v){
+                    if ($v['type'] == 1){
+                        $list['wx'] = $v;
+                    }elseif ($v['type'] == 2){
+                        $list['zfb'] = $v;
+                    }elseif ($v['type'] == 3){
+                        $list['bank'] = $v;
+                    }
+                }
+            }
         }else{
+            if ($data['type'] == 1){
+                $list = self::where([['uid', '=', $uid], ['status', '=', 1]])->page($data['page'], $data['limit'])->select(); //待上传订单
+
+            }else if($data['type'] == 2){
+                $list = self::where([['uid', '=', $uid], ['status', '=', 2]])->page($data['page'], $data['limit'])->select(); //待审核订单
 
-            $list = self::where([['uid', '=', $uid], ['status', '<', 1]])->page($data['page'], $data['limit'])->select()->toArray(); //过期订单
+            }else if($data['type'] == 3) {
+                $list = self::where([['uid', '=', $uid], ['status', '=', 3]])->page($data['page'], $data['limit'])->select(); //完成订单
+            }else{
+                $list = self::where([['uid', '=', $uid], ['status', '<', 1]])->page($data['page'], $data['limit'])->select(); //过期订单
+            }
         }
 
+        $list = !empty($list)? $list->toArray(): [];
+
         return $list;
     }
 
@@ -68,18 +89,26 @@ class AuctionOrder extends BaseModel
      */
     public static function seller_list($data,$uid)
     {
-        if ($data['type'] == 1){
-            $list = self::where([['collection_id', '=', $uid], ['status', '=', 1]])->page($data['page'], $data['limit'])->select()->toArray(); //待上传订单
+        if ($data['order_id']){
+            $list = self::alias('a')
+                ->field('a.*,u.nickname,u.avatar')
+                ->leftJoin('user u', 'a.uid = u.uid')
+                ->where('a.order_id', $data['order_id'])->find(); //详细订单
+        }else{
+            if ($data['type'] == 1){
+                $list = self::where([['collection_id', '=', $uid], ['status', '=', 1]])->page($data['page'], $data['limit'])->select()->toArray(); //待上传订单
 
-        }else if($data['type'] == 2){
-            $list = self::where([['collection_id', '=', $uid], ['status', '=', 2]])->page($data['page'], $data['limit'])->select()->toArray(); //待审核订单
+            }else if($data['type'] == 2){
+                $list = self::where([['collection_id', '=', $uid], ['status', '=', 2]])->page($data['page'], $data['limit'])->select()->toArray(); //待审核订单
 
-        }else if($data['type'] == 3) {
-            $list = self::where([['collection_id', '=', $uid], ['status', '=', 3]])->page($data['page'], $data['limit'])->select()->toArray(); //完成订单
-        }else{
+            }else if($data['type'] == 3) {
+                $list = self::where([['collection_id', '=', $uid], ['status', '=', 3]])->page($data['page'], $data['limit'])->select()->toArray(); //完成订单
+            }else{
 
-            $list = self::where([['collection_id', '=', $uid], ['status', '<', 1]])->page($data['page'], $data['limit'])->select()->toArray(); //过期订单
+                $list = self::where([['collection_id', '=', $uid], ['status', '<', 1]])->page($data['page'], $data['limit'])->select()->toArray(); //过期订单
+            }
         }
+        $list = !empty($list)? $list->toArray(): [];
 
         return $list;
     }

+ 34 - 0
app/models/auction/AuctionPay.php

@@ -0,0 +1,34 @@
+<?php
+
+namespace app\models\auction;
+
+use app\models\store\StoreProduct;
+use crmeb\services\SystemConfigService;
+use think\facade\Db;
+use crmeb\traits\ModelTrait;
+use crmeb\basic\BaseModel;
+
+/**
+ * TODO 场馆model
+ * Class Article
+ * @package app\models\article
+ */
+class AuctionPay extends BaseModel
+{
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 模型名称
+     * @var string
+     */
+    protected $name = 'auction_pay';
+
+    use ModelTrait;
+    protected $autoWriteTimestamp = true;
+
+
+}

+ 5 - 0
route/api/route.php

@@ -165,6 +165,8 @@ Route::group(function () {
     Route::get('auction/auction_product', 'auction.auctionProductController/auction_product')->name('auction_product');// 场馆商品
     Route::get('auction/user_product', 'auction.auctionProductController/user_product')->name('user_product');// 用户商品
     Route::post('auction/purchase', 'auction.auctionProductController/purchase')->name('purchase');// 抢购商品
+    Route::get('auction/details', 'auction.auctionProductController/details')->name('details');// 商品详情
+    Route::get('auction/belong', 'auction.auctionProductController/belong')->name('belong');// 商品以往所属
 
     Route::get('auction/user_auction_order', 'auction.auctionProductController/user_auction_order')->name('user_auction_order');// 用户竞拍订单
     Route::get('auction/seller', 'auction.auctionProductController/seller')->name('seller');// 卖家卖出订单
@@ -177,6 +179,9 @@ Route::group(function () {
     Route::get('auction/auction_gu', 'auction.auctionController/auction_gu')->name('auction_gu');// 场馆
     Route::get('auction/user_gu', 'auction.auctionController/user_gu')->name('user_gu');// 管理会馆
 
+    Route::post('auction/pay', 'auction.auctionController/pay')->name('pay');// 添加收款方式
+    Route::get('auction/pay_list', 'auction.auctionController/pay_list')->name('pay_list');// 用户收款方式
+
 })->middleware(\app\http\middleware\AllowOriginMiddleware::class)->middleware(\app\http\middleware\AuthTokenMiddleware::class, true);
 //未授权接口
 Route::group(function () {