afa 9 сар өмнө
parent
commit
dbf5cf9737

+ 0 - 1
application/admin/controller/product/Lists.php

@@ -116,7 +116,6 @@ class Lists extends Backend
 
     /**
      * 编辑
-     *
      * @param $ids
      * @return string
      * @throws DbException

+ 2 - 4
application/admin/controller/product/Popular.php

@@ -92,7 +92,6 @@ class Popular extends Backend
             if(time() >= strtotime($params['start_time'])) $params['status'] = $this->model::NORMAL;
             if(time() >= strtotime($params['end_time'])) $params['status'] = $this->model::STOP;
             $params['num']   = 0;
-            $params['stock'] = ProductArea::getProductStock($params['product_id']);
             $result = $this->model->allowField(true)->save($params);
             Db::commit();
         } catch (ValidateException|PDOException|Exception $e) {
@@ -140,10 +139,9 @@ class Popular extends Backend
                 $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
                 $row->validateFailException()->validate($validate);
             }
-            if(time() < strtotime($params['start_time'])) $params['status'] = $this->model::NOTSTOP;
+            if(time() < strtotime($params['start_time'])) $params['status']  = $this->model::NOTSTOP;
             if(time() >= strtotime($params['start_time'])) $params['status'] = $this->model::NORMAL;
-            if(time() >= strtotime($params['end_time'])) $params['status'] = $this->model::STOP;
-            $params['stock'] = ProductArea::getProductStock($params['product_id']);
+            if(time() >= strtotime($params['end_time'])) $params['status']   = $this->model::STOP;
             $result = $row->allowField(true)->save($params);
             Db::commit();
         } catch (ValidateException|PDOException|Exception $e) {

+ 5 - 1
application/admin/view/product/popular/add.html

@@ -46,8 +46,12 @@
         </div>
     </div>
     <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Stock')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-stock" data-rule="required" class="form-control" name="row[stock]" type="number" value="0">
+        </div>
         <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
-        <div class="col-xs-12 col-sm-8">
+        <div class="col-xs-12 col-sm-3">
             <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="0">
         </div>
     </div>

+ 5 - 1
application/admin/view/product/popular/edit.html

@@ -40,8 +40,12 @@
         </div>
     </div>
     <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Stock')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-stock" data-rule="required" class="form-control" name="row[stock]" type="number" value="{$row.stock|htmlentities}">
+        </div>
         <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
-        <div class="col-xs-12 col-sm-8">
+        <div class="col-xs-12 col-sm-3">
             <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
         </div>
     </div>

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

@@ -31,7 +31,6 @@ class Order extends Api
         $params = $this->request->post();
         $validate = \think\Loader::validate('Order');
         if(!$validate->scene('add')->check($params)) $this->error($validate->getError());
-        
         $order_info = $productPopular->where('id', $params['order_id'])->find();
         if(empty($order_info)) $this->error(__("参数有误,无可用产品"));
         $areaArr = explode(',', $params['area_id']);