appointmentlogic.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. namespace app\index\logic;
  3. use app\common\model\appointmentmodel;
  4. /**
  5. * 登记记录表
  6. *
  7. * @author wj
  8. * @date 2022-07-22
  9. */
  10. class appointmentlogic extends baselogic
  11. {
  12. /**
  13. * 设置请求数据规则
  14. * 20220107
  15. * wj
  16. */
  17. protected function setrules()
  18. {
  19. $list = [
  20. 'getuseablelist' => [
  21. ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
  22. ],
  23. 'newinfo' => [
  24. ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
  25. ['name' => 'sfzid', 'title' => '身份证号', 'require' => true, 'type' => 'string'],
  26. ['name' => 'name', 'title' => '姓名', 'require' => true, 'type' => 'string'],
  27. ['name' => 'telno', 'title' => '手机号', 'require' => false, 'type' => 'string'],
  28. ['name' => 'signurl', 'title' => '签名', 'require' => true, 'type' => 'string'],
  29. //['name' => 'wid', 'title' => '用户id', 'require' => true, 'type' => 'numeric'],
  30. //['name' => 'gps_lng', 'title' => '经度', 'require' => false, 'type' => 'numeric', 'default' => ''],
  31. //['name' => 'gps_lat', 'title' => '纬度', 'require' => false, 'type' => 'numeric', 'default' => ''],
  32. ],
  33. ];
  34. return $list;
  35. }
  36. /**
  37. * 获取用户可用数据
  38. *
  39. * @param [type] $arr
  40. * @return void
  41. * @author wj
  42. * @date 2022-07-25
  43. */
  44. public function getuseablelist($arr)
  45. {
  46. $result = $this->checkparam(__FUNCTION__, $arr);
  47. if (1 != $result['status']) {
  48. return $result;
  49. }
  50. $data = $result['data'];
  51. $openid = $data['openid'];
  52. $m_a = new appointmentmodel();
  53. $where = ['openid' => $openid, 'ispay' => '1', 'isuse' => 0];
  54. $field = ['id', 'openid', 'name', 'telno'];
  55. $list = $m_a->getList($where, $field, 1, 0);
  56. if (empty($list)) {
  57. return backarr(0, "无申请数据");
  58. }
  59. return backarr(1, "查询成功", $list);
  60. }
  61. /**
  62. * 新建用户申请数据
  63. *
  64. * @param [type] $arr
  65. * @return void
  66. * @author wj
  67. * @date 2022-07-22
  68. */
  69. public function newinfo($arr)
  70. {
  71. $result = $this->checkparam(__FUNCTION__, $arr);
  72. if (1 != $result['status']) {
  73. return $result;
  74. }
  75. $data = $result['data'];
  76. $m_a = new appointmentmodel();
  77. $insertData = [
  78. 'openid' => $data['openid'],
  79. 'name' => $data['name'],
  80. 'sfzid' => $data['sfzid'],
  81. 'telno' => $data['telno'],
  82. 'oprdate' => date('Y-m-d H:i:s'),
  83. 'signurl' => $data['signurl'],
  84. ];
  85. $id = $m_a->insertData($insertData);
  86. if (empty($id)) {
  87. return backarr(0, "添加失败");
  88. }
  89. return backarr(1, "添加成功", ['id' => $id]);
  90. }
  91. }