123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- namespace app\index\logic;
- use app\common\model\appointmentmodel;
- /**
- * 登记记录表
- *
- * @author wj
- * @date 2022-07-22
- */
- class appointmentlogic extends baselogic
- {
- /**
- * 设置请求数据规则
- * 20220107
- * wj
- */
- protected function setrules()
- {
- $list = [
- 'getuseablelist' => [
- ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
- ],
- 'newinfo' => [
- ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
- ['name' => 'sfzid', 'title' => '身份证号', 'require' => true, 'type' => 'string'],
- ['name' => 'name', 'title' => '姓名', 'require' => true, 'type' => 'string'],
- ['name' => 'telno', 'title' => '手机号', 'require' => false, 'type' => 'string'],
- ['name' => 'signurl', 'title' => '签名', 'require' => true, 'type' => 'string'],
- ['name' => 'age', 'title' => '年龄', 'require' => true, 'type' => 'numeric'],
- ['name' => 'gender', 'title' => '性别', 'require' => true, 'type' => 'string'],
- ['name' => 'birthday', 'title' => '生日', 'require' => true, 'type' => 'string'],
- //['name' => 'wid', 'title' => '用户id', 'require' => true, 'type' => 'numeric'],
- //['name' => 'gps_lng', 'title' => '经度', 'require' => false, 'type' => 'numeric', 'default' => ''],
- //['name' => 'gps_lat', 'title' => '纬度', 'require' => false, 'type' => 'numeric', 'default' => ''],
- ],
- ];
- return $list;
- }
- /**
- * 获取用户可用数据
- *
- * @param [type] $arr
- * @return void
- * @author wj
- * @date 2022-07-25
- */
- public function getuseablelist($arr)
- {
- $result = $this->checkparam(__FUNCTION__, $arr);
- if (1 != $result['status']) {
- return $result;
- }
- $data = $result['data'];
- $openid = $data['openid'];
- $m_a = new appointmentmodel();
- $where = ['openid' => $openid, 'ispay' => '1', 'isuse' => 0];
- $field = ['id', 'openid', 'name', 'telno'];
- $list = $m_a->getList($where, $field, 1, 0);
- if (empty($list)) {
- return backarr(0, "无申请数据");
- }
- return backarr(1, "查询成功", $list);
- }
- /**
- * 新建用户申请数据
- *
- * @param [type] $arr
- * @return void
- * @author wj
- * @date 2022-07-22
- */
- public function newinfo($arr)
- {
- $result = $this->checkparam(__FUNCTION__, $arr);
- if (1 != $result['status']) {
- return $result;
- }
- $data = $result['data'];
- $m_a = new appointmentmodel();
- $insertData = [
- 'openid' => $data['openid'],
- 'name' => $data['name'],
- 'sfzid' => $data['sfzid'],
- 'telno' => $data['telno'],
- 'oprdate' => date('Y-m-d H:i:s'),
- 'signurl' => $data['signurl'],
- 'age' => $data['age'],
- 'gender' => $data['gender'],
- 'birthday' => $data['birthday'],
- ];
- $id = $m_a->insertData($insertData);
- if (empty($id)) {
- return backarr(0, "添加失败");
- }
- return backarr(1, "添加成功", ['id' => $id]);
- }
- }
|