1
0

Material.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. <?php
  2. namespace app\api\controller;
  3. use app\model\CustomerClue;
  4. use app\model\Employee;
  5. use app\model\MaterialCase;
  6. use app\model\Community;
  7. use app\model\Decostyle;
  8. use app\model\Housetype;
  9. use app\model\EvidenceCate;
  10. use app\model\MaterialEvidence;
  11. use app\model\Miniprogram;
  12. use app\model\Org;
  13. use app\model\UserCollect;
  14. use think\facade\Console;
  15. use wx\miniprogram\Qrcode;
  16. use app\model\Designer;
  17. use app\model\User;
  18. class Material extends Base
  19. {
  20. /**
  21. * 装修案例风格
  22. */
  23. public function decostylelist()
  24. {
  25. $styleArr = Decostyle::where(['root_id' => request()->token['root_org']])->where([['type', '=', 0]])->field('id, name')->select();
  26. return json(['code' => 0, 'data' => $styleArr, 'msg' => '获取成功']);
  27. }
  28. /**
  29. * 装修案例小区列表
  30. */
  31. public function communitylist()
  32. {
  33. $name = input('name', '', 'trim');
  34. if ($name) {
  35. $where[] = ['name', 'like', '%' . $name . '%'];
  36. }
  37. $from = input('from', '', 'trim');
  38. $where[] = ['type', '=', 0];
  39. $where[] = ['root_id', '=', request()->token['root_org']];
  40. $communityArr = Community::where($where)->field('id,name,pinyin,case_num')->order('pinyin asc')->select()->toArray();
  41. $comidlist = array_column($communityArr, 'id');
  42. $caseData = MaterialCase::where([['community_id', 'in', $comidlist], ['del', '=', 0], ['publish', '=', 1]])->group('community_id')->order('updatetime asc')->column('max(updatetime) as updatetime, sum(shared_times) as shared_times, count(id) as case_num', 'community_id');
  43. // 个人上传装修案例,数量显示为此小区下此员工上传的数量
  44. if ($from) {
  45. foreach ($caseData as $k => $v) {
  46. $caseData[$k]['case_num'] = MaterialCase::where([['community_id', '=', $v['community_id']], ['from', '=', 1], ['employee_id', '=', request()->token['employee_id']]])->count();
  47. }
  48. }
  49. foreach ($communityArr as &$i) {
  50. if (isset($caseData[$i['id']])) {
  51. $i['updatetime'] = $caseData[$i['id']]['updatetime'];
  52. $i['shared_times'] = (int)$caseData[$i['id']]['shared_times'];
  53. $i['case_num'] = (int)$caseData[$i['id']]['case_num'];
  54. } else {
  55. $i['updatetime'] = 0;
  56. $i['shared_times'] = 0;
  57. $i['case_num'] = 0;
  58. }
  59. }
  60. return json(['code' => 0, 'data' => $communityArr, 'msg' => '获取成功']);
  61. }
  62. /*
  63. * 装修案例户型
  64. */
  65. public function housetypelist()
  66. {
  67. $housetypeArr = Housetype::where(['root_id' => request()->token['root_org']])->field('id,name')->select();
  68. return json(['code' => 0, 'data' => $housetypeArr, 'msg' => '获取成功']);
  69. }
  70. /*
  71. * material case list
  72. */
  73. public function caselist()
  74. {
  75. $param = $this->request->param();
  76. $order = (!isset($param['order']) || !$param['order']) ? 'addtime' : $param['order'];
  77. $desc = (!isset($param['desc']) || !$param['desc']) ? 'desc' : $param['desc'];
  78. // $order = $order . ' ' . $desc;
  79. $where[] = ['root_id', '=', request()->token['root_org']];
  80. // 我上传的
  81. if (!empty($param['my_case'])) {
  82. switch ($param['my_case']) {
  83. case 'publish': //通过的
  84. $where[] = ['publish', '=', 1];
  85. $where[] = ['del', '=', 0];
  86. $where[] = ['employee_id', '=', request()->token['employee_id']];
  87. $where[] = ['from', '=', 1];
  88. break;
  89. case 'all': //全部的
  90. $where[] = ['employee_id', '=', request()->token['employee_id']];
  91. $where[] = ['from', '=', 1];
  92. break;
  93. default:
  94. $where[] = ['publish', '=', 1];
  95. $where[] = ['del', '=', 0];
  96. $where[] = ['employee_id', '=', request()->token['employee_id']];
  97. $where[] = ['from', '=', 1];
  98. break;
  99. }
  100. } else {
  101. $where[] = ['del', '=', 0];
  102. $where[] = ['publish', '=', 1];
  103. }
  104. setCondition($param, ['commu_id', 'community_id'], '=', $where);
  105. setCondition($param, 'style_id', '=', $where);
  106. setCondition($param, ['square_start', 'square'], '>=', $where);
  107. setCondition($param, ['square_end', 'square'], '<', $where);
  108. setCondition($param, ['keyword', 'title'], ['like', '%VALUE%'], $where);
  109. setCondition($param, 'housetype_id', '=', $where);
  110. if (!empty($param['id'])) $where[] = ['designer_id', '=', $param['id']];
  111. if (!empty($param['case_type'])) {
  112. if ($param['case_type'] == 1) {
  113. $where[] = ['desc', '<>', ''];
  114. $where[] = ['desc', 'not null',''];
  115. }
  116. if ($param['case_type'] == 2) {
  117. $where[] = ['real_case', '<>', ''];
  118. $where[] = ['real_case', 'not null',''];
  119. }
  120. }
  121. $page = !empty($param['page']) ? $param['page'] : 1;
  122. $limit = !empty($param['limit']) ? $param['limit'] : 15;
  123. $list = MaterialCase::with(['designer' => function ($query) {
  124. $query->field('id,name, headimgurl,addtime');
  125. }, 'community' => function ($query) {
  126. $query->field('id,name');
  127. }, 'decostyle' => function ($query) {
  128. $query->field('id,name');
  129. }])->where($where);
  130. if ($order == 'clue_number' || empty($param['order'])) {
  131. $list = $list->order('recommend desc, addtime desc')->select()->toArray();
  132. } else {
  133. $list = $list->page($page, $limit)->order('recommend desc, ' . $order . ' ' . $desc)->select()->toArray();
  134. }
  135. $collectedIds = UserCollect::where(['user_id' => $this->request->token['uid'], 'content_type' => 'materialCase'])->column('content_id');
  136. $list_ids = array_column($list, 'id');
  137. $clue_number = CustomerClue::where([['pipe_type', '=', 'materialCase'], ['pipe_id', 'in', $list_ids]])->group('pipe_id')->column('count(id) as id_count', 'pipe_id');
  138. foreach ($list as &$item) {
  139. if (in_array($item['id'], $collectedIds)) {
  140. $item['collected'] = true;
  141. } else {
  142. $item['collected'] = false;
  143. }
  144. $item['clue_number'] = isset($clue_number[$item['id']]) ? $clue_number[$item['id']] : 0;
  145. /** -----乐尚企业演示,线索数量进行调整按照分享量的三分之一展示,正式使用系统时删除此代码 ------*/
  146. if(request()->token['root_org'] == 1793) {
  147. $item['clue_number'] = floor($item['shared_times'] > 0 ? $item['shared_times']/3 : 0);
  148. }
  149. /*------------------------------------------------------------------------*/
  150. }
  151. // 排序
  152. if ($order == 'clue_number') {
  153. $sort = $desc == 'desc' ? SORT_DESC : SORT_ASC;
  154. array_multisort(array_column($list, $order), $sort, array_column($list, 'addtime'), SORT_DESC, $list);
  155. $list = array_slice($list, ($page-1) * $limit, $limit);
  156. }
  157. // 默认排序 vr&video->vr->video->article
  158. if (empty($param['order'])){
  159. $new_list['recommend'] = [];
  160. $new_list['vr_video'] = [];
  161. $new_list['vr'] = [];
  162. $new_list['video'] = [];
  163. $new_list['article'] = [];
  164. foreach ($list as $k => $v){
  165. if ($v['recommend'] == 1) {
  166. $new_list['recommend'][] = $v;
  167. }elseif (!empty($v['vr_case']) && !empty($v['video_case'])){
  168. $new_list['vr_video'][] = $v;
  169. } elseif (!empty($v['vr_case'])){
  170. $new_list['vr'][] = $v;
  171. } elseif (!empty($v['video_case'])){
  172. $new_list['video'][] = $v;
  173. } else {
  174. $new_list['article'][] = $v;
  175. }
  176. }
  177. $all_list = [];
  178. foreach ($new_list as $k => $v){
  179. foreach ($v as $vv){
  180. $all_list[] = $vv;
  181. }
  182. }
  183. $list = array_slice($all_list, ($page-1) * $limit, $limit);
  184. }
  185. return json(['code' => 0, 'data' => $list, 'msg' => '获取成功']);
  186. }
  187. /**
  188. * 装修案例
  189. */
  190. public function casedetail()
  191. {
  192. $id = $this->request->param('id');
  193. $token = $this->request->token;
  194. $colected = UserCollect::where(['user_id' => $token['uid'], 'content_type' => 'materialCase', 'content_id' => $id])->count();
  195. $data = MaterialCase::with([
  196. 'community',
  197. 'designer',
  198. 'decostyle',
  199. 'housetype'
  200. ])->where(['id' => $id, 'root_id' => $token['root_org']])->find();
  201. //MaterialCase::where(['id' => $id, 'root_id' => $token['root_org']])->inc('view_times')->update();
  202. $data['collected'] = $colected > 0 ? true : false;
  203. // 关联案例
  204. if (!empty($data['designer_id'])){
  205. $relatedcaselist = MaterialCase::where([['designer_id', '=', $data['designer_id']],['id', '<>', $id], ['root_id', '=', $token['root_org']], ['del', '=', 0], ['publish', '=', 1]])
  206. ->with(['community' => function ($query) {
  207. $query->field('id,name');
  208. }, 'decostyle' => function ($query) {
  209. $query->field('id,name');
  210. }])->page(1, 4)->order('id desc')->select()->each(function ($item) {
  211. $item->clue_number = CustomerClue::where([['pipe_type', '=', 'materialCase'], ['pipe_id', '=', $item['id']]])->count();
  212. })->toArray();
  213. } else {
  214. $relatedcaselist = [];
  215. }
  216. $data['designer_related_cases'] = $relatedcaselist;
  217. //设计师附属字段
  218. if ($data->designer) {
  219. $designer = Designer::where([['employee_id', '=', $data->designer_id], ['root_id', '=', $token['root_org']]])->field('id,good_at,position')->findOrEmpty();
  220. if ($designer->isEmpty()) {
  221. $data->designer->good_at = '';
  222. $data->designer->position = '';
  223. } else {
  224. $data->designer->good_at = !empty($designer->good_at) ? $designer->good_at : '';
  225. $data->designer->position = $designer->position ? $designer->position : '';
  226. }
  227. $data->designer->headimgurl = User::where('id', '=', $data->designer->uid)->value('headimgurl');
  228. }
  229. // 为null处理,防止前端报错
  230. $data['real_case'] = !is_null($data['real_case']) ? $data['real_case'] : '';
  231. $data['desc'] = !is_null($data['desc']) ? $data['desc'] : '';
  232. $data['vr_case'] = !is_null($data['vr_case']) ? $data['vr_case'] : '';
  233. $data['housetype']['name'] = $data->housetype->name;
  234. return json(['code' => 0, 'data' => $data, 'msg' => '获取成功']);
  235. }
  236. /**
  237. * 设计师相关案例
  238. */
  239. public function designercases()
  240. {
  241. $data = input();
  242. //$style_id = $data['style_id'];
  243. $page = $data['page'];
  244. $limit = $data['limit'];
  245. $material_case_id = input('material_case_id', '', 'intval');
  246. if ($material_case_id) {//相关推荐时,去除所查看的案例
  247. $where[] = ['id', '<>', $material_case_id];
  248. }
  249. //$where[] = ['style_id', '=', $style_id];
  250. $designer_id = input('designer_id', '', 'intval');
  251. if ($designer_id) {
  252. $where[] = ['designer_id', '=', $designer_id];
  253. } else {
  254. return json(['code' => 0, 'data' => [], 'msg' => '获取成功']);
  255. }
  256. $where[] = ['root_id', '=', request()->token['root_org']];
  257. $where[] = ['del', '=', 0];
  258. $where[] = ['publish', '=', 1];
  259. $relatedcaselist = MaterialCase::where($where)->with(['community', 'decostyle'])->page($page, $limit)->order('id desc')->select();
  260. return json(['code' => 0, 'data' => $relatedcaselist, 'msg' => '获取成功']);
  261. }
  262. /*
  263. * 口碑见证列表
  264. */
  265. public function evidencelist()
  266. {
  267. $param = $this->request->param();
  268. $param['difference'] = isset($param['difference']) ? $param['difference'] : 0;
  269. $order = (!isset($param['order']) || !$param['order']) ? 'addtime' : $param['order'];
  270. $desc = (!isset($param['desc']) || !$param['desc']) ? 'desc' : $param['desc'];
  271. $order = $order . ' ' . $desc;
  272. $where[] = ['root_id', '=', request()->token['root_org']];
  273. $where[] = ['del', '=', 0];
  274. $where[] = ['publish', '=', 1];
  275. if ($param['difference']) {
  276. $where[] = ['difference', '=', $param['difference']];
  277. }
  278. setCondition($param, 'cate', '=', $where);
  279. setCondition($param, ['keyword', 'title'], ['like', '%VALUE%'], $where);
  280. $page = !empty($param['page']) ? $param['page'] : 1;
  281. $limit = !empty($param['limit']) ? $param['limit'] : 15;
  282. $list = MaterialEvidence::where($where)->limit($limit)->page($page, $limit)->order($order)->select();
  283. $collectedIds = UserCollect::where(['user_id' => $this->request->token['uid'], 'content_type' => 'materialEvidence'])->column('content_id');
  284. foreach ($list as &$item) {
  285. if (in_array($item['id'], $collectedIds)) {
  286. $item['collected'] = true;
  287. } else {
  288. $item['collected'] = false;
  289. }
  290. }
  291. return json(['code' => 0, 'data' => $list, 'msg' => '获取成功']);
  292. }
  293. /*
  294. * 口碑见证详情
  295. */
  296. public function evidencedetail($id)
  297. {
  298. $evidence = MaterialEvidence::where(['id' => $id, 'root_id' => request()->token['root_org']])->find();
  299. //MaterialEvidence::where(['id' => $id, 'root_id' => request()->token['root_org']])->inc('view_times')->update();
  300. if (empty($evidence)) return json(['code' => self::error_msg, 'msg' => '数据不存在']);
  301. // 查询上一条
  302. $lastId = MaterialEvidence::where([['addtime', '>', $evidence->addtime], ['id', '<>', $id], ['root_id', '=', request()->token['root_org']], ['del', '=', 0], ['publish', '=', 1]])
  303. ->order('addtime asc')->value('id');
  304. $nextId = MaterialEvidence::where([['addtime', '<', $evidence->addtime], ['id', '<>', $id], ['root_id', '=', request()->token['root_org']], ['del', '=', 0], ['publish', '=', 1]])
  305. ->order('addtime desc')->value('id');
  306. $colected = UserCollect::where(['user_id' => $this->request->token['uid'], 'content_type' => 'materialEvidence', 'content_id' => $id])->count();
  307. $evidence['collected'] = $colected > 0 ? true : false;
  308. return json(['code' => 0, 'data' => $evidence, 'msg' => '获取成功', 'lastId' => $lastId, 'nextId' => $nextId]);
  309. }
  310. /**
  311. * 口碑见证分类
  312. */
  313. public function evidenceCate()
  314. {
  315. $styleArr = EvidenceCate::where(['root_id' => request()->token['root_org']])->field('id, name')->select();
  316. return json(['code' => 0, 'data' => $styleArr, 'msg' => '获取成功']);
  317. }
  318. /**
  319. * 收藏
  320. */
  321. public function collect()
  322. {
  323. $param = $this->request->param();
  324. $data = [
  325. 'user_id' => $this->request->token['uid'],
  326. 'content_type' => $param['content_type'],
  327. 'content_id' => $param['content_id']
  328. ];
  329. $collect = UserCollect::where($data)->find();
  330. if ($collect) {
  331. $collect->delete();
  332. return json(['code' => 0, 'msg' => '取消收藏']);
  333. } else {
  334. UserCollect::create($data);
  335. return json(['code' => 0, 'msg' => '收藏成功']);
  336. }
  337. }
  338. /**
  339. * 设计师
  340. */
  341. public function designer()
  342. {
  343. //设计师获取
  344. $where = [];
  345. $org_id = input('org_id', '', 'intval');
  346. if ($org_id) {
  347. $where[] = ['org_id', '=', $org_id];
  348. } else {
  349. $w[] = ['path', 'like', $this->request->token['root_org'] . '-%'];
  350. $w[] = ['org_type', '=', 2];
  351. $orgs = Org::where($w)->column('id');
  352. $where[] = ['org_id', 'in', $orgs];
  353. }
  354. $where[] = ['state', '=', '在职'];
  355. $list = Employee::where($where)->field('id,name,headimgurl')->select()->toArray();
  356. return json(['code' => self::success, 'data' => $list]);
  357. }
  358. public function designer_org()
  359. {
  360. //设计师部门获取
  361. $w[] = ['path', 'like', $this->request->token['root_org'] . '-%'];
  362. $w[] = ['org_type', '=', 2];
  363. $orgs = Org::where($w)->field(['id', 'name', 'pid'])->order('pid asc')->select()->toArray();
  364. foreach ($orgs as $k => $v) {
  365. $e_count = Employee::where([['org_id', '=', $v['id'], ['state', '=', '在职']]])->count();
  366. if ($e_count == 0) {
  367. unset($orgs[$k]);
  368. }
  369. }
  370. $orgs = array_values($orgs);
  371. return json(['code' => self::success, 'data' => $orgs]);
  372. }
  373. /**
  374. * 员工添加装修案例
  375. */
  376. public function case_add()
  377. {
  378. $param = $this->request->only(['title', 'community_name', 'community_id', 'designer_id', 'style_id', 'square', 'room', 'hall', 'toilet', 'cover_img', 'desc', 'housetype_id', 'money', 'img_content', 'cover_share_img', 'housetype_type'=>'housetype']);
  379. if (!empty($param['community_name'])) {
  380. //新增小区
  381. if (strlen($param['community_name']) > 45) {
  382. return json(['code' => self::error_msg, 'msg' => '小区名称过长']);
  383. }
  384. $condition[] = ['name', '=', $param['community_name']];
  385. $condition[] = ['type', '=', 0];
  386. $condition[] = ['root_id', '=', $this->request->token['root_org']];
  387. $exitedobj = Community::where($condition)->findorEmpty();
  388. if (!$exitedobj->isEmpty()) {
  389. $param['community_id'] = $exitedobj['id'];
  390. }else{
  391. $pinyin = hanzi2pinyin($param['community_name']);
  392. $community_id = Community::create([
  393. 'root_id' => $this->request->token['root_org'],
  394. 'pinyin' => $pinyin,
  395. 'name' => $param['community_name'],
  396. 'type' => 0,
  397. 'initials' => strtoupper(substr($pinyin, 0, 1)),
  398. 'employee_id'=> request()->token['employee_id']
  399. ]);
  400. $param['community_id'] = $community_id->id;
  401. }
  402. }
  403. if (!empty($param['img_content'])) {
  404. $img_content_data = [];
  405. if (isset($param['img_content'][0]['img'])) {
  406. foreach ($param['img_content'] as $k => $v) {
  407. $img_content_data[$k] = [
  408. 'img' => $v['img'],
  409. 'text' => $v['text']
  410. ];
  411. }
  412. }else{
  413. foreach ($param['img_content'] as $k => $v) {
  414. $img_content_data[$k] = [
  415. 'serverId' => $v['serverId'],
  416. 'text' => $v['text']
  417. ];
  418. }
  419. }
  420. $param['img_content'] = '';
  421. $param['img_download_status'] = 1;
  422. $param['img_content_data'] = json_encode($img_content_data);
  423. }
  424. $param['from'] = 1;
  425. $param['root_id'] = $this->request->token['root_org'];
  426. $param['employee_id'] = $this->request->token['employee_id'];
  427. $param['publish'] = 0;
  428. $result = MaterialCase::create($param);
  429. if ($result) {
  430. $rootOrgId = $this->request->token['root_org'];
  431. $mini = Miniprogram::where([['root_id', '=', $rootOrgId]])->find();
  432. $qrObj = new Qrcode;
  433. $mini_param = [
  434. 'scene' => 'cli=' . $mini['notify'] . '&cid=' . $result->id,
  435. 'page' => 'pages/decorateguidemsg/decorateguidemsg',
  436. 'width' => '280px',
  437. ];
  438. $qr = $qrObj->getUnlimited($mini->accesstoken, $mini_param);
  439. $rs = json_decode($qr, true);
  440. if (!is_null($rs)) {
  441. trace('装修案例二维码生成失败' . ';error:' . $qr, 'error');
  442. }
  443. $path = 'MaterialCaseQrcode/' . uniqid() . '.jpeg';
  444. ossContentUpload($path, $qr);
  445. MaterialCase::where('id', '=', $result->id)->save(['qrcode' => $path]);
  446. Console::call('download', ['material_case']);
  447. return json(['code' => self::success, 'msg' => '添加成功']);
  448. } else {
  449. return json(['code' => self::error_msg, 'msg' => '添加失败']);
  450. }
  451. }
  452. /**
  453. * 装修案例编辑
  454. */
  455. public function case_edit()
  456. {
  457. $param = $this->request->only(['id', 'title', 'community_name', 'community_id', 'designer_id', 'style_id', 'square', 'room', 'hall', 'toilet', 'cover_img', 'desc', 'housetype_id', 'money', 'img_content', 'cover_share_img', 'housetype_type'=>'housetype']);
  458. $find = MaterialCase::find($param['id']);
  459. if (!empty($param['community_name'])) {
  460. //新增小区
  461. if (strlen($param['community_name']) > 18) {
  462. return json(['code' => self::error_msg, 'msg' => '小区名称过长']);
  463. }
  464. $condition = [
  465. ['name', '=', $param['community_name']],
  466. ['type', '=', 0],
  467. ['root_id', '=', $this->request->token['root_org']]
  468. ];
  469. $CommunityId = Community::where($condition)->value('id');
  470. if(empty($CommunityId)) {
  471. $pinyin = hanzi2pinyin($param['community_name']);
  472. $community_id = Community::create([
  473. 'root_id' => $this->request->token['root_org'],
  474. 'pinyin' => $pinyin,
  475. 'name' => $param['community_name'],
  476. 'type' => 0,
  477. 'initials' => strtoupper(substr($pinyin,0,1)),
  478. 'employee_id'=> request()->token['employee_id']
  479. ]);
  480. $param['community_id'] = $community_id->id;
  481. }else{
  482. $param['community_id'] = $CommunityId;
  483. }
  484. }
  485. if (!empty($param['img_content'])) {
  486. $img_content_data = [];
  487. foreach ($param['img_content'] as $k => $v) {
  488. $img_content_data[$k] = [
  489. 'serverId' => $v['serverId'] ?? '',
  490. 'text' => $v['text'],
  491. 'img' => $v['img'] ?? ''
  492. ];
  493. }
  494. $param['img_content'] = '';
  495. $param['img_download_status'] = 1;
  496. $param['img_content_data'] = json_encode($img_content_data);
  497. }
  498. $param['publish'] = 0;
  499. $result = $find->save($param);
  500. Console::call('download', ['material_case']);
  501. if ($result) {
  502. return json(['code' => self::success, 'msg' => '保存成功']);
  503. } else {
  504. return json(['code' => self::error_msg, 'msg' => '保存失败']);
  505. }
  506. }
  507. }