Эх сурвалжийг харах

红包创建补生效时间字段

shizhongqi 5 сар өмнө
parent
commit
5b7daa4bec

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

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

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

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