tp的复杂连表

本文介绍了一个PHP实现的API接口,用于获取指定ID的微信子账号详细信息及关联设备列表。通过数据库查询操作返回子账号的状态、注册时间等基本信息,并获取了前10条设备记录。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

public function getWxChildList()
    {
        $response['errcode'] = 202;
        $response['errmsg'] = '查询失败';
        if(IS_POST)
        {
            $id = I('post.id');
            $res = M('TOpChildwx')
                ->field('id,perid,cname,CONVERT(varchar(120), register_time, 23) as time,user_status,wx_code,wx_pwd,shebei_code,shebei_name,register_way,register_code,card_pos,beizhu,status,cost')
                ->where("id = '{$id}'")
                ->find();
            $equipment = M('t_op_ysdevice')
                ->alias('a')
                ->join('t_ma_device b on a.materialId = b.id')
                ->field('a.id,a.devino,b.ma_desc,b.ma_vector')
                ->limit(10)
                ->select();

            if(!empty($res)){
                $response['errcode'] = 200;
                $response['errmsg'] = '查询成功';
                $response['data'] = $res;
                $response['equipment'] = $equipment;
            }

        }
        $this->ajaxreturn($response);
    }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值