我做的话思路大概是这样
如果有redis就从redis查数据,不走mysql
// 查询我所邀请的会员, 并获取id
$aMember = db('会员表')->where($where)->field($field)->select();
$aMemberIds = array_column($aMember, 'member_id');
// 查询会员id对应的任务
$aTask = db('任务表')->where(['member_id' => ['in', $aMemberIds]])->field($field)->select();
// 处理两个数组
foreach ($variable as $key => $value) {
# code...
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…