Browse Source

红包创建补生效时间字段

shizhongqi 4 tháng trước cách đây
mục cha
commit
5b7daa4bec
2 tập tin đã thay đổi với 7 bổ sung2 xóa
  1. 2 1
      app-hd/controllers/HbController.php
  2. 5 1
      app-hd/models/hb/CreateHbForm.php

+ 2 - 1
app-hd/controllers/HbController.php

@@ -104,7 +104,8 @@ class HbController extends BaseController
 
         $duration = (int)$form->days;
         $count = $post['count'] ?? 1;
-        $beginTime = time();
+        $effectiveDate = $post['effectiveDate'];
+        $beginTime = $effectiveDate == '' ? time() : strtotime($effectiveDate);
         if ($duration <= 0) {
             $endTime = 4102416000;
         } else {

+ 5 - 1
app-hd/models/hb/CreateHbForm.php

@@ -30,6 +30,9 @@ class CreateHbForm extends BaseForm
     /** @var string 备注 */
     public $remark;
 
+    /** @var string 生效时间 */
+    public $effectiveDate;
+
     /**
      * {@inheritdoc}
      */
@@ -51,7 +54,7 @@ class CreateHbForm extends BaseForm
             [['userId', 'customId'], 'integer', 'min' => 1, 'tooSmall' => '{attribute}参数错误'],
             [['days'], 'integer', 'min' => 0, 'max' => 3650, 'tooSmall' => '{attribute}必须大于等于0', 'tooBig' => '{attribute}过大'],
             [['count'], 'integer', 'min' => 1, 'max' => 1000, 'tooSmall' => '{attribute}必须大于等于1', 'tooBig' => '{attribute}过大'],
-            [['remark'], 'string'],
+            [['remark', 'effectiveDate'], 'string'],
             [['remark'], 'filter', 'filter' => 'trim'],
         ];
     }
@@ -69,6 +72,7 @@ class CreateHbForm extends BaseForm
             'minConsume' => '最低消费',
             'days' => '有效时长',
             'count' => '红包个数',
+            'effectiveDate' => '生效时间',
             'remark' => '备注信息',
         ];
     }