Appoint.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. <?php
  2. namespace Work\lib;
  3. use Dever;
  4. Class Appoint
  5. {
  6. public function startBranch($id,$name,$data)
  7. {
  8. // Dever::config('base')->hook = true;
  9. $group = Dever::param('group',$data);
  10. // $id = Dever::param('id',$data);
  11. if ($group) {
  12. $res = Dever::db('work/branch')->find(array('group_id'=>$group[0]));
  13. if ($res && isset($id['where_id']) && $id['where_id']){
  14. if ($res['id'] != $id['where_id']){
  15. Dever::alert('部门已存在');
  16. }
  17. } elseif ($res) {
  18. Dever::alert('部门已存在');
  19. }
  20. }
  21. }
  22. public function updateBranch($id,$name,$data)
  23. {
  24. // Dever::config('base')->hook = true;
  25. $group = Dever::param('group',$data);
  26. if($group) {
  27. $where['where_id'] = $id;
  28. $where['group_id'] = $group[0];
  29. Dever::db('work/branch')->update($where);
  30. }
  31. }
  32. public function insertAppoint($id,$name,$data)
  33. {
  34. $admin = Dever::load("manage/auth.info");
  35. $info_id = Dever::param('info_id',$data);
  36. if ($info_id) {
  37. $info = Dever::db('work/info')->find($info_id);
  38. // print_R($info);die;
  39. // if ($info['appoint_id'] != $admin['id'] && $admin['id'] != $info['audit_admin']) {
  40. // Dever::alert('reload');
  41. // }
  42. if ($info['status']>=3){
  43. Dever::alert('reload');
  44. }
  45. }
  46. }
  47. public function updateAppoint($id,$name,$data)
  48. {
  49. Dever::config('base')->hook = true;
  50. $info_id = Dever::param('info_id',$data);
  51. $branch = Dever::param('admin_id',$data);
  52. $email = Dever::param('email',$data);
  53. if ($info_id ) {
  54. $info = Dever::db('work/info')->find($info_id);
  55. $admin = Dever::load('manage/auth.info');
  56. $admin_id = $info['audit_admin'];
  57. if ($info['audit_admin'] != $admin['id']) {
  58. $admin_id = $admin['id'];
  59. }
  60. if($info) {
  61. if ($branch) {
  62. $i['where_id'] = $info['id'];
  63. // if ($info['group']) {
  64. // $group = $info['group'].',';
  65. // } else {
  66. $group = $branch[0];
  67. // }
  68. if (isset($branch[1]) && $branch[1]) {
  69. $i['appoint_id'] = $branch[1];
  70. }
  71. $i['group'] = $group;
  72. $i['zdate'] = time();
  73. $i['chdate'] = time();
  74. $i['status'] = 2;
  75. if ($i) {
  76. Dever::db('work/info')->update($i);
  77. }
  78. }
  79. $w['info_id'] = $info['id'];
  80. $w['admin_id'] = $admin_id;
  81. $w['appoint_id'] = $id;
  82. if (isset($branch[1]) && $branch[1]) {
  83. $w['app_admin_id'] = $branch[1];
  84. }
  85. Dever::db('work/info_log')->insert($w);
  86. }
  87. if ($branch) {
  88. // $data = Dever::db('work/branch')->find(array('group_id'=>$branch[0]));
  89. // if ($data) {
  90. // $where['where_id'] = $data['id'];
  91. // $where['num'] = $data['num'] +1;
  92. // Dever::db('work/branch')->update($where);
  93. // }
  94. $wh['where_id'] = $id;
  95. $wh['group'] = $branch[0];
  96. if(isset($branch[1]) && $branch[1]) {
  97. $wh['admin'] = $branch[1];
  98. }
  99. Dever::db('work/appoint')->update($wh);
  100. }
  101. if ($email && $email == 2) {
  102. $admin = Dever::db('manage/admin')->find($branch['1']);
  103. $res = Dever::load('work/lib/manage')->getTotal($admin['id'],'1,2');
  104. $work_list =Dever::url('project/database/list?project=work&table=info&search_option_dever_auth=2&search_option_state=1&[refer]', 'manage');
  105. $url = Dever::url('home?link=' . urlencode($work_list) . '&group=10&parent_menu=work&menu=work.my' , 'manage');
  106. // $url =
  107. $content = '你有'.$res.'个待处理工单,<a href="'.$url.'">点此跳转至工单系统查看</a>';
  108. Dever::load('work/lib/cron')->send($admin['email'],$admin['username'],'你有新的工单待处理',$content);
  109. }
  110. }
  111. }
  112. #指派人
  113. private $default = array
  114. (
  115. 'value' => -1,
  116. 'name' => '不选择',
  117. );
  118. private $search_default = array
  119. (
  120. 'value' => -1,
  121. 'name' => '部门',
  122. );
  123. public function get_api()
  124. {
  125. $type = Dever::input('type', 2);
  126. # 联动总数,默认到部门
  127. $level_total = Dever::input('level_total', 1);
  128. # 当前联动级别
  129. $level_num = Dever::input('level_num');
  130. # 一般为id
  131. $level_id = Dever::input('level_id');
  132. # 是否是搜索列表页
  133. $level_search = Dever::input('level_search');
  134. if ($level_search) {
  135. $default = $this->search_default;
  136. if ($level_num == 1) {
  137. $default['name'] = '部门选择';
  138. } elseif ($level_num == 2) {
  139. $default['name'] = '组员选择';
  140. }
  141. } else {
  142. // echo 11;
  143. $default = $this->default;
  144. }
  145. // if ($level_id < 0) {
  146. // Dever::alert('error');
  147. // }
  148. if ($level_num == 1) {
  149. $data = $this->group();
  150. } elseif ($level_num == 2) {
  151. $data = $this->group_admin($level_id, $type);
  152. }
  153. if (!$data) {
  154. Dever::alert('error');
  155. }
  156. if ($level_search || $level_num >= 1) {
  157. array_unshift($data, $default);
  158. }
  159. if ($level_num == 2) {
  160. unset($data[0]);
  161. }
  162. $result['level_total'] = $level_total;
  163. $result['list'] = $data;
  164. return $result;
  165. }
  166. public function group(){
  167. $data = Dever::load('manage/company')->getGroup();
  168. foreach ($data as $k => $v) {
  169. $data[$k]['value'] = $v['id'];
  170. }
  171. return $data;
  172. }
  173. public function group_admin($level_id, $type = 1){
  174. $admin_id = false;
  175. if ($type == 2) {
  176. $info = Dever::db('work/branch')->find(array('group_id' => $level_id));
  177. if ($info) {
  178. $temp = explode(',', $info['group']);
  179. $admin_id = $temp[1] . ',' . $info['coor'];
  180. }
  181. }
  182. $data = Dever::load('manage/company')->getAdmin($level_id, false, $admin_id);
  183. foreach ($data as $k => $v) {
  184. foreach ($v as $k1 => $v1) {
  185. $data[$k]['value'] = $v['id'];
  186. $data[$k]['name'] = $v['username'];
  187. }
  188. }
  189. return $data;
  190. }
  191. #问题
  192. private $cdefault = array
  193. (
  194. 'value' => -1,
  195. 'name' => '不选择',
  196. );
  197. private $search_cdefault = array
  198. (
  199. 'value' => -1,
  200. 'name' => '问题类型描述',
  201. );
  202. #问题类型联动
  203. public function getCate_api()
  204. {
  205. # 联动总数,默认到部门
  206. $level_total = Dever::input('level_total', 1);
  207. # 当前联动级别
  208. $level_num = Dever::input('level_num');
  209. # 一般为id
  210. $level_id = Dever::input('level_id');
  211. # 是否是搜索列表页
  212. $level_search = Dever::input('level_search');
  213. if ($level_search) {
  214. $default = $this->search_cdefault;
  215. if ($level_num == 1) {
  216. $default['name'] = '问题分类名称';
  217. } elseif ($level_num == 2) {
  218. $default['name'] = '问题类型描述';
  219. }
  220. } else {
  221. $default = $this->cdefault;
  222. }
  223. if ($level_num == 1) {
  224. $data = Dever::db('work/q_cate')->getSearchAll();
  225. } elseif ($level_num == 2) {
  226. $data = Dever::db('work/question')->getSearchAll(array('cate_id'=>$level_id));
  227. }
  228. if (!$data) {
  229. Dever::alert('error');
  230. }
  231. if ($level_search || $level_num >= 1) {
  232. array_unshift($data, $default);
  233. }
  234. $result['level_total'] = $level_total;
  235. if ($level_num == 2) {
  236. unset($data[0]);
  237. }
  238. $result['list'] = $data;
  239. return $result;
  240. }
  241. public function show_api()
  242. {
  243. $info_id = Dever::input('id');
  244. $data['info'] = Dever::db('work/info')->find($info_id);
  245. $ztime = $data['info']['cdate'];
  246. $data['info']['cdate'] = date('Y-m-d H:i',$data['info']['cdate']);
  247. $priority = Dever::db('work/priority')->find($data['info']['priority_id']);
  248. $data['info']['priority_name'] = $priority['name'];
  249. $data['info']['color'] = $priority['color'];
  250. $admin = Dever::db('manage/admin')->find($data['info']['audit_admin']);
  251. // print_R($admin);die;
  252. $admin['group'] = explode(',',$admin['group']);
  253. foreach ($admin['group'] as $k => $v) {
  254. $group = Dever::db('manage/group')->find(array('company_id'=>$data['info']['company_id'],'id'=>$v));
  255. }
  256. $data['info']['admin'] = $group['name'].' / '.$admin['username'];
  257. if ($data['info']['source']) {
  258. $source = Dever::db('work/q_source')->find($data['info']['source']);
  259. if ($source) {
  260. $data['info']['source_name'] = $source['name'];
  261. }
  262. }
  263. if ($data['info']['branch_id']) {
  264. $branch_id = explode(',',$data['info']['branch_id']);
  265. if (isset($branch_id[0]) && $branch_id[0]>0) {
  266. $group = Dever::db('manage/group')->find($branch_id[0]);
  267. $data['info']['branch_name'] = '指派人:'.$group['name'];
  268. }
  269. if (isset($branch_id[1]) && $branch_id[1]>0) {
  270. $admin = Dever::db('manage/admin')->find($branch_id[1]);
  271. $data['info']['branch_name'] = $data['info']['branch_name'].' / '.$admin['username'];
  272. }
  273. }
  274. $data['info']['role_name'] = '';
  275. $data['info']['idcard'] = '';
  276. $user = Dever::db('work/user')->find(array('mobile'=>$data['info']['mobile']));
  277. if ($user) {
  278. $data['info']['user_name'] = $user['name'];
  279. $data['info']['mobile'] = $user['mobile'];
  280. if(isset($user['idcard']) && $user['idcard']) {
  281. $data['info']['idcard'] = '身份证号码:'.$user['idcard'];
  282. }
  283. if ($user['agent_uid'] && $user['agent_uid']>0) {
  284. $member = Dever::db('agent/member')->find($user['agent_uid']);
  285. if ($member && $member['role']) {
  286. $role = Dever::db('setting/role')->find($member['role']);
  287. if ($role) {
  288. $data['info']['role_name'] = '代理商角色:'.$role['name'];
  289. }
  290. }
  291. }
  292. }
  293. $data['info']['cate_name'] = '';
  294. $data['info']['product_name'] = '';
  295. $data['info']['question_name'] ='';
  296. if ($data['info']['cate_id']) {
  297. $cate_id = explode(',',$data['info']['cate_id']);
  298. if (isset($cate_id[0]) && $cate_id[0]) {
  299. $cate = Dever::db('work/q_cate')->find($cate_id[0]);
  300. if ($cate) {
  301. $data['info']['cate_name'] = $cate['name'];
  302. }
  303. } else {
  304. $cate = array();
  305. }
  306. if (isset($cate_id[1]) && $cate_id[1]) {
  307. $question = Dever::db('work/question')->find($cate_id[1]);
  308. if ($question) {
  309. $product = Dever::db('work/product')->find($question['product_id']);
  310. if ($product) {
  311. $data['info']['product_name'] = $product['name'];
  312. }
  313. $data['info']['question_name'] = $question['name'];
  314. }
  315. } else {
  316. $question = array();
  317. }
  318. if ($data['info']['cate_name'] && $data['info']['question_name']) {
  319. $data['info']['cate_name'] = $data['info']['cate_name'].' / '.$data['info']['question_name'];
  320. }
  321. }
  322. if ($data['info']['pic']) {
  323. $data['info']['pic'] = explode(',',$data['info']['pic']);
  324. }
  325. $data['info_log'] = Dever::db('work/info_log')->getAll(array('info_id'=>$info_id));
  326. foreach ($data['info_log'] as $k => $v) {
  327. $data['info_log'][$k]['admin_group'] = '';
  328. $data['info_log'][$k]['cdate'] = date('Y-m-d H:i:s',$v['cdate']);
  329. $admin = Dever::db('manage/admin')->find($v['admin_id']);
  330. $admin['group'] = explode(',',$admin['group']);
  331. if (isset($admin['group']) && $admin['group']) {
  332. foreach ($admin['group'] as $k1 => $v1) {
  333. $admin_group = Dever::db('manage/group')->find(array('company_id'=>$data['info']['company_id'],'id'=>$v1));
  334. if ($admin_group) {
  335. $data['info_log'][$k]['admin_group'] = $admin_group['name'].' / '.$admin['username'];
  336. }
  337. }
  338. }
  339. $appoint = Dever::db('work/appoint')->find($v['appoint_id']);
  340. if (isset($appoint) && $appoint) {
  341. $data['info_log'][$k]['desc'] = $appoint['desc'];
  342. $appoint_admin = explode(',',$appoint['admin_id']);
  343. if (isset($appoint_admin[0])) {
  344. $appoint_group = Dever::db('manage/group')->find($appoint_admin[0]);
  345. } else {
  346. $appoint_group = array();
  347. }
  348. if (isset($appoint_admin[1]) && $appoint_admin[1]) {
  349. $appoint_ad = Dever::db('manage/admin')->find($appoint_admin[1]);
  350. } else {
  351. $appoint_ad = array();
  352. }
  353. if ($appoint_group && $appoint_ad) {
  354. $data['info_log'][$k]['appoint_admin'] = '指派人:'. $appoint_group['name'].' / '.$appoint_ad['username'];
  355. }
  356. }
  357. $data['info_log'][$k]['image'] = '';
  358. if ($appoint['video']) {
  359. $data['info_log'][$k]['video'] = $appoint['video'];
  360. }
  361. if ($appoint['pic']) {
  362. $data['info_log'][$k]['pic'] = explode(',',$appoint['pic']);
  363. }
  364. }
  365. $data['s_zhi'] = array();
  366. $data['s_zhi']['cdate'] = date('Y-m-d H:i',time());
  367. $data['zhi'] = Dever::db('work/appoint')->getAll(array('info_id'=>$info_id));
  368. foreach ($data['zhi'] as $k => $v) {
  369. $time = $v['cdate'] - $ztime;
  370. $data['zhi'][$k]['time'] = floor($time%86400/3600).'小时'.floor($time%3600/60).'分钟'.floor($time%60).'秒';
  371. $admin = explode(',',$v['admin_id']);
  372. if (isset($admin[0]) && $admin[0]) {
  373. $group = Dever::db('manage/group')->find($admin[0]);
  374. } else {
  375. $group = array();
  376. }
  377. if (isset($admin[1]) && $admin[1]) {
  378. $adm = Dever::db('manage/admin')->find($admin[1]);
  379. if ($adm) {
  380. $adm_username = $adm['username'];
  381. }
  382. } else {
  383. $adm_username = '';
  384. }
  385. if ($group && $admin) {
  386. $data['zhi'][$k]['admin'] = $group['name'].' / '.$adm_username;
  387. } else {
  388. $data['zhi'][$k]['admin'] = '';
  389. }
  390. $data['zhi'][$k]['cdate'] = date('Y-m-d H:i',$v['cdate']);
  391. $info_log = Dever::db('work/info_log')->find(array('appoint_id'=>$v['id']));
  392. if ($info_log && $info_log['fdate']) {
  393. $data['zhi'][$k]['finish'] = '完成关闭';
  394. $data['zhi'][$k]['time'] ='';
  395. } else {
  396. if ($info_log && $info_log['cloce_date']) {
  397. $data['zhi'][$k]['finish'] = '取消关闭';
  398. $data['zhi'][$k]['time'] ='';
  399. } else {
  400. $data['zhi'][$k]['finish'] = '';
  401. $data['zhi'][$k]['time'] = floor($time%86400/3600).'小时'.floor($time%3600/60).'分钟'.floor($time%60).'秒';
  402. }
  403. }
  404. }
  405. $data['jilu'] = array();
  406. if (!$data['zhi']) {
  407. if ($data['info']['fdate']) {
  408. // $time = $data['info']['fdate']-$ztime;
  409. $data['jilu']['time'] = date('Y-m-d H:i',$data['info']['fdate']);
  410. if ($data['info']['status'] == 3) {
  411. $data['jilu']['finish'] = '完成关闭';
  412. } elseif ($data['info']['status'] == 4) {
  413. $data['jilu']['finish'] = '取消关闭';
  414. }
  415. }
  416. }
  417. if ($data['info']['status'] < 3) {
  418. $data['hui'] = Dever::url('project/database/update?project=work&table=appoint&search_option_info_id='.$info_id, 'manage');
  419. }
  420. return Dever::render('index', $data);
  421. }
  422. public function back_api(){
  423. $mobile = Dever::input('mobile');
  424. $data = array();
  425. if ($mobile) {
  426. if(!preg_match('/^1[3|5|6|7|8|9]\d{9}$/', $mobile)){
  427. // Dever::alert('代理商手机号不正确');
  428. return '代理商手机号不正确';
  429. }
  430. $user = Dever::db('work/user')->find(array('mobile'=>$mobile));
  431. if (!$user) {
  432. $data['user']['mobile'] = $mobile;
  433. $data['user']['type'] = '无系统关联关系';
  434. $data['user']['work'] = Dever::url('project/database/update?project=work&table=info&menu=work&search_option_mobile='.$mobile, 'manage');
  435. // print_R($data);die;
  436. return Dever::render('back', $data);
  437. }
  438. if ($user){
  439. $table = array();
  440. $user['role_name'] = '';
  441. $user['type'] = '';
  442. if ($user['agent_uid'] && $user['agent_uid'] > 0) {
  443. $member = Dever::db('agent/member')->find($user['agent_uid']);
  444. if ($member['role']) {
  445. $role = Dever::db('setting/role')->find($member['role']);
  446. if ($role) {
  447. $user['role_name'] = $role['name'];
  448. }
  449. }
  450. $user['type'] = '代理商';
  451. if ($user['option_uid'] && $user['option_uid']>0) {
  452. $user['type'] = $user['type'].'<br/>期权账户';
  453. }
  454. if ($user['passport_uid'] && $user['passport_uid']>0) {
  455. $user['type'] = $user['type'].'<br/>小程序';
  456. }
  457. $user['type'] = $user['type'].'<br/>客服系统用户';
  458. } else {
  459. if ($user['option_uid'] && $user['option_uid']>0) {
  460. $user['type'] = '期权账户';
  461. if ($user['passport_uid'] && $user['passport_uid']>0) {
  462. $user['type'] = $user['type'].'<br/>小程序';
  463. }
  464. $user['type'] = $user['type'].'<br/>客服系统用户';
  465. } else {
  466. if ($user['passport_uid'] && $user['passport_uid']>0) {
  467. $user['type'] = '小程序';
  468. $user['type'] = $user['type'].'<br/>客服系统用户';
  469. } else {
  470. $user['type'] = '客服系统用户';
  471. // $user['type'] = '无系统关联关系';
  472. }
  473. }
  474. }
  475. if ($user['agent_uid']) {
  476. $user['order'] = Dever::url('project/database/list?project=agent&table=order&p=1&search_option_mid='.$user['agent_uid'], 'manage');
  477. $user['agent'] = Dever::url('project/database/list?project=agent&table=member_area&mid='.$user['agent_uid'].'&page_type=1&search_auth=1&page_type=1&jump=19','manage');
  478. $user['soft'] = Dever::url('project/database/list?project=agent&table=soft_cash&search_option_mid='.$user['agent_uid'], 'manage');
  479. }
  480. if ($user['option_uid']) {
  481. $user['option'] = Dever::url('project/database/list?project=option&table=member&search_option_id='.$user['option_uid'], 'manage');
  482. }
  483. $user['work'] = Dever::url('project/database/update?project=work&table=info&menu=work&search_option_mobile='.$mobile, 'manage');
  484. $data['user'] = $user;
  485. $data['info'] = Dever::db('work/info')->getHAll(array('mobile'=>$mobile));
  486. $config = Dever::db('work/info')->config['config_status'];
  487. foreach($data['info'] as $k => $v) {
  488. $data['info'][$k]['cdate'] = date('Y-m-d H:i',$v['cdate']);
  489. $data['info'][$k]['fdate'] = date('Y-m-d H:i',$v['fdate']);
  490. $cate = Dever::db('work/q_cate')->find(array('id'=>$v['cate_id']));
  491. $data['info'][$k]['cate_name'] = $cate['name'];
  492. $you = Dever::db('work/priority')->find(array('id'=>$v['priority_id']));
  493. $data['info'][$k]['you'] = $you['name'];
  494. $v['branch_id'] = explode(',',$v['branch_id']);
  495. if (isset($v['branch_id'][0]) && $v['branch_id'][0]>0){
  496. $group = Dever::db('manage/group')->find(array('id'=>$v['branch_id'][0],'company_id'=>$v['company_id']));
  497. $data['info'][$k]['branch'] = $group['name'];
  498. }
  499. if (isset($v['branch_id'][1]) && $v['branch_id'][1]>0){
  500. $admin = Dever::db('manage/admin')->find(array('id'=>$v['branch_id'][1]));
  501. $data['info'][$k]['branch'] = $group['name'].'/'.$admin['username'];
  502. }
  503. $data['info'][$k]['status'] = Dever::status($config,$v['status']);
  504. $data['info'][$k]['url'] = Dever::url('lib/appoint.show&id='.$v['id'],'work');
  505. if ($v['status']<3) {
  506. $data['info'][$k]['zhipai'] = Dever::url('project/database/update?project=work&table=appoint&search_option_info_id='.$v['id'], 'manage');
  507. } else {
  508. $data['info'][$k]['zhipai'] = '';
  509. }
  510. }
  511. }
  512. $data['page'] = Dever::page("current");
  513. }
  514. return Dever::render('back', $data);
  515. }
  516. public function callback_api(){
  517. $mobile = Dever::input('phone');
  518. $type = Dever::input('type');
  519. $data = array();
  520. if ($mobile) {
  521. $state = 2;
  522. if(!preg_match('/^1[3|5|6|7|8|9]\d{9}$/', $mobile)){
  523. // Dever::alert('代理商手机号不正确');
  524. $state = 1;
  525. if ($type == 1) {
  526. return '手机号不正确';
  527. }
  528. }
  529. if ($state == 1) {
  530. $data = array();
  531. return Dever::render('callback', $data);
  532. }
  533. $data['user']['title'] = '电话号码';
  534. $data['user']['mobile'] = $mobile;
  535. $data['user']['username'] = $mobile;
  536. $member = Dever::db('agent/member')->find(array('mobile'=>$mobile));
  537. $option = Dever::db('option/member')->find(array('mobile'=>$mobile));
  538. $passport = Dever::db('passport/user')->find(array('mobile'=>$mobile));
  539. $work = Dever::db('work/user')->find(array('mobile'=>$mobile));
  540. $user = array();
  541. $data['user']['order'] = '';
  542. $data['user']['agent'] = '';
  543. $data['user']['soft'] = '';
  544. $data['user']['option'] = '';
  545. $user['role'] = '';
  546. if (!$member && !$option && !$passport && !$work) {
  547. $user['name'] = $mobile;
  548. $user['role'] = '';
  549. $user['type'][] = '无系统关联关系';
  550. } else {
  551. if ($work) {
  552. $user['name'] = $work['name'].'<br/>'.$mobile;
  553. $user['type'][] = '客服系统用户';
  554. }
  555. if ($option) {
  556. $user['name'] = $option['name'].'<br/>'.$mobile;
  557. $user['type'][] = '期权账户';
  558. $data['user']['option'] = Dever::url('project/database/list?project=option&table=member&search_option_id='.$option['id'], 'manage');
  559. $data['user']['option'] = Dever::url('home?link=' . urlencode( $data['user']['option']) . '&group=8&parent_menu=menu_279&menu=menu_279.menu_291' , 'manage');
  560. }
  561. if ($passport) {
  562. $user['name'] = $passport['username'].'<br/>'.$mobile;
  563. $user['type'][] = '小程序用户';
  564. }
  565. if ($member) {
  566. if ($member['role']) {
  567. $role = Dever::db('setting/role')->find($member['role']);
  568. if ($role['name']) {
  569. $role_name = '<br/>'.$role['name'];
  570. }
  571. $user['role'] = '/角色';
  572. } else {
  573. $role_name = '';
  574. $user['role'] = '';
  575. }
  576. $user['name'] = $member['name'].'<br/>'.$mobile.$role_name;
  577. $user['type'][] = '代理商';
  578. $data['user']['order'] = Dever::url('project/database/list?project=agent&table=order&p=1&search_option_mid='.$member['id'], 'manage');
  579. $data['user']['order'] = Dever::url('home?link=' . urlencode($data['user']['order']) . '&group=7&parent_menu=menu_240&menu=agent.order', 'manage');
  580. $data['user']['agent'] = Dever::url('project/database/list?project=agent&table=member_area&mid='.$member['id'].'&page_type=1&search_auth=1&page_type=1&jump=19','manage');
  581. $data['user']['agent'] = Dever::url('home?link=' . urlencode($data['user']['agent']) . '&group=7&parent_menu=menu_240&menu=agent.member' , 'manage');
  582. $data['user']['soft'] = Dever::url('project/database/list?project=agent&table=soft_cash&search_option_mid='.$member['id'], 'manage');
  583. $data['user']['soft'] = Dever::url('home?link=' . urlencode($data['user']['soft']) . '&group=7&parent_menu=menu_240&menu=agent.soft_cash' , 'manage');
  584. }
  585. $data['user']['title'] = '名称/电话号码' . $user['role'];
  586. }
  587. $data['user']['type'] = implode('<br />', $user['type']);
  588. $data['user']['username'] = $user['name'];
  589. $data['user']['work'] = Dever::url('project/database/update?project=work&table=info&menu=work&search_option_mobile='.$mobile, 'manage');
  590. $data['user']['work'] = Dever::url('home?link=' . urlencode($data['user']['work']) . '&group=10&parent_menu=work&menu=work.add' , 'manage');
  591. $data['user']['work_list'] = Dever::url('project/database/list&project=work&table=info&menu=work&search_option_state=1&search_api_mobile='.$mobile, 'manage');
  592. $data['user']['work_list'] = Dever::url('home?link=' . urlencode($data['user']['work_list']) . '&group=10&parent_menu=work&menu=work.info' , 'manage');
  593. return Dever::render('callback', $data);
  594. }else {
  595. $data = array();
  596. return Dever::render('callback', $data);
  597. }
  598. }
  599. }