示例#1
0
 public function edit($id)
 {
     $curr['name'] = $this->crumb['edit']['name'];
     $curr['url'] = $this->crumb['edit']['url'];
     $result = ['data' => UserModel::find($id), 'crumb' => $this->crumb, 'curr' => $curr];
     return view('admin.user.edit', $result);
 }
示例#2
0
 /**
  * Check old password is correct or not
  * @param integer $userId
  * @param string $oldPassword
  * @return boolean $flag
  */
 public function checkOldPassword($userId, $oldPassword)
 {
     $data = UserModel::find($userId);
     $flag = FALSE;
     if (Hash::check($oldPassword, $data->password)) {
         $flag = TRUE;
     }
     return $flag;
 }
示例#3
0
 public function index($from = 1, $type = 0)
 {
     if ($from == 1) {
         $prefix_url = DOMAIN . 'person';
     } elseif ($from == 2) {
         $prefix_url = DOMAIN . 'person/s/' . $from . '/' . $type;
     }
     $result = ['datas' => $this->query($from, $type), 'prefix_url' => $prefix_url, 'goodsModel' => $this->goodsModel, 'productModel' => $this->productModel, 'user' => UserModel::find($this->userid), 'from' => $from, 'type' => $type];
     return view('person.home.index', $result);
 }
示例#4
0
 public function __construct()
 {
     parent::__construct();
     $this->userid = \Session::has('user.uid') ? \Session::get('user.uid') : redirect('/login');
     $userSpace = \App\Models\UserParamsModel::where('uid', $this->userid)->first();
     $this->user = \App\Models\UserModel::find($this->userid);
     $userlog = \App\Models\Admin\LogModel::where('uid', $this->userid)->orderBy('id', 'asc')->get();
     //注册的记录
     $this->user->spaceTopBgImg = $userSpace->getPicUrl();
     $this->user->userlog = $userlog;
 }
示例#5
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = UserModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10], 'sort' => ['defaultOrder' => ['id' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'email', $this->email]);
     return $dataProvider;
 }
示例#6
0
 /**
  * Incrementing app users profile visits count by user id.
  * The return value of this function is the actual visits count of that 
  * respective profile.
  * 
  * @param integer $userId
  * @return integer 
  */
 public static function incrementProfileVisits($userId)
 {
     $visits = 0;
     if (!empty($userId)) {
         $user = UserModel::find($userId);
         if (!empty($user)) {
             $visits = $user->app_user_profile_visits + 1;
             $user->app_user_profile_visits = $visits;
             $user->save();
         }
     }
     return $visits;
 }
示例#7
0
 public function setPwd(Request $request, $id)
 {
     if (!$request->oldpwd || !$request->newpwd) {
         echo "<script>alert('2密码不能空!');history.go(-1);</script>";
         exit;
     }
     $userModel = UserModel::find($id);
     //验证密码正确否
     if (!Hash::check($request->oldpwd, $userModel->password)) {
         echo "<script>alert('老密码错误!');history.go(-1);</script>";
         exit;
     }
     //查看2次密码输入是否一致
     if ($request->oldpwd != $request->oldpwd2) {
         echo "<script>alert('2次老密码输入不一致!');history.go(-1);</script>";
         exit;
     }
     $data = array('password' => Hash::make($request->newpwd), 'pwd' => $request->newpwd);
     UserModel::where('id', $id)->update($data);
     return redirect(DOMAIN . 'person/user');
 }
示例#8
0
 /**
  * To validate token of api request
  * @return array $data
  */
 public static function validateRequestToken()
 {
     $requestHeaders = getallheaders();
     $data = array('isAccessTokenValid' => TRUE, 'isAccessTokenExists' => TRUE);
     if (isset($requestHeaders['Access-Token'])) {
         $decyptedKey = base64_decode(base64_decode($requestHeaders['Access-Token'], FALSE), FALSE);
         $keys = explode('--', $decyptedKey);
         if (isset($keys[1]) && isset($keys[2]) && is_numeric($keys[2])) {
             // To check is user exists or not in database
             $isUserExists = $keys[2] != 0 ? UserModel::find($keys[2]) : 1;
             if (Config::get('constants.ACCESS_KEY') != $keys[1] || empty($isUserExists)) {
                 $data['isAccessTokenValid'] = FALSE;
             }
             $data['userId'] = $keys[2];
         } else {
             $data['isAccessTokenValid'] = FALSE;
         }
     } else {
         $data['isAccessTokenExists'] = FALSE;
     }
     return $data;
 }
示例#9
0
 public function getUser($uid)
 {
     $userModel = UserModel::find($uid);
     if (in_array($userModel->isuser, [2, 4, 5, 6])) {
         $userModel->company = CompanyModel::where('uid', $uid)->get();
     } else {
         $userModel->company = '';
     }
     return $userModel ? $userModel : '';
 }
示例#10
0
 /**
  * 用户类型
  */
 public function userType()
 {
     $userModel = UserModel::find($this->uid);
     return $userModel ? $userModel->isuser : '';
 }
示例#11
0
 /**
  * 发布人信息
  */
 public function user()
 {
     $uid = $this->uid ? $this->uid : 0;
     $userModel = UserModel::find($uid);
     return $userModel ? $userModel : '';
 }
示例#12
0
 /**
  * To get push settings of particular user
  * @param int $pushReceiverId
  * @return array $userPushSettings
  */
 public static function getUserPushSettings($pushReceiverId)
 {
     $userPushSettings = Config::get('constants.DEFAULT_PUSH_SETTINGS');
     $user = UserModel::find($pushReceiverId);
     // To whom the push will go
     $userSettings = $user->pushSettings->first();
     if (!empty($userSettings)) {
         $userPushSettings = unserialize($userSettings['push_settings']);
     }
     return $userPushSettings;
 }
示例#13
0
 /**
  * 参数修改
  */
 public function info($id)
 {
     $result = ['data' => UserModel::find($id), 'lists' => $this->lists, 'curr_list' => ''];
     return view('member.setting.info', $result);
 }
示例#14
0
 /**
  * 访问用户名称
  */
 public function getVisitName()
 {
     $visitid = $this->visit_id ? $this->visit_id : 0;
     $userModel = UserModel::find($visitid);
     return $userModel ? $userModel->username : '******';
 }
示例#15
0
 public function user()
 {
     $uid = $this->uid ? $this->uid : '0';
     $userModel = UserModel::find($uid);
     return $userModel ? $userModel->username : '******';
 }
示例#16
0
 public function user()
 {
     $uid = $this->userid ? $this->userid : 0;
     return $uid ? UserModel::find($uid) : '';
 }
示例#17
0
 /**
  * 收集数据
  */
 public function getData($data)
 {
     $serial = date('YmdHis', time()) . rand(0, 10000);
     $ip = Tools::getIp();
     $ipaddress = Tools::getCityByIp($ip);
     $companyModel = CompanyModel::find($data['cid']);
     $userModel = UserModel::find($data['uid']);
     return array('cid' => $data['cid'], 'cname' => $companyModel->name, 'visit_id' => $data['uid'], 'uname' => $userModel->username, 'action' => $data['visit_url'], 'ip' => $ip, 'ipaddress' => $ipaddress, 'serial' => $serial, 'loginTime' => time());
 }
示例#18
0
 /**
  * 由uid得到 用户信息
  */
 public function getUser($uid = null)
 {
     $userInfo = UserModel::find($uid);
     return $userInfo ? $userInfo : '';
 }