wugg 3 years ago
parent
commit
d620c90774
3 changed files with 29 additions and 3 deletions
  1. 25 1
      app/admin/controller/Goldprice.php
  2. 2 2
      app/admin/controller/Goodup.php
  3. 2 0
      app/admin/route/app.php

+ 25 - 1
app/admin/controller/Goldprice.php

@@ -12,12 +12,26 @@ class Goldprice extends BaseController
     public $gold=[
         1=>'18K',2=>'24K',3=>'白银'
     ];
-
+    public $rate=[
+        0,1,3,6,9,13
+    ];
     public function __construct(App $app)
     {
         parent::__construct($app);
         $this->post=$this->request->post();
     }
+
+    public function linst(){
+        $data=[];
+        foreach ($this->gold as $key=>$value){
+            $v =[];
+            $v['type']=$key;
+            $v['type_cn']=$value;
+            $data[]=$v;
+        }
+        return app_show(0,"获取成功",$data);
+    }
+
     public function create(){
         $type = isset($this->post['type']) && $this->post['type'] !=="" ?trim($this->post['type']):"";
         if($type==""){
@@ -85,6 +99,7 @@ class Goldprice extends BaseController
         }
         return app_show(0,"获取成功",['list'=>$data,'count'=>$count,]);
     }
+
     public function del(){
         $id = $this->post['id'] && $this->post['id'] !=="" ? intval($this->post['id']) :"";
         if($id===""){
@@ -167,4 +182,13 @@ class Goldprice extends BaseController
         }
     }
 
+    public function ratelist(){
+        $data =[];
+        foreach ($this->rate as $key=>$value){
+            $v =[];
+            $v['rate']=$value;
+            $data[]=$v;
+        }
+        return app_show(0,"获取成功",$data);
+    }
 }

+ 2 - 2
app/admin/controller/Goodup.php

@@ -38,10 +38,10 @@ class Goodup extends BaseController
         if($end!==""){
             $where[]=['addtime',"<",date('Y-m-d H:i:s',strtotime($end)+24*3600)];
         }
-        $count = Db::name('good')->where($where)->count();
+        $count = Db::name('good_basic')->where($where)->count();
         $total = ceil($count / $size);
         $page = $page >= $total ? $total : $page;
-        $list = Db::name('good')->where($where)->page($page,$size)->order("addtime desc")->select();
+        $list = Db::name('good_basic')->where($where)->page($page,$size)->order("addtime desc")->select();
         return app_show(0,"获取成功",['list'=>$list,'count'=>$count]);
     }
 

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

@@ -304,6 +304,8 @@ Route::rule('goldpricecreate','admin/Goldprice/create');
 Route::rule('goldpricelist','admin/Goldprice/list');
 Route::rule('goldpricedelect','admin/Goldprice/del');
 Route::rule('goldpricestatus','admin/Goldprice/status');
+Route::rule('goldlinst','admin/Goldprice/linst');
+Route::rule('goldratelist','admin/Goldprice/ratelist');
 
 Route::rule('customarcreate','admin/Customar/create');
 Route::rule('customarlist','admin/Customar/list');