Pushmessage.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\BaseController;
  4. use think\facade\Db;
  5. use think\facade\View;
  6. use think\facade\Session;
  7. use think\App;
  8. use app\wechat\controller\Officialaccount;
  9. class Pushmessage{
  10. protected $Officialaccount;
  11. public function initialize(){
  12. return new Officialaccount();
  13. }
  14. // 通知设置列表
  15. public function index(){
  16. if (request()->isAjax()){
  17. $user_type = get_login_admin('user_type');
  18. $where = array();
  19. if($user_type == -1 || $user_type == -2){
  20. $where = [
  21. 'user_type' => -1,
  22. ];
  23. }
  24. $list = Db::name('PushMessage')->where($where)->select();
  25. // dump($list);
  26. return to_assign(0, '', $list);
  27. } else {
  28. return view();
  29. }
  30. }
  31. // 添加通知设置
  32. public function add(){
  33. $param = get_params();
  34. if(request()->isAjax()){
  35. $data = [
  36. 'title' => $param['title'],
  37. 'is_who' => implode(',', $param['is_who']),
  38. 'is_wechat' => $param['is_wechat'],
  39. 'is_wechat_company' => $param['is_wechat_company'],
  40. 'is_wechat_proprietor' => $param['is_wechat_proprietor'],
  41. 'content' => $param['content'],
  42. 'is_project_name' => $param['is_project_name'],
  43. 'is_people' => $param['is_people'],
  44. 'content_company' => $param['content_company'],
  45. 'is_project_name_company' => $param['is_project_name_company'],
  46. 'is_people_company' => $param['is_people_company'],
  47. 'content_proprietor' => $param['content_proprietor'],
  48. 'is_project_name_proprietor' => $param['is_project_name_proprietor'],
  49. 'is_people_proprietor' => $param['is_people_proprietor'],
  50. // 'rule_id' => $param['rule_id'],
  51. // 'rule_url' => Db::name('AdminRule')->where('id', $param['rule_id'])->value('src'),
  52. 'rule_url' => $param['rule_url'],
  53. 'user_type' => -1,
  54. 'unit_name' => get_login_admin('unit_name'),
  55. 'pid' => $param['pid'],
  56. ];
  57. if(isset( $param['title_company'])){
  58. $data['title_company'] = $param['title_company'];
  59. }
  60. if(isset( $param['title_proprietor'])){
  61. $data['title_proprietor'] = $param['title_proprietor'];
  62. }
  63. // halt($data);
  64. if($data['rule_url'] != NULL){
  65. $rule_url = Db::name('PushMessage')->where('rule_url', $data['rule_url'])->find();
  66. if($rule_url != NULL){
  67. return to_assgin(1, "已存在该通知阶段");
  68. }
  69. }
  70. Db::startTrans();
  71. try {
  72. $uid = Db::name('PushMessage')->strict(false)->field(true)->insertGetId($data);
  73. add_log('add', $uid, $data);
  74. // 提交事务
  75. Db::commit();
  76. }catch(\Exception $e){
  77. // 回滚事务
  78. Db::rollback();
  79. return to_assign(1, '提交失败:' . $e->getMessage());
  80. }
  81. return to_assign(0,"操作成功");
  82. }else{
  83. $pid = isset($param['pid']) ? $param['pid'] : 0;
  84. $user_type = get_login_admin('user_type');
  85. $push_message = Db::name('PushMessage')->where('user_type', -1)->select()->toArray();
  86. $push_message = set_recursion($push_message);
  87. $rule = Db::name('adminRule')->order('sort asc,id asc')->select();
  88. $rule = set_recursion($rule);
  89. View::assign('push_message', $push_message);
  90. View::assign('rule', $rule);
  91. View::assign('pid', $pid);
  92. return view();
  93. }
  94. }
  95. //编辑通知设置
  96. public function edit(){
  97. $param = get_params();
  98. // halt($param);
  99. if(request()->isAjax()){
  100. $arr = array();
  101. if(isset($param['is_cost'])){
  102. $arr[0] = 0;
  103. }
  104. if(isset($param['is_owner'])){
  105. $arr[1] = 1;
  106. }
  107. if(isset($param['is_company'])){
  108. $arr[2] = 2;
  109. }
  110. $param['is_who'] = implode(',', $arr);
  111. // halt($param);
  112. $data = [
  113. 'id' => $param['id'],
  114. 'title' => $param['title'],
  115. 'title_company' => $param['title_company'],
  116. 'title_proprietor' => $param['title_proprietor'],
  117. 'is_who' => $param['is_who'],
  118. 'is_wechat' => $param['is_wechat'],
  119. 'is_wechat_company' => $param['is_wechat_company'],
  120. 'is_wechat_proprietor' => $param['is_wechat_proprietor'],
  121. 'content' => $param['content'],
  122. 'is_project_name' => $param['is_project_name'],
  123. 'is_people' => $param['is_people'],
  124. 'content_company' => $param['content_company'],
  125. 'is_project_name_company' => $param['is_project_name_company'],
  126. 'is_people_company' => $param['is_people_company'],
  127. 'content_proprietor' => $param['content_proprietor'],
  128. 'is_project_name_proprietor' => $param['is_project_name_proprietor'],
  129. 'is_people_proprietor' => $param['is_people_proprietor'],
  130. 'rule_url' => $param['rule_url'],
  131. 'user_type' => -1,
  132. 'unit_name' => get_login_admin('unit_name'),
  133. 'pid' => $param['pid'],
  134. ];
  135. if($data['rule_url'] != NULL){
  136. if($data['rule_url'] != Db::name('PushMessage')->where('id', $data['id'])->value('rule_url')){
  137. $rule_url = Db::name('PushMessage')->where('rule_url', $data['rule_url'])->find();
  138. if($rule_url != NULL){
  139. return to_assign(1, "已存在该通知阶段");
  140. }
  141. }
  142. }
  143. // halt($data);
  144. Db::startTrans();
  145. try {
  146. Db::name('PushMessage')->strict(false)->field(true)->update($data);
  147. add_log('add', $param['id'], $data);
  148. // 提交事务
  149. Db::commit();
  150. }catch(\Exception $e){
  151. // 回滚事务
  152. Db::rollback();
  153. return to_assign(1, '提交失败:' . $e->getMessage());
  154. }
  155. return to_assign(0,"操作成功");
  156. }else{
  157. $id = $param['id'];
  158. $data = Db::name('PushMessage')->where('id', $id)->find();
  159. $data['is_who'] = explode(',', $data['is_who']);
  160. // dump($data);
  161. if(in_array(0, $data['is_who'])){ // 财政局
  162. $data['is_cost'] = 1;
  163. }else{
  164. $data['is_cost'] = 0;
  165. }
  166. if(in_array(1, $data['is_who'])){ // 业主
  167. $data['is_owner'] = 1;
  168. }else{
  169. $data['is_owner'] = 0;
  170. }
  171. if(in_array(2, $data['is_who'])){ // 公司
  172. $data['is_company'] = 1;
  173. }else{
  174. $data['is_company'] = 0;
  175. }
  176. $push_message = Db::name('PushMessage')->where('user_type', -1)->select()->toArray();
  177. $push_message = set_recursion($push_message);
  178. $rule = Db::name('AdminRule')->order('sort asc,id asc')->select();
  179. $rule = set_recursion($rule);
  180. View::assign('data', $data);
  181. View::assign('push_message', $push_message);
  182. View::assign('rule', $rule);
  183. return view();
  184. }
  185. }
  186. // 删除通知设置
  187. public function delete(){
  188. $id = get_params('id');
  189. $count = Db::name('PushMessage')->where('pid', '=', $id)->count();
  190. if ($count > 0) {
  191. return to_assign(1, "该通知设置下还有子设置,无法删除");
  192. }
  193. if (Db::name('PushMessage')->delete($id) !== false) {
  194. add_log('delete', $id);
  195. return to_assign(0, "删除通知设置成功");
  196. } else {
  197. return to_assign(1, "删除失败");
  198. }
  199. // $is_who = [
  200. // 'cai','gongi',' yezhu'
  201. // ];
  202. // $is_who = [
  203. // 'cai','gongi'
  204. // ];
  205. // $is_who = [
  206. // 'cai'=> 0,
  207. // 'gongi'=> 1,
  208. // ];
  209. }
  210. /**
  211. * $url: 方法URL
  212. * $project_id:项目ID int
  213. * $financial:财政局人员 array
  214. * [1,2,3]
  215. * [
  216. * 0 => 1,
  217. * 1 => 2,
  218. * ];
  219. * $company:公司人员 [1,2,3] array
  220. * $proprietor:业主人员 [1,2,3] array
  221. * $new_url:用于新的内容设置
  222. */
  223. public function pushMessage($project_id, $financial = NULL, $company = NULL, $proprietor = NULL, $new_url = NULL){
  224. if($new_url == NULL){
  225. $url = (string) \think\facade\Route::buildUrl();
  226. $url = self::handleUrl($url);
  227. }else{
  228. $url = $new_url;
  229. }
  230. $push = Db::name('PushMessage')->where('rule_url', $url)->find();
  231. // 通知成员
  232. // $project_id
  233. $message_id = $push['id'];
  234. // 抄送成员
  235. $member = Db::name('PushMember')->where('message_id', $message_id)->where('unit_name', get_login_admin('unit_name'))->value('member_id');
  236. if(get_login_admin('user_type') == 0){
  237. if(!empty($financial)){
  238. // $financial = array_unique(array_merge(explode(',', $member), $financial));
  239. $member = self::inform_send($financial, $member);
  240. }
  241. }else if(get_login_admin('user_type') == 2){
  242. if(!empty($company)){
  243. // $company = array_unique(array_merge(explode(',', $member), $company));
  244. $member = self::inform_send($company, $member);
  245. }
  246. }else if(get_login_admin('user_type') == 1){
  247. $member = self::inform_send($proprietor, $member);
  248. }else{
  249. return 0;
  250. }
  251. if($financial != NULL){
  252. // halt($financial);
  253. if($push['content'] != NULL){ // 财政局
  254. $content = self::handleContent($push, $project_id);
  255. self::webPush($content, $project_id, $financial);
  256. // dump($financial, $content);
  257. if($push['is_wechat'] == 1){
  258. self::initialize()->sendText($financial, $content);
  259. }
  260. if($member != NULL){
  261. $str = '';
  262. for($i = 0; $i <count($financial); $i++){
  263. if($i < count($financial) - 1){
  264. $str = $str . Db::name('Admin')->where('id', $financial[$i])->value('nickname') . ',';
  265. }else{
  266. $str = $str . Db::name('Admin')->where('id', $financial[$i])->value('nickname');
  267. }
  268. }
  269. $content = str_replace('您', $str, $content);
  270. self::webPush($content, $project_id, $member);
  271. // dump($financial, $content);
  272. if($push['is_wechat'] == 1){
  273. self::initialize()->sendText($member, $content);
  274. }
  275. }
  276. }
  277. }
  278. if($proprietor != NULL){
  279. if($push['content_proprietor'] != NULL){ //公司
  280. $content_proprietor = self::handleContent_proprietor($push, $project_id);
  281. self::webPush($content_proprietor, $project_id, $proprietor);
  282. if($push['is_wechat_proprietor'] == 1){
  283. self::initialize()->sendText($proprietor, $content_proprietor);
  284. }
  285. if($member != NULL){
  286. $str = '';
  287. for($i = 0; $i <count($proprietor); $i++){
  288. if($i < count($proprietor) - 1){
  289. $str = $str . Db::name('Admin')->where('id', $proprietor[$i])->value('nickname') . ',';
  290. }else{
  291. $str = $str . Db::name('Admin')->where('id', $proprietor[$i])->value('nickname');
  292. }
  293. }
  294. $content = str_replace('您', $str, $content);
  295. self::webPush($content, $project_id, $member);
  296. // dump($financial, $content);
  297. if($push['is_wechat'] == 1){
  298. self::initialize()->sendText($member, $content);
  299. }
  300. }
  301. }
  302. }
  303. if($company != NULL){
  304. if($push['content_company'] != NULL){ //公司
  305. $content_company = self::handleContent_company($push, $project_id);
  306. self::webPush($content_company, $project_id, $company);
  307. if($push['is_wechat_company'] == 1){
  308. self::initialize()->sendText($company, $content_company);
  309. }
  310. if($member != NULL){
  311. $str = '';
  312. for($i = 0; $i <count($company); $i++){
  313. if($i < count($company) - 1){
  314. $str = $str . Db::name('Admin')->where('id', $company[$i])->value('nickname') . ',';
  315. }else{
  316. $str = $str . Db::name('Admin')->where('id', $company[$i])->value('nickname');
  317. }
  318. }
  319. $content = str_replace('您', $str, $content);
  320. self::webPush($content, $project_id, $member);
  321. // dump($financial, $content);
  322. if($push['is_wechat'] == 1){
  323. self::initialize()->sendText($member, $content);
  324. }
  325. }
  326. }
  327. }
  328. }
  329. // 网页通知
  330. public function webPush($content, $project_id, $uid){
  331. $uid = (array)$uid;
  332. for($i = 0; $i < count($uid); $i++){
  333. $data = [
  334. 'content' => $content,
  335. 'project_id' => $project_id,
  336. 'uid' => $uid[$i],
  337. 'create_time' => time(),
  338. ];
  339. $newId = Db::name('ProjectMsg')->strict(false)->field(true)->insertGetId($data);
  340. $unread = (string) Db::name('Admin')->where('id', $uid[$i])->value('unread');
  341. $unread = $unread . ',' . $newId;
  342. Db::name('Admin')->where('id', $uid[$i])->update(['unread' => $unread]);
  343. }
  344. }
  345. public function handleContent($push, $project_id){
  346. if(!is_array ($project_id)){
  347. $project_id = (array)$project_id;
  348. }
  349. $content = $push['content'];
  350. if($push['is_project_name'] == 0 && $push['is_people'] == NULL){
  351. $is_project_name = '';
  352. $people = '';
  353. }else if($push['is_project_name'] == 1 && $push['is_people'] == NULL){
  354. $is_project_name = '项目名称' . ':';
  355. for($i = 0; $i < count($project_id); $i++){
  356. if($i < count($project_id) - 1){
  357. $is_project_name = $is_project_name . Db::name('CostProject')->where('id', $project_id[$i])->value('project_name') . ',';
  358. continue;
  359. }
  360. $is_project_name = $is_project_name . Db::name('CostProject')->where('id', $project_id[$i])->value('project_name') . '。';
  361. }
  362. $people = '';
  363. }else if($push['is_project_name'] == 0 && $push['is_people'] != NULL){
  364. $is_project_name = '';
  365. $people = $push['is_people'] . ':' . get_login_admin('nickname') . '。';
  366. }else{
  367. $is_project_name = '项目名称' . ':';
  368. for($i = 0; $i < count($project_id); $i++){
  369. if($i < count($project_id) - 1){
  370. $is_project_name = $is_project_name . Db::name('CostProject')->where('id', $project_id[$i])->value('project_name') . ',';
  371. continue;
  372. }
  373. $is_project_name = $is_project_name . Db::name('CostProject')->where('id', $project_id[$i])->value('project_name') . '。';
  374. }
  375. $people = $push['is_people'] . ':' . get_login_admin('nickname') . '。';
  376. }
  377. if($push['is_people'] != NULL){
  378. $str = '“' . $push['is_people'] . '”';
  379. if(mb_strpos($content, $str) !== false){
  380. $content = str_replace($str, get_login_admin('nickname'), $content);
  381. }
  382. }
  383. $str = "“公司”";
  384. if(mb_strpos($content, $str) !== false){
  385. $company_name = Db::name('Department')->where('id', get_login_admin('unit_name'))->value('title');
  386. $content = str_replace($str, $company_name, $content);
  387. }
  388. $content = $content . "\n". $is_project_name . "\n". $people;
  389. return $content;
  390. }
  391. public function handleContent_proprietor($push, $project_id){
  392. if(!is_array ($project_id)){
  393. $project_id = (array)$project_id;
  394. }
  395. $content_proprietor = $push['content_proprietor'];
  396. if($push['is_project_name_proprietor'] == 0 && $push['is_people_proprietor'] == NULL){
  397. $is_project_name_proprietor = '';
  398. $people_proprietor = '';
  399. }else if($push['is_project_name_proprietor'] == 1 && $push['is_people_proprietor'] == NULL){
  400. $is_project_name_proprietor = '项目名称' . ':';
  401. for($i = 0; $i < count($project_id); $i++){
  402. if($i < count($project_id) - 1){
  403. $is_project_name_proprietor = $is_project_name_proprietor . Db::name('CostProject')->where('id', $project_id[$i])->value('project_name') . ',';
  404. continue;
  405. }
  406. $is_project_name_proprietor = $is_project_name_proprietor . Db::name('CostProject')->where('id', $project_id[$i])->value('project_name') . '。';
  407. }
  408. // $is_project_name_company = '项目名称' . ':' . Db::name('CostProject')->where('id', $project_id)->value('project_name') . '。';
  409. $people_proprietor = '';
  410. }else if($push['is_project_name_proprietor'] == 0 && $push['is_people_proprietor'] != NULL){
  411. $is_project_name_proprietor = '';
  412. $people_proprietor = $push['is_people_proprietor'] . ':' . get_login_admin('nickname') . '。';
  413. }else{
  414. $is_project_name_proprietor = '项目名称' . ':';
  415. for($i = 0; $i < count($project_id); $i++){
  416. if($i < count($project_id) - 1){
  417. $is_project_name_proprietor = $is_project_name_proprietor . Db::name('CostProject')->where('id', $project_id[$i])->value('project_name') . ',';
  418. continue;
  419. }
  420. $is_project_name_proprietor = $is_project_name_proprietor . Db::name('CostProject')->where('id', $project_id[$i])->value('project_name') . '。';
  421. }
  422. // $is_project_name_company = '项目名称' . ':' . Db::name('CostProject')->where('id', $project_id)->value('project_name') . '。';
  423. $people_proprietor = $push['is_people_proprietor'] . ':' . get_login_admin('nickname') . '。';
  424. }
  425. if($push['is_people_proprietor'] != NULL){
  426. $str = '“' . $push['is_people_proprietor'] . '”';
  427. if(mb_strpos($content_proprietor, $str) !== false){
  428. $content_proprietor = str_replace($str, get_login_admin('nickname'), $content_proprietor);
  429. }
  430. }
  431. $str = "“公司”";
  432. if(mb_strpos($content_proprietor, $str) !== false){
  433. $company_name = Db::name('Department')->where('id', get_login_admin('unit_name'))->value('title');
  434. $content_proprietor = str_replace($str, $company_name, $content_proprietor);
  435. }
  436. $content_proprietor = $content_proprietor . "\n". $is_project_name_proprietor . "\n". $people_proprietor;
  437. return $content_proprietor;
  438. }
  439. public function handleContent_company($push, $project_id){
  440. if(!is_array ($project_id)){
  441. $project_id = (array)$project_id;
  442. }
  443. $content_company = $push['content_company'];
  444. if($push['is_project_name_company'] == 0 && $push['is_people_company'] == NULL){
  445. $is_project_name_company = '';
  446. $people_company = '';
  447. }else if($push['is_project_name_company'] == 1 && $push['is_people_company'] == NULL){
  448. $is_project_name_company = '项目名称' . ':';
  449. for($i = 0; $i < count($project_id); $i++){
  450. if($i < count($project_id) - 1){
  451. $is_project_name_company = $is_project_name_company . Db::name('CostProject')->where('id', $project_id[$i])->value('project_name') . ',';
  452. continue;
  453. }
  454. $is_project_name_company = $is_project_name_company . Db::name('CostProject')->where('id', $project_id[$i])->value('project_name') . '。';
  455. }
  456. // $is_project_name_company = '项目名称' . ':' . Db::name('CostProject')->where('id', $project_id)->value('project_name') . '。';
  457. $people_company = '';
  458. }else if($push['is_project_name_company'] == 0 && $push['is_people_company'] != NULL){
  459. $is_project_name_company = '';
  460. $people_company = $push['is_people_company'] . ':' . get_login_admin('nickname') . '。';
  461. }else{
  462. $is_project_name_company = '项目名称' . ':';
  463. for($i = 0; $i < count($project_id); $i++){
  464. if($i < count($project_id) - 1){
  465. $is_project_name_company = $is_project_name_company . Db::name('CostProject')->where('id', $project_id[$i])->value('project_name') . ',';
  466. continue;
  467. }
  468. $is_project_name_company = $is_project_name_company . Db::name('CostProject')->where('id', $project_id[$i])->value('project_name') . '。';
  469. }
  470. // $is_project_name_company = '项目名称' . ':' . Db::name('CostProject')->where('id', $project_id)->value('project_name') . '。';
  471. $people_company = $push['is_people_company'] . ':' . get_login_admin('nickname') . '。';
  472. }
  473. if($push['is_people_company'] != NULL){
  474. $str = '“' . $push['is_people_company'] . '”';
  475. if(mb_strpos($content_company, $str) !== false){
  476. $content_company = str_replace($str, get_login_admin('nickname'), $content_company);
  477. }
  478. }
  479. $str = "“公司”";
  480. if(mb_strpos($content_company, $str) !== false){
  481. $company_name = Db::name('Department')->where('id', get_login_admin('unit_name'))->value('title');
  482. $content_company = str_replace($str, $company_name, $content_company);
  483. }
  484. $content_company = $content_company . "\n". $is_project_name_company . "\n". $people_company;
  485. return $content_company;
  486. }
  487. public function handleUrl($url){
  488. $url = substr($url, 1);
  489. $url = strtolower($url);
  490. return $url;
  491. }
  492. public function handleId($notify){
  493. $idList = [];
  494. foreach($notify as $key => $value){
  495. $idList[$key] = $notify[$key]['id'];
  496. }
  497. // $idList = explode(',', $idList);
  498. return $idList;
  499. }
  500. public function handleParam($param){
  501. if (isset($param["financial"])) {
  502. $financial = $param['financial'];
  503. unset($param['financial']);
  504. $financial = self::handleId($financial);
  505. }else{
  506. $financial = NULL;
  507. }
  508. if(isset($param["company"])){
  509. $company = $param['company'];
  510. unset($param['company']);
  511. $company = self::handleId($company);
  512. }else{
  513. $company = NULL;
  514. }
  515. $data = [
  516. 'param' => $param,
  517. 'financial' => $financial,
  518. 'company' => $company,
  519. ];
  520. return $data;
  521. }
  522. // 抄送成员去除通知成员
  523. // $inform 通知成员
  524. // $member 抄送成员
  525. public function inform_send($inform, $member){
  526. // public function inform_send(){
  527. // $inform = [
  528. // 0 => 1,
  529. // 1 => 2,
  530. // ];
  531. // $member = [
  532. // // 0 => 3,
  533. // // 1 => 2,
  534. // // 2 => 6,
  535. // ];
  536. $a = 0;
  537. $b = 0;
  538. if(!empty($inform)){
  539. $a = count((array)$inform);
  540. $inform = (array)$inform;
  541. }
  542. if(!empty($member)){
  543. $b = count((array)$member);
  544. $member = (array)$member;
  545. }
  546. for($i = 0; $i < $a; $i++){
  547. for($j = 0; $j < $b; $j++){
  548. if($inform[$i] == $member[$j]){
  549. unset($member[$j]);
  550. }
  551. }
  552. }
  553. if(!empty($member)){
  554. $member = array_values($member);
  555. }
  556. // if($member ==null){
  557. // dump('111');
  558. // }else{
  559. // dump('222');
  560. // }
  561. // halt($member);
  562. return $member;
  563. }
  564. public function test(){
  565. dump(self::test1([]));
  566. }
  567. public function test1($a = NULL){
  568. if($a == NULL){
  569. return NULL;
  570. }else{
  571. return "!!!";
  572. }
  573. }
  574. }