From 965c97eda48331a2443c57f3e1ddd226c51b744a Mon Sep 17 00:00:00 2001 From: cuixin Date: Fri, 13 Feb 2015 19:16:17 +0800 Subject: [PATCH 1/3] add user register info(addr,unit,phone) --- Westdc/Member/Account.php | 9 ++++++++- Westdc/User/Account.php | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Westdc/Member/Account.php b/Westdc/Member/Account.php index 8aeebfc..4d58d6e 100644 --- a/Westdc/Member/Account.php +++ b/Westdc/Member/Account.php @@ -89,6 +89,10 @@ class Account extends AbstractEventManager implements ServiceManagerAwareInterfa 'password' => md5($data['password']), 'usertype' => $this->RoleMember, 'email' => $data['email'], + 'realname' => $data['realname'], + 'phone' => $data['phone'], + 'unit' => $data['unit'], + 'address' => $data['address'] ]; // $dbh = new TableGateway($this->memberTable, Zend_Db::getInstance()); @@ -205,7 +209,10 @@ class Account extends AbstractEventManager implements ServiceManagerAwareInterfa 'password' => $request->getParam('password'), 'confirm_password' => $request->getParam('confirm_password'), 'email' => $request->getParam('email'), - 'realname' => $request->getParam('realname') + 'realname' => $request->getParam('realname'), + 'phone' => $request->getParam('phone'), + 'unit' => $request->getParam('unit'), + 'address' => $request->getParam('address') ); return $data; diff --git a/Westdc/User/Account.php b/Westdc/User/Account.php index 540c356..df246d8 100644 --- a/Westdc/User/Account.php +++ b/Westdc/User/Account.php @@ -78,7 +78,7 @@ class Account implements EventManagerAwareInterface //注册 public function register($data) - {var_dump($data); + {var_dump($data);exit; $params = compact('data'); $results = $this->getEventManager()->trigger('register.pre', $this, $params); $cache_data = $results->last(); @@ -118,7 +118,7 @@ class Account implements EventManagerAwareInterface $dbh = new dbh(); $id = $dbh->insert($this->memberTable,$data,true); - + if(!empty($id) && is_numeric($id)) { $this->storeLogin($loginData); From 7645b55cd27193d9003535434eb464965c06c558 Mon Sep 17 00:00:00 2001 From: cuixin Date: Fri, 13 Feb 2015 23:21:33 +0800 Subject: [PATCH 2/3] add user view,ban --- Westdc/User/User.php | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/Westdc/User/User.php b/Westdc/User/User.php index 62863fe..5b8f4d6 100644 --- a/Westdc/User/User.php +++ b/Westdc/User/User.php @@ -33,6 +33,7 @@ class User extends AbstractEventManager implements ServiceManagerAwareInterface /** + * 所有用户 * @param $usertype * @return mixed */ @@ -46,6 +47,34 @@ class User extends AbstractEventManager implements ServiceManagerAwareInterface /** + * 用户详细信息 + * @param $userid + * @return mixed + */ + public function view ($userid) { + + $sql = "SELECT * FROM users WHERE id = $userid"; + $rs = $this->db->query($sql); + + return $rs->fetchAll(\PDO::FETCH_ASSOC); + } + + /** + * 禁止用户 + * @param $userid + * @return mixed + */ + public function ban ($userid, $status) { + + $sql = "UPDATE users SET status= $status WHERE id = $userid"; + $this->db->exec($sql); + + return true; + } + + + /** + * 黑河用户 * @return bool */ public function fetchAllHeiHe () { @@ -59,9 +88,13 @@ class User extends AbstractEventManager implements ServiceManagerAwareInterface } + /** + * 所有长时间未登录的用户 + * @return mixed + */ public function fetchAllSendmail () { - $time = date("Y-m-d H:i:s", time() - 3 * 365 * 24 * 3600); + $time = date("Y-m-d H:i:s", time()-3 * 365 * 24 * 3600); $sql = "SELECT * FROM users WHERE ts_last_login<'$time' From 0a266bef023c4baf8e4ea7b702c62d40422772dd Mon Sep 17 00:00:00 2001 From: Jack Freeman Date: Sat, 14 Feb 2015 21:15:52 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Westdc/Metadata/Attachments.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Westdc/Metadata/Attachments.php b/Westdc/Metadata/Attachments.php index af942e8..f759f20 100644 --- a/Westdc/Metadata/Attachments.php +++ b/Westdc/Metadata/Attachments.php @@ -80,4 +80,23 @@ class Attachments extends AbstractEventManager implements ServiceManagerAwareInt return $sql." DESC"; } + public function upload($file) + { + $configService = $this->serviceManager->get('ConfigService'); + $appConfig = $configService->get('application.ini'); + + $fileUploadService = $this->serviceManager->get('File/Upload'); + $fileUploadService->attachDefaultListener(); + $fileUploadService->setParams(['file_type' => 'file']); + + $file_info = $fileUploadService($file,$appConfig['attachment_save_path'],"","",$fileUploadService::DATETIME_MODEL_Y); + + if(isset($file_info['error']) && !empty($file_info['error'])) + { + return array("error" => $file_info['error']); + } + + return $file_info; + } + } \ No newline at end of file