WriteOffController.php 1.2 KB

12345678910111213141516171819202122232425
  1. <?php
  2. namespace app\admin\controller\finance;
  3. use support\Db;
  4. class WriteOffController
  5. {
  6. public function records()
  7. {
  8. $sql = "select a.appointment_id as benefit_id,a.appointment_addtimes as addtimes,m.member_mobile,c.member_cert_name,b.member_benefit_name as benefit_name,a.appointment_done_json as used_json,a.appointment_done_datetime from app_appointment as a
  9. left join app_member as m on m.member_id = a.join_appointment_member_id
  10. left join app_member_cert as c on c.join_cert_member_id = a.join_appointment_member_id
  11. left join app_member_benefit as b on b.join_benefit_member_id = a.join_appointment_member_id
  12. UNION
  13. select q.member_quota_id as benefit_id,q.member_quota_addtimes as addtimes,q.member_quota_used_json as used_json, q.member_quota_name as benefit_name,m.member_mobile,c.member_cert_name from app_member_quota as q
  14. left join app_member as m on m.member_id = q.join_quota_member_id
  15. left join app_member_cert as c on c.join_cert_member_id = q.join_quota_member_id
  16. order by addtimes desc limit 0,10";
  17. $records = Db::select($sql);
  18. dump($records);
  19. }
  20. }