作者 Cool
1 个管道 的构建 通过 耗费 1 秒

社区电话管理调试

@@ -9,4 +9,26 @@ use think\Model; @@ -9,4 +9,26 @@ use think\Model;
9 class HousePhone extends Model 9 class HousePhone extends Model
10 { 10 {
11 11
  12 +
  13 + // 自动写入时间戳字段
  14 + protected $autoWriteTimestamp = 'int';
  15 +
  16 + // 定义时间戳字段名
  17 + protected $createTime = 'createtime';
  18 + protected $updateTime = 'updatetime';
  19 + protected $deleteTime = false;
  20 +
  21 + // 追加属性
  22 + protected $append = [
  23 +
  24 + ];
  25 +
  26 +
  27 + protected static function init()
  28 + {
  29 + self::afterInsert(function ($row) {
  30 + $pk = $row->getPk();
  31 + $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
  32 + });
  33 + }
12 } 34 }
@@ -12,12 +12,12 @@ @@ -12,12 +12,12 @@
12 <input id="c-phone" data-rule="required" class="form-control" name="row[phone]" type="text" value=""> 12 <input id="c-phone" data-rule="required" class="form-control" name="row[phone]" type="text" value="">
13 </div> 13 </div>
14 </div> 14 </div>
15 - <div class="form-group">  
16 - <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>  
17 - <div class="col-xs-12 col-sm-8">  
18 - <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="0">  
19 - </div>  
20 - </div> 15 +<!-- <div class="form-group">-->
  16 +<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>-->
  17 +<!-- <div class="col-xs-12 col-sm-8">-->
  18 +<!-- <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="0">-->
  19 +<!-- </div>-->
  20 +<!-- </div>-->
21 <div class="form-group layer-footer"> 21 <div class="form-group layer-footer">
22 <label class="control-label col-xs-12 col-sm-2"></label> 22 <label class="control-label col-xs-12 col-sm-2"></label>
23 <div class="col-xs-12 col-sm-8"> 23 <div class="col-xs-12 col-sm-8">
@@ -12,12 +12,12 @@ @@ -12,12 +12,12 @@
12 <input id="c-phone" data-rule="required" class="form-control" name="row[phone]" type="text" value="{$row.phone|htmlentities}"> 12 <input id="c-phone" data-rule="required" class="form-control" name="row[phone]" type="text" value="{$row.phone|htmlentities}">
13 </div> 13 </div>
14 </div> 14 </div>
15 - <div class="form-group">  
16 - <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>  
17 - <div class="col-xs-12 col-sm-8">  
18 - <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">  
19 - </div>  
20 - </div> 15 +<!-- <div class="form-group">-->
  16 +<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>-->
  17 +<!-- <div class="col-xs-12 col-sm-8">-->
  18 +<!-- <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">-->
  19 +<!-- </div>-->
  20 +<!-- </div>-->
21 <div class="form-group layer-footer"> 21 <div class="form-group layer-footer">
22 <label class="control-label col-xs-12 col-sm-2"></label> 22 <label class="control-label col-xs-12 col-sm-2"></label>
23 <div class="col-xs-12 col-sm-8"> 23 <div class="col-xs-12 col-sm-8">