示例#1
0
 public function updateMultiNewUserPaid(Request $request)
 {
     $ids = $request->get('ids', []);
     foreach ($ids as $id) {
         $user = StudentUser::find($id);
         if (!$user->save()) {
             $data['status'] = 10000;
             $data['msg'] = '结算失败';
             return $data;
         }
     }
     $data['status'] = 0;
     return $data;
 }
示例#2
0
 /**
  * 解锁选中的用户
  * @method unlockUsers
  * @param  Request   $request [description]
  * @return [type]             [description]
  */
 public function unlockUsers(Request $request)
 {
     $ids = $request->get('ids');
     foreach ($ids as $id) {
         $user = StudentUser::find($id);
         $user->isactive = 1;
         $result[] = $user->save();
     }
     // 合并数组中的重复值
     $unique_result = array_unique($result);
     // 如果数组中有且只有true,则操作全部成功
     if (in_array('true', $unique_result) && count($unique_result) == 1) {
         $data['status'] = true;
     } else {
         $data['status'] = false;
     }
     return $data;
 }