PostRepositories.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: edz
  5. * Date: 2019-06-10
  6. * Time: 17:53
  7. */
  8. namespace App\Repositories;
  9. use App\Models\Behavior;
  10. use App\Models\Post;
  11. use App\Models\PostCollect;
  12. use App\Models\PostComment;
  13. use App\Models\PostData;
  14. use App\Models\PostDislike;
  15. use App\Models\PostImgs;
  16. use App\Models\PostLike;
  17. use App\Models\PostLog;
  18. use App\Models\PostShare;
  19. use App\Models\Topic;
  20. use App\Service\AliYunVodService;
  21. use App\Service\DetectionService;
  22. use App\Traits\CmsTrait;
  23. use App\Traits\PostTrait;
  24. use App\Traits\UserTrait;
  25. use Illuminate\Database\QueryException;
  26. use Illuminate\Support\Carbon;
  27. use Illuminate\Support\Facades\Log;
  28. use Illuminate\Support\Facades\Redis;
  29. use Illuminate\Support\Facades\DB;
  30. use Tymon\JWTAuth\Facades\JWTAuth;
  31. class PostRepositories
  32. {
  33. use UserTrait;
  34. use PostTrait;
  35. use CmsTrait;
  36. public function __construct(Post $post,
  37. PostData $postData,
  38. PostImgs $postImgs,
  39. PostComment $postComment,
  40. PostCollect $postCollect,
  41. PostShare $postShare,
  42. PostLog $postLog,
  43. DetectionService $detectionService,
  44. AliYunVodService $aliYunVodService,
  45. Topic $topic)
  46. {
  47. $this->post = $post;
  48. $this->postData = $postData;
  49. $this->postImgs = $postImgs;
  50. $this->postComment = $postComment;
  51. $this->postCollect = $postCollect;
  52. $this->postShare = $postShare;
  53. $this->postLog = $postLog;
  54. $this->detectionService = $detectionService;
  55. $this->topic = $topic;
  56. $this->aliYunVodService = $aliYunVodService;
  57. }
  58. /**
  59. * 发布内容
  60. */
  61. public function create($request)
  62. {
  63. //验证小号
  64. $userInfo = $this->getUserInfo();
  65. if (empty($userInfo)) {
  66. return jsonError('获取用户信息失败');
  67. }
  68. if(!$userInfo['sns_status']){
  69. return jsonError('您已被禁言');
  70. }
  71. $isValid = 0;
  72. if($userInfo['strength']){
  73. $isValid = 1;
  74. }
  75. // $oneHourTime = Carbon::now()->addHours(-1)->toDateTimeString();
  76. // $oneHourPostCount = $this->post->where('uid', $userInfo['uid'])->where('created_at', '>', $oneHourTime)->count();
  77. // if($oneHourPostCount > 5){
  78. // return jsonError('创作欲望太强啦,休息一下,看看其他用户的内容吧!');
  79. // }
  80. $detectionText = $request['title'] .','. $request['content'];
  81. $detectionTextResult = $this->detectionService->checkText($detectionText);
  82. if ($detectionTextResult['code']<0) {
  83. return jsonError('内容违规,请修正哦');
  84. }
  85. $topicIds = json_decode($request['topic_ids'], true);
  86. $topicCount = count($topicIds);
  87. if($topicCount == 0 || $topicCount > 5){
  88. return jsonError('所选话题必须1-5个');
  89. }
  90. //验证话题
  91. $hasTopicCount = $this->topic->whereIn('id', $topicIds)->count();
  92. if($topicCount != $hasTopicCount){
  93. Log::error('所选话题非法'.$request['topic_ids']);
  94. return jsonError('所选话题非法');
  95. }
  96. $imgs = [];
  97. if($request['type'] == 'image'){
  98. $imgs = json_decode($request['imgs'], true);
  99. $imgCount = count($imgs);
  100. if($imgCount == 0 || $imgCount > 9){
  101. return jsonError('所传图集必须1-9个');
  102. }
  103. }
  104. $allImg = array_merge($imgs, [$request['img']]);
  105. $detectionImageResult = $this->detectionService->checkImg($allImg);
  106. if ($detectionImageResult['code']<0) {
  107. return jsonError('图片违规,请修正哦');
  108. }
  109. $videoUrl = "";
  110. $videoId = "";
  111. if(isset($request['video']) && $request['video']){
  112. $videoId = $request['video'];
  113. for($i=0;$i<3;$i++){
  114. $videoUrl = $this->aliYunVodService->getPlayUrlByVideoId($request['video']);
  115. Log::debug('video-url:'.$videoUrl);
  116. if($videoUrl){
  117. break;
  118. }
  119. }
  120. if(empty($videoUrl)){
  121. return jsonError('发布失败,请重试');
  122. }
  123. }
  124. $data = [
  125. 'uid' => $userInfo['uid'],
  126. 'username' => $userInfo['username'],
  127. 'mobile' => $userInfo['mobile'],
  128. 'avatar' => $userInfo['avatar']??'',
  129. 'type' => $request['type'],
  130. 'img' => $request['img'],
  131. 'video' => $videoUrl,
  132. 'video_id' => $videoId,
  133. 'topic_ids' => implode(',', $topicIds),
  134. 'title' => isset($request['title'])? $request['title'] : '',
  135. 'content' => $request['content'],
  136. 'location' => isset($request['location'])? $request['location'] : '',
  137. 'is_suggest' => 0,
  138. 'is_hide' => 0
  139. ];
  140. $date = date('Y-m-d H:i:s');
  141. $fresh = (Carbon::now()->timestamp) - (Carbon::parse("2019-05-01 00:00:00")->timestamp);
  142. $score = $fresh / 86400;
  143. DB::beginTransaction();
  144. try{
  145. $post = $this->post->create($data);
  146. $postData = $this->postData->create([
  147. 'post_id' => $post->id,
  148. 'pv' => 0,
  149. 'pv_real' => 0,
  150. 'dislike_count' => 0,
  151. 'praise_count' => 0,
  152. 'praise_real_count' => 0,
  153. 'share_count' => 0,
  154. 'share_real_count' => 0,
  155. 'comment_count' => 0,
  156. 'collect_count' => 0,
  157. 'collect_real_count' => 0,
  158. 'available_bean' => $this->availableBean(),
  159. 'will_collect_bean' => rand(100, 200),
  160. 'collect_bean' => 0,
  161. 'weight' => $score
  162. ]);
  163. if($imgs){
  164. $imgData = [];
  165. foreach($imgs as $img){
  166. $imgData[] = [
  167. 'post_id' => $post->id,
  168. 'img' => $img,
  169. 'created_at' => $date,
  170. 'updated_at' => $date
  171. ];
  172. }
  173. $this->postImgs->insert($imgData);
  174. }
  175. DB::commit();
  176. Redis::zadd('post_trigger_type', $isValid, $post->id);
  177. foreach($topicIds as $id){
  178. Redis::zincrby('topic.user_uid'.$userInfo['uid'], 1, $id);
  179. }
  180. return jsonSuccess([
  181. 'post_id' => $post->id,
  182. 'h5url' => config('customer.share_post_h5url')."?post_id={$post->id}&invite_code={$userInfo['invite_code']}",
  183. 'bean' => $postData->available_bean,
  184. ]);
  185. }catch (QueryException $exception){
  186. DB::rollBack();
  187. Log::debug('发布内容失败:'.$exception->getMessage());
  188. return jsonError('发布内容失败,请重试');
  189. }
  190. }
  191. /**
  192. * 评论&回复
  193. */
  194. public function comment($request)
  195. {
  196. //验证小号
  197. $userInfo = $this->getUserInfo();
  198. if (empty($userInfo)) {
  199. return jsonError('获取用户信息失败');
  200. }
  201. if(!$userInfo['sns_status']){
  202. return jsonError('您已被禁言');
  203. }
  204. $oneHourTime = Carbon::now()->addHours(-1)->toDateTimeString();
  205. $oneHourCommentCount = $this->postComment->where('uid', $userInfo['uid'])->where('created_at', '>', $oneHourTime)->count();
  206. if($oneHourCommentCount > 59){
  207. return jsonError('回复了这么多,休息休息,喝口水吧!');
  208. }
  209. $detectionTextResult = $this->detectionService->checkText($request['content']);
  210. if ($detectionTextResult['code']<0) {
  211. return jsonError('内容违规,请修正哦');
  212. }
  213. $post = $this->post->find($request['post_id']);
  214. if(!$post){
  215. return jsonError('获取内容信息失败');
  216. }
  217. $data = [
  218. 'uid' => $userInfo['uid'],
  219. 'post_id' => $request['post_id'],
  220. 'parent_id' => 0,
  221. 'username' => $userInfo['username'],
  222. 'reply_uid' => 0,
  223. 'reply_username' => '',
  224. 'avatar' => $userInfo['avatar']??'',
  225. 'content' => $request['content'],
  226. 'is_delete' => 0,
  227. ];
  228. if(isset($request['parent_id']) && $request['parent_id'] != 0){
  229. $comment = $this->postComment->find($request['parent_id']);
  230. if(!$comment || $comment->post_id != $post->id){
  231. return jsonError('获取评论信息失败');
  232. }
  233. if($comment->parent_id){
  234. return jsonError('只能回复评论');
  235. }
  236. $data['parent_id'] = $request['parent_id'];
  237. if(isset($request['reply_uid']) && isset($request['reply_username'])){
  238. $data['reply_uid'] = $request['reply_uid'];
  239. $data['reply_username'] = $request['reply_username'];
  240. }else{
  241. $data['reply_uid'] = 0;
  242. $data['reply_username'] = '';
  243. }
  244. }
  245. DB::beginTransaction();
  246. try{
  247. $comment = $this->postComment->create($data);
  248. DB::commit();
  249. return jsonSuccess(['id' => $comment->id], '评论成功');
  250. }catch (QueryException $exception){
  251. DB::rollBack();
  252. Log::debug('评论内容失败:'.$exception->getMessage());
  253. return jsonError('评论内容失败,请重试');
  254. }
  255. }
  256. /**
  257. * 内容列表
  258. */
  259. public function lists($request)
  260. {
  261. Log::debug('内容列表'.json_encode($request));
  262. $perPage = isset($request['per_page']) ? $request['per_page'] : 20;
  263. return $this->post
  264. ->join('post_data', 'post_data.post_id', '=', 'post.id')
  265. ->select('post.*')
  266. ->where(function($query) use ($request){
  267. if(isset($request['keyword'])){
  268. $query->where('title', 'like', "%{$request['keyword']}%")
  269. ->orWhere('content', 'like', "%{$request['keyword']}%");
  270. }
  271. })
  272. ->where(function($query) use ($request){
  273. if(isset($request['topic_ids']) && $request['topic_ids']){
  274. $topicIds = json_decode($request['topic_ids'], true);
  275. foreach ($topicIds as $key=>$id) {
  276. if ($key==0) {
  277. $query->whereRaw('FIND_IN_SET('.$id.', post.topic_ids)');
  278. } else {
  279. $query->orWhereRaw('FIND_IN_SET('.$id.', post.topic_ids)');
  280. }
  281. }
  282. }
  283. })
  284. ->orderBy('weight','desc')
  285. ->paginate($perPage);
  286. }
  287. /**
  288. * 视频列表
  289. */
  290. public function video($request)
  291. {
  292. $perPage = isset($request['per_page']) ? $request['per_page'] : 20;
  293. $where = [];
  294. $id = 0;
  295. if(isset($request['id'])){
  296. $id = $request['id'];
  297. }
  298. $where[] = ['type', 'video'];
  299. if(isset($request['type'])){
  300. if($request['type'] == 'hot'){
  301. $ids = Redis::get('hotVideoIds');
  302. if(!$ids){
  303. $ids = $this->hotVideoIds();
  304. if(!$ids){
  305. $ids = '';
  306. }
  307. }
  308. Log::debug('热门视频ids'.$ids);
  309. return $this->post
  310. ->join('post_data', 'post_data.post_id', '=', 'post.id')
  311. ->select('post.*', DB::raw("IF (post.id = {$id},1,0) as sort"))
  312. ->where($where)
  313. ->whereIn('post.id', explode(',', $ids))
  314. ->orderBy('sort', 'desc')
  315. ->orderByRaw(DB::raw("FIELD(post.id,{$ids})"))
  316. ->paginate($perPage);
  317. }elseif($request['type'] == 'one'){
  318. $where[] = ['post.id', $id];
  319. return $this->post
  320. ->join('post_data', 'post_data.post_id', '=', 'post.id')
  321. ->select('post.*')
  322. ->where($where)
  323. ->paginate($perPage);
  324. }
  325. }
  326. return $this->post
  327. ->join('post_data', 'post_data.post_id', '=', 'post.id')
  328. ->select('post.*', DB::raw("IF (post.id = {$id},1,0) as sort"))
  329. ->where($where)
  330. ->orderBy('sort', 'desc')
  331. ->orderBy('weight','desc')
  332. ->paginate($perPage);
  333. }
  334. /**
  335. * 个人中心内容列表
  336. */
  337. public function MyPost($request, $uid)
  338. {
  339. $type = $request['type'];
  340. $perPage = isset($request['per_page']) ? $request['per_page'] : 20;
  341. $where = [];
  342. if($type == 'create'){
  343. $where[] = ['post.uid', $uid];
  344. $post = $this->post;
  345. $order = 'post.id';
  346. }elseif($type == 'collect'){
  347. $post = $this->post->withTrashed()->join('post_collect', 'post_collect.post_id', '=', 'post.id');
  348. $where[] = ['post_collect.uid', $uid];
  349. $order = 'post_collect.id';
  350. }else{
  351. $post = $this->post->withTrashed()->join('post_share', 'post_share.post_id', '=', 'post.id');
  352. $where[] = ['post_share.uid', $uid];
  353. $order = 'post_share.updated_at';
  354. }
  355. return $post
  356. ->join('post_data', 'post_data.post_id', '=', 'post.id')
  357. ->select('post.*')
  358. ->where($where)
  359. ->orderBy($order,'desc')
  360. ->paginate($perPage);
  361. }
  362. /**
  363. * 内容详情
  364. */
  365. public function detail($id)
  366. {
  367. return $this->post
  368. ->join('post_data', 'post_data.post_id', '=', 'post.id')
  369. ->select('post.*')
  370. ->find($id);
  371. }
  372. /**
  373. * 内容是否存在
  374. */
  375. public function detailExists($id)
  376. {
  377. return $this->post->where('id', $id)->exists();
  378. }
  379. /**
  380. * 推荐内容列表
  381. */
  382. public function suggestPost($request)
  383. {
  384. $perPage = isset($request['per_page']) ? $request['per_page'] : 20;
  385. return $this->post
  386. ->join('post_data', 'post_data.post_id', '=', 'post.id')
  387. ->select('post.*')
  388. ->orderBy('is_suggest','desc')
  389. ->orderBy('weight','desc')
  390. ->paginate($perPage);
  391. }
  392. /**
  393. * 话题内容
  394. */
  395. public function topicPost($request)
  396. {
  397. $perPage = isset($request['per_page']) ? $request['per_page'] : 20;
  398. return $this->post
  399. ->join('post_data', 'post_data.post_id', '=', 'post.id')
  400. ->select('post.*')
  401. ->whereRaw('FIND_IN_SET(' . $request['id'] . ',post.topic_ids)')
  402. ->orderBy('id','desc')
  403. ->paginate($perPage);
  404. }
  405. /**
  406. * 评论列表
  407. */
  408. public function commentList($request)
  409. {
  410. $perPage = isset($request['per_page']) ? $request['per_page'] : 20;
  411. return $this->postComment
  412. ->where('post_id', $request['post_id'])
  413. ->where('parent_id', 0)
  414. ->orderBy('id','desc')
  415. ->paginate($perPage);
  416. }
  417. /**
  418. * 回复列表
  419. */
  420. public function replyList($request)
  421. {
  422. $perPage = isset($request['per_page']) ? $request['per_page'] : 20;
  423. return $this->postComment
  424. ->where('parent_id', $request['id'])
  425. ->orderBy('id','desc')
  426. ->paginate($perPage);
  427. }
  428. /**
  429. * 话题列表
  430. */
  431. public function topicList($request)
  432. {
  433. $perPage = isset($request['per_page']) ? $request['per_page'] : 20;
  434. $where = [];
  435. if(isset($request['category_id']) && $request['category_id']){
  436. $topic = $this->topic->join('category_topic', 'category_topic.topic_id', '=', 'topic.id')->select('topic.*');
  437. $where[] = ['category_topic.category_id', $request['category_id']];
  438. }else{
  439. $topic = $this->topic;
  440. }
  441. if(isset($request['is_suggest']) && $request['is_suggest']){
  442. $where[] = ['topic.is_hot', $request['is_suggest']];
  443. }
  444. if(isset($request['name'])){
  445. $where[] = ['topic.name', 'like', "%{$request['name']}%"];
  446. }
  447. return $topic
  448. ->where($where)
  449. ->orderBy('id','desc')
  450. ->paginate($perPage);
  451. }
  452. /**
  453. * 更新帖子统计数量
  454. * @param $request
  455. * @return mixed
  456. */
  457. public function updatePostData($request)
  458. {
  459. $postId = isset($request['post_id'])?$request['post_id']:0;
  460. if(empty($postId)){
  461. Log::debug("非帖子类操作,不操作帖子统计数量".json_encode($request));
  462. return true;
  463. }
  464. $post = PostData::where('post_id', $postId)->first();
  465. if(!$post) return true;
  466. if (isset($request['behavior_flag']) && $request['behavior_flag'] == 'read') {
  467. $post->pv += 1;
  468. $post->pv_real += 1;
  469. Log::debug("帖子:".$postId."被阅读,pv +1");
  470. } elseif (isset($request['behavior_flag']) && $request['behavior_flag'] == 'unlike') {
  471. $post->dislike_count += 1;
  472. PostDislike::create(['uid'=>$request['target_id'],'post_id'=>$request['post_id']]);
  473. Log::debug("帖子:".$postId."被不喜欢,unlike +1");
  474. } elseif (isset($request['behavior_flag']) && $request['behavior_flag'] == 'like') {
  475. if($request['behavior_value']){
  476. $post->praise_count += 1;
  477. $post->praise_real_count += 1;
  478. PostLike::create(['uid'=>$request['target_id'],'post_id'=>$request['post_id']]);
  479. Log::debug("帖子:".$postId."被点赞,praise_count +1");
  480. }else{
  481. $post->praise_count -= 1;
  482. $post->praise_real_count -= 1;
  483. PostLike::where(['uid'=>$request['target_id'],'post_id'=>$request['post_id']])->delete();
  484. Log::debug("帖子:".$postId."被取消点赞,praise_count -1");
  485. }
  486. } elseif (isset($request['behavior_flag']) && $request['behavior_flag'] == 'forward') {
  487. $post->share_count += 1;
  488. $post->share_real_count += 1;
  489. $shareRow = PostShare::where(['uid'=>$request['target_id'],'post_id'=>$request['post_id']])->first();
  490. if($shareRow){
  491. PostShare::where(['uid'=>$request['target_id'],'post_id'=>$request['post_id']])->update(['uid'=>$request['target_id'],'post_id'=>$request['post_id']]);
  492. }else{
  493. PostShare::create(['uid'=>$request['target_id'],'post_id'=>$request['post_id']]);
  494. }
  495. Log::debug("帖子:".$postId."被分享,share_count +1");
  496. } elseif (isset($request['behavior_flag']) && $request['behavior_flag'] == 'comment') {
  497. $post->comment_count += 1;
  498. Log::debug("帖子:".$postId."被评论,comment_count +1");
  499. } elseif (isset($request['behavior_flag']) && $request['behavior_flag'] == 'collect') {
  500. if($request['behavior_value']) {
  501. $post->collect_count += 1;
  502. $post->collect_real_count += 1;
  503. PostCollect::create(['uid'=>$request['target_id'],'post_id'=>$request['post_id']]);
  504. Log::debug("帖子:".$postId."被收藏,collect_count +1");
  505. }else{
  506. $post->collect_count -= 1;
  507. $post->collect_real_count -= 1;
  508. PostCollect::where(['uid'=>$request['target_id'],'post_id'=>$request['post_id']])->delete();
  509. Log::debug("帖子:".$postId."被取消收藏,collect_count -1");
  510. }
  511. }
  512. $this->collectPostId($request['post_id']);
  513. return $post->save();
  514. }
  515. /**
  516. * 收集所有有操作的帖子,存入redis
  517. * 供后续计算帖子权重
  518. * @param $id
  519. */
  520. public function collectPostId($id)
  521. {
  522. $key = "community_calc_post_score";
  523. Redis::sadd($key,$id);
  524. Log::debug('存入帖子'.$id.'到权重列表');
  525. }
  526. /**
  527. * 话题详情
  528. */
  529. public function topicDetail($id)
  530. {
  531. return $this->topic
  532. ->find($id);
  533. }
  534. /**
  535. * 获取话题
  536. */
  537. public function getTopic($ids)
  538. {
  539. $topics = $this->topic
  540. ->whereIn('id', explode(',',$ids))
  541. ->orderByRaw(DB::raw("FIELD(id,{$ids})"))
  542. ->get();
  543. $data = [];
  544. foreach($topics as $topic){
  545. $data[] = [
  546. 'id' => $topic->id,
  547. 'name' => $topic->name,
  548. 'img' => $topic->img,
  549. 'follow_count' => getNumber($topic->follow->count() + $topic->base_count),
  550. ];
  551. }
  552. return $data;
  553. }
  554. /**
  555. * 获取内容视频组
  556. */
  557. public function getPostVideo($ids)
  558. {
  559. return $this->post
  560. ->select('id', 'img', 'uid', 'username', 'avatar')
  561. ->whereIn('id', explode(',',$ids))
  562. ->where('type', 'video')
  563. ->get();
  564. }
  565. //用户内容数,转发数,收藏数统计
  566. public function memberPostStatistics($uid){
  567. $postCount = $this->post->where('uid',$uid)->count();
  568. $postCollectCount = $this->postCollect->where('uid',$uid)->count();
  569. $postShareCount = $this->postShare->where('uid',$uid)->count();
  570. $data = ['post_count'=>$postCount,'share_count'=>$postShareCount,'collect_count'=>$postCollectCount];
  571. return jsonSuccess($data);
  572. }
  573. /**
  574. * 删除内容
  575. */
  576. public function delete($request)
  577. {
  578. //验证用户信息
  579. $userInfo = $this->getUserInfo();
  580. if (empty($userInfo)) {
  581. return jsonError('获取用户信息失败');
  582. }
  583. $post = $this->post->find($request['id']);
  584. if(!$post){
  585. return jsonError('获取内容信息失败');
  586. }
  587. if($post->uid != $userInfo['uid']){
  588. return jsonError('只能删除自己发布的内容');
  589. }
  590. $logData = [
  591. 'uid' => $userInfo['uid'],
  592. 'operator_type' => 'user',
  593. 'post_id' => $request['id'],
  594. 'username' => $userInfo['username'],
  595. 'log_type' => 'delete',
  596. 'content' => json_encode(['delete' => $request['id']]),
  597. ];
  598. DB::beginTransaction();
  599. try{
  600. $post->delete();
  601. $this->postLog->create($logData);
  602. DB::commit();
  603. Log::debug('删除内容失败:'.$request['id']);
  604. return jsonSuccess('删除内容成功');
  605. }catch (QueryException $exception){
  606. DB::rollBack();
  607. Log::debug('删除内容失败:'.$request['id'].$exception->getMessage());
  608. return jsonError('删除内容失败,请重试');
  609. }
  610. }
  611. }