How to use getInfo method of UserModel class

Best AspectMock code snippet using UserModel.getInfo

forum.php

Source:forum.php Github

copy

Full Screen

...32 $user_count = $this->usermodel->getCount();33 //最后发表34 foreach ( $list as $posts )35 {36 $new_post = $this->postmodel->getInfo( array('id' => $posts->post_id) );37 //compareTime :帖子发表的时间距和今天的 时间差38 if ( !empty( $new_post->title ) && !empty( $new_post->created ) )39 {40 $posts->cmptime = compareTime( $new_post->created );41 $posts->new_post = $new_post->title;42 $posts->new_post_id = $new_post->id;43 }44 else45 {46 $posts->cmptime = "";47 $posts->new_post = "";48 $posts->new_post_id = "";49 }50 }51 $this->setComponent( 'plate', array('list' => $list, 'subject_count' => $subject_count, "user_count" => $user_count,52 'posts_count' => $posts_count, "today_count" => $today_count) );53 $this->showTemplate( 'forum_base' );54 }55 //主题列表页56 function postlist( $id, $start = 0 )57 {58 $this->load->library( 'frontpagination' );59 $this->load->helpers( 'myfunctions_helper' );60 $get = $this->input->get();61 $limit = 10;62 $where = array('status' => "normal", 'plate_id' => $id, 'parent_id' => '0');63 $list = $this->postmodel->getList( $where, $limit, $start, "top DESC,created DESC" );64 $count = $this->postmodel->getCount( $where );65 $count_info = $this->postplatemodel->getInfo( array('id' => $id) );66 $today_count = $this->postmodel->getCount( array("created like" => date( "Y-m-d" ) . "%", "parent_id" => 0, 'plate_id' => $id) );67 //$total_user 用户68 $total_user = $this->User_Model->getCount('`id` > 0');69 $config[ 'base_url' ] = base_url() . 'forum/postlist/' . $id;70 $config[ 'total_rows' ] = $count;71 $config[ 'per_page' ] = $limit;72 $this->frontpagination->initialize( $config );73 $pagination = $this->frontpagination->create_links( 4 );74 //查询最后回复的用户信息 和时间75 $this->load->model( "usermodel" );76 foreach ( $list as $key => $item )77 {78 $list[ $key ]->user = $this->usermodel->getInfo( array('id' => $item->user_id) );79 $list[ $key ]->last_reply_user = $this->usermodel->getInfo( array('id' => $item->last_reply) );80 $s = $item->last_reply_time;81 if ( $item->last_reply_time != "0000-00-00 00:00:00" )82 {83 $list[ $key ]->cptime = compareTime( $item->last_reply_time );84 }85 else86 {87 $list[ $key ]->cptime = "";88 }89 }90 $this->setComponent( 'post_list', array('list' => $list, 'plate_id' => $id,91 "pagination" => $pagination, 'count' => $count, 'count_info' => $count_info, "today_count" => $today_count,'total_user'=>$total_user92 ) );93 $this->showTemplate( 'forum_base' );94 }95 /*96 * 添加主题97 * @param int $plate_id 板块id98 */99 function add( $plate_id )100 {101 $plate_info = $this->postplatemodel->getInfo( array("id" => $plate_id) );102 $this->setComponent( 'post_add', array('plate_info' => $plate_info) );103 $this->showTemplate( 'forum_base' );104 }105 function addup( $plate_id )106 {107 $data = $this->input->post();108 if ( empty( $data[ 'title' ] ) || empty( $data[ 'content' ] ) )109 {110 Util::jumpback( "不能发表空白的主题" );111 }112 $data[ 'user_id' ] = $this->user['id'];113 $data[ 'plate_id' ] = $plate_id;114 $data[ 'parent_id' ] = "0";115 //最新主题的id116 $this->postmodel->insert( $data );117 Util::redirect( '/forum/postlist/' . $plate_id );118 }119 /*120 * 帖子详细页面121 * @param int $id 帖子的id122 */123 function view( $id, $start = 0 )124 {125 $this->load->library( "frontpagination" );126 $data = $this->postmodel->getInfo( array("id" => $id) );127 $this->load->model( "usermodel" );128 $data->user = $this->usermodel->getInfo( array('id' => $data->user_id) );129 //楼主的发帖数130 $data->user->posts_count = $this->postmodel->getCount( array('user_id' => $data->user_id, 'parent_id' => 0, "status" => "normal") );131 //查看次数132 $this->postmodel->db->set( 'view', 'view+1', false );133 $this->postmodel->update( array(), array('id' => $id) );134 $plate_info = $this->postplatemodel->getInfo( array('id' => $data->plate_id) );135 $limit = 10;136 //回复信息137 //if( $start == 0 ){138 //$limit--;139 //}140 $repeat_info = $this->postmodel->getList( array("parent_id" => $data->id), $limit, $start, "created ASC" );141 $count = $this->postmodel->getCount( array("parent_id" => $data->id) );142 //分页143 $config[ 'base_url' ] = base_url() . 'forum/view/' . $id;144 $config[ 'total_rows' ] = $count;145 $config[ 'per_page' ] = $limit;146 $this->frontpagination->initialize( $config );147 $pagination = $this->frontpagination->create_links( 4 );148 //回复信息的用户信息149 foreach ( $repeat_info as $info )150 {151 $info->user = $this->usermodel->getInfo( array('id' => $info->user_id) );152 //回复用户的发帖数153 $info->user->posts_count = $this->postmodel->getCount( array('user_id' => $info->user_id, 'parent_id' => 0, "status" => "normal") );154 }155 //上一主题156 $prev[ 'top >=' ] = $data->top;157 $prev[ 'created >=' ] = $data->created;158 $prev[ 'id <>' ] = $data->id;159 $prev[ 'parent_id' ] = 0;160 $prev[ 'plate_id' ] = $data->plate_id;161 //上一主题162 $next[ 'top <=' ] = $data->top;163 $next[ 'created <=' ] = $data->created;164 $next[ 'id <>' ] = $data->id;165 $next[ 'parent_id' ] = 0;...

Full Screen

Full Screen

Index.php

Source:Index.php Github

copy

Full Screen

...26 //绑定socket27 Socket::bind(SESSIONID, $uid);28 29 //获取数据30 $user = $mUser->getInfo();31 32 $this->success($user);33 }34 35 //注册(测试用)36 public function registerAction()37 {38 $data = $this->getRequest()->getParams();39 $username = trim($data['username']);40 $nickname = trim($data['nickname']);41 if(!$username){42 $this->error('InvaludUserName');43 return ;44 }45 if(!$nickname){46 $this->error('InvalidNickName');47 return ;48 }49 50 $redis = RedisDB::factory('user');51 $uid = $redis->incr(UserModel::USERID_KEY);52 $ret = $redis->hSetNx(UserModel::USERNAME_KEY, $username, $uid);53 if(!$ret){54 $this->error('UserNameExists');55 return ;56 }57 58 //write user info59 $user = array(60 'uid' => $uid,61 'username' => $username,62 'nickname' => $nickname,63 'gamepoint' => 0,64 'gold' => 20,65 'regdate' => time(),66 );67 $redis->hMSet(UserModel::INFO_KEY . $uid, $user);68 69 //write auth info70 $token = md5(date('YmdHis') . mt_rand(1000, 9999) . $username);71 $redis->hSet(UserModel::AUTH_KEY, $data['username'], $token);72 73 $this->success(array(74 'username' => $username,75 'token' => $token,76 ));77 }78 79 //客户端连接80 public function onConnectAction()81 {82 //TODO83 }84 85 //客户端关闭86 public function onCloseAction()87 {88 $mUser = new UserModel();89 $uid = $mUser->getUid();90 $ret = Socket::unbind(SESSIONID, $uid);91 92 //玩家离线处理93 if($ret){94 $user = $mUser->getInfo();95 if(!empty($user['roomid'])){96 $mRoom = new RoomModel($mUser, $user['roomid']);97 $mRoom->offline($user['seatid']);98 }99 }100 }101 102 //创建房间103 public function createAction()104 {105 $mUser = new UserModel();106 $user = $mUser->getInfo();107 if($user['gold'] < 5){108 $this->error('GoldLess');109 return ;110 }111 112 if(!empty($user['roomid'])){113 $this->error('InRoom');114 return ;115 }116 117 $mGame = new RoomModel($mUser);118 $ret = $mGame->create();119 if(!$ret){120 $this->error('CreateFailed');121 return ;122 }123 124 //update user info125 $mUser->save(array(126 'roomid' => $mGame->getId(),127 ));128 129 $this->success($ret);130 }131 132 //加入房间133 public function joinAction()134 {135 $data = $this->getRequest()->getParams();136 $roomid = $data['roomid'];137 if(!$roomid){138 $this->error('InvalidRoomId');139 return ;140 }141 142 $mUser = new UserModel();143 $user = $mUser->getInfo();144 if($user['gold'] < 5){145 $this->error('GoldLess');146 return ;147 }148 149 if(!empty($user['roomid'])){150 $this->error('InRoom');151 return ;152 }153 154 $mGame = new RoomModel($mUser, $roomid);155 $ret = $mGame->join($user['uid']);156 if(!$ret){157 $this->error('PositionLess');158 return ;159 }160 161 $this->success($ret);162 }163 164 //退出房间165 public function leaveAction()166 {167 $mUser = new UserModel();168 $user = $mUser->getInfo();169 if(!$user['roomid']){170 $this->error('NotInRoom');171 return ;172 }173 174 $mGame = new RoomModel($mUser, $user['roomid']);175 $ret = $mGame->leave();176 if(!$ret){177 $this->error('LeaveFailed');178 return ;179 }180 181 $this->success();182 }...

Full Screen

Full Screen

User.php

Source:User.php Github

copy

Full Screen

...5class UserController extends Yaf\Controller_Abstract {6 //个人中心数据7 public function infoAction(){8 $data = $this->getRequest()->getPost();9 $userInfo = \Api\UserModel::getInstance()->getInfo($data['openid']);10 11 //消息12 $result['messageCount'] = \Api\UserModel::getInstance()->getNewMessage($userInfo['id']);13 //造型收藏14 $result['modellingCollect'] = \Api\UserModel::getInstance()->getModellingCollect($userInfo['id']);15 //装备收藏16 $result['equipCollect'] = \Api\UserModel::getInstance()->getEquipCollect($userInfo['id']);17 //音乐收藏18 $result['musicCollect'] = \Api\UserModel::getInstance()->getMusicCollect($userInfo['id']);19 json_return($result);20 return false;21 }22 //用户消息记录23 public function messageAction(){24 $data = $this->getRequest()->getPost();25 $userInfo = \Api\UserModel::getInstance()->getInfo($data['openid']);26 $result = \Api\UserModel::getInstance()->getMessage($userInfo['id']);27 json_return($result);28 return false;29 }30 //发送消息31 public function sendMessageAction(){32 $data = $this->getRequest()->getPost();33 $userInfo = \Api\UserModel::getInstance()->getInfo($data['openid']);34 35 $data['sender'] = $userInfo['id'];36 unset($data['openid']);37 $result = \Api\UserModel::getInstance()->sendMessage($data);38 json_return($result);39 return false;40 }41 //收藏音乐列表42 public function collectMusicAction(){43 $data = $this->getRequest()->getPost();44 $userInfo = \Api\UserModel::getInstance()->getInfo($data['openid']);45 $result = \Api\UserModel::getInstance()->getCollectMusic($userInfo['id']);46 json_return($result);47 return false;48 }49 //收藏造型列表50 public function collectModellingAction(){51 $data = $this->getRequest()->getPost();52 $userInfo = \Api\UserModel::getInstance()->getInfo($data['openid']);53 54 $result = \Api\UserModel::getInstance()->getCollectModelling($userInfo['id']);55 json_return($result);56 return false;57 }58 //收藏装备列表59 public function collectEquipAction(){60 $data = $this->getRequest()->getPost();61 $userInfo = \Api\UserModel::getInstance()->getInfo($data['openid']);62 63 $result = \Api\UserModel::getInstance()->getCollectEquip($userInfo['id']);64 json_return($result);65 return false;66 }67 //造型详情68 public function modellingAction(){69 $data = $this->getRequest()->getPost();70 $result = \Api\UserModel::getInstance()->getModelling($data['id']);71 json_return($result);72 return false;73 }74}...

Full Screen

Full Screen

getInfo

Using AI Code Generation

copy

Full Screen

1$obj = new UserModel();2$obj->getInfo();3$obj = new UserModel();4$obj->getInfo();5$obj = new UserModel();6$obj->getInfo();7$obj = new UserModel();8$obj->getInfo();9$obj = new UserModel();10$obj->getInfo();11$obj = new UserModel();12$obj->getInfo();13$obj = new UserModel();14$obj->getInfo();15$obj = new UserModel();16$obj->getInfo();17$obj = new UserModel();18$obj->getInfo();19$obj = new UserModel();20$obj->getInfo();21$obj = new UserModel();22$obj->getInfo();23$obj = new UserModel();24$obj->getInfo();25$obj = new UserModel();26$obj->getInfo();27$obj = new UserModel();28$obj->getInfo();29$obj = new UserModel();30$obj->getInfo();31$obj = new UserModel();32$obj->getInfo();33$obj = new UserModel();34$obj->getInfo();35$obj = new UserModel();36$obj->getInfo();37$obj = new UserModel();38$obj->getInfo();

Full Screen

Full Screen

getInfo

Using AI Code Generation

copy

Full Screen

1$user = new UserModel();2$user->getInfo();3$user = new UserModel();4$user->getInfo();5$user = new UserModel();6$user->getInfo();7$user = new UserModel();8$user->getInfo();9$user = new UserModel();10$user->getInfo();11$user = new UserModel();12$user->getInfo();13$user = new UserModel();14$user->getInfo();15$user = new UserModel();16$user->getInfo();17$user = new UserModel();18$user->getInfo();19$user = new UserModel();20$user->getInfo();21$user = new UserModel();22$user->getInfo();23$user = new UserModel();24$user->getInfo();25$user = new UserModel();26$user->getInfo();27$user = new UserModel();28$user->getInfo();29$user = new UserModel();30$user->getInfo();31$user = new UserModel();32$user->getInfo();33$user = new UserModel();34$user->getInfo();35$user = new UserModel();36$user->getInfo();37$user = new UserModel();38$user->getInfo();

Full Screen

Full Screen

getInfo

Using AI Code Generation

copy

Full Screen

1$user = new UserModel();2echo $user->getInfo();3require_once 'UserModel.php';4$user = new UserModel();5echo $user->getInfo();6require_once 'UserModel.php';7$user = new UserModel();8echo $user->getInfo();9require_once 'UserModel.php';10$user = new UserModel();11echo $user->getInfo();12require_once 'UserModel.php';13$user = new UserModel();14echo $user->getInfo();15require_once 'UserModel.php';16$user = new UserModel();17echo $user->getInfo();18require_once 'UserModel.php';19$user = new UserModel();20echo $user->getInfo();21require_once 'UserModel.php';22$user = new UserModel();23echo $user->getInfo();24require_once 'UserModel.php';25$user = new UserModel();26echo $user->getInfo();27require_once 'UserModel.php';28$user = new UserModel();29echo $user->getInfo();30require_once 'UserModel.php';31$user = new UserModel();32echo $user->getInfo();33require_once 'UserModel.php';34$user = new UserModel();35echo $user->getInfo();36require_once 'UserModel.php';37$user = new UserModel();38echo $user->getInfo();39require_once 'UserModel.php';40$user = new UserModel();41echo $user->getInfo();

Full Screen

Full Screen

getInfo

Using AI Code Generation

copy

Full Screen

1$user = new UserModel();2echo $user->getInfo();3{4 protected $name;5 protected $age;6 public function __construct($name, $age)7 {8 $this->name = $name;9 $this->age = $age;10 }11 public function getInfo()12 {13Age: $this->age";14 }15}16{17 public function getInfo()18 {19Location: New York";20 }21}22$user = new UserModel('John Doe', 25);23echo $user->getInfo();

Full Screen

Full Screen

getInfo

Using AI Code Generation

copy

Full Screen

1$object = new UserModel();2$object->getInfo();3class User {4 public function getInfo($name) {5 echo "Name: $name";6 }7}8class UserModel extends User {9 public function getInfo($name, $age) {10 echo "Name: $name";11 echo "Age: $age";12 }13}14$object = new UserModel();15$object->getInfo("John", 25);16class User {17 public function getInfo($name) {18 echo "Name: $name";19 }20}21class UserModel extends User {22 public function getInfo($age) {23 echo "Age: $age";24 }25}26$object = new UserModel();27$object->getInfo(25);28class User {29 public function getInfo() {30 return "John";31 }32}33class UserModel extends User {34 public function getInfo() {35 return 25;36 }37}38$object = new UserModel();39echo $object->getInfo();

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run AspectMock automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger getInfo code on LambdaTest Cloud Grid

Execute automation tests with getInfo on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful