Csc.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. <?php
  2. /** 客服中心 -- 控制器
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2019/10/24
  6. * Time: 10:47
  7. */
  8. namespace app\home\controller;
  9. use think\Config;
  10. use think\Db;
  11. class Csc extends Home {
  12. private $_type
  13. = [
  14. '1' => '账号问题' ,
  15. '2' => '充值问题' ,
  16. '3' => '申诉问题' ,
  17. '4' => '人工服务' ,
  18. '5' => '其他' ,
  19. ];
  20. private $_appealMsgCode = 'SMS_192715035'; //'【祈盟文化游戏】您正在申诉账号,验证码:[%s],有效期10分钟。请勿向任何人提供您收到的验证码。';
  21. /**
  22. * 初始化操作
  23. */
  24. protected function _initialize() {
  25. parent::_initialize();
  26. $this->cscModel = model('CpsProblem');
  27. }
  28. /**
  29. * 常见问题
  30. */
  31. public function index() {
  32. $type = $this->request->param('type' , 0 , 'intval');
  33. $typeArr = $this->_type;
  34. foreach ($typeArr as $k => $v) {
  35. $num = $this->judgeHasByType($k);
  36. if ( !$num) unset($typeArr[$k]);
  37. }
  38. $runable = true;
  39. if ( !$type || !isset($typeArr[$type])) {
  40. reset($typeArr);
  41. $type = key($typeArr);
  42. }
  43. if (( !count($typeArr) || !isset($typeArr[$type])) && $type != 0) {
  44. $runable = false;
  45. }
  46. $page_num = 10;
  47. if ($runable) {
  48. $list = Db::connect(config('database_slave'))->table('cy_csc_problem')->cache(Config::get('QUERY_RESULT_CACHE_TIME'))
  49. ->field('id,title,answer')
  50. ->where('type' , $type)
  51. ->order('order asc, create_time asc')
  52. ->paginate($page_num , false , array('query' => input('get.')));
  53. }
  54. $this->assign('runable' , $runable);
  55. $this->assign('typeList' , $runable ? $typeArr : []);
  56. $this->assign('type' , $runable ? $type : 0);
  57. $this->assign('list' , $runable ? $list : []);
  58. $this->assign('current_num' , $runable ? count($list) ? ($list->toArray()['current_page'] - 1) * $page_num : 0 : 0);
  59. $this->assign('page' , $runable ? $list->render() : null);
  60. return $this->fetch();
  61. }
  62. /**
  63. * 判断 某个类型下 是否有问题
  64. */
  65. public function judgeHasByType($type) {
  66. $num = Db::connect(config('database_slave'))->table('cy_csc_problem')->cache(Config::get('QUERY_RESULT_CACHE_TIME'))->where('type' , $type)->count('id');
  67. return $num;
  68. }
  69. /**
  70. * w微信申诉页面
  71. */
  72. public function wechatAppeal() {
  73. return $this->fetch();
  74. }
  75. /**
  76. * 申诉查询
  77. */
  78. public function appealResult() {
  79. if ($this->request->isAjax()) {
  80. $code = $this->request->param('code');
  81. if ( !$code) $this->jsonResult([] , 0 , '请输入申诉编号');
  82. $Ticket = $this->request->param('ticket' , '' );
  83. $Randstr = $this->request->param('randstr' , '' );
  84. $slider = (new \app\home\controller\Member)->sliderVelidate($Ticket,$Randstr);
  85. if (!$slider['code']) $this->jsonResult([],0,$slider['msg']);
  86. $res = model('CscAppeal')
  87. ->field('id,userid,username,mobile,mail,status,code,certificate')
  88. ->where('code' , $code)->find();
  89. if (empty($res)) $this->jsonResult([] , 0 , '不存在该申诉编号');
  90. // 0:未审核 1:成功 2:失败 3:成功改完密码状态 4驳回',
  91. if ($res['status'] == 4) $res['status'] = 2;
  92. session('appeal_rest_pwd_info' , $res);
  93. if ( !empty($res['mobile'])) $res['mobile'] = stringObfuscation($res['mobile']);
  94. if ( !empty($res['mail'])) $res['mail'] = mailObfuscation($res['mail']);
  95. $this->success('','appealResultPage');
  96. }
  97. $appid = Config::get('SLIDER_VERIFICATION.APPID');
  98. $this->assign('appid',$appid);
  99. return $this->fetch();
  100. }
  101. /**
  102. * 申诉查询--结果页面
  103. */
  104. public function appealResultPage(){
  105. if (!session('appeal_rest_pwd_info')) $this->redirect(getServiceUrl(3));
  106. if ($this->request->isAjax()){
  107. $certificate = $this->request->param('certificate');
  108. if ( !$certificate) $this->jsonResult([] , 0 , '请输入成功凭证');
  109. $appealInfo = session('appeal_rest_pwd_info');
  110. if (empty($appealInfo) || $certificate != $appealInfo['certificate']) {
  111. $this->jsonResult([] , 0 , '成功凭证不正确');
  112. }
  113. $this->success('','resetPwdPage');
  114. }
  115. $info = session('appeal_rest_pwd_info');
  116. /*$info['status'] = 1;*/
  117. $this->assign('info',$info);
  118. return $this->fetch();
  119. }
  120. /**
  121. * 通过申诉凭证 -- 充值密码页面
  122. */
  123. public function resetPwdPage() {
  124. if (!session('appeal_rest_pwd_info')) $this->redirect(getServiceUrl(3));
  125. $appid = Config::get('SLIDER_VERIFICATION.APPID');
  126. $this->assign('appid',$appid);
  127. return $this->fetch();
  128. }
  129. /**
  130. * 重置密码
  131. */
  132. public function resetPwd() {
  133. $appealInfo = session('appeal_rest_pwd_info');
  134. if (empty($appealInfo)) $this->jsonResult([] , 0 , '系统繁忙,请稍后再试');
  135. $password1 = input('post.password1' , '' );
  136. $password2 = input('post.password2' , '' );
  137. if (empty($password1)) $this->jsonResult([] , -1 , '请输入密码');
  138. if (empty($password2)) $this->jsonResult([] , -2 , '请再次输入密码');
  139. if ($password1 != $password2) $this->jsonResult([] , -2 , '两次输入的密码不一致');
  140. $userid = model('Members')->where(['username'=>$appealInfo['username']])->value('id');
  141. $memberCTR = new Member();
  142. $res = $memberCTR->resetPassword($userid , $password1,1);
  143. if ($res == 0) $this->jsonResult([] , -2 , '新密码不能与旧密码相同');
  144. if ($res == 3) $this->jsonResult([] , -1 , '请输入正确的密码,6-15位字符');
  145. if ($res == 2) $this->jsonResult([] , -2 , '密码重置失败,请稍后在试!');
  146. $result = model('CscAppeal')->save(['status' => 3] , ['id' => $appealInfo['id']]);
  147. session('appeal_rest_pwd_info' , null);
  148. if ($result || $appealInfo['status'] == 3) {
  149. $this->success('密码重置成功',url('resetPwdResult',['suc'=>1]));
  150. }
  151. $this->success('密码重置失败',url('resetPwdResult'));
  152. }
  153. /**
  154. * 重置密码--结果页
  155. */
  156. public function resetPwdResult(){
  157. $suc = $this->request->param('suc',0,'intval');
  158. $this->assign('suc',$suc);
  159. return $this->fetch();
  160. }
  161. /**
  162. * 账号申诉---确认申诉账号
  163. */
  164. public function appeal() {
  165. if (session('appeal')) {
  166. session('appeal' , null);
  167. }
  168. if ($this->request->isAjax()) {
  169. $username = input('post.username' , '' );
  170. $type = input('post.type' , '' );
  171. $number = input('post.number' , '' );
  172. $reason = input('post.reason' , '' , 'intval');
  173. $agreexy = input('post.reason' );
  174. $userid = session('front_userid'); //登录帐号id(不是申诉号码id)
  175. $typeArr = ['mobile' , 'email'];
  176. $data = [];
  177. if (empty($username)) $this->error('请输入申诉账号');
  178. if ( !in_array($type , $typeArr)) $this->error('请选择申诉接收方式');
  179. if ($type == $typeArr[0]) {
  180. $data['mobile'] = $number;
  181. if (empty($number)) $this->error('请输入手机号');
  182. if ( !$this->isMobile($number)) $this->error('请输入正确的手机号');
  183. }
  184. if ($type == $typeArr[1]) {
  185. $data['mail'] = $number;
  186. if (empty($number)) $this->error('请输入邮箱');
  187. if ( !$this->isEmail($number)) $this->error('请输入正确的邮箱');
  188. }
  189. if (empty($reason)) $this->error('请选择申诉原因');
  190. if (!$agreexy) $this->error('请先同意祈盟文化服务使用协议');
  191. $condition['username'] = $username;
  192. $id = model('Members')->where($condition)->value('id');
  193. if (empty($id)) $this->error('帐号不存在');
  194. $data['userid'] = $userid;
  195. $result = Db::table('cy_csc_appeal')->where($condition)->select();
  196. if (!empty($result)){
  197. foreach ($result as $v){
  198. if ($v['status'] == 0) $this->error('该账号还有申诉处理中,请勿重复申诉');
  199. if ($v['status'] == 1) {
  200. $url = getServiceUrl(3);
  201. $this->error('该账号有申诉已通过,但未重置密码,请前往<a href="' . $url . '" style="color:blue">"申诉查询"</a> 进行操作');
  202. }
  203. if (NOW_TIMESTAMP - $v['create_time'] <= 3600) $this->error('该账号距离上一次申诉未到1小时,请稍后再试,或联系祈盟文化客服');
  204. }
  205. }
  206. if ($reason == 2) {
  207. $condition['status'] = ['in',['3',4]];
  208. $condition['reason'] = 2;
  209. $condition['create_time'] = ['egt' , NOW_TIMESTAMP - 180 * 24 * 60 * 60];
  210. $result = model('CscAppeal')->where($condition)->order('id desc')->find();
  211. if ($result['status'] == 3 || $result['status'] == 4) $this->error('该账号在近期已有账号被盗受理完成,不可再申诉,请联系祈盟文化客服咨询');
  212. }
  213. $data['reason'] = $reason;
  214. $data['username'] = $username;
  215. session('appeal',$data);
  216. $this->success('','Csc/check');
  217. }
  218. return $this->fetch();
  219. }
  220. /**
  221. * 账号申诉---手机/邮箱验证
  222. */
  223. public function check(){
  224. if (!session('appeal')){
  225. $this->redirect(getServiceUrl('2'));
  226. }
  227. $appid = Config::get('SLIDER_VERIFICATION.APPID');
  228. $this->assign('appid',$appid);
  229. $this->assign('info',session('appeal'));
  230. return $this->fetch();
  231. }
  232. /**
  233. * 账号申诉---发送验证码
  234. */
  235. public function sendCode(){
  236. $type = input('post.type' , '' );
  237. $info = session('appeal');
  238. $typeArr = ['mobile' , 'email'];
  239. if (!$info) $this->redirect(getServiceUrl('2'));
  240. if (!in_array($type,$typeArr) || empty($info)) $this->error('非法请求');
  241. $Ticket = $this->request->param('ticket' , '' );
  242. $Randstr = $this->request->param('randstr' , '' );
  243. $slider = (new \app\home\controller\Member)->sliderVelidate($Ticket,$Randstr);
  244. if (!$slider['code']) $this->jsonResult([],0,$slider['msg']);
  245. if ($type == $typeArr[0]){
  246. $result = (new \app\common\library\Sms)->sendCode($info['mobile'],$this->_appealMsgCode);
  247. }else{
  248. $result = (new \app\common\library\Mail)->sendCodeMailByType($info['username'], $info['mail'],'appeal');
  249. }
  250. if(isset($result) && $result['status']){
  251. $this->jsonResult([],1,'发送成功');
  252. }else{
  253. $this->jsonResult([],0,$result['msg']);
  254. }
  255. }
  256. /**
  257. * 账号申诉---验证码验证
  258. */
  259. public function appealCheckCode(){
  260. $info = session('appeal');
  261. $code = input('post.code' , 0 , 'intval');
  262. $type = input('post.type' , '' );
  263. $typeArr = ['mobile' , 'email'];
  264. if ( !in_array($type , $typeArr) || empty($info)) $this->jsonResult([],0,'非法请求');
  265. if (empty($code)) $this->jsonResult([],0,'验证不能为空');
  266. if ($type == $typeArr[0]) {
  267. $result = (new \app\common\library\Sms)->checkCode($info['mobile'] , $code);
  268. } else {
  269. $result = (new \app\common\library\Mail)->checkCode($info['username'] , $info['mail'] , $code);
  270. }
  271. if ( isset($result) && $result['status']) {
  272. session('apeealHasCheck',true);
  273. $this->success('验证成功','appealAccount');
  274. }
  275. $this->jsonResult([],0,$result['msg']);
  276. }
  277. /**
  278. * 账号申诉---账号信息
  279. */
  280. public function appealAccount(){
  281. if(!session('apeealHasCheck')){
  282. $this->redirect('sendCode');
  283. }
  284. if(session('apeealUserinfo')){
  285. session('apeealUserinfo',null);
  286. }
  287. /*$data = session('appeal');*/
  288. $province = Db::table('cy_city')->where('parent_id=1')->select();
  289. $gameWhere = [
  290. 'cooperation_status' => ['neq',0],
  291. 'nickname' => ['neq',''],
  292. ];
  293. $gamelist = model('Game')->field('id,nickname')->where($gameWhere)->group('nickname')->order('id desc')->select();
  294. $this->assign('province',$province);
  295. $this->assign('gamelist',$gamelist);
  296. return $this->fetch('appeal_account');
  297. }
  298. /**
  299. * 按省份获取市
  300. */
  301. public function getAddr(){
  302. $id = $this->request->param('id','','intval');
  303. if (!$id) $this->error('非法请求');
  304. $data = Db::table('cy_city')->where('parent_id='.$id)->select();
  305. $this->success('','',$data);
  306. }
  307. /**
  308. * 账号申诉---账号信息---提交
  309. */
  310. public function appealAccountTij(){
  311. $regtime = strtotime(input('post.regtime', ''));
  312. $imei = input('post.imei', '');
  313. $addr = input('post.addr', '');
  314. $reggameid = input('post.reggameid', '');
  315. $regmobile = input('post.regmobile', '');
  316. $totalrecharge = input('post.totalrecharge', '', 'intval');
  317. $firstrechargegameid = input('post.firstrechargegameid', '');
  318. if (empty($regtime)) $this->jsonResult('',-1,'请选择注册时间');
  319. /*if (!empty($imei)) {
  320. if (strlen($imei) != 15) {
  321. $this->jsonResult('',-2,'imei格式错误');
  322. }
  323. }*/
  324. if (empty($addr)) $this->jsonResult('',-3,'请选择注册地址');
  325. if (is_numeric($addr)) $this->jsonResult('',-3,'地址格式不能为数字');
  326. if ($reggameid == '') $this->jsonResult('',-4,'请选择注册游戏');
  327. if ( $firstrechargegameid == '') $this->jsonResult('',-5,'请选择首次充值游戏');
  328. if (!empty($regmobile)) {
  329. if ($regmobile == '无') {
  330. } else {
  331. if (!$this->isMobile($regmobile)) $this->jsonResult('',-6,'请输入正确的手机号');
  332. }
  333. }else{
  334. $this->jsonResult('',-6,'请输入注册时手机号');
  335. }
  336. if ($totalrecharge != 0 && empty($totalrecharge)) $this->jsonResult('',-7,'请输入累积充值金额');
  337. if (!is_numeric($totalrecharge)) $this->jsonResult('',-7,'请输入正确的金额');
  338. $data = session('appeal');
  339. $data['regtime'] = $regtime;
  340. $data['imei'] = $imei;
  341. $data['addr'] = $addr;
  342. $data['reggameid'] = $reggameid;
  343. if ($regmobile != '无') {
  344. $data['regmobile'] = $regmobile;
  345. }else{
  346. $data['regmobile'] = '';
  347. }
  348. $data['totalrecharge'] = $totalrecharge;
  349. $data['firstrechargegameid'] = $firstrechargegameid;
  350. if(session('apeealUserinfo')){
  351. session('apeealUserinfo',null);
  352. }
  353. session('apeealUserinfo',$data);
  354. $this->success('','appealHistory');
  355. }
  356. /**
  357. * 账号申诉---账号历史信息
  358. */
  359. public function appealHistory(){
  360. if (!session('apeealUserinfo')){
  361. $this->redirect('appealAccount');
  362. }
  363. $gameWhere = [
  364. 'cooperation_status' => ['neq',0],
  365. 'nickname' => ['neq',''],
  366. ];
  367. $gamelist = model('Game')->field('id,nickname')->where($gameWhere)->group('nickname')->order('id desc')->select();
  368. $this->assign('gamelist',$gamelist);
  369. return $this->fetch('appeal_history');
  370. }
  371. /**
  372. * 账号申诉---账号历史信息--提交
  373. */
  374. public function appealHistoryTij(){
  375. $regchannelname = $this->request->param('regchannelname', '');
  376. $oldmail = !empty($this->request->param('oldmail/a')) ? array_flip(array_flip(array_filter($this->request->param('oldmail/a')))) : [];
  377. $oldmobile = !empty($this->request->param('oldmobile/a')) ? array_flip(array_flip(array_filter($this->request->param('oldmobile/a')))) : [];
  378. $boundgameid = !is_null($this->request->param('boundgameid/a')) ? array_flip(array_flip(array_filter($this->request->param('boundgameid/a')))) : '';
  379. // 旧密码 充值时间 和 充值金额可能重复,不能用array_flip进行数组翻转(会过滤掉值一样的key)
  380. $rechargetime = !empty($this->request->param('rechargetime/a')) ? array_filter($this->request->param('rechargetime/a')) : [];
  381. $rechargeamount = !is_null($this->request->param('rechargeamount/a')) ? array_filter($this->request->param('rechargeamount/a')) : [];
  382. $oldpwd = !empty($this->request->param('oldpwd/a')) ? array_filter($this->request->param('oldpwd/a')) : [];
  383. if (empty($oldpwd)) {
  384. $this->jsonResult(0,-1,'密码不能为空');
  385. }else{
  386. $pwdpreg = '/^[a-zA-Z0-9]{6,15}$/';
  387. foreach ($oldpwd as $k => $oldpwdinfo) {
  388. if (0 == preg_match($pwdpreg, $oldpwdinfo)) {
  389. $this->jsonResult($k,-1,'密码长度为6-15位字符!');
  390. }
  391. }
  392. }
  393. if ( !empty($oldmail)) {
  394. foreach ($oldmail as $k => $oldmailinfo) {
  395. if (!empty($oldmailinfo) && !$this->isEmail($oldmailinfo)) $this->jsonResult($k,-2,'请输入正确的邮箱');
  396. }
  397. }
  398. if (!empty($oldmobile)) {
  399. foreach ($oldmobile as $k => $oldmobileinfo) {
  400. if (!empty($oldmobileinfo) && !$this->isMobile($oldmobileinfo)) $this->jsonResult($k,-3,'请输入正确的手机号');
  401. }
  402. }
  403. if (empty($rechargetime) && !empty($rechargeamount)) $this->jsonResult(0,-5,'请输入充值时间');
  404. if (!empty($rechargetime) && empty($rechargeamount)) $this->jsonResult(0,-6,'请输入累积充值金额');
  405. if (!empty($rechargeamount)) {
  406. foreach ($rechargeamount as $k => $rechargeamountinfo) {
  407. if (!isset($rechargetime[$k]) || empty($rechargetime[$k])) $this->jsonResult($k,-5,'请输入充值时间');
  408. if (!is_numeric($rechargeamountinfo)) $this->jsonResult($k,-6,'请输入正确的充值金额');
  409. }
  410. }
  411. if (!empty($rechargetime)) {
  412. foreach ($rechargetime as $k => $rechargetimeinfo) {
  413. if (!isset($rechargeamount[$k]) || !is_numeric($rechargeamount[$k])) $this->jsonResult($k,-6,'请输入正确的充值金额');
  414. if (empty($rechargetimeinfo)) $this->jsonResult($k,-5,'请输入充值时间');
  415. }
  416. }
  417. if ($boundgameid == '') $this->jsonResult(0,-7,'请选择登录过的游戏');
  418. if (!empty($boundgameid)) {
  419. foreach ($boundgameid as $k => $boundgameidinfo) {
  420. if (!is_numeric($boundgameidinfo)) $this->jsonResult($k,-7,'登录过的游戏数据出错');
  421. }
  422. }
  423. $regchannelid = model('Channel')->where(['name'=>$regchannelname])->value('id');
  424. $arr['oldpwd'] = serialize($oldpwd);
  425. $arr['oldmail'] = serialize($oldmail);
  426. $arr['oldmobile'] = serialize($oldmobile);
  427. $arr['boundgameid'] = serialize($boundgameid);
  428. $arr['rechargetime'] = serialize($rechargetime);
  429. $arr['rechargeamount'] = serialize($rechargeamount);
  430. $arr['regchannelid'] = $regchannelid;
  431. $arr['create_time'] = date('Y-m-d H:i:s',NOW_TIMESTAMP); // model('CscAppeal')->getAppealScore($data) 里面时间是日期格式
  432. $data = session('apeealUserinfo');
  433. $data = array_merge($data, $arr);
  434. // 判断是否已经申诉了,防止同时申诉
  435. $result = Db::table('cy_csc_appeal')->where(['username'=>$data['username'],'status'=>['in',[0,1,2]]])->select();
  436. $re_arr = [];
  437. if (!empty($result)){
  438. foreach ($result as $v){
  439. if ($v['status'] ==2 && (NOW_TIMESTAMP - $v['create_time'] <= 3600)) $this->error('该账号距离上一次申诉未到1小时,请稍后再试,或联系祈盟文化客服');
  440. if ($v['status'] !=2 ) $re_arr[] = $v;
  441. }
  442. if (!empty($re_arr)) $this->error('该账号还有申诉处理中,请勿重复申诉');
  443. }
  444. $showtime = date("YmdHis", time());
  445. $data['code'] = $showtime . rand(0, 9); //申述编码
  446. $data['score'] = model('CscAppeal')->getAppealScore($data);
  447. $scoreLow = model('CscSetting')->where('name="MARK_APPEAL"')->value('value');
  448. $appealInfo = session('appeal');
  449. $data['reason'] = $appealInfo['reason']; //申述原因
  450. $data['userid'] = $appealInfo['userid'];
  451. $data['create_time'] = strtotime($data['create_time']); // 申诉时间
  452. $is_suc = true;
  453. if ($data['score'] < $scoreLow){
  454. $data['status'] = 2;
  455. $data['operate_time'] = NOW_TIMESTAMP;
  456. $data['operate_id'] = 1;
  457. $data['notice_time'] = $data['create_time'];
  458. $is_suc = false;
  459. if (isset($appealInfo['mobile']) && !empty($appealInfo['mobile'])){
  460. $result = (new \app\common\library\Sms)->sendAppealCode($appealInfo['username'],$data['code'],$appealInfo['mobile'],'','',4);
  461. }elseif(isset($appealInfo['mail']) && !empty($appealInfo['mail'])){
  462. $result = (new \app\common\library\Mail)->sendAppealCodeMail($appealInfo['username'], $data['code'],$appealInfo['mail'],'','',4);
  463. }
  464. if(isset($result) && $result['status']){
  465. $data['is_finish'] = 1;
  466. }else{
  467. $data['remark'] = '短信发送失败:'.$result['msg'];
  468. }
  469. }else{
  470. if ($data['reason'] == 2) {
  471. // 清空手机和邮箱
  472. $update = [
  473. 'flag' => 1 ,
  474. 'email' => '' ,
  475. 'mobile' => '' ,
  476. ];
  477. model('Members')->save($update,['username' => $appealInfo['username']]);
  478. // 记录用户冻结历史记录
  479. $userid = model('Members')->where(['username' => $appealInfo['username']])->value('id');
  480. model('FrozenHistory')->addData($userid,1,0);
  481. }
  482. if (isset($appealInfo['mobile']) && !empty($appealInfo['mobile'])){
  483. $data['notice_time'] = $data['create_time'] + 86400 * 3;
  484. $result = (new \app\common\library\Sms)->sendAppealCode($appealInfo['username'],$data['code'],$appealInfo['mobile'],'三','',0);
  485. }elseif(isset($appealInfo['mail']) && !empty($appealInfo['mail'])){
  486. $data['notice_time'] = $data['create_time'] + 3600 * 6;
  487. $result = (new \app\common\library\Mail)->sendAppealCodeMail($appealInfo['username'], $data['code'],$appealInfo['mail'],'一','',0);
  488. }
  489. }
  490. $appealId = model('CscAppeal')->insertGetId($data);
  491. if ($appealId) {
  492. session('appealResult',['username'=>$appealInfo['username'],'code'=>$data['code'],'status'=>$is_suc]);
  493. $this->success('','appealEnding');
  494. }
  495. $this->error('系统繁忙,请稍后再试!');
  496. }
  497. /**
  498. * 申诉结果
  499. */
  500. public function appealEnding(){
  501. $info = session('appealResult');
  502. session('apeealUserinfo',null);
  503. session('apeeal',null);
  504. session('apeealHasCheck',null);
  505. $this->assign('info',$info);
  506. return $this->fetch();
  507. }
  508. }