作者 lyh

变更数据

@@ -80,13 +80,20 @@ class GeoController extends BaseController @@ -80,13 +80,20 @@ class GeoController extends BaseController
80 'content.max' => '内容过长保存失败', 80 'content.max' => '内容过长保存失败',
81 ]); 81 ]);
82 $token = trim($this->param['token']); 82 $token = trim($this->param['token']);
83 - $data = GeoWritings::where(['uniqid' => $token])->first();  
84 - if (empty($data)){ 83 + $geoWritingsModel = new GeoWritings();
  84 + $info = $geoWritingsModel->read(['uniqid' => $token]);
  85 + if ($info === false){
85 return $this->error('非法请求'); 86 return $this->error('非法请求');
86 } 87 }
87 - if ($data->status != GeoWritings::STATUS_RUNNING){ 88 + if ($info['status'] != GeoWritings::STATUS_RUNNING){
88 return $this->error('当前文章已确认,不可再次确认'); 89 return $this->error('当前文章已确认,不可再次确认');
89 } 90 }
  91 + $param = [
  92 + 'confirm_ip'=>$this->request->ip(),
  93 + 'confirm_at'=>date('Y-m-d H:i:s'),
  94 + 'content_length'=>$info['content'],
  95 + 'status'
  96 + ];
90 // FIXME 验证完成,保存数据,计算内容长度,处理内容中的资源, IP 确认时间 状态 97 // FIXME 验证完成,保存数据,计算内容长度,处理内容中的资源, IP 确认时间 状态
91 return $data; 98 return $data;
92 } 99 }
@@ -58,7 +58,6 @@ class GeoWritingsLogic extends BaseLogic @@ -58,7 +58,6 @@ class GeoWritingsLogic extends BaseLogic
58 $this->param['uniqid'] = uniqid().$this->param['project_id']; 58 $this->param['uniqid'] = uniqid().$this->param['project_id'];
59 $id = $this->model->addReturnId($this->param); 59 $id = $this->model->addReturnId($this->param);
60 } 60 }
61 - GeoWritings::sendConfirmMessage($id);  
62 }catch (\Exception $e){ 61 }catch (\Exception $e){
63 $this->fail('保存数据失败,请联系管理员'.$e->getMessage()); 62 $this->fail('保存数据失败,请联系管理员'.$e->getMessage());
64 } 63 }
@@ -99,7 +99,6 @@ class GeoWritings extends Base @@ -99,7 +99,6 @@ class GeoWritings extends Base
99 'thumbUrl' => 'https://hub.globalso.com/logocm.png', 99 'thumbUrl' => 'https://hub.globalso.com/logocm.png',
100 'url' => 'https://oa.quanqiusou.cn/public-geo-article-list?token=' . $token 100 'url' => 'https://oa.quanqiusou.cn/public-geo-article-list?token=' . $token
101 ]; 101 ];
102 - $content = json_encode($content_array, JSON_UNESCAPED_UNICODE);  
103 MessagePush::insert(compact('project_id', 'friend_id', 'type', 'content_type', 'content', 'send_time', 'updated_at', 'created_at')); 102 MessagePush::insert(compact('project_id', 'friend_id', 'type', 'content_type', 'content', 'send_time', 'updated_at', 'created_at'));
104 return true; 103 return true;
105 } 104 }