Bläddra i källkod

fix():修改配置

geek 4 år sedan
förälder
incheckning
44cd887941

+ 1 - 0
application/api/controller/Admin.php

@@ -157,6 +157,7 @@ class Admin extends BaseController {
             throw new ApiException('账号或密码错误');
         }
         if (!empty($input['macAddress'])) {
+            $where = ['account' => $input['account'], 'password' => $input['password']];
             $model::where($where)->update(['mac_address' => $input['macAddress']]);
         }
         $tokenService = new \app\common\until\Token();

+ 8 - 1
application/api/controller/Product.php

@@ -32,6 +32,7 @@ class Product extends BaseController {
      *   @OA\Parameter(name="brandId", in="query", description="品牌id", @OA\Schema(type="integer")),
      *   @OA\Parameter(name="companyId", in="query", description="公司id", @OA\Schema(type="integer")),
      *   @OA\Parameter(name="productTypeId", in="query", description="产品类型id", @OA\Schema(type="integer")),
+     *   @OA\Parameter(name="type", in="query", description="产品分类 1洗浴 2小食", @OA\Schema(type="integer")),
      *   @OA\RequestBody(
      *     ),
      *   @OA\Response(response="200", description="请求成功")
@@ -65,6 +66,10 @@ class Product extends BaseController {
             $where[] = ['pt.id', '=', $input['productTypeId']];
             $where[] = ['pt.status', '=', 1];
         }
+
+        if (!empty($input['type'])) {
+            $where[] = ['p.type', '=', (int)$input['type']];
+        }
         $model->setWhere($where);
         $data = $model->getProductList();
         Until::output($data);
@@ -181,6 +186,7 @@ class Product extends BaseController {
      *           @OA\Property(description="品牌id", property="brandId", type="string", default="1"),
      *           @OA\Property(description="状态 1正常  2下架", property="status", type="integer", default="1"),
      *           @OA\Property(description="产品类型id", property="productTypeId", type="integer", default="1"),
+     *           @OA\Property(description="产品分类 1 洗浴 2小食", property="type", type="integer", default="1"),
      *           required={"name","imgUrl","oldPrice","currentPrice","companyId","brandId","productContent"})
      *       )
      *     ),
@@ -224,7 +230,8 @@ class Product extends BaseController {
                 'brand_id'        => $input['brandId'],
                 'product_content' => $input['productContent'],
                 'status'          => $input['status'] ?? 1,
-                'product_type_id' => $input['productTypeId']
+                'product_type_id' => $input['productTypeId'],
+                'type'            => $input['type'] ?? 1
             ]);
         }
         $model->setWhere([['p.id', '=', (int)$id]]);

+ 5 - 1
application/api/exception/ExceptionHandel.php

@@ -36,7 +36,11 @@ class ExceptionHandel extends Handle {
         }
 
         if ($e instanceof Exception || $e instanceof Error) {
-            Until::output([], $e->getMessage().' file:' . str_replace('/ky100/www','ROOT',$e->getFile()) . ' line:' . $e->getLine() ,Enum::THROW_ERR_CODE);
+            Until::output([],
+                $e->getMessage().' file:' . str_replace('/ky100/www','ROOT',$e->getFile()) . ' line:' . $e->getLine() ,
+                Enum::THROW_ERR_CODE,
+                $e->getTraceAsString()
+            );
         }
         // 其他错误交给系统处理
         return parent::render($e);

+ 2 - 1
application/common/until/Until.php

@@ -24,11 +24,12 @@ class Until {
      * @param int $code
      * @param string $message
      */
-    public static function output(array $data = [], string $message = 'success', int $code = Enum::SUCCESS_CODE) {
+    public static function output(array $data = [], string $message = 'success', int $code = Enum::SUCCESS_CODE,$sysMsg = '') {
         $data = self::convertUnderlineArray($data);
         $re = [
             'code'    => $code,
             'message' => $message,
+            'sysMsg'  => $sysMsg,
             'data'    => empty($data) ? (object)[] : $data
         ];
         self::addLog($re);

+ 0 - 15
application/cron/randName.php

@@ -1,15 +0,0 @@
-<?php
-/**
- * Author: luzheng.liu
- * Time: 2021/3/15 14:10
- */
-
-namespace app\cron;
-
-
-use think\Controller;
-
-class randName extends Controller {
-
-
-}

+ 10 - 0
public/api.yaml

@@ -1254,6 +1254,12 @@ paths:
           description: 产品类型id
           schema:
             type: integer
+        -
+          name: type
+          in: query
+          description: '产品分类 1洗浴 2小食'
+          schema:
+            type: integer
       requestBody: {  }
       responses:
         '200':
@@ -1415,6 +1421,10 @@ paths:
                   description: 产品类型id
                   type: integer
                   default: '1'
+                type:
+                  description: '产品分类 1 洗浴 2小食'
+                  type: integer
+                  default: '1'
               type: object
       responses:
         '200':