request = $request; // 记录请求api路径 // Log::recod($this->request->url()); } /** * 测试文件 * */ public function test() { } /** * * 促销产品 * */ public function discountsGoods() { $num = 10; $areaId = null; // 是否获取区域信息 if($this->request->param('areaId')) { $query->where('area_id', $areaId); } // 获取商品数据 $product = StoreProductModel::where('is_show', 1) ->where('is_benefit', 1) ->field('product_id, store_name, ot_price, price, cost') ->select(); $this->apiSuccess('获取成功', $product); } /** * * 交易趋势 * */ public function trendtrading() { $num = 10; $areaId = null; // 是否获取区域信息 if($this->request->param('areaId')) { $query->where('area_id', $areaId); } // 获取商品订单日志->订单快照 $productOrderLog = ProductOrderLogModel::where('status', 1) ->fieldRaw("SUM(total_price) as month_price, month(create_time) as months") ->group('months') ->select(); $this->apiSuccess('获取成功', $productOrderLog); } /** * * 热销农副产品 * */ public function sellLikeGoods() { $num = 10; $areaId = null; // 是否获取区域信息 if($this->request->param('areaId')) { $query->where('area_id', $areaId); } // 获取商品数据 $product = StoreProductModel::where('is_show', 1) ->where('is_hot', 1) ->field('product_id, store_name, ot_price, price, cost') ->select(); $this->apiSuccess('获取成功', $product); } /** * * 区域负责人信息获取控制器 * num 获取数量 默认为10条 * areaId 区域ID 默认为null 获取全部 * AreaManagerModel 隐形路由绑定 * */ public function arealist(AreaManagerModel $query) { $num = 10; $areaId = null; // 是否获取区域负责人信息 if($this->request->param('areaId')) { $query->where('area_id', $areaId); } // 判断是否获取数量 if($this->request->param('number') != 10) { $query->limit($num); } $this->apiSuccess('获取成功', $query->select()); } /** * * 实时直播 * */ public function realTimeLive() { $num = 10; $areaId = null; // 是否获取区域信息 if($this->request->param('areaId')) { $query->where('area_id', $areaId); } // 推流地址 $live = [ 'rtmp' => 'rtmp://pull.aliyunlive.com/live/0000?auth_key={鉴权串}', 'flv' => 'http://pull.aliyunlive.com/live/0000.flv?auth_key={鉴权串}', 'm3u8' => 'http://pull.aliyunlive.com/live/0000.m3u8?auth_key={鉴权串}', 'rts' => 'artc://pull.aliyunlive.com/live/0000?auth_key={鉴权串}', 'mp4' => 'https://nk.lihaink.cn/video/test.mp4' ]; $this->apiSuccess('获取成功', $live); } /** * * 市场人流量 * */ public function bazaarPeopleFlow() { $num = 10; $areaId = null; // 是否获取区域信息 if($this->request->param('areaId')) { $query->where('area_id', $areaId); } $number = rand(1000000, 9999999); // 当前人流量 $yesterDayNumber = rand(3000000, 9999999); // 昨日人流量 // 人浏览预留接口 $visitorsFlow = [ 'number' => $number, // 浏览人流量 'yesterDayNumber' => $yesterDayNumber, // 昨日浏览人流量 ]; $this->apiSuccess('获取成功', $visitorsFlow); } /** * * 实时监控 * */ public function realTimeMonitoring() { $num = 10; $areaId = null; // 是否获取区域信息 if($this->request->param('areaId')) { $query->where('area_id', $areaId); } // 推流地址 $live = [ [ 'rtmp' => 'rtmp://pull.aliyunlive.com/live/0000?auth_key={鉴权串}', 'flv' => 'http://pull.aliyunlive.com/live/0000.flv?auth_key={鉴权串}', 'm3u8' => 'http://pull.aliyunlive.com/live/0000.m3u8?auth_key={鉴权串}', 'rts' => 'artc://pull.aliyunlive.com/live/0000?auth_key={鉴权串}', 'mp4' => 'https://nk.lihaink.cn/video/test.mp4' ], [ 'rtmp' => 'rtmp://pull.aliyunlive.com/live/0000?auth_key={鉴权串}', 'flv' => 'http://pull.aliyunlive.com/live/0000.flv?auth_key={鉴权串}', 'm3u8' => 'http://pull.aliyunlive.com/live/0000.m3u8?auth_key={鉴权串}', 'rts' => 'artc://pull.aliyunlive.com/live/0000?auth_key={鉴权串}', 'mp4' => 'https://nk.lihaink.cn/video/test.mp4' ], [ 'rtmp' => 'rtmp://pull.aliyunlive.com/live/0000?auth_key={鉴权串}', 'flv' => 'http://pull.aliyunlive.com/live/0000.flv?auth_key={鉴权串}', 'm3u8' => 'http://pull.aliyunlive.com/live/0000.m3u8?auth_key={鉴权串}', 'rts' => 'artc://pull.aliyunlive.com/live/0000?auth_key={鉴权串}', 'mp4' => 'https://nk.lihaink.cn/video/test.mp4' ], [ 'rtmp' => 'rtmp://pull.aliyunlive.com/live/0000?auth_key={鉴权串}', 'flv' => 'http://pull.aliyunlive.com/live/0000.flv?auth_key={鉴权串}', 'm3u8' => 'http://pull.aliyunlive.com/live/0000.m3u8?auth_key={鉴权串}', 'rts' => 'artc://pull.aliyunlive.com/live/0000?auth_key={鉴权串}', 'mp4' => 'https://nk.lihaink.cn/video/test.mp4' ], [ 'rtmp' => 'rtmp://pull.aliyunlive.com/live/0000?auth_key={鉴权串}', 'flv' => 'http://pull.aliyunlive.com/live/0000.flv?auth_key={鉴权串}', 'm3u8' => 'http://pull.aliyunlive.com/live/0000.m3u8?auth_key={鉴权串}', 'rts' => 'artc://pull.aliyunlive.com/live/0000?auth_key={鉴权串}', 'mp4' => 'https://nk.lihaink.cn/video/test.mp4' ], ]; $this->apiSuccess('获取成功', $live); } /** * * 镇农副业特色产品 * */ public function featureGoods() { $num = 10; $areaId = null; // 是否获取区域信息 if($this->request->param('areaId')) { $query->where('area_id', $areaId); } // 农产品结构 $agricultureProducts = AgricultureProductsModel::where('status', 1) ->field('title, yield, cycle') ->select(); $this->apiSuccess('获取成功', $agricultureProducts); } /** * * 电视右下角二维码 * */ public function telQrcode() { $this->apiSuccess('获取成功', ['img' => 'https://nk.lihaink.cn/img/ShopQrcode.jpg']); } }