Simpleform.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use think\Db;
  5. /**
  6. * 几个简单表单
  7. */
  8. class Simpleform extends Api
  9. {
  10. protected $noNeedLogin = ['laorenguanhuai_category'];
  11. protected $noNeedRight = ['*'];
  12. //空间预约
  13. public function kongjianyuyue(){
  14. $truename = input('truename');
  15. $mobile = input('mobile');
  16. $huodongchangdi = input('huodongchangdi');
  17. $yuyue_time = input('yuyue_time');
  18. $data = [
  19. 'user_id' => $this->auth->id,
  20. 'truename' => $truename,
  21. 'mobile' => $mobile,
  22. 'huodongchangdi' => $huodongchangdi,
  23. 'yuyue_time' => strtotime($yuyue_time),
  24. 'createtime' => time(),
  25. ];
  26. Db::name('kongjianyuyue')->insert($data);
  27. $this->success('预约成功');
  28. }
  29. public function my_yuyue(){
  30. $list = Db::name('kongjianyuyue')->where('user_id',$this->auth->id)->autopage()->order('id desc')->select();
  31. $this->success(1, $list);
  32. }
  33. //老人关怀选项
  34. public function laorenguanhuai_category(){
  35. $list = Db::name('laorenguanhuai_category')->field('id,name')->where('status',1)->order('weigh','desc')->select();
  36. $this->success(1,$list);
  37. }
  38. public function shequ(){
  39. $list = Db::name('shequ')->select();
  40. $this->success(1,$list);
  41. }
  42. //老人关怀
  43. public function laorenguanhuai(){
  44. $truename = input('truename');
  45. $gender = input('gender',0,'intval');
  46. $birthday = input('birthday');
  47. $mobile = input('mobile');
  48. $shequ = input('shequ');
  49. $address = input('address');
  50. $jiankang = input('jiankang');
  51. $data = [
  52. 'user_id' => $this->auth->id,
  53. 'truename' => $truename,
  54. 'gender' => $gender,
  55. 'birthday' => $birthday,
  56. 'mobile' => $mobile,
  57. 'shequ' => $shequ,
  58. 'address' => $address,
  59. 'jiankang' => $jiankang,
  60. 'createtime' => time(),
  61. ];
  62. Db::name('laorenguanhuai')->insert($data);
  63. $this->success('登记成功');
  64. }
  65. }