|
@@ -27,24 +27,23 @@ class GeoController extends BaseController |
|
@@ -27,24 +27,23 @@ class GeoController extends BaseController |
|
27
|
* 获取GEO相关配置
|
27
|
* 获取GEO相关配置
|
|
28
|
* @param Request $request
|
28
|
* @param Request $request
|
|
29
|
*/
|
29
|
*/
|
|
30
|
- public function getConfig(Request $request)
|
30
|
+ public function getConfig()
|
|
31
|
{
|
31
|
{
|
|
32
|
$this->request->validate([
|
32
|
$this->request->validate([
|
|
33
|
'project_id' => 'required',
|
33
|
'project_id' => 'required',
|
|
34
|
], [
|
34
|
], [
|
|
35
|
'project_id.required' => '项目ID不能为空',
|
35
|
'project_id.required' => '项目ID不能为空',
|
|
36
|
]);
|
36
|
]);
|
|
37
|
-
|
|
|
|
38
|
- $project_geo_conf = Project::select('title', 'version', 'geo_status', 'geo_qualify_num')->where(['project_id' => $this->param['project_id']])->first();
|
|
|
|
39
|
- $geo_conf = GeoConf::where(['project_id' => $this->param['project_id']])->first();
|
|
|
|
40
|
- $geo_manage_list = GeoConf::geoManage();
|
|
|
|
41
|
-
|
37
|
+ $projectModel = new Project();
|
|
|
|
38
|
+ $project_geo_conf = $projectModel->read(['project_id' => $this->param['project_id']],['title', 'version', 'geo_status', 'geo_qualify_num']);
|
|
|
|
39
|
+ $geoConfModel = new GeoConf();
|
|
|
|
40
|
+ $geo_conf = $geoConfModel->read(['project_id' => $this->param['project_id']]);
|
|
|
|
41
|
+ $geo_manage_list = $geoConfModel->geoManage();
|
|
42
|
// geo配置管理员,已经移除管理员列表,补充管理员信息
|
42
|
// geo配置管理员,已经移除管理员列表,补充管理员信息
|
|
43
|
- if ($geo_conf && $geo_conf->manager_id && empty($geo_manage_list[$geo_conf->manager_id])) {
|
|
|
|
44
|
- $manage = ManageHr::where(['id' => $geo_conf->manager_id])->pluck('name', 'id')->toArray();
|
43
|
+ if ($geo_conf && $geo_conf['manager_id'] && empty($geo_manage_list[$geo_conf['manager_id']])) {
|
|
|
|
44
|
+ $manage = ManageHr::where(['id' => $geo_conf['manager_id']])->pluck('name', 'id')->toArray();
|
|
45
|
$geo_manage_list = array_merge($geo_manage_list, $manage);
|
45
|
$geo_manage_list = array_merge($geo_manage_list, $manage);
|
|
46
|
}
|
46
|
}
|
|
47
|
-
|
|
|
|
48
|
$result = [
|
47
|
$result = [
|
|
49
|
'project_geo_conf' => $project_geo_conf,
|
48
|
'project_geo_conf' => $project_geo_conf,
|
|
50
|
'geo_conf' => $geo_conf,
|
49
|
'geo_conf' => $geo_conf,
|
|
@@ -63,7 +62,7 @@ class GeoController extends BaseController |
|
@@ -63,7 +62,7 @@ class GeoController extends BaseController |
|
63
|
* @param Request $request
|
62
|
* @param Request $request
|
|
64
|
* @throws \App\Exceptions\AsideGlobalException
|
63
|
* @throws \App\Exceptions\AsideGlobalException
|
|
65
|
*/
|
64
|
*/
|
|
66
|
- public function saveConfig(Request $request)
|
65
|
+ public function saveConfig()
|
|
67
|
{
|
66
|
{
|
|
68
|
$this->request->validate([
|
67
|
$this->request->validate([
|
|
69
|
'project_id' => 'required',
|
68
|
'project_id' => 'required',
|
|
@@ -78,7 +77,6 @@ class GeoController extends BaseController |
|
@@ -78,7 +77,6 @@ class GeoController extends BaseController |
|
78
|
'brand.max' => '品牌名不能超过200个字符',
|
77
|
'brand.max' => '品牌名不能超过200个字符',
|
|
79
|
'description.max' => '描述不能超过500个字符',
|
78
|
'description.max' => '描述不能超过500个字符',
|
|
80
|
]);
|
79
|
]);
|
|
81
|
-
|
|
|
|
82
|
try {
|
80
|
try {
|
|
83
|
$data = GeoConf::saveConf($this->param['project_id'], $this->param['manager_id'], $this->param['company'], $this->param['brand'], $this->param['description'], $this->param['prefix'], $this->param['suffix']);
|
81
|
$data = GeoConf::saveConf($this->param['project_id'], $this->param['manager_id'], $this->param['company'], $this->param['brand'], $this->param['description'], $this->param['prefix'], $this->param['suffix']);
|
|
84
|
# FIXME 保存GEO状态 达标数量
|
82
|
# FIXME 保存GEO状态 达标数量
|
|
@@ -94,7 +92,7 @@ class GeoController extends BaseController |
|
@@ -94,7 +92,7 @@ class GeoController extends BaseController |
|
94
|
* @param Request $request
|
92
|
* @param Request $request
|
|
95
|
* @throws \App\Exceptions\AsideGlobalException
|
93
|
* @throws \App\Exceptions\AsideGlobalException
|
|
96
|
*/
|
94
|
*/
|
|
97
|
- public function saveConfirmContent(Request $request)
|
95
|
+ public function saveConfirmContent()
|
|
98
|
{
|
96
|
{
|
|
99
|
$this->request->validate([
|
97
|
$this->request->validate([
|
|
100
|
'project_id' => 'required',
|
98
|
'project_id' => 'required',
|
|
@@ -108,16 +106,13 @@ class GeoController extends BaseController |
|
@@ -108,16 +106,13 @@ class GeoController extends BaseController |
|
108
|
'content.required' => '确定数据不能为空',
|
106
|
'content.required' => '确定数据不能为空',
|
|
109
|
'max_num.required' => '最大确认数量不能为空',
|
107
|
'max_num.required' => '最大确认数量不能为空',
|
|
110
|
]);
|
108
|
]);
|
|
111
|
-
|
|
|
|
112
|
try {
|
109
|
try {
|
|
113
|
$data = GeoConfirm::saveContent($this->param['project_id'], $this->param['type'], $this->param['content'], $this->param['max_num']);
|
110
|
$data = GeoConfirm::saveContent($this->param['project_id'], $this->param['type'], $this->param['content'], $this->param['max_num']);
|
|
114
|
-
|
|
|
|
115
|
$friend = ProjectAssociation::where(['project_id' => $this->param['project_id']])->first();
|
111
|
$friend = ProjectAssociation::where(['project_id' => $this->param['project_id']])->first();
|
|
116
|
- if (empty($friend))
|
112
|
+ if (empty($friend)){
|
|
117
|
$this->fail('项目未绑定微信群, 推送消息失败!');
|
113
|
$this->fail('项目未绑定微信群, 推送消息失败!');
|
|
118
|
-
|
114
|
+ }
|
|
119
|
$data = GeoConfirm::sendConfirmMessage($data->id, $friend->friend_id);
|
115
|
$data = GeoConfirm::sendConfirmMessage($data->id, $friend->friend_id);
|
|
120
|
-
|
|
|
|
121
|
$this->response('success', Code::SUCCESS, $data);
|
116
|
$this->response('success', Code::SUCCESS, $data);
|
|
122
|
} catch (\Exception $e) {
|
117
|
} catch (\Exception $e) {
|
|
123
|
$this->fail('操作失败, error:' . $e->getMessage());
|
118
|
$this->fail('操作失败, error:' . $e->getMessage());
|
|
@@ -131,4 +126,4 @@ class GeoController extends BaseController |
|
@@ -131,4 +126,4 @@ class GeoController extends BaseController |
|
131
|
*/
|
126
|
*/
|
|
132
|
public function saveConfirmData(Request $request)
|
127
|
public function saveConfirmData(Request $request)
|
|
133
|
{}
|
128
|
{}
|
|
134
|
-} |
|
|
|
|
|
129
|
+} |