<?php
namespace app\app\logic;

use app\index\model\appointmentmodel;

/**
 * 登记记录表
 *
 * @author wj
 * @date 2022-07-22
 */
class appointmentlogic extends baselogic
{
    /**
     * 设置请求数据规则
     * 20220107
     * wj
     */
    protected function setrules()
    {
        $list = [
            'getinfobyid' => [
                ['name' => 'id', 'title' => '申请id', 'require' => true, 'type' => 'numeric'],
            ],
        ];
        return $list;
    }
    /**
     * 获取用户当日申请最后一条数据
     *
     * @param  [type] $arr
     * @return void
     * @author wj
     * @date 2022-07-22
     */
    public function getinfobyid($arr)
    {
        $result = $this->checkparam(__FUNCTION__, $arr);
        if (1 != $result['status']) {
            return $result;
        }
        $m_a = new appointmentmodel();
        $where = ['id' => $arr['id']];
        $field = ['name', 'sfzid', 'telno', 'signurl', 'oprdate', 'ispay', 'isuse', 'payorderno'];
        $info = $m_a->getInfo($where, $field);
        if (empty($info)) {
            return backarr(0, "无申请数据");
        }
        if (!$info['ispay']) {
            return backarr(0, "未支付");
        }
        if ($info['isuse']) {
            return backarr(0, "已使用");
        }
        return backarr(1, "查询成功", $info);
    }
}
