更新初级版本
This commit is contained in:
@@ -28,7 +28,7 @@ class TcmController extends BaseApiController
|
||||
* @notes 不需要登录的方法
|
||||
* @var array
|
||||
*/
|
||||
public array $notNeedLogin = ['getPatientSignature', 'diagnosisDetail', 'getDict'];
|
||||
public array $notNeedLogin = ['getPatientSignature', 'diagnosisDetail', 'getDict', 'confirmDiagnosis'];
|
||||
|
||||
/**
|
||||
* @notes 获取患者签名(供小程序调用)
|
||||
@@ -58,20 +58,58 @@ class TcmController extends BaseApiController
|
||||
*/
|
||||
public function diagnosisDetail()
|
||||
{
|
||||
$id = $this->request->get('id');
|
||||
$params = [
|
||||
'id' => $this->request->get('id'),
|
||||
'user_id' => $this->request->get('user_id', 0),
|
||||
'share_user_id' => $this->request->get('share_user_id', 0)
|
||||
];
|
||||
|
||||
if (!$id) {
|
||||
if (!$params['id']) {
|
||||
return $this->fail('诊单ID不能为空');
|
||||
}
|
||||
|
||||
try {
|
||||
$result = DiagnosisLogic::detail(['id' => $id]);
|
||||
$result = DiagnosisLogic::diagnosisDetailWithRecord($params);
|
||||
|
||||
if ($result === false) {
|
||||
return $this->fail(DiagnosisLogic::getError());
|
||||
}
|
||||
|
||||
return $this->data($result);
|
||||
} catch (\Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 确认诊单(供小程序调用)
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function confirmDiagnosis()
|
||||
{
|
||||
$params = [
|
||||
'id' => $this->request->post('id'),
|
||||
'user_id' => $this->userId,
|
||||
'share_user_id' => $this->request->post('share_user', 0)
|
||||
];
|
||||
|
||||
if (!$params['id']) {
|
||||
return $this->fail('诊单ID不能为空');
|
||||
}
|
||||
|
||||
try {
|
||||
$result = DiagnosisLogic::confirmDiagnosisRecord($params);
|
||||
|
||||
if ($result === false) {
|
||||
return $this->fail(DiagnosisLogic::getError());
|
||||
}
|
||||
|
||||
return $this->success('确认成功');
|
||||
} catch (\Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取字典数据(供小程序调用)
|
||||
* @return \think\response\Json
|
||||
|
||||
@@ -53,6 +53,7 @@ class UserController extends BaseApiController
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
|
||||
$result = UserLogic::info($this->userId);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ class UserLogic extends BaseLogic
|
||||
public static function info(int $userId)
|
||||
{
|
||||
$user = User::where(['id' => $userId])
|
||||
->with('diagnosis')
|
||||
->field('id,sn,sex,account,password,nickname,real_name,avatar,mobile,create_time,user_money')
|
||||
->findOrEmpty();
|
||||
$user['has_password'] = !empty($user['password']);
|
||||
|
||||
@@ -75,6 +75,7 @@ class WechatUserService
|
||||
$unionid = $this->unionid;
|
||||
|
||||
$user = User::alias('u')
|
||||
->with('diagnosis')
|
||||
->field('u.id,u.sn,u.mobile,u.nickname,u.avatar,u.mobile,u.is_disable,u.is_new_user,au.openid')
|
||||
->join('user_auth au', 'au.user_id = u.id')
|
||||
->where(function ($query) use ($openid, $unionid) {
|
||||
|
||||
Reference in New Issue
Block a user