From 833a347f4cafb57c3837c3cfea7df67101012358 Mon Sep 17 00:00:00 2001 From: jianglong Date: Tue, 9 Jul 2024 11:24:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/logic/content/ResourceLogic.php | 10 ++++++---- app/admin/logic/user/ShipLogLogic.php | 4 +++- app/admin/view/content/resource/add.html | 8 +++++++- app/admin/view/content/resource/edit.html | 11 ++++++++++- app/admin/view/content/resource_category/add.html | 4 ++-- app/admin/view/content/resource_category/edit.html | 4 ++-- app/api/controller/Community.php | 3 ++- app/api/logic/CommunityLogic.php | 6 ++++-- app/api/logic/ResourceLogic.php | 10 ++++++++-- app/api/logic/UserLogic.php | 2 +- 10 files changed, 45 insertions(+), 17 deletions(-) diff --git a/app/admin/logic/content/ResourceLogic.php b/app/admin/logic/content/ResourceLogic.php index b2a41b0..8b9db9c 100644 --- a/app/admin/logic/content/ResourceLogic.php +++ b/app/admin/logic/content/ResourceLogic.php @@ -98,7 +98,7 @@ class ResourceLogic extends Logic try { Resource::create([ 'cid' => $post['cid'], - 'cid2' => $post['cid2'], + 'cid2' => $post['cid2'] ?? 0 , 'title' => $post['title'], 'image' => $post['image'] ?? '', 'path' => $post['path'] ?? '', @@ -113,7 +113,8 @@ class ResourceLogic extends Logic 'likes' => 0, 'download' => 0, 'sort' => $post['sort'] ?? 0, - 'is_show' => $post['is_show'] + 'is_show' => $post['is_show'], + 'base_visit' => $post['base_visit']?? rand(500,1000), ]); return true; @@ -134,7 +135,7 @@ class ResourceLogic extends Logic try { Resource::update([ 'cid' => $post['cid'], - 'cid2' => $post['cid2'], + 'cid2' => $post['cid2'] ?? 0 , 'title' => $post['title'], 'image' => $post['image'] ?? '', 'path' => $post['path'] ?? '', @@ -149,7 +150,8 @@ class ResourceLogic extends Logic 'likes' => 0, 'download' => 0, 'sort' => $post['sort'] ?? 0, - 'is_show' => $post['is_show'] + 'is_show' => $post['is_show'], + 'base_visit' => $post['base_visit']?? rand(500,1000), ], ['id'=>$post['id']]); return true; diff --git a/app/admin/logic/user/ShipLogLogic.php b/app/admin/logic/user/ShipLogLogic.php index ea080a9..9749582 100644 --- a/app/admin/logic/user/ShipLogLogic.php +++ b/app/admin/logic/user/ShipLogLogic.php @@ -8,6 +8,7 @@ use app\common\model\order\OrderUser; use app\common\model\user\UserShip; use app\common\model\user\UserTag; use app\common\model\user\User; +use app\common\server\UrlServer; class ShipLogLogic extends Logic { @@ -61,12 +62,13 @@ class ShipLogLogic extends Logic ->alias('a') ->join('user b','a.user_id=b.id','LEFT') ->join('user_ship c','a.org_id=c.id','LEFT') - ->page($get['page'], $get['limit'])->select()->toArray(); + ->page($get['page'], $get['limit'])->order('id','desc')->select()->toArray(); $count = $orderuser ->alias('a')->alias('a') ->join('user b','a.user_id=b.id','LEFT')->where($where)->count(); foreach ($lists as &$item){ + $item['avatar'] = $item['avatar'] ? UrlServer::getFileUrl($item['avatar']) : ''; $item['pay_time_str'] = date("Y-m-d H:i:s",$item['pay_time']); $item['type_name'] = $item['type']==0?'免费':'付费'; $item['order_source_name'] = $order_source[$item['order_source']]; diff --git a/app/admin/view/content/resource/add.html b/app/admin/view/content/resource/add.html index b0e14c0..32ca91e 100644 --- a/app/admin/view/content/resource/add.html +++ b/app/admin/view/content/resource/add.html @@ -86,7 +86,7 @@
-
@@ -172,6 +172,12 @@
+ +
+ +
+
+
diff --git a/app/admin/view/content/resource/edit.html b/app/admin/view/content/resource/edit.html index acd22ea..332c392 100644 --- a/app/admin/view/content/resource/edit.html +++ b/app/admin/view/content/resource/edit.html @@ -86,7 +86,7 @@
- {volist name="category2" id="vo"} @@ -197,6 +197,15 @@
+ +
+ +
+ +
+
+ +
diff --git a/app/admin/view/content/resource_category/add.html b/app/admin/view/content/resource_category/add.html index 0ae64c6..4ec681d 100644 --- a/app/admin/view/content/resource_category/add.html +++ b/app/admin/view/content/resource_category/add.html @@ -4,8 +4,8 @@
- + {volist name="category" id="vo"} {/volist} diff --git a/app/admin/view/content/resource_category/edit.html b/app/admin/view/content/resource_category/edit.html index e3380a3..b872abe 100644 --- a/app/admin/view/content/resource_category/edit.html +++ b/app/admin/view/content/resource_category/edit.html @@ -4,8 +4,8 @@
- + {volist name="category" id="vo"} {/volist} diff --git a/app/api/controller/Community.php b/app/api/controller/Community.php index d151abe..e44bf57 100644 --- a/app/api/controller/Community.php +++ b/app/api/controller/Community.php @@ -95,7 +95,8 @@ class Community extends Api public function cate() { $get = $this->request->get(); - $type = ''; + $type = 99; + if(isset($get['type'])){ $type = intval($get['type']); } diff --git a/app/api/logic/CommunityLogic.php b/app/api/logic/CommunityLogic.php index 13a50ce..108225f 100644 --- a/app/api/logic/CommunityLogic.php +++ b/app/api/logic/CommunityLogic.php @@ -222,7 +222,7 @@ class CommunityLogic extends Logic public static function getCate($type='') { $where = ['is_show' => 1, 'del' => 0]; - if($type!='' || $type==0){ + if($type!=''){ $where['type'] = $type; } $lists = CommunityCategory::field(['id', 'name','type']) @@ -500,7 +500,9 @@ class CommunityLogic extends Logic $result['city_id'], ]):''; - + $contact = $result['contact']; + $result['contact'] = $result['contact_name']; + $result['contact_name'] = $contact; return $result; } diff --git a/app/api/logic/ResourceLogic.php b/app/api/logic/ResourceLogic.php index 0affeee..a594780 100644 --- a/app/api/logic/ResourceLogic.php +++ b/app/api/logic/ResourceLogic.php @@ -38,6 +38,8 @@ class ResourceLogic extends Logic if(isset($get['pid']) ){ $where[] = ['pid','=',$get['pid']]; + }else{ + $where[] = ['pid','=',0]; } return $model->field(['id', 'name']) @@ -51,6 +53,7 @@ class ResourceLogic extends Logic } } + /** * @Notes: 文章列表 * @Author: 张无忌 @@ -73,6 +76,7 @@ class ResourceLogic extends Logic $where[] = ['a.title', 'like', "%".$get['keyword']."%"]; } + if(isset($get['cid']) && !empty($get['cid']) && $get['cid']>0 && !strstr($get['cid'],"city_") ) { $where[] = ['cid', '=', $get['cid']]; } @@ -109,7 +113,7 @@ class ResourceLogic extends Logic $list = $model->alias('a') ->join('resource_category c', 'c.id = a.cid') - ->field(['a.id', 'a.title', 'a.image', 'a.visit', 'a.likes','a.intro', 'a.content', 'a.create_time','a.price','a.type','a.province_id','a.city_id','a.district_id']) + ->field(['a.id', 'a.title', 'a.image', 'a.base_visit','a.visit', 'a.likes','a.intro', 'a.content', 'a.create_time','a.price','a.type','a.province_id','a.city_id','a.district_id']) ->where($where) ->order($order) ->page($get['page_no'], $get['page_size']) @@ -117,6 +121,7 @@ class ResourceLogic extends Logic ->toArray(); foreach ($list as &$item){ $item['price_str'] = $item['type']==0? "免费":($item['type']==1?"VIP会员免费":round($item['price'],2)); + $item['visit'] = $item['visit'] +$item['base_visit'] ; } @@ -136,7 +141,7 @@ class ResourceLogic extends Logic $list = $model->alias('b') ->join('resource a', 'b.resource_id = a.id') ->join('resource_category c', 'c.id = a.cid') - ->field(['a.id', 'a.title', 'a.image', 'a.visit', 'a.likes','a.intro', 'a.content', 'a.create_time','a.price','a.type','a.province_id','a.city_id','a.district_id']) + ->field(['a.id', 'a.title', 'a.image','a.image', 'a.visit', 'a.likes','a.intro', 'a.content', 'a.create_time','a.price','a.type','a.province_id','a.city_id','a.district_id']) ->where($where) ->order($order) ->page($get['page_no'], $get['page_size']) @@ -206,6 +211,7 @@ class ResourceLogic extends Logic $pattern = '/]+href=["\'](.*?\.(?:mp4|wav))["\'][^>]*>(.*?)<\/a>/i'; $replacement = ''; $article['content'] = preg_replace($pattern, $replacement, $article['content']); + $article['visit'] = $article['visit'] +$article['base_visit'] ; } return $article; diff --git a/app/api/logic/UserLogic.php b/app/api/logic/UserLogic.php index 2a33aa6..eebcf49 100644 --- a/app/api/logic/UserLogic.php +++ b/app/api/logic/UserLogic.php @@ -685,7 +685,7 @@ class UserLogic extends Logic if(($shipId && $exTime==0) || $day==0){ $time = ['time'=>'永久会员']; }else{ - if(!$shipId){ + if(!$shipId || $exTimedate('Y-m-d',strtotime("+".$day." day"))]; }else{ $time = ['time'=>date('Y-m-d',intval($exTime)+intval($day)*3600*24)];