the tuijian field is your own recommendation code in the table. Otuijian is the recommendation code that you fill in when you register.
when you output the user list, count and show the number of users" recommendations at the same time. I use the following method
$list =
db("jianlis")
->alias("a")
->join("jianlis b","a.tuijian=b.otuijian")
->field(["a.*,count(b.id) as count"])
->group("a.name")
->paginate(15);
although user information and recommendation statistics can be found, because there are tens of thousands of items of data, it is too slow to query the data, is there a more convenient sql statement, or the model method of tp5?