MassagerService.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. <?php
  2. namespace app\api\service;
  3. use app\admin\model\dynamic\Dynamic;
  4. use app\admin\model\dynamic\Like;
  5. use app\api\model\massager\Massager;
  6. use app\api\model\massager\Collect;
  7. use app\api\model\massager\Comment;
  8. use app\api\model\massager\Work;
  9. use app\api\model\massager\WorkPeriod;
  10. use app\api\model\order\Order;
  11. use app\api\model\service\Service;
  12. use redis\RedisClient;
  13. class MassagerService extends BaseService
  14. {
  15. private $massagerModel;
  16. private $colletModel;
  17. private $commentModel;
  18. private $orderModel;
  19. private $workModel;
  20. public function __construct()
  21. {
  22. $this->massagerModel = new Massager();
  23. $this->colletModel = new Collect();
  24. $this->commentModel = new Comment();
  25. $this->orderModel = new Order();
  26. $this->workModel = new Work();
  27. }
  28. /**
  29. * 合并助教数据代码
  30. * @param $paginate
  31. * @param $user_id
  32. * @return array
  33. */
  34. private function mergeMassager($paginate, $user_id)
  35. {
  36. $items = $paginate->items();
  37. $collet_relation = [];
  38. if ($user_id) {
  39. $collet_relation = $this->colletModel->fetchByUserIdAndMassagerIds($user_id, array_map(function ($data) {
  40. return $data['id'];
  41. }, $items));
  42. $collet_relation = array_reduce($collet_relation, function ($p, $cur) {
  43. $p[$cur['massager_id']] = 1;
  44. return $p;
  45. }, []);
  46. }
  47. $services = (new \app\admin\model\Service())->where([
  48. "duration_minute" => 120,
  49. "type" => \E_SERVICE_TYPE::App,
  50. ])->select();
  51. $services = array_reduce($services, function ($p, $cur) {
  52. $p[$cur["level"]] = $cur["real_price"];
  53. return $p;
  54. }, []);
  55. foreach ($items as &$item) {
  56. $recently_work_date = $this->workDateRange(array_map(function ($data) {
  57. return [strtotime($data["service_start_date"]), strtotime($data["service_end_date"])];
  58. }, $item["nearly_two_days_orders"]), true);
  59. $item['recently_work_date'] = $recently_work_date;
  60. $item['is_can_collet'] = !isset($collet_relation[$item['id']]);
  61. $item["price"] = isset($services[$item['level']]) ? $services[$item['level']] : 260;
  62. unset($item['nearly_two_days_orders']);
  63. }
  64. return [
  65. array_map(function ($data) {
  66. return Massager::fmtMassager($data);
  67. }, $items),
  68. $paginate->total()
  69. ];
  70. }
  71. /**
  72. * 判断是否能够选择
  73. * @param $in_time
  74. * @param $ranges
  75. * @return bool
  76. */
  77. private function checkCanOption($in_time, $ranges)
  78. {
  79. foreach ($ranges as $range) {
  80. if ($in_time >= $range[0] && $in_time <= $range[1]) {
  81. return false;
  82. }
  83. }
  84. return true;
  85. }
  86. /**
  87. * 获取可助教工作的时间段
  88. * @param array $order_date_range
  89. * @param bool $recently
  90. * @return array|false|string|null
  91. */
  92. private function workDateRange(array $order_date_range, $recently = true)
  93. {
  94. $now_time = time();
  95. $range = [];
  96. $max_time = strtotime(date("Y-m-d 23:59:59"));
  97. $acc_time = $now_time;
  98. $recently_work_date = null;
  99. while (true) {
  100. if ($acc_time === $now_time) {
  101. $y_m_d = date("Y-m-d", $acc_time);
  102. $now_minute = date("i", $acc_time);
  103. if ($now_minute < 30) {
  104. $range["$y_m_d"] = ["date" => $y_m_d, "range" => [["value" => date("H:30", $acc_time), "can_option" => false]]];
  105. }
  106. }
  107. $acc_time += (60 * 60);
  108. $y_m_d = date("Y-m-d", $acc_time);
  109. $y_m_d_h = date("Y-m-d H:00:00", $acc_time);
  110. $v_1 = [
  111. "value" => date("H:00", strtotime($y_m_d_h)),
  112. "can_option" => (($acc_time - (60 * 60)) === $now_time) ? false : $this->checkCanOption(strtotime($y_m_d_h), $order_date_range)
  113. ];
  114. $v_2 = [
  115. "value" => date("H:30", $acc_time),
  116. "can_option" => $this->checkCanOption($acc_time + (30 * 60), $order_date_range)
  117. ];
  118. if ($recently) {
  119. if ($v_1["can_option"]) {
  120. $recently_work_date = "$y_m_d_h";
  121. break;
  122. }
  123. if ($v_2["can_option"]) {
  124. $recently_work_date = date("Y-m-d H:30:00", $acc_time);
  125. break;
  126. }
  127. }
  128. if (isset($range["$y_m_d"])) {
  129. array_push($range["$y_m_d"]["range"], $v_1, $v_2);
  130. } else {
  131. $range["$y_m_d"] = [
  132. "date" => $y_m_d,
  133. "range" => [$v_1, $v_2]
  134. ];
  135. }
  136. if ($acc_time >= $max_time) break;
  137. }
  138. if ($recently) {
  139. return $recently_work_date;
  140. }
  141. $format_range = [];
  142. $keys = array_keys($range);
  143. for ($i = 0; $i <= count($keys) - 1; $i++) {
  144. $key = $keys[$i];
  145. $format_range[$i] = $range[$key];
  146. }
  147. return $format_range;
  148. }
  149. /**
  150. * 获取App助教
  151. * @param null $user_id
  152. * @param array $params
  153. * @param $gender
  154. * @return array
  155. */
  156. public function fetchAppMassager($user_id, array $params, $gender)
  157. {
  158. $paginate = $this->massagerModel->fetchAppMassager(
  159. $params['city_code'],
  160. $params['lng_lat'],
  161. isset($params['search_text']) && mb_strlen($params['search_text']) > 0 ? $params['search_text'] : null,
  162. isset($params['distance']) && is_numeric($params["distance"]) ? $params['distance'] : 300,
  163. isset($params['service_status']) && is_numeric($params['service_status']) ? $params['service_status'] : null,
  164. $gender,
  165. isset($params['free_travel']) && is_numeric($params['free_travel']) ? $params['free_travel'] : null,
  166. isset($params['hot']) && is_numeric($params['hot']) ? $params['hot'] : null,
  167. isset($params['service_id']) && is_numeric($params['service_id']) ? $params['service_id'] : null,
  168. $params['sort'] ?? null,
  169. $params['page'] ?? 1,
  170. $params['size'] ?? 10,
  171. $user_id,
  172. isset($params['level']) && is_numeric($params['level']) ? $params['level'] : null
  173. );
  174. return $this->mergeMassager($paginate, $user_id);
  175. }
  176. /**
  177. * 获取球房助教
  178. * @param array $params
  179. * @param $gender
  180. * @param null $user_id
  181. * @return array
  182. */
  183. public function fetchStoreMassager(array $params, $gender, $user_id = null)
  184. {
  185. $paginate = $this->massagerModel->fetchStoreMassager(
  186. $params['store_id'],
  187. $params['service_id'] ?? null,
  188. $params['search_text'] ?? null,
  189. $params['hot'] ?? null,
  190. $gender,
  191. $params['page'] ?? 1,
  192. $params['size'] ?? 10
  193. );
  194. return $this->mergeMassager($paginate, $user_id);
  195. }
  196. /**
  197. * 获取助教上班的的时间
  198. * @param $id
  199. * @return |null
  200. */
  201. public function getWorkDateRange($id)
  202. {
  203. $massager = $this->massagerModel->getMassager($id, ["store", "nearlyTwoDaysOrders"]);
  204. if (!$massager)
  205. return $this->ok([]);
  206. $order_date_range = array_map(function ($data) {
  207. return [strtotime($data["service_start_date"]), strtotime($data["service_end_date"])];
  208. }, $massager["nearlyTwoDaysOrders"]);
  209. $no_work_ranges = (new WorkPeriod())->where("massager_id", $id)->where("end_time", ">", time())->select();
  210. $ranges_ = array_map(function ($data) {
  211. return [$data["start_time"], $data["end_time"]];
  212. }, $no_work_ranges);
  213. $range = $this->workDateRange(array_merge($order_date_range, $ranges_), false);
  214. return $this->ok([
  215. "id" => $massager->id,
  216. "range" => $range
  217. ]);
  218. }
  219. /**
  220. * 获取单个助教详情
  221. * @param $massager_id
  222. * @param null $user_id
  223. * @return |null
  224. */
  225. public function get($massager_id, $user_id = null, $is_add_clock = null)
  226. {
  227. $massager = $this->massagerModel->fetchHiddenAndNormal($massager_id);
  228. if (null === $massager)
  229. return null;
  230. $massager['is_can_collet'] = true;
  231. if ($user_id) {
  232. $relation = $this->colletModel->getByUserIdAndMassagerId($user_id, $massager_id);
  233. if ($relation)
  234. $massager['is_can_collet'] = false;
  235. }
  236. $serviceModel = new Service();
  237. $query = $serviceModel
  238. ->where([
  239. "level" => $massager["level"],
  240. "type" => \E_SERVICE_TYPE::App
  241. ]);
  242. if (is_null($is_add_clock) || $is_add_clock != 1) {
  243. $query->where("is_add_clock", 0);
  244. }
  245. $q = ["id", "<>", "276"];
  246. $exist = null;
  247. $items = collection($query
  248. ->order('sort', 'desc')
  249. ->order('real_price', 'ASC')->select())->toArray();
  250. $membership_discount_rate = config("site.membership_discount_rate") / 100;
  251. $available_services = [];
  252. foreach ($items as &$item) {
  253. $item["membership_discount_price"] = fixed2Float($item["real_price"] * $membership_discount_rate);
  254. if ($item["id"] != 276) {
  255. $available_services[] = $item;
  256. } else {
  257. if ($massager["store_id"] == $exist && $exist > 0) {
  258. $available_services[] = $item;
  259. }
  260. }
  261. }
  262. $massager["services"] = $available_services;
  263. return Massager::fmtMassager($massager);
  264. }
  265. /**
  266. * @param $massager_id
  267. * @param $page
  268. * @param $size
  269. * @return array
  270. * @throws \think\exception\DbException
  271. */
  272. public function fetchMassagerComment($massager_id, $page, $size)
  273. {
  274. $paginate = $this->commentModel->fetchByMassagerId($massager_id, $page, $size);
  275. $items = $paginate->items();
  276. return [
  277. array_map(function ($data) {
  278. $nickname = "匿名用户";
  279. $avatar = null;
  280. if ($data['user'] && 0 == $data['is_anonymity']) {
  281. $nickname = $data['user']['nickname'];
  282. $avatar = $data['user']['avatar'];
  283. }
  284. $data['user_nickname'] = $nickname;
  285. $data['user_avatar'] = $avatar;
  286. unset($data['user']);
  287. return $data;
  288. }, $items),
  289. $paginate->total()
  290. ];
  291. }
  292. public function getMassagerTentativeNowLevelConfiguration($m_id, $city_code, $intraday = null)
  293. {
  294. $configuration = [
  295. [0, 50],
  296. [300, 60],
  297. [500, 65],
  298. [700, 70]
  299. ];
  300. $level_index = 1;
  301. $profit_rate = 50;
  302. $next_configuration = 288;
  303. $sumPerformanceByNowMonth = $this->orderModel->sumPerformanceByIntraday($m_id, $city_code, $intraday);
  304. if ($sumPerformanceByNowMonth > $configuration[0][0]) {
  305. for ($index = 0; $index < count($configuration); $index++) {
  306. $item = $configuration[$index];
  307. if ($sumPerformanceByNowMonth > $item[0]) {
  308. $level_index += 1;
  309. $profit_rate = $item[1];
  310. $next_configuration = isset($configuration[$index + 1]) ? $configuration[$index + 1][0] : null;
  311. }
  312. }
  313. $level_index -= 1;
  314. }
  315. return [
  316. "level" => $level_index,
  317. "profit_rate" => $profit_rate,
  318. "next_configuration" => $next_configuration,
  319. "sum_performance_by_now_month" => $sumPerformanceByNowMonth,
  320. ];
  321. }
  322. public function getMassagerNowLevelConfiguration($m_id, $city_code, $y = null, $m = null)
  323. {
  324. $configuration = array_map(function ($data) {
  325. $performance = explode("|", $data["月业绩/元"]);
  326. $duration = explode("|", $data["在岗时长/小时"]);
  327. $reorder = explode("|", $data["加钟比例(%)"]);
  328. $praise = explode("|", $data["好评率(%)"]);
  329. $chargeback = explode("|", $data["退单率(%)"]);
  330. return [
  331. [
  332. "condition" => isset($performance[0]) && is_numeric($performance[0]) ? (float)$performance[0] : 6500,
  333. "rate" => isset($performance[1]) && is_numeric($performance[1]) ? (float)$performance[1] : 55
  334. ],
  335. [
  336. "condition" => isset($duration[0]) && is_numeric($duration[0]) ? (float)$duration[0] : 100,
  337. "rate" => isset($duration[1]) && is_numeric($duration[1]) ? (float)$duration[1] : 1
  338. ],
  339. [
  340. "condition" => isset($reorder[0]) && is_numeric($reorder[0]) ? (float)$reorder[0] : 30,
  341. "rate" => isset($reorder[1]) && is_numeric($reorder[1]) ? (float)$reorder[1] : 1
  342. ],
  343. [
  344. "condition" => isset($praise[0]) && is_numeric($praise[0]) ? (float)$praise[0] : 30,
  345. "rate" => isset($praise[1]) && is_numeric($praise[1]) ? (float)$praise[1] : 1
  346. ],
  347. [
  348. "condition" => isset($chargeback[0]) && is_numeric($chargeback[0]) ? (float)$chargeback[0] : 30,
  349. "rate" => isset($chargeback[1]) && is_numeric($chargeback[1]) ? (float)$chargeback[1] : -1
  350. ]
  351. ];
  352. }, [
  353. config("site.massager_level_1"),
  354. config("site.massager_level_2"),
  355. config("site.massager_level_3"),
  356. config("site.massager_level_4"),
  357. config("site.massager_level_5"),
  358. ]);
  359. $sumPerformanceByNowMonth = $this->orderModel->sumPerformanceByNowMonth($m_id, $city_code, $y, $m);
  360. $sumDurationByNowMonth = $this->workModel->sumByNowMonth($m_id, $y, $m);
  361. $reorderRateByNowMonth = $this->orderModel->reorderRateByNowMonth($m_id, $city_code, $y, $m);
  362. $praiseRateByNowMonth = $this->orderModel->countByPraiseRate($m_id, $city_code, $y, $m);
  363. $chargebackRateByNowMonth = $this->orderModel->chargebackRate($m_id, $city_code, $y, $m);
  364. $profit_rate = config("site.massager_basics_deposit_rate") ?? 50;
  365. $level_index = 0;
  366. $next_configuration = null;
  367. for ($i = 0; $i < count($configuration); $i++) {
  368. $now_configuration = $configuration[$i];
  369. if ($sumPerformanceByNowMonth >= $now_configuration[0]["condition"]) {
  370. $level_index += 1;
  371. $next_configuration = isset($configuration[$i + 1]) ? $configuration[$i + 1] : null;
  372. $profit_rate = $now_configuration[0]["rate"];
  373. $profit_rate += ($sumDurationByNowMonth >= $now_configuration[1]["condition"] ? $now_configuration[1]["rate"] : 0);
  374. $profit_rate += ($reorderRateByNowMonth >= $now_configuration[2]["condition"] ? $now_configuration[2]["rate"] : 0);
  375. $profit_rate += ($praiseRateByNowMonth >= $now_configuration[3]["condition"] ? $now_configuration[3]["rate"] : 0);
  376. $profit_rate += ($chargebackRateByNowMonth >= $now_configuration[4]["condition"] ? $now_configuration[4]["rate"] : 0);
  377. } else {
  378. break;
  379. }
  380. }
  381. return [
  382. "level" => $level_index,
  383. "profit_rate" => $profit_rate,
  384. "next_configuration" => $next_configuration,
  385. "sum_performance_by_now_month" => $sumPerformanceByNowMonth,
  386. ];
  387. }
  388. public function getProfitRate($m_id, $city_code, $y = null, $m = null, $intraday = null): float
  389. {
  390. $massager = $this->massagerModel->findById($m_id);
  391. if (!$massager)
  392. return 0;
  393. if ($massager["fixed_profit_rate"] > 0)
  394. return $massager["fixed_profit_rate"];
  395. // DOTO: 临时替换
  396. $level_info = $this->getMassagerTentativeNowLevelConfiguration($m_id, $city_code, $intraday);
  397. // $level_info = $this->getMassagerNowLevelConfiguration($m_id, $city_code, $y, $m);
  398. return $level_info["profit_rate"];
  399. }
  400. public function interiorScoreLevel($score)
  401. {
  402. $config = config("site.massager_review_level");
  403. $keys = array_keys($config);
  404. $level_desc = "不及格";
  405. foreach ($keys as $key) {
  406. if ($score >= (float)$key) {
  407. $level_desc = $config[$key];
  408. } else {
  409. break;
  410. }
  411. }
  412. return $level_desc;
  413. }
  414. public function updateInteriorScore($m_id, $year, $month)
  415. {
  416. $config = config("site.massager_review_score");
  417. $fmt_config = [
  418. "duration" => explode("|", $config["时长/天"] ?? "6|2"),
  419. "praise" => explode("|", $config["评论/好评"] ?? "1|2"),
  420. "negative" => explode("|", $config["评论/差评"] ?? "1|-10"),
  421. "performance" => explode("|", $config["业绩/天"] ?? "500|2"),
  422. "reorder" => explode("|", $config["项目加钟"] ?? "1|2")
  423. ];
  424. $byDuration = $this->interiorScoreByDuration($m_id, $year, $month, $fmt_config["duration"]);
  425. $byPraise = $this->interiorScoreByPraise($m_id, $year, $month, $fmt_config["praise"]);
  426. $byNegative = $this->interiorScoreByNegative($m_id, $year, $month, $fmt_config["negative"]);
  427. $byPerformance = $this->interiorScoreByPerformance($m_id, $year, $month, $fmt_config["performance"]);
  428. $byReorder = $this->interiorScoreByReorder($m_id, $year, $month, $fmt_config["reorder"]);
  429. $total_score = fixed2Float(
  430. $byDuration["score"]
  431. + $byPraise["score"]
  432. + $byNegative["score"]
  433. + $byPerformance["score"]
  434. + $byReorder["score"]
  435. );
  436. if (date("Y") == $year && date("m") == $month) {
  437. $this->massagerModel->update([
  438. "interior_score" => $total_score
  439. ], ["id" => $m_id]);
  440. }
  441. return [
  442. "total_interior_score" => $total_score,
  443. "level_desc" => $this->interiorScoreLevel($total_score),
  444. "items" => [
  445. "byDuration" => $byDuration,
  446. "byPraise" => $byPraise,
  447. "byNegative" => $byNegative,
  448. "byPerformance" => $byPerformance,
  449. "byReorder" => $byReorder
  450. ]
  451. ];
  452. }
  453. public function interiorScoreByDuration($m_id, $year, $month, $config)
  454. {
  455. $last_day = date("t", strtotime("$year-$month-01 00:00:00"));
  456. $starttime = strtotime("$year-$month-01 00:00:00");
  457. $endtime = strtotime("$year-$month-$last_day 23:59:59");
  458. $works = (new Work())
  459. ->where("massager_id", $m_id)
  460. ->where("clock_in_time", ">=", $starttime)
  461. ->where("clock_off_time", "<=", $endtime)
  462. ->select();
  463. $clocks_times = [];
  464. foreach ($works as $work) {
  465. $times = splittingDate($work["clock_in_time"], $work["clock_off_time"]);
  466. $clocks_times = array_merge($clocks_times, $times);
  467. }
  468. $clocks_times = array_merge(array_unique($clocks_times));
  469. $every_days = [];
  470. $DAY_TIME = 24 * 60 * 60;
  471. $start_time_copy = $starttime;
  472. while ($start_time_copy <= $endtime) {
  473. array_push($every_days, date("Y-m-d", $start_time_copy));
  474. $start_time_copy += $DAY_TIME;
  475. }
  476. $score = 0;
  477. $intersections = [];
  478. foreach ($every_days as $now_day) {
  479. $now_day_times = splittingDate(strtotime("$now_day 00:00:00"), strtotime("$now_day 23:59:59"));
  480. $intersection = array_intersect($now_day_times, $clocks_times);
  481. $meet = count($intersection) >= (fixed2Float((($config[0] ?? 6) * 60) / 10) + 1);
  482. if ($meet) {
  483. $intersections[] = [
  484. "date" => $now_day,
  485. "count" => count($intersection),
  486. ];
  487. $score += $config[1] ?? 2;
  488. }
  489. }
  490. return [
  491. "score" => fixed2Float($score),
  492. "details" => $intersections
  493. ];
  494. }
  495. public function interiorScoreByPraise($m_id, $year, $month, $config)
  496. {
  497. $negative = $this->commentModel->fetchPraiseCommentByMassager($m_id, $year, $month);
  498. $count = count($negative);
  499. $item_score = $config[1] / $config[0];
  500. return ["score" => fixed2Float($item_score * $count), "details" => $negative];
  501. }
  502. public function interiorScoreByNegative($m_id, $year, $month, $config)
  503. {
  504. $negative = $this->commentModel->fetchNegativeCommentByMassager($m_id, $year, $month);
  505. $count = count($negative);
  506. $item_score = $config[1] / $config[0];
  507. return ["score" => fixed2Float($item_score * $count), "details" => $negative];
  508. }
  509. public function interiorScoreByPerformance($m_id, $year, $month, $config)
  510. {
  511. $all_orders = $this->orderModel->fetchByMassager($m_id, $year, $month);
  512. $fmt = [];
  513. foreach ($all_orders as $order) {
  514. $key = date("Y-m-d", $order["pay_time"]);
  515. if (isset($fmt[$key])) {
  516. $fmt[$key] += $order["total_real_amount"];
  517. } else {
  518. $fmt[$key] = $order["total_real_amount"];
  519. }
  520. }
  521. $score = 0;
  522. $details = [];
  523. foreach ($fmt as $key => $value) {
  524. if ($value >= $config[0]) {
  525. $details[] = [
  526. "date" => $key,
  527. "count" => $value,
  528. ];
  529. $score += $config[1];
  530. }
  531. }
  532. return ["score" => fixed2Float($score), "details" => $details];
  533. }
  534. public function interiorScoreByReorder($m_id, $year, $month, $config)
  535. {
  536. $all_orders = $this->orderModel->fetchReorderByMassager($m_id, $year, $month);
  537. $count = count($all_orders);
  538. $item_score = $config[1] / $config[0];
  539. return ["score" => fixed2Float($item_score * $count), "details" => $all_orders];
  540. }
  541. public function fetchSelfDynamics($m_id, $page = 1, $size = 10)
  542. {
  543. $paginate = (new Dynamic())
  544. ->where("massager_id", $m_id)
  545. ->with(["comments", "likes"])
  546. ->page($page)
  547. ->paginate($size);
  548. return [
  549. $paginate->items(),
  550. $paginate->total()
  551. ];
  552. }
  553. public function fetchFansNumberAndPraiseNumber($m_id)
  554. {
  555. return [
  556. "fansNumber" => Collect::where("massager_id", $m_id)->count(),
  557. "praiseNumber" => Like::where("massager_id", $m_id)->count()
  558. ];
  559. }
  560. }