Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
周先生
authored and
周先生
committed
Dec 31, 2017
1 parent
fcae464
commit d80272c
Showing
21 changed files
with
745 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
|
||
return new \Phalcon\Config([ | ||
'login_type' => [ | ||
1 | ||
1,2 | ||
], | ||
/** | ||
* 七牛上传配置信息 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: Mr.Zhou | ||
* Date: 2017/12/9 | ||
* Time: 下午2:52 | ||
*/ | ||
|
||
namespace App\Controllers\User; | ||
|
||
use App\Controllers\BaseController; | ||
use App\Models\ForumArticleInfo; | ||
use App\Models\ForumArticleReply; | ||
use App\Models\ForumArticleReplyView; | ||
use App\Models\ForumUserAttention; | ||
use App\Models\ForumUserCollection; | ||
use App\Services\ArticleInfoService; | ||
use App\Services\ReplyService; | ||
|
||
class ReplyController extends BaseController | ||
{ | ||
public function initialize() | ||
{ | ||
|
||
} | ||
|
||
public function setReadMsgAction() | ||
{ | ||
if (!$this->request->isPost()) { | ||
output_data(-502, '非法请求'); | ||
} | ||
if (!$this->user) { | ||
output_data(-401, '请先登录'); | ||
} | ||
$type = $this->request->getPost('type', 'int',1); | ||
|
||
$readModel = new ForumArticleReplyView(); | ||
$flag = $readModel->create([ | ||
'type' => $type, | ||
'user_id' => $this->user['id'], | ||
'created_time' => time(), | ||
]); | ||
if ($flag) { | ||
output_data(1, 'success'); | ||
} | ||
output_data(-1, '信息阅读失败'); | ||
} | ||
|
||
/** | ||
* 获取回复列表接口 | ||
*/ | ||
public function myReplyListAction() | ||
{ | ||
if (!$this->request->isPost()) { | ||
output_data(-502, '非法请求'); | ||
} | ||
if (!$this->user) { | ||
output_data(-401, '请先登录'); | ||
} | ||
|
||
$page = $this->request->getPost('current_page', 'int', 1); | ||
$pageNums = $this->request->getPost('page_nums', 'int', 20); | ||
|
||
$res = ReplyService::getMyArticleReply($this->user, $page, $pageNums); | ||
$arr = []; | ||
$titles = $this->commonConfig->verify_title->toArray(); | ||
foreach ($res['rows'] as $key => $value) { | ||
$arr[$key] = [ | ||
'article_id' => $value->article_id, | ||
'user_id' => $value->user_id, | ||
'content' => $value->content, | ||
'title' => $value->articleInfo->title, | ||
'nickname' => $value->userInfo->nickname, | ||
'head_img' => $value->userInfo->head_img, | ||
'verify_type' => $value->userInfo->verify_type, | ||
'type_name' => !empty($titles[$value->userInfo->verify_type]) ? $titles[$value->userInfo->verify_type] : '', | ||
'time' => timeCompute($value->created_time), | ||
]; | ||
} | ||
$res['rows'] = $arr; | ||
output_data(1, 'success', $res); | ||
} | ||
|
||
/** | ||
* 获取@我的回复列表接口 | ||
*/ | ||
public function atMeListAction() | ||
{ | ||
if (!$this->request->isPost()) { | ||
output_data(-502, '非法请求'); | ||
} | ||
if (!$this->user) { | ||
output_data(-401, '请先登录'); | ||
} | ||
|
||
$page = $this->request->getPost('current_page', 'int', 1); | ||
$pageNums = $this->request->getPost('page_nums', 'int', 20); | ||
|
||
$res = ReplyService::getAtMeReply($this->user, $page, $pageNums); | ||
$arr = []; | ||
$titles = $this->commonConfig->verify_title->toArray(); | ||
foreach ($res['rows'] as $key => $value) { | ||
$arr[$key] = [ | ||
'article_id' => $value->article_id, | ||
'user_id' => $value->user_id, | ||
'content' => $value->content, | ||
'title' => $value->articleInfo->title, | ||
'nickname' => $value->userInfo->nickname, | ||
'head_img' => $value->userInfo->head_img, | ||
'verify_type' => $value->userInfo->verify_type, | ||
'type_name' => !empty($titles[$value->userInfo->verify_type]) ? $titles[$value->userInfo->verify_type] : '', | ||
'time' => timeCompute($value->created_time), | ||
]; | ||
} | ||
$res['rows'] = $arr; | ||
output_data(1, 'success', $res); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
class ForumArticleReplyView extends BaseModel | ||
{ | ||
|
||
/** | ||
* | ||
* @var integer | ||
* @Primary | ||
* @Identity | ||
* @Column(type="integer", length=11, nullable=false) | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* | ||
* @var integer | ||
* @Column(type="integer", length=4, nullable=false) | ||
*/ | ||
public $type; | ||
|
||
/** | ||
* | ||
* @var integer | ||
* @Column(type="integer", length=11, nullable=false) | ||
*/ | ||
public $user_id; | ||
|
||
/** | ||
* | ||
* @var integer | ||
* @Column(type="integer", length=11, nullable=false) | ||
*/ | ||
public $created_time; | ||
|
||
/** | ||
* Initialize method for model. | ||
*/ | ||
public function initialize() | ||
{ | ||
$this->setSchema("phalcon-forum"); | ||
} | ||
|
||
/** | ||
* Returns table name mapped in the model. | ||
* | ||
* @return string | ||
*/ | ||
public function getSource() | ||
{ | ||
return 'forum_article_reply_view'; | ||
} | ||
|
||
/** | ||
* Allows to query a set of records that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return ForumArticleReplyView[]|ForumArticleReplyView|\Phalcon\Mvc\Model\ResultSetInterface | ||
*/ | ||
public static function find($parameters = null) | ||
{ | ||
return parent::find($parameters); | ||
} | ||
|
||
/** | ||
* Allows to query the first record that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return ForumArticleReplyView|\Phalcon\Mvc\Model\ResultInterface | ||
*/ | ||
public static function findFirst($parameters = null) | ||
{ | ||
return parent::findFirst($parameters); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.