GeoConfirmLogic.php
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/**
* @remark :
* @name :GeoConfirmLogic.php
* @author :lyh
* @method :post
* @time :2025/10/25 11:36
*/
namespace App\Http\Logic\Aside\Geo;
use App\Enums\Common\Code;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Geo\GeoConfirm;
use App\Models\ProjectAssociation\ProjectAssociation;
/**
* @remark :用户确认信息
* @name :GeoConfirmLogic
* @author :lyh
* @method :post
* @time :2025/10/25 11:37
*/
class GeoConfirmLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new GeoConfirm();
}
/**
* @remark :保存数据->并推送微信群客户确认
* @name :saveConfirmContent
* @author :lyh
* @method :post
* @time :2025/10/25 11:41
*/
public function saveConfirmContent($param)
{
try {
$info = $this->model->read(['project_id' => $param['project_id'],'type' => $param['type']]);
if($info === false){
$id = $this->model->addReturnId($param);
}else{
$id = $info['id'];
$this->model->edit($param,['id'=>$info['id']]);
}
$friend = ProjectAssociation::where(['project_id' => $param['project_id']])->first();
if (empty($friend)){
$this->fail('项目未绑定微信群, 推送消息失败!');
}
GeoConfirm::sendConfirmMessage($id, $friend->friend_id);
} catch (\Exception $e) {
$this->fail('操作失败, error:' . $e->getMessage());
}
return $this->success(['id'=>$id]);
}
/**
* @remark :获取数据详情
* @name :getInfo
* @author :lyh
* @method :post
* @time :2025/10/30 09:13
*/
public function getConfirmInfo()
{
$data = $this->model->read($this->param);
if($data === false){
return $this->success();
}
return $this->success($data);
}
/**
* @remark :保存确认信息
* @name :saveConfirmInfo
* @author :lyh
* @method :post
* @time :2025/10/30 11:41
*/
public function saveConfirmInfo()
{
$this->param['status'] = GeoConfirm::STATUS_FINISH;
$info = $this->model->read(['project_id' => $this->param['project_id'],'type'=>$this->param['type']]);
if($info === false){
$id = $this->model->addReturnId($this->param);
}else{
$id = $info['id'];
$this->model->edit($this->param,['id'=>$info['id']]);
}
return $this->success(['id'=>$id]);
}
}