用户注册时,增加用户创建者id。增加医生配置表字段
This commit is contained in:
parent
aa8b31c1bf
commit
e4ea689b79
123
app/Command/editDoctorInquiryConfigCommand.php
Normal file
123
app/Command/editDoctorInquiryConfigCommand.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Command;
|
||||
|
||||
use App\Model\DoctorInquiryConfig;
|
||||
use App\Model\SystemInquiryConfig;
|
||||
use App\Model\UserDoctor;
|
||||
use Hyperf\Command\Command as HyperfCommand;
|
||||
use Hyperf\Command\Annotation\Command;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
#[Command]
|
||||
class editDoctorInquiryConfigCommand extends HyperfCommand
|
||||
{
|
||||
public function __construct(protected ContainerInterface $container)
|
||||
{
|
||||
parent::__construct('editDoctorInquiryConfig:command');
|
||||
}
|
||||
|
||||
public function configure()
|
||||
{
|
||||
parent::configure();
|
||||
$this->setDescription('修改医生问诊配置');
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$this->line('开始');
|
||||
|
||||
// 获取医生信息
|
||||
$params = array();
|
||||
$user_doctors = UserDoctor::getList($params);
|
||||
if (empty($user_doctors)) {
|
||||
$this->line('结束,无医生需处理');
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取系统问诊配置
|
||||
$params = array();
|
||||
$params['inquiry_type'] = 4;
|
||||
$params['inquiry_mode'] = 1;
|
||||
$system_inquiry_config = SystemInquiryConfig::getOne($params);
|
||||
if (empty($system_inquiry_config)) {
|
||||
$this->line('结束,系统问诊配置获取失败');
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($user_doctors as $user_doctor){
|
||||
Db::beginTransaction();
|
||||
|
||||
try {
|
||||
// 是否参加专家图文接诊
|
||||
if ($user_doctor['is_img_expert_reception'] == 1){
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_doctor['doctor_id'];
|
||||
$params['inquiry_type'] = 1;
|
||||
$params['inquiry_mode'] = 1;
|
||||
|
||||
$data['is_enable'] = 1;
|
||||
DoctorInquiryConfig::editInquiryConfig($params,$data);
|
||||
}
|
||||
|
||||
// 是否参加快速图文接诊
|
||||
if ($user_doctor['is_img_quick_reception'] == 1){
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_doctor['doctor_id'];
|
||||
$params['inquiry_type'] = 2;
|
||||
$params['inquiry_mode'] = 1;
|
||||
|
||||
$data['is_enable'] = 1;
|
||||
DoctorInquiryConfig::editInquiryConfig($params,$data);
|
||||
}
|
||||
|
||||
// 是否参加公益图文问诊
|
||||
if ($user_doctor['is_img_welfare_reception'] == 1){
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_doctor['doctor_id'];
|
||||
$params['inquiry_type'] = 3;
|
||||
$params['inquiry_mode'] = 1;
|
||||
|
||||
$data['is_enable'] = 1;
|
||||
DoctorInquiryConfig::editInquiryConfig($params,$data);
|
||||
}
|
||||
|
||||
// 医生多点执业认证状态
|
||||
if ($user_doctor['multi_point_status'] == 1){
|
||||
// 查询是否已设置多点执业认证状态
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_doctor['doctor_id'];
|
||||
$params['inquiry_type'] = 4;
|
||||
$params['inquiry_mode'] = 1;
|
||||
$doctor_inquiry_config = DoctorInquiryConfig::getOne($params);
|
||||
if (empty($doctor_inquiry_config)) {
|
||||
$data = array();
|
||||
$data['doctor_id'] = $user_doctor['doctor_id'];
|
||||
$data['inquiry_type'] = 4;
|
||||
$data['inquiry_mode'] = 1;
|
||||
$data['is_enable'] = 1;
|
||||
$data['work_num_day'] = $system_inquiry_config["max_work_num_day"];
|
||||
$data['inquiry_price'] = $system_inquiry_config["inquiry_price"];
|
||||
|
||||
$doctorInquiryConfig = DoctorInquiryConfig::addInquiryConfig($data);
|
||||
if (empty($doctorInquiryConfig)){
|
||||
Db::rollBack();
|
||||
$this->line('失败:问诊购药处理失败');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
}catch (\Throwable $e){
|
||||
Db::rollBack();
|
||||
// 记录失败次数
|
||||
$this->line("失败:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
$this->line('结束');
|
||||
}
|
||||
}
|
||||
@ -14,6 +14,8 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property string $doctor_id 医生id
|
||||
* @property int $inquiry_type 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
* @property int $inquiry_mode 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
* @property int $is_enable 是否启用(0:否 1:是)
|
||||
* @property int $last_enable_method 最后开启方式(1:自己 2:后台)
|
||||
* @property int $work_num_day 每日接诊数量
|
||||
* @property string $inquiry_price 接诊价格(专家问诊-公益问诊)
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
@ -31,12 +33,12 @@ class DoctorInquiryConfig extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['inquiry_config_id', 'doctor_id', 'inquiry_type', 'inquiry_mode', 'work_num_day', 'inquiry_price', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['inquiry_config_id', 'doctor_id', 'inquiry_type', 'inquiry_mode', 'is_enable', 'last_enable_method', 'work_num_day', 'inquiry_price', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = ['inquiry_config_id' => 'string', 'doctor_id' => 'string', 'inquiry_type' => 'integer', 'inquiry_mode' => 'integer', 'work_num_day' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
protected array $casts = ['inquiry_config_id' => 'string', 'doctor_id' => 'string', 'inquiry_type' => 'integer', 'inquiry_mode' => 'integer', 'work_num_day' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'is_enable' => 'integer', 'last_enable_method' => 'integer'];
|
||||
|
||||
protected string $primaryKey = "inquiry_config_id";
|
||||
|
||||
|
||||
@ -9,20 +9,22 @@ use Hyperf\Database\Model\Builder;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property string $user_id 主键
|
||||
* @property int $user_id 主键
|
||||
* @property string $user_name 用户名称
|
||||
* @property string $user_account 账号
|
||||
* @property string $mobile 手机号
|
||||
* @property int $sex 性别(0:未知 1:男 2:女)
|
||||
* @property string $avatar 头像
|
||||
* @property string $wx_mobile 微信手机号
|
||||
* @property string $user_password 密码
|
||||
* @property string $salt 密码混淆码
|
||||
* @property int $user_type 用户类型(1:患者 2:医师 3:药师)
|
||||
* @property int $user_status 状态(0:禁用 1:正常 2:删除)
|
||||
* @property int $register_method 注册方式(1:微信小程序 )
|
||||
* @property int $register_method 注册方式(1:微信小程序 2:后台添加 )
|
||||
* @property int $age 年龄
|
||||
* @property int $sex 性别(0:未知 1:男 2:女)
|
||||
* @property string $avatar 头像
|
||||
* @property string $login_ip 登陆ip
|
||||
* @property string $last_login_at 最后登陆时间
|
||||
* @property string $created_by 创建者id(后台用户表id null:自己注册)
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
@ -38,7 +40,7 @@ class User extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['user_id', 'user_name', 'user_account', 'mobile', 'sex', 'avatar', 'wx_mobile', 'user_password', 'salt', 'user_type', 'user_status', 'register_method', 'login_ip', 'last_login_at', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['user_id', 'user_name', 'user_account', 'mobile', 'wx_mobile', 'user_password', 'salt', 'user_type', 'user_status', 'register_method', 'age', 'sex', 'avatar', 'login_ip', 'last_login_at', 'created_by', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "user_id";
|
||||
|
||||
|
||||
@ -131,6 +131,14 @@ class LoginService extends BaseService
|
||||
}
|
||||
}
|
||||
|
||||
// 修改用户表创建者id
|
||||
$params = array();
|
||||
$params['user_id'] = $user['user_id'];
|
||||
|
||||
$data = array();
|
||||
$data['created_by'] = $user['user_id'];
|
||||
UserModel::editUser($params,$data);
|
||||
|
||||
// 创建im账号
|
||||
$account = new Account();
|
||||
// 创建单个账号
|
||||
@ -226,7 +234,7 @@ class LoginService extends BaseService
|
||||
// 创建单个账号
|
||||
$account->createAccount($user['user_id'], $user['user_name'], $avatar);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Throwable $e) {
|
||||
Log::getInstance()->error("IM账号倒入失败");
|
||||
}
|
||||
}
|
||||
@ -389,6 +397,14 @@ class LoginService extends BaseService
|
||||
}
|
||||
}
|
||||
|
||||
// 修改用户表创建者id
|
||||
$params = array();
|
||||
$params['user_id'] = $user['user_id'];
|
||||
|
||||
$data = array();
|
||||
$data['created_by'] = $user['user_id'];
|
||||
UserModel::editUser($params,$data);
|
||||
|
||||
// 创建im账号
|
||||
$account = new Account();
|
||||
// 创建单个账号
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user