CpBookController.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. <?php
  2. namespace App\Http\Controllers\Manage\Book;
  3. use Illuminate\Http\Request;
  4. use App\Http\Controllers\Controller;
  5. use App\Modules\Book\Models\BookCp;
  6. use App\Modules\Book\Models\BookConfig;
  7. use DB;
  8. use App\Modules\Subscribe\Models\BookOrder;
  9. use Illuminate\Support\Facades\Storage;
  10. class CpBookController extends Controller
  11. {
  12. /**
  13. * @apiDefine BookCP 图书CP模块
  14. */
  15. /**
  16. * @apiVersion 1.0.0
  17. * @apiDescription 获取所有cp
  18. * @api {get} bookcp/getAllCp 获取所有cp
  19. * @apiGroup BookCP
  20. * @apiName getAllCp
  21. * @apiSuccess {int} code 态码
  22. * @apiSuccess {String} msg 信息
  23. * @apiSuccess {object} data 结果集
  24. * @apiSuccessExample {json} Success-Response:
  25. * HTTP/1.1 200 OK
  26. * {
  27. * code: 0,
  28. * msg: "",
  29. * data: [
  30. * "quyuewang",
  31. * "tianya",
  32. * "zhongtian",
  33. * "ycsd",
  34. * "zhizihuan",
  35. * "timeread",
  36. * "shuhai",
  37. * ]
  38. * }
  39. */
  40. public function getAllCp(){
  41. $cps = BookCp::select('cp')->get()->pluck('cp');
  42. return response()->success($cps);
  43. }
  44. /**
  45. * @apiVersion 1.0.0
  46. * @apiDescription cp统计数据
  47. * @api {get} bookcp/cpTotal cp统计数据
  48. * @apiGroup BookCP
  49. * @apiName cpTotal
  50. * @apiParam {String} cp cp名称
  51. * @apiParam {String} [export] 要导出需要传值等于1
  52. * @apiSuccess {int} code 态码
  53. * @apiSuccess {String} msg 信息
  54. * @apiSuccess {object} data 结果集
  55. * @apiSuccess {object} data.cp_source cp名称
  56. * @apiSuccess {object} data.count 图书数量
  57. * @apiSuccess {object} data.bids bids(每日数据需要传递的参数)
  58. * @apiSuccess {object} data.yesterday 昨日订阅量
  59. * @apiSuccess {object} data.month 本月订阅量
  60. * @apiSuccess {object} data.prev_month 上月订阅量
  61. * @apiSuccess {object} data.today 上月订阅量
  62. * @apiSuccessExample {json} Success-Response:
  63. * HTTP/1.1 200 OK
  64. * {
  65. * code: 0,
  66. * msg: "",
  67. * data: [
  68. * {
  69. * cp_source: "17k",
  70. * bids: "21,22,582,583,584,591,612,629,634,635,637,638,639,641,642,843,844",
  71. * count: 17,
  72. * yesterday: "68194",
  73. * month: "660188",
  74. * prev_month: "55172"
  75. * }
  76. * ]
  77. * }
  78. */
  79. public function cpTotal2(Request $request){
  80. $cp = $request->input('cp');
  81. $res = BookConfig::select('cp_source',DB::raw('GROUP_CONCAT(bid) as bids'),DB::raw('count(*) as count'))->where('cp_source','!=','');
  82. if($cp){
  83. $res = $res->where('cp_source','like','%'.$cp.'%');
  84. }
  85. $res = $res->groupBy('cp_source')->get();
  86. //return $res;
  87. $yesterday = date('Y-m-d',time()-86400);
  88. $today = date('Y-m-d');
  89. $tomorrow = date('Y-m-d',time()+86400);
  90. $month = date('Y-m').'-01';
  91. $prev_month = date('Y-m',strtotime('-1 month')).'-01';
  92. $next_month = date('Y-m',strtotime('+1 month')).'-01';
  93. //echo $next_month;
  94. $sql = '(select ifnull(sum(fee),0) as %s from chapter_order_total where bid in (%s) and day BETWEEN "%s" and "%s") %s';
  95. $book_sql = '(select ifnull(sum(fee),0) as %s from book_orders where bid in (%s) and created_at BETWEEN "%s" and "%s") %s';
  96. //BookOrder::join('book_config','book_orders.bid','=','book_config.bid')->select()->get();
  97. foreach ($res as &$v){
  98. $yesterday_sql = sprintf($sql,'yesterday',$v->bids,$yesterday,$today,'a');
  99. $month_sql = sprintf($sql,'month',$v->bids,$month,$next_month,'b');
  100. $prev_month_sql = sprintf($sql,'prev_month',$v->bids,$prev_month,$month,'c');
  101. $total_sql = 'select * from ('.$yesterday_sql.' join '.$month_sql.' join '.$prev_month_sql.')';
  102. $temp_res = DB::connection('chapter_order_mysql')->select($total_sql);
  103. $book_yesterday_sql = sprintf($book_sql,'yesterday',$v->bids,$yesterday,$today,'a');
  104. $book_month_sql = sprintf($book_sql,'month',$v->bids,$month,$next_month,'b');
  105. $book_prev_month_sql = sprintf($book_sql,'prev_month',$v->bids,$prev_month,$month,'c');
  106. $book_total_sql = 'select * from ('.$book_yesterday_sql.' join '.$book_month_sql.' join '.$book_prev_month_sql.')';
  107. $book_temp_res = DB::select($book_total_sql);
  108. $v->yesterday = (int)$book_temp_res[0]->yesterday+(int)$temp_res[0]->yesterday;
  109. $v->month = (int)$book_temp_res[0]->month+(int)$temp_res[0]->month;
  110. $v->prev_month = (int)$book_temp_res[0]->prev_month+(int)$temp_res[0]->prev_month;
  111. $v->today = '-';
  112. $temp_res = null;
  113. $total_sql = null;
  114. }
  115. if($request->input('export')){
  116. $filename = 'cptotal'.date('YmdHis').'.csv';
  117. Storage::append($filename,mb_convert_encoding("书籍数量,今日订阅量,昨日订阅量,本月订阅量,上月订阅量",'gbk'));
  118. $str = '';
  119. foreach ($res as $val){
  120. $str .= "{$val->count},{$val->today},{$val->yesterday},{$val->month},{$val->prev_month}\r\n";
  121. }
  122. Storage::append($filename,mb_convert_encoding($str,'gbk'));
  123. return response()->download(storage_path('app/'.$filename))->deleteFileAfterSend(true);
  124. }
  125. return response()->success($res);
  126. }
  127. public function cpTotal(Request $request){
  128. $cp = $request->input('cp');
  129. $sql_format = '
  130. SELECT "-" as today,a.bids,a.cp_source,a.count,a.yesterday,a.yesterday_charge_balance,a.yesterday_reward_balance,b.`month`,b.month_charge_balance,b.month_reward_balance,c.prev_month,c.prev_month_charge_balance,c.prev_month_reward_balance from(
  131. (SELECT SUM(a.fee) as yesterday,sum(reward_balance) as yesterday_reward_balance,sum(charge_balance) as yesterday_charge_balance,b.cp_source,count(*) as `count`,GROUP_CONCAT(b.bid) as bids from book_order_statistical a join book_configs b on a.bid=b.bid where a.`day` = "%s" and %s GROUP BY b.cp_source) a
  132. join
  133. (SELECT SUM(a.fee)as `month`,sum(reward_balance) as month_reward_balance,sum(charge_balance) as month_charge_balance,b.cp_source from book_order_statistical a join book_configs b on a.bid=b.bid where a.`day` >= "%s" and a.`day` < "%s" and %s GROUP BY b.cp_source) b
  134. on a.cp_source = b.cp_source
  135. JOIN (
  136. SELECT SUM(a.fee) as prev_month,sum(reward_balance) as prev_month_reward_balance,sum(charge_balance) as prev_month_charge_balance,b.cp_source from book_order_statistical a join book_configs b on a.bid=b.bid where a.`day` >= "%s" and a.`day`< "%s" and %s GROUP BY b.cp_source
  137. ) c on a.cp_source = c.cp_source
  138. )
  139. ';
  140. $yesterday = date('Y-m-d',time()-86400);
  141. $today = date('Y-m-d');
  142. $tomorrow = date('Y-m-d',time()+86400);
  143. $month = date('Y-m').'-01';
  144. $now_month = date('n');
  145. if($now_month == 1){
  146. $year = date('Y');
  147. $prev_month = ($year-1).'-12-01';
  148. }else{
  149. $year = date('Y');
  150. $prev_month = ($year).'-'.($now_month-1).'-01';
  151. }
  152. //$prev_month = date('Y-m',strtotime('-1 month')).'-01';
  153. $next_month = date('Y-m',strtotime('+1 month')).'-01';
  154. if($cp){
  155. $where = 'b.cp_source like '.'"%'.$cp.'%"';
  156. }else{
  157. $where = '1=1';
  158. }
  159. $sql = sprintf($sql_format,$yesterday,$where,$month,$next_month,$where,$prev_month,$month,$where);
  160. $res = DB::select($sql);
  161. if($request->input('export')){
  162. $filename = 'cptotal'.date('YmdHis').'.csv';
  163. Storage::append($filename,mb_convert_encoding("书籍数量,今日订阅量,昨日订阅量,昨日订阅量充值币,昨日订阅量赠送币,本月订阅量,本月订阅量充值币,本月订阅量赠送币,上月订阅量,上月订阅量充值币,上月订阅量赠送币",'gbk'));
  164. $str = '';
  165. foreach ($res as $val){
  166. $str .= "{$val->count},{$val->today},
  167. {$val->yesterday},{$val->yesterday_charge_balance},{$val->yesterday_reward_balance},
  168. {$val->month},{$val->month_charge_balance},{$val->month_reward_balance},
  169. {$val->prev_month},{$val->prev_month_charge_balance},{$val->prev_month_reward_balance}\r\n";
  170. }
  171. Storage::append($filename,mb_convert_encoding($str,'gbk'));
  172. return response()->download(storage_path('app/'.$filename))->deleteFileAfterSend(true);
  173. }
  174. return response()->success($res);
  175. }
  176. /**
  177. * @apiVersion 1.0.0
  178. * @apiDescription cp每日数据
  179. * @api {get} bookcp/everyDayCpTotal cp每日数据
  180. * @apiGroup BookCP
  181. * @apiName everyDayCpTotal
  182. * @apiParam {String} cp cp名称
  183. * @apiParam {String} bids bids(cp统计数据返回的bids)
  184. * @apiParam {String} [export] 要导出需要传值等于1
  185. * @apiParam {String} page 页码
  186. * @apiParam {String} pagesize 每页数据
  187. * @apiSuccess {int} code 态码
  188. * @apiSuccess {String} msg 信息
  189. * @apiSuccess {object} data 结果集
  190. * @apiSuccess {object} data.list.fee 订阅量
  191. * @apiSuccess {object} data.list.day 图书数量量
  192. * @apiSuccess {object} data.meta.last_page 最后意一页
  193. * @apiSuccess {object} data.meta.current_page 当前页
  194. * @apiSuccessExample {json} Success-Response:
  195. * HTTP/1.1 200 OK
  196. * {
  197. * code: 0,
  198. * msg: "",
  199. * data: {
  200. * list:[
  201. * {
  202. * fee: "96",
  203. * day: "2017-12-21"
  204. * },
  205. * {
  206. * fee: "1262",
  207. * day: "2017-12-22"
  208. * },
  209. * {
  210. * fee: "382",
  211. * day: "2017-12-24"
  212. * },
  213. * ],
  214. * meta{
  215. * last_page:3,
  216. * current_page:1
  217. * }
  218. * }
  219. * }
  220. */
  221. public function everyDayCpTotal(Request $request){
  222. $cp = $request->input('cp');
  223. $bids = $request->input('bids');
  224. $page = (int)$request->input('page',1);
  225. $pagesize = (int)$request->input('pagesize',15);
  226. $start = ($page-1)*$pagesize;
  227. $sql = 'select sum(fee) as fee,`day` from chapter_order_total where bid in ('.$bids.') group by `day` limit '.$start.','.$pagesize;
  228. $count_sql = 'select count(*) as count from (select sum(fee) as fee,`day` from chapter_order_total where bid in ('.$bids.') group by `day`) a';
  229. if($request->input('export')){
  230. $book_order_bids = $this->getBookOrderBid();
  231. $this_book_bid = array_intersect($book_order_bids,explode(',',$bids));
  232. $sqls = 'select sum(fee) as fee,`day` from chapter_order_total where bid in ('.$bids.') group by `day`';
  233. $res = DB::connection('chapter_order_mysql')->select($sqls);
  234. if($this_book_bid){
  235. $book_order_res = BookOrder::whereIn('bid',$this_book_bid)
  236. ->select(DB::raw('date(created_at) as day'),DB::raw('sum(fee) as fee'))
  237. ->groupBy(DB::raw('date(created_at)'))
  238. ->get();
  239. foreach ($res as &$v){
  240. foreach ($book_order_res as $value){
  241. if($v->day == $value->day){
  242. $v->fee = $v->fee+$value->fee;
  243. }
  244. continue;
  245. }
  246. }
  247. }
  248. $filename = 'cptotal'.date('YmdHis').'.csv';
  249. Storage::append($filename,mb_convert_encoding("日期,订阅量",'gbk'));
  250. $str = '';
  251. foreach ($res as $val){
  252. $str .= "{$val->day},{$val->fee}\r\n";
  253. }
  254. Storage::append($filename,mb_convert_encoding($str,'gbk'));
  255. return response()->download(storage_path('app/'.$filename))->deleteFileAfterSend(true);
  256. }
  257. $count = DB::connection('chapter_order_mysql')->select($count_sql);
  258. $res = DB::connection('chapter_order_mysql')->select($sql);
  259. $book_order_bids = $this->getBookOrderBid();
  260. $this_book_bid = array_intersect($book_order_bids,explode(',',$bids));
  261. if($this_book_bid){
  262. $book_order_res = BookOrder::whereIn('bid',$this_book_bid)
  263. ->select(DB::raw('date(created_at) as day'),DB::raw('sum(fee) as fee'))
  264. ->groupBy(DB::raw('date(created_at)'))
  265. ->get();
  266. foreach ($res as &$v){
  267. foreach ($book_order_res as $value){
  268. if($v->day == $value->day){
  269. $v->fee = $v->fee+$value->fee;
  270. }
  271. continue;
  272. }
  273. }
  274. }
  275. $data = [
  276. 'meta'=>['last_page'=>ceil($count[0]->count/$pagesize),'current_page'=>$page],
  277. 'list'=>$res
  278. ];
  279. return response()->success($data);
  280. }
  281. /**
  282. * @apiVersion 1.0.0
  283. * @apiDescription cp图书统计数据
  284. * @api {get} bookcp/bookCpTotal cp图书统计数据
  285. * @apiGroup BookCP
  286. * @apiName bookCpTotal
  287. * @apiParam {String} cp cp名称
  288. * @apiParam {String} [export] 要导出需要传值等于1
  289. * @apiParam {String} bids bids(cp统计数据返回的bids)
  290. * @apiSuccess {int} code 态码
  291. * @apiSuccess {String} msg 信息
  292. * @apiSuccess {object} data 结果集
  293. * @apiSuccess {object} data.book_name 书名
  294. * @apiSuccess {object} data.bid bid
  295. * @apiSuccess {object} data.yesterday 昨日订阅量
  296. * @apiSuccess {object} data.month 本月订阅量
  297. * @apiSuccess {object} data.prev_month 上月订阅量
  298. * @apiSuccess {object} data.today 上月订阅量
  299. * @apiSuccessExample {json} Success-Response:
  300. * HTTP/1.1 200 OK
  301. * {
  302. * code: 0,
  303. * msg: "",
  304. * data: {
  305. * yesterday: "32",
  306. * month: "2762",
  307. * prev_month: "0",
  308. * book_name: "将军在上",
  309. * today: "-",
  310. * bid: "21"
  311. * },
  312. * }
  313. * }
  314. */
  315. public function bookCpTotal(Request $request){
  316. $bids = $request->input('bids');
  317. $yesterday = date('Y-m-d',time()-86400);
  318. $today = date('Y-m-d');
  319. $tomorrow = date('Y-m-d',time()+86400);
  320. $month = date('Y-m').'-01';
  321. $prev_month = date('Y-m',strtotime('-1 month')).'-01';
  322. $next_month = date('Y-m',strtotime('+1 month')).'-01';
  323. $sql_format = '(select ifnull(sum(fee),0) as %s from chapter_order_total where bid = %s and day BETWEEN "%s" and "%s") %s';
  324. $book_sql_format = '(select ifnull(sum(fee),0) as %s from book_orders where bid = %s and date(created_at) BETWEEN "%s" and "%s") %s';
  325. $book_array = explode(',',$bids);
  326. $res = [];
  327. $book_order_bids = $this->getBookOrderBid();
  328. for ($i = 0;$i<count($book_array);$i++ ){
  329. $yesterday_sql = sprintf($sql_format,'yesterday',$book_array[$i],$yesterday,$today,'a');
  330. $month_sql = sprintf($sql_format,'month',$book_array[$i],$month,$next_month,'b');
  331. $prev_month_sql = sprintf($sql_format,'prev_month',$book_array[$i],$prev_month,$month,'c');
  332. $total_sql = 'select * from ('.$yesterday_sql.' join '.$month_sql.' join '.$prev_month_sql.'
  333. join (select book_name from chapter_order_total where bid='.$book_array[$i].' limit 1) d
  334. )';
  335. $temp_res = DB::connection('chapter_order_mysql')->select($total_sql);
  336. if(in_array($book_array[$i],$book_order_bids)){
  337. $book_yesterday_sql = sprintf($book_sql_format,'yesterday',$book_array[$i],$yesterday,$today,'a');
  338. $book_month_sql = sprintf($book_sql_format,'month',$book_array[$i],$month,$next_month,'b');
  339. $book_prev_month_sql = sprintf($book_sql_format,'prev_month',$book_array[$i],$prev_month,$month,'c');
  340. $book_total_sql = 'select * from ('.$book_yesterday_sql.' join '.$book_month_sql.' join '.$book_prev_month_sql.'
  341. join (select book_name from chapter_order_total where bid='.$book_array[$i].' limit 1) d
  342. )';
  343. $book_temp_res = DB::connection('chapter_order_mysql')->select($book_total_sql);
  344. $temp_res[0]->yesterday = $book_temp_res[0]->yesterday;
  345. $temp_res[0]->yesterday = $book_temp_res[0]->month;
  346. $temp_res[0]->yesterday = $book_temp_res[0]->prev_month;
  347. $temp_res[0]->yesterday = $book_temp_res[0]->book_name;
  348. }
  349. $res[$i]['yesterday'] = $temp_res[0]->yesterday;
  350. $res[$i]['month'] = $temp_res[0]->month;
  351. $res[$i]['prev_month'] = $temp_res[0]->prev_month;
  352. $res[$i]['book_name'] = $temp_res[0]->book_name;
  353. $res[$i]['today'] = '-';
  354. $res[$i]['bid'] = $book_array[$i];
  355. $temp_res = null;
  356. }
  357. if($request->input('export')){
  358. $filename = 'cptotal'.date('YmdHis').'.csv';
  359. Storage::append($filename,mb_convert_encoding("书籍ID,书名,今日订阅量,昨日订阅量,本月订阅量,上月订阅量",'gbk'));
  360. $str = '';
  361. foreach ($res as $val){
  362. $str .= "{$val['bid']},{$val['book_name']},{$val['today']},{$val['yesterday']},{$val['month']},{$val['prev_month']}\r\n";
  363. }
  364. Storage::append($filename,mb_convert_encoding($str,'gbk'));
  365. return response()->download(storage_path('app/'.$filename))->deleteFileAfterSend(true);
  366. }
  367. return response()->success($res);
  368. }
  369. /**
  370. * @apiVersion 1.0.0
  371. * @apiDescription cp每本书数据
  372. * @api {get} bookcp/everyBookTotal cp每本书数据
  373. * @apiGroup BookCP
  374. * @apiName everyBookTotal
  375. * @apiParam {String} bid bid
  376. * @apiParam {String} [export] 要导出需要传值等于1
  377. * @apiParam {String} page 页码
  378. * @apiParam {String} pagesize 每页数据
  379. * @apiSuccess {int} code 态码
  380. * @apiSuccess {String} msg 信息
  381. * @apiSuccess {object} data 结果集
  382. * @apiSuccess {object} data.list.fee 订阅量
  383. * @apiSuccess {object} data.list.day 图书数量量
  384. * @apiSuccess {object} data.meta.last_page 最后意一页
  385. * @apiSuccess {object} data.meta.current_page 当前页
  386. * @apiSuccessExample {json} Success-Response:
  387. * HTTP/1.1 200 OK
  388. * {
  389. * code: 0,
  390. * msg: "",
  391. * data: {
  392. * list:[
  393. * {
  394. * fee: "96",
  395. * day: "2017-12-21"
  396. * },
  397. * {
  398. * fee: "1262",
  399. * day: "2017-12-22"
  400. * },
  401. * {
  402. * fee: "382",
  403. * day: "2017-12-24"
  404. * },
  405. * ],
  406. * meta{
  407. * last_page:3,
  408. * current_page:1
  409. * }
  410. * }
  411. * }
  412. */
  413. public function everyBookTotal(Request $request){
  414. $bid = $request->input('bid');
  415. $page = (int)$request->input('page',1);
  416. $pagesize = (int)$request->input('pagesize',15);
  417. $start = ($page-1)*$pagesize;
  418. $data = [];
  419. if(in_array($bid,$this->getBookOrderBid())){
  420. $book_sql = 'select sum(fee) as fee,date(created_at) as `day` from book_orders where bid='.$bid.' group by date(created_at) limit '.$start.','.$pagesize;
  421. $count_sql = 'select count(*) as count from (select sum(fee) as fee from book_orders where bid='.$bid.' group by date(created_at)) a';
  422. $temp_res = DB::select($book_sql);
  423. $count = DB::select($count_sql);
  424. $data = [
  425. 'meta'=>['last_page'=>ceil($count[0]->count/$pagesize),'current_page'=>$page],
  426. 'list'=>$temp_res
  427. ];
  428. }else{
  429. $sql = 'select sum(fee) as fee,`day` from chapter_order_total where bid='.$bid.' group by `day` limit '.$start.','.$pagesize;
  430. $count_sql = 'select count(*) as count from (select sum(fee) as fee,day from chapter_order_total where bid='.$bid.' group by `day`) a';
  431. $temp_res = DB::connection('chapter_order_mysql')->select($sql);
  432. $count = DB::connection('chapter_order_mysql')->select($count_sql);
  433. $data = [
  434. 'meta'=>['last_page'=>ceil($count[0]->count/$pagesize),'current_page'=>$page],
  435. 'list'=>$temp_res
  436. ];
  437. }
  438. if($request->input('export')){
  439. $filename = 'cptotal'.date('YmdHis').'.csv';
  440. Storage::append($filename,mb_convert_encoding("日期,订阅量",'gbk'));
  441. $str = '';
  442. foreach ($data['list'] as $val){
  443. $str .= "{$val->day},{$val->fee}\r\n";
  444. }
  445. Storage::append($filename,mb_convert_encoding($str,'gbk'));
  446. return response()->download(storage_path('app/'.$filename))->deleteFileAfterSend(true);
  447. }
  448. return response()->success($data);
  449. }
  450. protected function getBookOrderBid(){
  451. static $book_order_bid = null;
  452. if(is_null($book_order_bid)){
  453. $book_order_bid_obj = BookOrder::select(DB::raw('DISTINCT bid'))->get();
  454. foreach ($book_order_bid_obj as $v){
  455. $book_order_bid[] = $v->bid;
  456. }
  457. }
  458. return $book_order_bid;
  459. }
  460. }