123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace addons\cms\controller\api;
- use addons\cms\model\Comment;
- use addons\cms\model\Page;
- /**
- * 我的
- */
- class My extends Base
- {
- protected $noNeedLogin = ['aboutus', 'agreement'];
- /**
- * 我发表的评论
- */
- public function comment()
- {
- $commentList = Comment::with('archives')
- ->where(['user_id' => $this->auth->id])
- ->order('id desc')
- ->paginate();
- foreach ($commentList as $index => $item) {
- $item->create_date = human_date($item->createtime);
- }
- $this->success('', ['commentList' => $commentList]);
- }
- /**
- * 我的消费订单
- */
- public function order(){
- $orderList = \addons\cms\model\Order::with(['archives'])->where('user_id', $this->auth->id)
- ->where('status', 'paid')
- ->order('id', 'desc')
- ->paginate(10, null);
- foreach($orderList as $item){
- $item->createtime = date('Y-m-d H:i:s',$item->createtime);
- }
- $this->success('', ['orderList' => $orderList]);
- }
- /**
- * 关于我们
- */
- public function aboutus()
- {
- $pageInfo = Page::getByDiyname('aboutus');
- if (!$pageInfo || $pageInfo['status'] != 'normal') {
- $this->error(__('单页未找到'));
- }
- $pageInfo = $pageInfo->toArray();
- unset($pageInfo['status'], $pageInfo['showtpl']);
- $this->success('', ['pageInfo' => $pageInfo]);
- }
- /**
- * 用户协议
- */
- public function agreement()
- {
- $pageInfo = Page::getByDiyname('agreement');
- if (!$pageInfo || $pageInfo['status'] != 'normal') {
- $this->error(__('单页未找到'));
- }
- $pageInfo = $pageInfo->toArray();
- unset($pageInfo['status'], $pageInfo['showtpl']);
- $this->success('', ['pageInfo' => $pageInfo]);
- }
- }
|