|
@@ -3,6 +3,7 @@ namespace app\app\logic;
|
|
|
|
|
|
use app\common\model\appointmentmodel;
|
|
|
use app\common\model\tubemodel;
|
|
|
+use app\common\model\webusermodel;
|
|
|
use think\Db;
|
|
|
|
|
|
/**
|
|
@@ -28,6 +29,7 @@ class appointmentlogic extends baselogic
|
|
|
['name' => 'appointment_id', 'title' => '申请id', 'require' => true, 'type' => 'numeric'],
|
|
|
['name' => 'testtubeno', 'title' => '测试管号', 'require' => true, 'type' => 'numeric'],
|
|
|
['name' => 'testtype', 'title' => '测试类型', 'require' => true, 'type' => 'numeric'],
|
|
|
+ ['name' => 'token', 'title' => 'token', 'require' => true, 'type' => 'string'],
|
|
|
],
|
|
|
];
|
|
|
return $list;
|
|
@@ -46,21 +48,22 @@ class appointmentlogic extends baselogic
|
|
|
if (1 != $result['status']) {
|
|
|
return $result;
|
|
|
}
|
|
|
+ $data = $result['data'];
|
|
|
$m_a = new appointmentmodel();
|
|
|
- $where = ['id' => $arr['id']];
|
|
|
+ $where = ['id' => $data['id']];
|
|
|
$field = ['name', 'sfzid', 'telno', 'signurl', 'oprdate', 'ispay', 'isuse', 'payorderno', 'id'];
|
|
|
$info = $m_a->getInfo($where, $field);
|
|
|
if (empty($info)) {
|
|
|
return backarr(0, "无申请数据");
|
|
|
}
|
|
|
+ $aid = $info['id'];
|
|
|
if (!$info['ispay']) {
|
|
|
- return backarr(0, "未支付");
|
|
|
+ return backarr(0, "未支付", ['id' => $aid]);
|
|
|
}
|
|
|
if ($info['isuse']) {
|
|
|
- $aid = $info['id'];
|
|
|
$m_t = new tubemodel();
|
|
|
$tinfo = $m_t->getInfo(['appointment_id' => $aid], ['oprtime']);
|
|
|
- return backarr(0, "已使用", ['id' => $aid, 'oprtime' => $tinfo['oprtime']]);
|
|
|
+ return backarr(-1, "已使用", ['id' => $aid, 'oprtime' => $tinfo['oprtime']]);
|
|
|
}
|
|
|
return backarr(1, "查询成功", $info);
|
|
|
}
|
|
@@ -82,8 +85,10 @@ class appointmentlogic extends baselogic
|
|
|
$aid = $data['appointment_id'];
|
|
|
$testtubeno = $data['testtubeno'];
|
|
|
$testtype = $data['testtype'];
|
|
|
+ $token = $data['token'];
|
|
|
$m_t = new tubemodel();
|
|
|
$m_a = new appointmentmodel();
|
|
|
+ $m_w = new webusermodel();
|
|
|
$testtypelist = $m_t->gettesttypelist();
|
|
|
if (!isset($testtypelist[$testtype])) {
|
|
|
return backarr(0, "测试类型错误");
|
|
@@ -107,6 +112,7 @@ class appointmentlogic extends baselogic
|
|
|
}
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
+ $winfo = $m_w->getinfobytoken($token);
|
|
|
$tinsertData = [
|
|
|
'openid' => $ainfo['openid'],
|
|
|
'name' => $ainfo['name'],
|
|
@@ -116,6 +122,7 @@ class appointmentlogic extends baselogic
|
|
|
'code' => $ainfo['code'],
|
|
|
'appointment_id' => $ainfo['id'],
|
|
|
'test_type' => $testtype,
|
|
|
+ 'wid' => $winfo['id'],
|
|
|
];
|
|
|
$tid = $m_t->insertData($tinsertData);
|
|
|
if (empty($tid)) {
|