Index.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. namespace app\index\controller;
  3. use \daswork\Controller;
  4. use app\admin\model\Attenders;
  5. Class Index extends Controller
  6. {
  7. public function index()
  8. {
  9. $this->fetch();
  10. }
  11. public function save()
  12. {
  13. if ($_SERVER['REQUEST_METHOD']=='POST') {
  14. $param = escapeString($_POST);
  15. // echo json_encode($param);
  16. // exit;
  17. //查询是否已经注册过
  18. $model = new Attenders();
  19. $name = handleInput($param['name']) ? $param['name'] : '';
  20. $phone = handleInput($param['phone']) ? $param['phone'] : '';
  21. $query = "select count(*) as total from attenders where truename='$name' and phone=$phone";
  22. $result = $model->query($query)->fetch_assoc();
  23. // echo json_encode($result['total']>0);
  24. // exit;
  25. /*
  26. tax_type 开票类型
  27. company_name 公司名称
  28. tax_number 纳税人识别号
  29. company_address 公司地址
  30. company_phone 公司电话
  31. bank_account 开户行及账号
  32. mailing_address 邮寄地址
  33. postcode 邮编
  34. name 名字
  35. sex 性别
  36. position 职务
  37. phone 电话
  38. email 邮箱
  39. fee_id 注册费类型
  40. school 学校
  41. professional 专业
  42. paper_type '论文类型:0, 不发表; 1, << 中国腐蚀与防护学报 >> 2000元/篇; 2, << 混凝土与水泥制品 >> 3200元/篇',
  43. is_report 是否作报告
  44. report_title 报告标题
  45. hotel_type 酒店类型
  46. room_type 房间类型
  47. pay_type 支付方式 1, 现场缴费 2汇款
  48. create_time '填表时间'
  49. */
  50. if($result['total']>0){
  51. echo "<script>alert('您已经报名成功,请勿重复提交!');location.href='http://meeting.ecorr.org';</script>";
  52. }else{
  53. $tax_type = handleInput($param['tax_type']) ? $param['tax_type'] : 1;
  54. $company_name = handleInput($param['company_name']) ? $param['company_name'] : '';
  55. $tax_number = handleInput($param['tax_number']) ? $param['tax_number'] : '';
  56. $company_address = handleInput($param['company_address']) ? $param['company_address'] : '';
  57. $company_phone = handleInput($param['company_phone']) ? $param['company_phone'] : '';
  58. $bank_account = handleInput($param['bank_account']) ? $param['bank_account'] : '';
  59. $mailing_address = handleInput($param['mailing_address']) ? $param['mailing_address'] : '';
  60. $postcode = handleInput($param['postcode']) ? $param['postcode'] : '';
  61. $name = handleInput($param['name']) ? $param['name'] : '';
  62. $sex = handleInput($param['sex']) ? $param['sex'] : 0;
  63. $position = handleInput($param['position']) ? $param['position'] : '';
  64. $phone = handleInput($param['phone']) ? $param['phone'] : '';
  65. $email = handleInput($param['email']) ? $param['email'] : '';
  66. $fee_id = handleInput($param['fee_id']) ? $param['fee_id'] : 1;
  67. $is_report = handleInput($param['is_report']) ?$param['is_report'] : 0;
  68. $report_title = handleInput($param['report_title']) ? $param['report_title'] : '无报告';
  69. // $hotel_type = handleInput(isset($param['hotel_type'])?$param['hotel_type']:1);
  70. $hotel_type = 1;
  71. $room_type = handleInput($param['room_type']) ?$param['room_type'] : 1;
  72. $is_share = handleInput($param['is_share']) ? $param['is_share'] : 0;
  73. $pay_type = handleInput($param['pay_type']) ? $param['pay_type'] : 1;
  74. $note = handleInput($param['note']) ? $param['note'] : '';
  75. $create_time = time();
  76. $data = [
  77. "meeting_id" => 3,
  78. "truename" => $name,
  79. "sex" => $sex,
  80. "organization" => $company_name,
  81. "position" => $position,
  82. "phone" => $phone,
  83. "email" => $email,
  84. "remark" => $note,
  85. "fee_type" => $fee_id,
  86. "is_report" => $is_report,
  87. "report_title" => $report_title,
  88. "hotel_type" => $hotel_type,
  89. "room_type" => $room_type,
  90. "is_share" => $is_share,
  91. "pay_type" => $pay_type,
  92. "tax_type" => $tax_type,
  93. "tax_title" => $company_name,
  94. "tax_number" => $tax_number,
  95. "company_address" => $company_address,
  96. "company_phone" => $company_phone,
  97. "bank_account" => $bank_account,
  98. "mailing_address" => $mailing_address,
  99. "postcode" => $postcode,
  100. "create_time" => $create_time
  101. ];
  102. $res = $model->save($data);
  103. // var_dump($res);
  104. // exit;
  105. if($res){
  106. echo "<script>alert('报名成功');location.href='http://meeting.ecorr.org';</script>";
  107. }else{
  108. echo "<script>alert('失败!请重新填写');history.back();</script>";
  109. }
  110. }
  111. } else {
  112. echo "<script>alert('非法操作!');location.href='http://meeting.ecorr.org';</script>";
  113. }
  114. }
  115. }