Sfoglia il codice sorgente

Merge branch 'dev_wf' of wugg/phpstock into version1.5

wufeng 2 anni fa
parent
commit
73b5332e52
2 ha cambiato i file con 127 aggiunte e 0 eliminazioni
  1. 126 0
      app/admin/controller/Consult.php
  2. 1 0
      app/admin/route/app.php

+ 126 - 0
app/admin/controller/Consult.php

@@ -2071,4 +2071,130 @@ class Consult extends Base
     }
 
 
+    //复制上面的bidlist方法,只更改排序方式
+    public function bidlistCopy()
+    {
+        $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) : "1";
+        $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) : "10";
+        $where = [['is_del', "=", 0]];
+        $zxNo = isset($this->post['zxNo']) && $this->post['zxNo'] !== "" ? trim($this->post['zxNo']) : "";
+        if ($zxNo !== "") {
+            $where[] = ['zxNo', 'like', '%' . $zxNo . '%'];
+        }
+        $infoNo = isset($this->post['infoNo']) && $this->post['infoNo'] !== "" ? trim($this->post['infoNo']) : "";
+        if ($infoNo !== "") {
+            $where[] = ['infoNo', 'like', '%' . $infoNo . '%'];
+        }
+        $bidNo = isset($this->post['bidNo']) && $this->post['bidNo'] !== "" ? trim($this->post['bidNo']) : "";
+        if ($bidNo !== "") {
+            $where[] = ['bidNo', 'like', '%' . $bidNo . '%'];
+        }
+        $pgNo = isset($this->post['pgNo']) && $this->post['pgNo'] !== "" ? trim($this->post['pgNo']) : "";
+        if ($pgNo !== "") {
+            $bidinfo = Db::name("consult_info")->where([["pgNo", "=", $pgNo], ["is_del", "=", 0]])->column("infoNo");
+            $where[] = ['infoNo', 'in', $bidinfo];
+        }
+        $bargain_status = isset($this->post['bargain_status']) && $this->post['bargain_status'] !== "" ? intval($this->post['bargain_status']) : "";
+        if ($bargain_status !== "") {
+            $bidinfo = Db::name("consult_info")->where([["bargain_status", "=", $bargain_status], ["is_del", "=", 0]])->column("infoNo");
+            $where[] = ['infoNo', 'in', $bidinfo];
+        }
+        $projectNo = isset($this->post['projectNo']) && $this->post['projectNo'] !== "" ? trim($this->post['projectNo']) : "";
+        if ($projectNo !== "") {
+            $zxlist = Db::name("consult_order")->where(["projectNo" => $projectNo, "is_del" => 0, "is_project" => 1])->column
+            ("zxNo");
+            $where[] = ['zxNo', 'in', $zxlist];
+        }
+        $is_own = isset($this->post['is_own']) ? intval($this->post['is_own']) : "0";
+        if ($is_own == 1) {
+            $token = isset($this->post['token']) ? trim($this->post['token']) : "";
+            if ($token == "") {
+                return error_show(101, 'token不能为空');
+            }
+            $apply_id = GetUserInfo($token);
+            if (empty($apply_id) || $apply_id['code'] != 0) {
+                return error_show(1002, "申请人数据不存在");
+            }
+            $rm = isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : "";
+            $where[] = ['createrid', "=", $rm];
+        }
+
+        $count = Db::name('consult_bids')->where($where)->count();
+        $total = ceil($count / $size);
+        $page = $page >= $total ? $total : $page;
+        $list = Db::name('consult_bids')->where($where)->page($page, $size)->order('addtime', 'desc')->select()->toArray();
+        $data = [];
+        foreach ($list as $value) {
+            $catinfo = Db::name("cat")->where(["id" => $value['cat_id']])->find();
+            $value['can'] = isset($value['cat_id']) && $value['cat_id'] != 0 ? made($value['cat_id']) : [];
+            $unit = Db::name("unit")->where(["id" => $value['unit_id']])->find();
+            $value['unit'] = isset($unit['unit']) ? $unit['unit'] : '';
+            $supplier = Db::name("supplier")->where(["code" => $value['supplierNo']])->find();
+            $value['supplierName'] = isset($supplier['name']) ? $supplier['name'] : "";
+            if ($value['brand_id'] != 0) {
+                $brand = Db::name("brand")->where(["id" => $value['brand_id']])->find();
+                $value["brand_name"] = isset($brand['brand_name']) ? $brand['brand_name'] : "";
+            } else {
+                $value["brand_name"] = "";
+                $value["brand_id"] = "";
+            }
+            $bidinfo = Db::name("consult_info")->where(["infoNo" => $value["infoNo"]])->find();
+            $budget = isset($catinfo['order_rate']) ? $catinfo['order_rate'] : 0;
+            $god = [
+                "metal_id" => $value['metal_id'],
+                "weight" => $value["good_weight"],
+                "demo_fee" => $value["demo_fee"],
+                "delivery_fee" => $value["delivery_fee"],
+                "open_fee" => $value["open_fee"],
+                "packing_fee" => $value["pakge_fee"],
+                "mark_fee" => $value["mark_fee"],
+                "nake_fee" => $value["nake_fee"],
+                "cert_fee" => $value["cert_fee"],
+                "cost_fee" => $value['status'] >= 5 ? $value["sale_cost_fee"] : $value["cost_fee"],
+                "num" => $bidinfo["num"],
+            ];
+            if ($value['is_gold_price'] == 1) {
+                $price = GoldPrice($god, $budget / 100);
+                $value['sale_price'] = round($price, 2);
+            }
+            $value['cost_fee'] = $value['origin_cost_fee'];
+            $value['specinfo'] = json_decode($value['specinfo'], true);
+            $value['metal_name'] = isset($value['metal_id']) && $value['metal_id'] != 0 ? $this->noble[$value['metal_id']] : "";
+            $value['bargain_status'] = $bidinfo['bargain_status'];
+
+            //reject驳回原因,status==5表示驳回
+            $value['reject'] = [];
+            if ($value['status'] >= 5) {
+                $value['reject'] = Db::name('bargain_order')
+                    ->field('id,remark,status')
+                    ->where(['infoNo' => $infoNo, 'bidsNo' => $value['bidNo']])
+                    ->whereIn('status', [3, 8, 11])->order("id desc")
+                    ->find();
+            }
+            //产地
+            $place = ["provice_code" => "", "city_code" => "", "area_code" => ""];
+            if ($value['delivery_place'] != "") {
+                list($place['provice_code'], $place['city_code'], $place['area_code']) = explode(",", $value['delivery_place']);
+            }
+            $value['delivery_place_cn'] = GetAddr(json_encode($place));
+            $place = ["provice_code" => "", "city_code" => "", "area_code" => ""];
+            if ($value['origin_place'] != "") {
+                list($place['provice_code'], $place['city_code'], $place['area_code']) = explode(",", $value['origin_place']);
+            }
+            $value['origin_addr'] = GetAddr(json_encode($place));
+//            if($value['origin_place']!=''){
+//                $code = explode(",",$value['origin_place']);
+//                $temp=[];
+//                $temp['provice_code']=isset($code[0])?$code[0]:"";
+//                $temp['city_code']=isset($code[1])?$code[1]:"";
+//                $temp['area_code']=isset($code[2])?$code[2]:"";
+//                $addr= GetAddr(json_encode($temp));
+//                $value['origin_addr'] = $addr;
+//            }
+            $data[] = $value;
+        }
+        return app_show(0, "获取成功", ['count' => $count, 'list' => $data]);
+    }
+
+
 }

+ 1 - 0
app/admin/route/app.php

@@ -418,6 +418,7 @@ Route::rule('consultfeed','admin/Consult/feadback');
 Route::rule('consultfeadinfo','admin/Consult/feadinfo');
 Route::rule('consultbaradd','admin/Consult/bargain_add');
 Route::rule('consultbidlist','admin/Consult/bidlist');
+Route::rule('consultbidlistcopy','admin/Consult/bidlistCopy');//复制consultbidlist,
 Route::rule('consultfeededit','admin/Consult/feededit');
 Route::rule('consultfeedlist','admin/Consult/feedlist');
 Route::rule('bragainstatus','admin/Consult/bargain_status');