diff --git a/app/admin/controller/content/ResourceLog.php b/app/admin/controller/content/ResourceLog.php new file mode 100644 index 0000000..e3d178e --- /dev/null +++ b/app/admin/controller/content/ResourceLog.php @@ -0,0 +1,63 @@ +request->isAjax()) { + $get = $this->request->get(); + $lists = ResourceLogLogic::lists($get); + return JsonServer::success("获取成功", $lists); + } + + // 订单来源 + $order_source = Client_::getClient(true); + // 支付方式 + $pay_way = PayEnum::getPayWay(true); + return view('', [ + 'order_source' => $order_source, + 'pay_way' => $pay_way, + ]); + } + + + /** + * @NOTES: 删除帮助分类 + * @author: 张无忌 + */ + public function del() + { + if ($this->request->isAjax()) { +// (new HelpValidate())->goCheck('id'); + $id = $this->request->post('id'); + $res = ResourceLogLogic::del($id); + if ($res === false) { + $error = ResourceLogLogic::getError() ?: '删除失败'; + return JsonServer::error($error); + } + return JsonServer::success('删除成功'); + } + + return JsonServer::error('异常'); + } + +} \ No newline at end of file diff --git a/app/admin/controller/content/UserResource.php b/app/admin/controller/content/UserResource.php new file mode 100644 index 0000000..3774a1f --- /dev/null +++ b/app/admin/controller/content/UserResource.php @@ -0,0 +1,38 @@ +request->isAjax()) { + $get = $this->request->get(); + $lists = ResourceDownloadLogic::lists($get); + return JsonServer::success("获取成功", $lists); + } + return view('',[ + 'category' => ResourceCategoryLogic::getCategory() + ]); + } + + +} \ No newline at end of file diff --git a/app/admin/controller/user/ShipLog.php b/app/admin/controller/user/ShipLog.php new file mode 100644 index 0000000..a2932f6 --- /dev/null +++ b/app/admin/controller/user/ShipLog.php @@ -0,0 +1,47 @@ +request->isAjax()){ + $get = $this->request->get(); + $lists = ShipLogLogic::lists($get); + return JsonServer::success('', $lists); + } + // 订单来源 + $order_source = Client_::getClient(true); + // 支付方式 + $pay_way = PayEnum::getPayWay(true); + return view('', [ + 'order_source' => $order_source, + 'pay_way' => $pay_way, + ]); + } + + public function del() + { + $id = $this->request->post('id', '', 'intval'); + $result = ShipLogLogic::del($id); + if($result === true) { + return JsonServer::success('删除成功'); + } + return JsonServer::error(ShipLogLogic::getError()); + } + +} \ No newline at end of file diff --git a/app/admin/logic/content/ResourceDownloadLogic.php b/app/admin/logic/content/ResourceDownloadLogic.php new file mode 100644 index 0000000..17086c4 --- /dev/null +++ b/app/admin/logic/content/ResourceDownloadLogic.php @@ -0,0 +1,69 @@ +field('c.*,a.create_time as download_time,b.nickname,b.avatar,b.mobile,d.name as cname') + ->alias('a') + ->join('user b','a.user_id=b.id','LEFT') + ->join('resource c','a.resource_id=c.id','LEFT') + ->join('resource_category d','c.cid=d.id','LEFT') + ->where($where) + ->order('a.create_time', 'desc') + ->paginate([ + 'page' => $get['page'], + 'list_rows' => $get['limit'], + 'var_page' => 'page' + ]) + ->toArray(); + + foreach ($lists['data'] as &$item) { + $item['category'] = $item['cname'] ?? '未知'; + $item['is_show'] = $item['is_show'] ? '显示' : '隐藏'; + $item['path'] = $item['path']?UrlServer::getFileUrl($item['path']):''; + $item['path_name']= $item['path']?substr($item['path'],strrpos($item['path'],"/")+1):''; + $item['address'] = $item['province_id']?AreaServer::getAddress([ + $item['province_id'], + $item['city_id'], + $item['district_id']]):''; + + } + + return ['count'=>$lists['total'], 'lists'=>$lists['data']]; + } catch (Exception $e) { + return ['error'=>$e->getMessage()]; + } + } + +} \ No newline at end of file diff --git a/app/admin/logic/content/ResourceLogLogic.php b/app/admin/logic/content/ResourceLogLogic.php new file mode 100644 index 0000000..73db17c --- /dev/null +++ b/app/admin/logic/content/ResourceLogLogic.php @@ -0,0 +1,101 @@ +=', strtotime($get['start_time'])]; + } + + if (isset($get['end_time']) && $get['end_time'] != '') { + $where[] = ['a.create_time', '<=', strtotime($get['end_time'])]; + } + $orderuser = new OrderResource(); + + + $lists = $orderuser + ->where($where) + ->field("a.*,b.nickname,b.avatar,b.mobile,c.title as resource_name") + ->alias('a') + ->join('user b','a.user_id=b.id','LEFT') + ->join('resource c','a.org_id=c.id','LEFT') + ->page($get['page'], $get['limit'])->order('a.create_time 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['pay_time_str'] = $item['pay_time']>0?date("Y-m-d H:i:s",$item['pay_time']):'--'; + $item['pay_status_str'] = $item['pay_status']==0?'未支付':'已支付'; + $item['order_source_name'] = $order_source[$item['order_source']]; + $item['pay_way_name'] = $item['pay_way']==0?'无':$pay_way[$item['pay_way']]; + } + return [ + 'lists' => $lists, + 'count' => $count + ]; + } + + public static function del($id) + { + try{ + $data = [ + 'id' => $id, + 'update_time' => time(), + 'del' => 1 + ]; + UserShip::update($data); + return true; + }catch(\Exception $e){ + self::$error = $e->getMessage(); + return false; + } + } + +} \ No newline at end of file diff --git a/app/admin/logic/user/ShipLogLogic.php b/app/admin/logic/user/ShipLogLogic.php new file mode 100644 index 0000000..ea080a9 --- /dev/null +++ b/app/admin/logic/user/ShipLogLogic.php @@ -0,0 +1,99 @@ +=', strtotime($get['start_time'])]; + } + + if (isset($get['end_time']) && $get['end_time'] != '') { + $where[] = ['a.create_time', '<=', strtotime($get['end_time'])]; + } + $orderuser = new OrderUser(); + + + $lists = $orderuser + ->where($where) + ->field("a.*,b.nickname,b.avatar,b.mobile,c.title as ship_name") + ->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(); + + + $count = $orderuser ->alias('a')->alias('a') + ->join('user b','a.user_id=b.id','LEFT')->where($where)->count(); + foreach ($lists as &$item){ + $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']]; + $item['pay_way_name'] = $item['pay_way']==0?'无':$pay_way[$item['pay_way']]; + $item['overdue_time_str'] = $item['overdue_time'] == 0?'永久': date("Y-m-d",$item['overdue_time']); + + } + return [ + 'lists' => $lists, + 'count' => $count + ]; + } + + public static function del($id) + { + try{ + $data = [ + 'id' => $id, + 'update_time' => time(), + 'del' => 1 + ]; + UserShip::update($data); + return true; + }catch(\Exception $e){ + self::$error = $e->getMessage(); + return false; + } + } + +} \ No newline at end of file diff --git a/app/admin/view/content/resource_log/lists.html b/app/admin/view/content/resource_log/lists.html new file mode 100644 index 0000000..571b587 --- /dev/null +++ b/app/admin/view/content/resource_log/lists.html @@ -0,0 +1,304 @@ +{layout name="layout1" /} +
+
+
+ +
+
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+
+
+ +
+
+ +
+ +
+ + + + + +
+
+ +
+ +
+
+ + + \ No newline at end of file diff --git a/app/admin/view/content/user_resource/lists.html b/app/admin/view/content/user_resource/lists.html new file mode 100644 index 0000000..6f04829 --- /dev/null +++ b/app/admin/view/content/user_resource/lists.html @@ -0,0 +1,237 @@ +{layout name="layout1" /} + +
+
+ +
+
+
+ +
+

*平台的资料中心。用户可在商城的下载查看。

+

*排序值越小越前,排序值相同时新增在前。

+
+
+
+
+ + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ 搜索 + 重置 +
+
+
+ + +
+ +
+ + + + + + +
+ +
+
+ + \ No newline at end of file diff --git a/app/admin/view/user/ship_log/lists.html b/app/admin/view/user/ship_log/lists.html new file mode 100644 index 0000000..7ebba30 --- /dev/null +++ b/app/admin/view/user/ship_log/lists.html @@ -0,0 +1,297 @@ +{layout name="layout1" /} +
+
+
+ +
+
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+
+
+ +
+
+ +
+ +
+ + + + + +
+
+ +
+ +
+
+ + + \ No newline at end of file diff --git a/app/api/controller/Resource.php b/app/api/controller/Resource.php index 9346a7e..9e02c07 100644 --- a/app/api/controller/Resource.php +++ b/app/api/controller/Resource.php @@ -33,7 +33,7 @@ class Resource extends Api $get = $this->request->get(); $get['page_no'] = $this->page_no; $get['page_size'] = $this->page_size; - $lists = ResourceLogic::lists($get); + $lists = ResourceLogic::lists($get,$this->user_id); return JsonServer::success('获取成功', $lists); } diff --git a/app/api/logic/OrderLogic.php b/app/api/logic/OrderLogic.php index 47e3342..ebbc6f1 100644 --- a/app/api/logic/OrderLogic.php +++ b/app/api/logic/OrderLogic.php @@ -828,7 +828,7 @@ class OrderLogic extends Logic $order_data['trade_id'] = $order_trade_create->id; $order_data['user_id'] = $post['user_id']; $order_data['order_sn'] = createSn('order_trade', 't_sn'); - $order_data['order_type'] = 0; + $order_data['type'] = 0; $order_data['org_id'] = $post['org_id']; $order_data['order_source'] = $post['client']; $order_data['order_status'] = 3; @@ -914,7 +914,7 @@ class OrderLogic extends Logic $order_data['trade_id'] = $order_trade_create->id; $order_data['user_id'] = $post['user_id']; $order_data['order_sn'] = createSn('order_trade', 't_sn'); - $order_data['order_type'] = 1; + $order_data['type'] = 1; $order_data['org_id'] = $post['org_id']; $order_data['order_source'] = $post['client']; $order_data['order_status'] = OrderEnum::ORDER_STATUS_NO_PAID; diff --git a/app/api/logic/ResourceLogic.php b/app/api/logic/ResourceLogic.php index 477fb0e..bdc3619 100644 --- a/app/api/logic/ResourceLogic.php +++ b/app/api/logic/ResourceLogic.php @@ -44,47 +44,75 @@ class ResourceLogic extends Logic * @param $get * @return array */ - public static function lists($get) + public static function lists($get,$user_id=0) { try { - $where = [ - ['a.del', '=', 0], - ['a.is_show', '=', 1], - ['c.del', '=', 0], - ['c.is_show', '=', 1], - ]; - if(isset($get['cid']) && !empty($get['cid']) && $get['cid']>0 && !strstr($get['cid'],"city_")) { - $where[] = ['cid', '=', $get['cid']]; - } + if(!isset($get['cid']) || !strstr($get['cid'],"my")){ + $where = [ + ['a.del', '=', 0], + ['a.is_show', '=', 1], + ['c.del', '=', 0], + ['c.is_show', '=', 1], + ]; + + if(isset($get['cid']) && !empty($get['cid']) && $get['cid']>0 && !strstr($get['cid'],"city_") ) { + $where[] = ['cid', '=', $get['cid']]; + } - if(isset($get['cid']) && !empty($get['cid']) && strstr($get['cid'],"city_") ) { - $where[] = ['a.city_id', '=', str_replace("city_","",$get['cid'])]; - } + if(isset($get['cid']) && !empty($get['cid']) && strstr($get['cid'],"city_") ) { + $where[] = ['a.city_id', '=', str_replace("city_","",$get['cid'])]; + } - $order = [ - 'sort' => 'asc', - 'id' => 'desc' - ]; + $order = [ + 'sort' => 'asc', + 'id' => 'desc' + ]; - $model = new Resource(); + $model = new Resource(); - $count = $model->alias('a')->join('resource_category c', 'c.id = a.cid')->where($where)->count(); + $count = $model->alias('a')->join('resource_category c', 'c.id = a.cid')->where($where)->count(); - $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']) - ->where($where) - ->order($order) - ->page($get['page_no'], $get['page_size']) - ->select() - ->toArray(); - foreach ($list as &$item){ - $item['price_str'] = $item['type']==0? "免费":($item['type']==1?"VIP会员免费":round($item['price'],2)); - } + $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']) + ->where($where) + ->order($order) + ->page($get['page_no'], $get['page_size']) + ->select() + ->toArray(); + foreach ($list as &$item){ + $item['price_str'] = $item['type']==0? "免费":($item['type']==1?"VIP会员免费":round($item['price'],2)); + } - $more = is_more($count, $get['page_no'], $get['page_size']); + }else{ + $where = [ + ['b.user_id', '=', $user_id], + ['b.type', '=', $get['cid']=='my_buy'?1:0], + ]; + $order = [ + 'create_time' => 'desc' + ]; + + $model = new UserResource(); + + $count = $model->alias('b')->join('resource a', 'b.resource_id = a.id')->join('resource_category c', 'c.id = a.cid')->where($where)->count(); + + $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']) + ->where($where) + ->order($order) + ->page($get['page_no'], $get['page_size']) + ->select() + ->toArray(); + foreach ($list as &$item){ + $item['price_str'] = $item['type']==0? "免费":($item['type']==1?"VIP会员免费":round($item['price'],2)); + } + } + $more = is_more($count, $get['page_no'], $get['page_size']); $data = [ 'list' => $list, 'page_no' => $get['page_no'], diff --git a/runtime/cache/9f/d2f37875d1da637002182ec566f162.php b/runtime/cache/9f/d2f37875d1da637002182ec566f162.php index 8d3bb62..ba9ba15 100644 --- a/runtime/cache/9f/d2f37875d1da637002182ec566f162.php +++ b/runtime/cache/9f/d2f37875d1da637002182ec566f162.php @@ -1,4 +1,4 @@ -a:5:{i:0;s:75:"D:\waibao\ahbcqz\server\runtime\cache\1e\9273b3315671b45227b5827559a179.php";i:1;s:75:"D:\waibao\ahbcqz\server\runtime\cache\a1\55016152d5af019afbbfd20daf7335.php";i:2;s:75:"D:\waibao\ahbcqz\server\runtime\cache\c0\cf484f10720659d936916d74e6362a.php";i:3;s:75:"E:\waibao\ahbcqz\server\runtime\cache\35\4c90d26061baaa2f7a972849339da3.php";i:4;s:75:"E:\waibao\ahbcqz\server\runtime\cache\64\80bd487ac5e230fd1fb2d74457b697.php";} \ No newline at end of file +a:6:{i:0;s:75:"D:\waibao\ahbcqz\server\runtime\cache\1e\9273b3315671b45227b5827559a179.php";i:1;s:75:"D:\waibao\ahbcqz\server\runtime\cache\a1\55016152d5af019afbbfd20daf7335.php";i:2;s:75:"D:\waibao\ahbcqz\server\runtime\cache\c0\cf484f10720659d936916d74e6362a.php";i:3;s:75:"E:\waibao\ahbcqz\server\runtime\cache\35\4c90d26061baaa2f7a972849339da3.php";i:4;s:75:"E:\waibao\ahbcqz\server\runtime\cache\64\80bd487ac5e230fd1fb2d74457b697.php";i:5;s:75:"E:\waibao\ahbcqz\server\runtime\cache\11\e63c5fed23ed0b72e5c3d85dccdf6a.php";} \ No newline at end of file