|
@@ -51,13 +51,29 @@ class User extends Backend
|
|
|
}
|
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
|
$list = $this->model
|
|
|
- ->with('group')
|
|
|
+// ->with('group')
|
|
|
+ ->with(['joinremarks1','joinremarks2','joinremarks3'])
|
|
|
->where($where)
|
|
|
->order($sort, $order)
|
|
|
->paginate($limit);
|
|
|
+
|
|
|
+// // 备注数据-- 不需要查询时
|
|
|
+// $remark_ids = [];
|
|
|
+// $user_remarks_list = UserRemarks::select();
|
|
|
+// foreach ($user_remarks_list as $vurl) {
|
|
|
+// $remark_ids[$vurl['id']] = $vurl['value'];
|
|
|
+// }
|
|
|
+
|
|
|
foreach ($list as $k => $v) {
|
|
|
$v->avatar = $v->avatar ? cdnurl($v->avatar, true) : letter_avatar($v->nickname);
|
|
|
$v->hidden(['password', 'salt']);
|
|
|
+
|
|
|
+// for ($i = 1; $i <= 3; $i++) {
|
|
|
+// $column_remarks = "remarks" . $i;
|
|
|
+// if ($v->$column_remarks != 0 && $v->$column_remarks != "") {
|
|
|
+// $list[$k]->$column_remarks = $remark_ids[$v->$column_remarks];
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
$result = array("total" => $list->total(), "rows" => $list->items());
|
|
|
|
|
@@ -291,8 +307,8 @@ class User extends Backend
|
|
|
$del_relations = true;
|
|
|
// 绑定新关系
|
|
|
$user_b_list = $this->model->where(['type_remarks' => $i, 'bind_remarks' => $params[$param_remarks]])->order('id', 'desc')->select();
|
|
|
- if(count($user_b_list)>0){
|
|
|
- foreach ($user_b_list as $user_b){
|
|
|
+ if (count($user_b_list) > 0) {
|
|
|
+ foreach ($user_b_list as $user_b) {
|
|
|
$user_relation[] = [
|
|
|
'c_user_id' => $row['id'],
|
|
|
'b_user_id' => $user_b['id'],
|
|
@@ -316,10 +332,10 @@ class User extends Backend
|
|
|
//删除旧关系
|
|
|
if ($row[$param_remarks] != 0 && $del_relations) {
|
|
|
$user_b = $this->model->where(['type_remarks' => $i, 'bind_remarks' => $row[$param_remarks]])->order('id', 'desc')->select();
|
|
|
- foreach ($user_b as $vub){
|
|
|
+ foreach ($user_b as $vub) {
|
|
|
$user_b_ids[] = $vub['id'];
|
|
|
}
|
|
|
- model('user_relations')->where('c_user_id',$row['id'])->whereIn('b_user_id',$user_b_ids)->delete();
|
|
|
+ model('user_relations')->where('c_user_id', $row['id'])->whereIn('b_user_id', $user_b_ids)->delete();
|
|
|
}
|
|
|
}
|
|
|
}
|