1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- namespace app\api\dao\doctor;
- use app\api\actions\ZskkCache;
- use app\api\dao\ZskkDefaultDao;
- use app\api\model\doctor\DoctorModel;
- use app\api\model\doctor\FaAdminModel;
- use think\facade\Log;
- use app\api\utils\UUIDUtils;
- /**
- * 后台控制器基类
- * 接口方法权限 必传参数 接口返回 错误抛出 通用参数处理
- */
- class DoctorDao extends ZskkDefaultDao {
- protected $flag = true;
- protected $logName = "DoctorDao";
- protected $doctor = null;
- public function __construct(DoctorModel $doctorModel)
- {
- parent::__construct();
- $this->doctor = $doctorModel;
- }
- public function getToken($token)
- {
- $user = $this->getCache($token);
- if(!$user){
- $this->throwError('登陆信息失效,请重新进行登陆', '0099');
- }
- return $user;
- }
- public function changePwd($id,$password)
- {
- $info = $this->doctor->changePwd($id,$password);
- return $info;
- }
- public function changeInfo($data,$id,$token)
- {
- $info = $this->doctor->changeInfo($data,$id);
- if($info){
- $where['id'] = $id;
- $doctor = $this->doctor->getUser($where);
- $cache = $this->updateCache($token,$doctor);
- }else{
- $this->throwError('修改失败',0011);
- }
- return $info;
- }
- public function getPower($id){
- $info = $this->doctor->getPower($id);
- return $info;
- }
- // 获取登录代码
- public function getLoginCode($user_id)
- {
- return $this->doctor->where('id', $user_id)->value('login_code');
- }
- public function getFaAdmin($phone)
- {
- $fa_admin = new FaAdminModel();
- return $fa_admin
- ->where('phone', $phone)
- ->value('id');
- }
- public function getDoctorList($institution)
- {
- $info = $this->doctor->getDoctorList($institution);
- return $info;
- }
- }
|