更新数据库加密相关操作

This commit is contained in:
2025-01-15 13:16:48 +08:00
parent 81069274be
commit 262ecc4f5e
12 changed files with 383 additions and 90 deletions

View File

@@ -9,8 +9,15 @@ use common\core\BaseAdminController;
use common\enums\UserRoleEnum;
use common\helpers\ArrayHelper;
use common\models\oldDb\AdminAccessToken;
use common\models\oldDb\DoctorInfo;
use common\models\oldDb\DoctorPatient;
use common\models\oldDb\LeadInfo;
use common\models\oldDb\Role;
use common\models\oldDb\ServInfo;
use common\models\oldDb\Store;
use common\models\oldDb\User;
use common\models\oldDb\UserPatient;
use common\modelsgii\oldDb\PharmacistInfo;
use common\services\SmsService;
use Yii;
use yii\base\Exception;
@@ -20,10 +27,100 @@ class LoginController extends BaseAdminController
public $modelClass = Admin::class;
public $enableCsrfValidation = false;
public $defaultAction = 'register';
public $optional = ['register', 'logout', 'login', 'send-code'];
public $optional = ['register', 'logout', 'login', 'send-code', 'test'];
public $mallId;
public function actionTest()
{
return UserPatient::find()->all();
$this->updateDoctor();
$this->updateUser();
$this->updateServInfo();
$this->updatePharmacistInfo();
$this->updateLeadInfo();
$this->updateUserPatient();
$this->updateDoctorPatient();
return ['执行完成'];
}
private function updateDoctor()
{
// 用到了身份证的模型DoctorInfo
$info = DoctorInfo::find()->all();
foreach ($info as $v) {
if (!is_encrypted($v->idcard)) {
$v->updated_at = time();
}
$v->save();
}
}
private function updateUser()
{
$info = User::find()->all();
foreach ($info as $v) {
if (!is_encrypted($v->idcard)) {
$v->updated_at = time();
}
$v->save();
}
}
private function updateServInfo()
{
$info = ServInfo::find()->all();
foreach ($info as $v) {
if (!is_encrypted($v->idcard)) {
$v->updated_at = time();
}
$v->save();
}
}
private function updatePharmacistInfo()
{
$info = PharmacistInfo::find()->all();
foreach ($info as $v) {
if (!is_encrypted($v->idcard)) {
$v->updated_at = time();
}
$v->save();
}
}
private function updateLeadInfo()
{
$info = LeadInfo::find()->all();
foreach ($info as $v) {
if (!is_encrypted($v->idcard)) {
$v->updated_at = time();
}
$v->save();
}
}
private function updateUserPatient()
{
$info = UserPatient::find()->all();
foreach ($info as $v) {
if (!is_encrypted($v->id_card)) {
$v->updated_at = time();
}
$v->save();
}
}
private function updateDoctorPatient()
{
$info = DoctorPatient::find()->all();
foreach ($info as $v) {
if (!is_encrypted($v->id_card)) {
$v->updated_at = time();
}
$v->save();
}
}
public function actionLogin()
{
$post = Yii::$app->request->post();