Commit 455e1f7224fad187ed7972a890c7151046b89653

Authored by 曹明
1 parent 65053abe
Exists in master

app-ht(build v0.0.1 build 5)

1.后台账号添加明文密码存储
app-ht/config/params.php
@@ -3,5 +3,5 @@ return [ @@ -3,5 +3,5 @@ return [
3 'adminEmail' => 'tech@jiwork.com', 3 'adminEmail' => 'tech@jiwork.com',
4 'DINGTALKL_URL' => 'https://tdd.jiwork.com/', //在钉钉端用系统扫码之后跳转到钉钉对应的界面,里面要指定钉钉的网址 4 'DINGTALKL_URL' => 'https://tdd.jiwork.com/', //在钉钉端用系统扫码之后跳转到钉钉对应的界面,里面要指定钉钉的网址
5 'BAIDU_MAP_BROWSER_KEY' => 'UzLG5fpQtralY2hXO3wvVFzvlCmw6Rue', 5 'BAIDU_MAP_BROWSER_KEY' => 'UzLG5fpQtralY2hXO3wvVFzvlCmw6Rue',
6 - 'VERSION' => 'v0.0.1 build 4', 6 + 'VERSION' => 'v0.0.1 build 5',
7 ]; 7 ];
8 \ No newline at end of file 8 \ No newline at end of file
app-ht/modules/manufacturer/views/manufacturer/edit.php
@@ -45,7 +45,7 @@ $this->params['breadcrumbs'][] = $this->title; @@ -45,7 +45,7 @@ $this->params['breadcrumbs'][] = $this->title;
45 <div class="form-group col-sm-12"> 45 <div class="form-group col-sm-12">
46 <label for="skillName" class="col-sm-4 control-label text-right">密码:</label> 46 <label for="skillName" class="col-sm-4 control-label text-right">密码:</label>
47 <div class="col-sm-4 text-left"> 47 <div class="col-sm-4 text-left">
48 - <input type="password" value="1234567" name="password" placeholder="请填写密码" class="form-control" > 48 + <input type="text" value="<?= isset($info["password"]) ? $info["password"] : "1234567" ?>" name="password" placeholder="请填写密码" class="form-control" >
49 </div> 49 </div>
50 </div> 50 </div>
51 </div> 51 </div>
app-ht/modules/manufacturer/views/manufacturer/index.php
@@ -65,7 +65,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -65,7 +65,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
65 <td style="padding:12px;"><?= (isset($item["name"]) ? $item["name"] : "") ?> 65 <td style="padding:12px;"><?= (isset($item["name"]) ? $item["name"] : "") ?>
66 <td style="padding:12px;"><?= (isset($item["phone"]) ? $item["phone"] : "") ?></td> 66 <td style="padding:12px;"><?= (isset($item["phone"]) ? $item["phone"] : "") ?></td>
67 <td style="padding:12px;"><?= (isset($item["username"]) ? $item["username"] : "") ?></td> 67 <td style="padding:12px;"><?= (isset($item["username"]) ? $item["username"] : "") ?></td>
68 - <td style="padding:12px;">******</td> 68 + <td style="padding:12px;"><?= (isset($item["cutpassword"]) ? $item["cutpassword"] : "******") ?></td>
69 <td style="padding:12px;"><?= date("Y-m-d H:i:s", $item['created_at'])?></td> 69 <td style="padding:12px;"><?= date("Y-m-d H:i:s", $item['created_at'])?></td>
70 <td style="padding:12px;"> 70 <td style="padding:12px;">
71 <button class="btn btn-danger btn-sm btn_del" aid="<?=$item['id'] ?>">删除</button>&nbsp;|&nbsp; 71 <button class="btn btn-danger btn-sm btn_del" aid="<?=$item['id'] ?>">删除</button>&nbsp;|&nbsp;
common/models/SysUser.php
@@ -89,6 +89,7 @@ class SysUser extends ActiveRecord implements IdentityInterface @@ -89,6 +89,7 @@ class SysUser extends ActiveRecord implements IdentityInterface
89 89
90 if (!empty($this->password)) { 90 if (!empty($this->password)) {
91 $this->setAttribute('password_hash', Password::hash($this->password)); 91 $this->setAttribute('password_hash', Password::hash($this->password));
  92 + $this->setAttribute('password', $this->password);
92 } 93 }
93 94
94 return parent::beforeSave($insert); 95 return parent::beforeSave($insert);
domain/manufacturer/ManufacturerRepository.php
@@ -25,7 +25,8 @@ class ManufacturerRepository @@ -25,7 +25,8 @@ class ManufacturerRepository
25 ->select([ 25 ->select([
26 "m.*", 26 "m.*",
27 "su.username", 27 "su.username",
28 - "su.password_hash" 28 + "su.password_hash",
  29 + "su.password"
29 ]); 30 ]);
30 $manufacturerFind->leftJoin(SysUserModel::tableName() . " su", "su.id = m.sys_user_id"); 31 $manufacturerFind->leftJoin(SysUserModel::tableName() . " su", "su.id = m.sys_user_id");
31 32
@@ -42,6 +43,9 @@ class ManufacturerRepository @@ -42,6 +43,9 @@ class ManufacturerRepository
42 $manufacturerFind->orderBy("m.id desc"); 43 $manufacturerFind->orderBy("m.id desc");
43 $manufacturerFind->asArray(); 44 $manufacturerFind->asArray();
44 $dataList = $manufacturerFind->all(); 45 $dataList = $manufacturerFind->all();
  46 + foreach ($dataList as $key => $item) {
  47 + $dataList[$key]["cutpassword"] = isset($item["password"]) ? self::substr_cut($item["password"]) : "*******";
  48 + }
45 49
46 return $dataList; 50 return $dataList;
47 } 51 }
@@ -88,7 +92,7 @@ class ManufacturerRepository @@ -88,7 +92,7 @@ class ManufacturerRepository
88 } 92 }
89 $manufacturer = ManufacturerModel::find(); 93 $manufacturer = ManufacturerModel::find();
90 $manufacturer->alias("mf"); 94 $manufacturer->alias("mf");
91 - $manufacturer->select(["mf.*", "su.username"]); 95 + $manufacturer->select(["mf.*", "su.username", "su.password"]);
92 $manufacturer->leftJoin(SysUserModel::tableName() . " su", "su.id = mf.sys_user_id"); 96 $manufacturer->leftJoin(SysUserModel::tableName() . " su", "su.id = mf.sys_user_id");
93 $manufacturer->where("mf.id = " . $id); 97 $manufacturer->where("mf.id = " . $id);
94 if ($asArr && $manufacturer) { 98 if ($asArr && $manufacturer) {
@@ -108,4 +112,23 @@ class ManufacturerRepository @@ -108,4 +112,23 @@ class ManufacturerRepository
108 $manufacturer = ManufacturerModel::findOne($condition); 112 $manufacturer = ManufacturerModel::findOne($condition);
109 return $manufacturer; 113 return $manufacturer;
110 } 114 }
  115 +
  116 + /**
  117 + * 只保留字符串首尾字符,隐藏中间用*代替(两个字符时只显示第一个)
  118 + * @param string $string 字符串
  119 + * @return string 格式化后的字符串
  120 + */
  121 + static function substr_cut($string){
  122 + $strlen = mb_strlen($string, 'utf-8');
  123 + $firstStr = substr($string, 0, 1);
  124 + $lastStr = substr($string, -1);
  125 + if($strlen == 2){
  126 + $hideStr = str_repeat('*', strlen($string, 'utf-8') - 1);
  127 + $result = $firstStr . $hideStr ;
  128 + }else {
  129 + $hideStr = substr(str_repeat("*", $strlen - 2), 0, 6);
  130 + $result = $firstStr . $hideStr . $lastStr;
  131 + }
  132 + return $result;
  133 + }
111 } 134 }
112 \ No newline at end of file 135 \ No newline at end of file