Ver Fonte

商品下线记录列表和详情

wufeng há 2 anos atrás
pai
commit
66c968a5cc
2 ficheiros alterados com 57 adições e 0 exclusões
  1. 55 0
      app/admin/controller/GoodOfflineLog.php
  2. 2 0
      app/admin/route/app.php

+ 55 - 0
app/admin/controller/GoodOfflineLog.php

@@ -0,0 +1,55 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\facade\Db;
+use think\facade\Validate;
+
+class GoodOfflineLog extends Base
+{
+
+    //列表
+    public function getList()
+    {
+
+        $param = $this->request->only(['start_date' => '', 'end_date' => '', 'creater' => '', 'page' => 1, 'size' => 15], 'post', 'trim');
+
+        $where = [];
+        if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['addtime', 'between', [$param['start_date'], $param['end_date']]];
+        if ($param['creater'] != '') $where[] = ['creater', 'like', '%' . $param['creater'] . '%'];
+
+        $count = Db::name('good_offline_log')->where($where)->count('id');
+
+        $list = Db::name('good_offline_log')
+            ->field('id,spuCode,good_name,creater,addtime')
+            ->where($where)
+            ->select()
+            ->toArray();
+
+        return app_show(0, "获取成功", ['list' => $list, 'count' => $count]);
+
+    }
+
+    //详情
+    public function getDetail()
+    {
+
+        $id = $this->request->post('id', null, 'trim');
+
+        $val = Validate::rule(['id|ID' => 'require|number|gt:0']);
+
+        if (!$val->check(['id' => $id])) return error_show(1004, $val->getError());
+        else {
+            $res = Db::name('good_offline_log')
+                ->alias('gol')
+                ->field('gol.*,ri.result_desc')
+                ->where('gol.id', $id)
+                ->leftJoin('result_info ri', 'ri.result_code=gol.offline_reason')
+                ->find();
+
+            return app_show(0, "获取成功", $res);
+        }
+
+    }
+
+}

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

@@ -371,6 +371,8 @@ Route::rule('goodupedit','admin/Goodup/edit');
 Route::rule('goodupprice','admin/Goodup/checkPrice');
 Route::rule('goodupreject','admin/Goodup/rejectGoodToAgainExamine');
 Route::rule('goodupoffline','admin/Goodup/offlineGoodBySpuCode');
+Route::rule('goodofflist','admin/GoodOfflineLog/getList');
+Route::rule('goodoffdetail','admin/GoodOfflineLog/getDetail');
 
 Route::rule('goodproof','admin/Goodup/prooflist');