|
|
@@ -18,6 +18,8 @@ namespace app\adminapi\logic\external;
|
|
|
use app\common\logic\ThirdOrderLogic;
|
|
|
use app\common\model\external\ExternalConsultation;
|
|
|
use app\common\logic\BaseLogic;
|
|
|
+use app\common\model\external\ExternalConsultationFollowLog;
|
|
|
+use app\common\model\external\ExternalConsultationOrder;
|
|
|
use think\facade\Db;
|
|
|
|
|
|
|
|
|
@@ -150,6 +152,42 @@ class ExternalConsultationLogic extends BaseLogic
|
|
|
'work_id' => $work_id,
|
|
|
'remark' => $params['remark']
|
|
|
]);
|
|
|
+ ExternalConsultationOrder::create([
|
|
|
+ 'consultation_id' => $params['id'],
|
|
|
+ 'user_address' => $params['user_address'],
|
|
|
+ 'lon' => $params['lon'],
|
|
|
+ 'lat' => $params['lat'],
|
|
|
+
|
|
|
+ 'appointment_time' => $params['appointment_time'],
|
|
|
+ 'goods_id' => $params['goods_id'],
|
|
|
+ 'amount' => $params['amount'],
|
|
|
+ 'work_id' => $work_id,
|
|
|
+ ]);
|
|
|
+ Db::commit();
|
|
|
+ return true;
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ Db::rollback();
|
|
|
+ self::setError($e->getMessage());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public static function followLog(array $params): bool
|
|
|
+ {
|
|
|
+ Db::startTrans();
|
|
|
+ try {
|
|
|
+
|
|
|
+ $consultation = ExternalConsultation::where('id', $params['id'])->findOrEmpty();
|
|
|
+ if(empty($consultation->follow_start_time)) $consultation->follow_start_time = time();
|
|
|
+ $consultation->follow_status = 1;
|
|
|
+ $consultation->save();
|
|
|
+
|
|
|
+ ExternalConsultationFollowLog::create([
|
|
|
+ 'consultation_id' => $params['id']??0,
|
|
|
+ 'content' => $params['content']??'',
|
|
|
+ 'admin_id' => $params['admin_id']??0,
|
|
|
+ 'create_time' => time(),
|
|
|
+ ]);
|
|
|
+
|
|
|
Db::commit();
|
|
|
return true;
|
|
|
} catch (\Exception $e) {
|