SpecialParam.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /**
  3. * 发送手机短信
  4. */
  5. namespace app\api\controller\v1;
  6. use app\api\controller\Api;
  7. use app\common\model\Members;
  8. use app\common\model\MailLog;
  9. use app\common\library\Sms;
  10. use app\common\model\ComplexChannelModel;
  11. use app\common\model\PolychannelGame;
  12. use think\Controller;
  13. use think\Env;
  14. use think\Exception;
  15. class SpecialParam extends Controller
  16. {
  17. protected $_neekCheckChannel = ['wanxiong'];
  18. public function getSpecialParam(){
  19. $log_postdata = '';
  20. try {
  21. $postData = input();
  22. if (!$postData) {
  23. $postData = request()->getInput();
  24. }
  25. foreach ($postData as $k => $v) {
  26. $log_postdata .= $k . ':' . $v . ' ';
  27. }
  28. } catch (\Exception $e) {
  29. $log_postdata = json_encode($postData);
  30. }
  31. log_message('请求:'.request()->url().' '.$log_postdata,'log',LOG_PATH . 'complex/SpecialParam/');
  32. $prefix = strtolower(input('channel_mark')); // 渠道标识
  33. $channelModel = new ComplexChannelModel;
  34. if(!($channel_id=$channelModel->where(['status'=>1,'mark'=>$prefix])->value('id')))
  35. {
  36. $this->jsonResult('',0,'渠道信息不存在');
  37. }
  38. if(!$polyChannelGame = (new PolychannelGame())->where(['channel_id'=>$channel_id,'game_id'=>$postData['gameid']])->find()){
  39. $this->jsonResult('',0,'渠道游戏不存在');
  40. }
  41. // 判断是否有做登录验证的渠道
  42. if (in_array($prefix,$this->_neekCheckChannel)){
  43. try {
  44. $sentence = ucfirst($prefix);
  45. $className = 'app\api\complex\\' . $sentence;
  46. $model = new $className;
  47. $result = $model->getSpecialParam(input(),$polyChannelGame);
  48. if($result){
  49. $this->jsonResultTrue(['cuserid'=>$result],1,'获取成功');
  50. }else{
  51. $this->jsonResultTrue('',0,'二次登录验证失败 ');
  52. }
  53. }catch (Exception $e){
  54. curlDD( '渠道支付回调:'. $e->getMessage(),Env::get('dingtalk.warning_url'));
  55. $this->jsonResultTrue('',0,'二次登录验证失败');
  56. }
  57. }else{
  58. $this->jsonResultTrue('', 1, '');
  59. }
  60. }
  61. public function jsonResultTrue($data, $code = 0, $msg = '',$isExit=true)
  62. {
  63. $result = [
  64. 'code' => $code,
  65. 'msg' => $msg,
  66. 'time' => request()->server('REQUEST_TIME'),
  67. 'data' => $data,
  68. ];
  69. //debug模式下返回明文
  70. echo json_encode($result);
  71. //为了使用fastcgi_finish_request等函数时,后续的执行能够继续生效
  72. if($isExit) exit;
  73. }
  74. }