新增用户弹窗接口,修改用户注册增加弹窗数据
This commit is contained in:
parent
60c257574d
commit
de4c302ad2
@ -275,3 +275,26 @@ function mkdirs(string $dir, int $mode = 0755): bool
|
||||
return @mkdir($dir, $mode);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换优惠卷适用范围为汉字
|
||||
* @param int|string $application_scope
|
||||
* @return string
|
||||
*/
|
||||
function couponScopeToString(int|string $application_scope): string
|
||||
{
|
||||
if ($application_scope == 1) {
|
||||
$result = "所有问诊类型";
|
||||
} elseif ($application_scope == 2) {
|
||||
$result = "快速问诊";
|
||||
} elseif ($application_scope == 3) {
|
||||
$result = "专家问诊";
|
||||
} elseif ($application_scope == 4) {
|
||||
$result = "公益问诊";
|
||||
} elseif ($application_scope == 5) {
|
||||
$result = "问诊购药";
|
||||
} else {
|
||||
$result = "";
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@ -153,6 +153,16 @@ class UserController extends AbstractController
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取弹窗数据
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getUserPopup(): ResponseInterface
|
||||
{
|
||||
$UserService = new UserService();
|
||||
$data = $UserService->getUserPopup();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
// 支付测试
|
||||
public function testpay(){
|
||||
|
||||
@ -310,10 +310,10 @@ class UserDoctorController extends AbstractController
|
||||
public function checkOpenPrescription(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(UserDoctorRequest::class);
|
||||
$request->scene('getPrescriptionInfo')->validateResolved();
|
||||
$request->scene('checkOpenPrescription')->validateResolved();
|
||||
|
||||
$UserDoctorService = new UserDoctorService();
|
||||
$data = $UserDoctorService->getPrescriptionInfo();
|
||||
$data = $UserDoctorService->checkOpenPrescription();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ use App\Amqp\Producer\AutoCompleteInquiryDelayDirectProducer;
|
||||
use App\Amqp\Producer\UserCouponExpiredDelayDirectProducer;
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Model\Coupon;
|
||||
use App\Model\Popup;
|
||||
use App\Model\UserCoupon;
|
||||
use App\Utils\Log;
|
||||
use Hyperf\Amqp\Producer;
|
||||
@ -105,7 +106,7 @@ class CouponService extends BaseService
|
||||
continue;
|
||||
}
|
||||
|
||||
// 进行发放
|
||||
// 添加用户优惠卷表
|
||||
$data = array();
|
||||
$data['user_id'] = $user_id;
|
||||
$data['patient_id'] = $patient_id;
|
||||
@ -128,6 +129,28 @@ class CouponService extends BaseService
|
||||
return false;
|
||||
}
|
||||
|
||||
// 添加弹窗表
|
||||
$data = array();
|
||||
$data['user_id'] = $user_id;
|
||||
$data['app_type'] = 1;
|
||||
$data['client_type'] = 1;// 客户端类型(1:患者端 2:医生端 3:药师端)
|
||||
$data['popup_type'] = 2;// 弹窗类型(1:结算费用规则 2:新优惠卷弹窗)
|
||||
$data['popup_title'] = "新人红包福利";
|
||||
|
||||
$popup_content = [
|
||||
'coupon_price' => $value['coupon_price'], // 优惠卷金额
|
||||
'application_scope' => $value['application_scope'], // 适用范围(1:全部 2:快速问诊 3:专家问诊 4:公益问诊 5:问诊购药)
|
||||
'valid_type' => $value['valid_type'], // 有效类型(1:绝对时效,xxx-xxx时间段有效 2:相对时效 n天内有效)
|
||||
'valid_days' => $value['valid_days'], // 自领取之日起有效天数
|
||||
'valid_start_time' => $value['valid_start_time'], // 开始使用时间
|
||||
'valid_end_time' => $value['valid_end_time'], // 结束使用时间
|
||||
];
|
||||
$data['popup_content'] = json_encode($popup_content,JSON_UNESCAPED_UNICODE);
|
||||
$popup = Popup::addPopup($data);
|
||||
if (empty($popup)){
|
||||
return false;
|
||||
}
|
||||
|
||||
// 添加用户优惠卷自动过期队列
|
||||
// 添加自动完成队列
|
||||
$valid_end_time = strtotime($data['valid_end_time']);
|
||||
|
||||
@ -987,6 +987,52 @@ class UserDoctorService extends BaseService
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测是否可以开具处方
|
||||
* @return array
|
||||
*/
|
||||
public function checkOpenPrescription(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$order_inquiry_id = $this->request->input('order_inquiry_id');
|
||||
|
||||
$result = array();
|
||||
$result['status'] = 1;
|
||||
$result['message'] = "成功";
|
||||
$result['data'] = [];
|
||||
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$order_prescription = OrderPrescription::getOne($params);
|
||||
if (empty($order_prescription)){
|
||||
return success($result);
|
||||
}
|
||||
|
||||
if ($order_prescription['prescription_status'] == 1){
|
||||
$result['status'] = 2;
|
||||
$result['message'] = "处方审核中,请勿重复开具";
|
||||
$result['data']['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||
$result['data']['order_inquiry_id'] = $order_prescription['order_inquiry_id'];
|
||||
return success($result);
|
||||
}
|
||||
|
||||
if ($order_prescription['prescription_status'] == 2){
|
||||
$result['status'] = 2;
|
||||
$result['message'] = "您已为患者开具处方,请勿重复开具";
|
||||
$result['data']['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||
$result['data']['order_inquiry_id'] = $order_prescription['order_inquiry_id'];
|
||||
return success($result);
|
||||
}
|
||||
|
||||
$result['status'] = 2;
|
||||
$result['message'] = "您已为患者开具处方,请勿重复开具";
|
||||
$result['data']['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||
$result['data']['order_inquiry_id'] = $order_prescription['order_inquiry_id'];
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改处方
|
||||
* 暂时去除修改处方
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Model\Popup;
|
||||
use App\Model\SubTemplate;
|
||||
use App\Model\User;
|
||||
use App\Model\User as UserModel;
|
||||
@ -513,6 +514,29 @@ class UserService extends BaseService
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取弹窗数据
|
||||
* @return array
|
||||
*/
|
||||
public function getUserPopup(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
if (empty($user_info)){
|
||||
// 未登陆
|
||||
return success();
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$params['user_id'] = $user_info['user_id'];
|
||||
$popup = Popup::getList($params);
|
||||
if (empty($popup)){
|
||||
return success();
|
||||
}
|
||||
|
||||
return success($popup->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过user_id获取用户openid
|
||||
* @param string|int $user_id
|
||||
@ -591,4 +615,5 @@ class UserService extends BaseService
|
||||
|
||||
return $avatar;
|
||||
}
|
||||
|
||||
}
|
||||
@ -650,4 +650,4 @@ Router::addGroup('/inquiry', function () {
|
||||
});
|
||||
|
||||
// 获取弹窗数据
|
||||
Router::get('/popup', [InquiryController::class, 'getInquiryMessageBasic']);
|
||||
Router::get('/popup', [UserController::class, 'getUserPopup']);
|
||||
Loading…
x
Reference in New Issue
Block a user