Ejemplo n.º 1
0
 /**
  * 加载DAO文件
  *
  * @param string $path DAO文件
  * @return object
  */
 public static function loadDao($path)
 {
     if (self::$_daoFactory === null) {
         Wind::import('WIND:dao.WindDaoFactory');
         self::$_daoFactory = new WindDaoFactory();
     }
     $dao = self::$_daoFactory->getDao('WINDID:service.' . $path);
     $dao->setDelayAttributes(array('connection' => array('ref' => 'windiddb')));
     return $dao;
 }
Ejemplo n.º 2
0
 /**
  * 获取基础dao
  *
  * @return object| throw Error
  */
 public function getBaseInstance()
 {
     if (!$this->_baseInstance) {
         if (empty($this->_defaultbaseInstance)) {
             throw new Exception('This dao is error');
         }
         $this->_baseInstance = Windid::loadDao($this->_defaultbaseInstance);
     }
     return $this->_baseInstance;
 }
Ejemplo n.º 3
0
 public function get($path, $ifthumb)
 {
     $dir = dirname($path);
     $file = basename($path);
     if ($ifthumb & 2) {
         $dir .= '/thumb/mini';
     } elseif ($ifthumb & 1) {
         $dir .= '/thumb';
     }
     return Windid::attachUrl() . '/' . $dir . '/' . $file;
 }
Ejemplo n.º 4
0
 public function doAvatar($uid, $file = '')
 {
     $client = Windid::client();
     $time = time() + $client->timecv * 60;
     $query = array('m' => 'api', 'c' => 'avatar', 'a' => 'doavatar', 'windidkey' => WindidUtility::appKey($client->clientId, $time, $client->clientKey), 'clientid' => $client->clientId, 'time' => $time, 'uid' => $uid);
     $url = $client->serverUrl . '/windid/index.php?' . http_build_query($query);
     $result = WindidUtility::uploadRequest($url, $file);
     if ($result === false) {
         return WindidError::SERVER_ERROR;
     }
     return WindJson::decode($result, true, $client->clientCharser);
 }
Ejemplo n.º 5
0
 public function registerTmpUser($from = 1, $key = '')
 {
     //need to check if registered user exists or not
     if (empty($key) == false) {
         //if has key, then check if this key has user or not
         $tmpFound = $this->getbyKey($from, $key);
         if (empty($tmpFound) == false) {
             //if has user info, then return user's information
             $userid = $tmpFound['userid'];
             return Windid::load('user.WindidUser')->getUserByUid($userid, WindidUser::FETCH_MAIN);
         }
     }
     Wind::import('SRC:service.user.dm.PwUserInfoDm');
     $userDm = new PwUserInfoDm();
     $password = substr(md5(rand() . '123456'), 0, 15);
     //order number: 13 number and 3 random number
     $currentTimeStamp = strtotime("+0 day");
     $prefix = 'tmp';
     if ($from == 1) {
         $prefix = 'web';
     } else {
         if ($from == 2) {
             $prefix = 'app';
         } else {
             if ($from == 3) {
                 $prefix = 'wx';
             }
         }
     }
     $username = $prefix . rand(10, 99) . $currentTimeStamp;
     $userDm->setUsername($username);
     $userDm->setPassword($password);
     $userDm->setRegdate(Pw::getTime());
     $userDm->setLastvisit(Pw::getTime());
     $userDm->setRegip(Wekit::app()->clientIp);
     Wind::import('SRV:user.srv.PwRegisterService');
     Wind::import('APPS:u.service.helper.PwUserHelper');
     Wind::import('SRV:user.validator.PwUserValidator');
     Wind::import('Wind:utility.WindValidator');
     Wind::import('SRV:user.srv.PwLoginService');
     $registerService = new PwRegisterService();
     $registerService->setUserDm($userDm);
     $info = $registerService->register();
     $userService = Wekit::load('user.srv.PwUserService');
     $userService->updateLastLoginData($info['uid'], Wekit::app()->clientIp);
     $userService->createIdentity($info['uid'], $password);
     $dm = new App_Tmpuser_Dm();
     $dm->setUserId($info['uid']);
     $dm->setFrom($from);
     $dm->setKey($key);
     $this->add($dm);
     return $info;
 }
Ejemplo n.º 6
0
 public static function open($script, $getData = array(), $postData = array(), $method = 'post', $protocol = 'http')
 {
     echo "here";
     $client = Windid::client();
     $time = time() + $client->timecv * 60;
     list($c, $a) = explode('/', $script);
     $query = array('m' => 'api', 'c' => $c, 'a' => $a, 'windidkey' => WindidUtility::appKey($client->clientId, $time, $client->clientKey), 'clientid' => $client->clientId, 'time' => $time);
     $url = $client->serverUrl . '/windid/index.php?' . http_build_query($query) . '&' . http_build_query($getData);
     $result = WindidUtility::buildRequest($url, $postData);
     if ($result === false) {
         return WindidError::SERVER_ERROR;
     }
     return WindJson::decode($result, true, $client->clientCharser);
 }
Ejemplo n.º 7
0
 public function getStore()
 {
     $ds = Windid::load('config.WindidConfig');
     $stores = $ds->getValues('storage');
     $config = $ds->getValues('attachment');
     $config = $config['storage.type'];
     if (!$config || !isset($stores[$config])) {
         $cls = 'WINDID:library.storage.WindidStorageLocal';
     } else {
         $store = unserialize($stores[$config]);
         $cls = $store['components']['path'];
     }
     $srv = Wind::import($cls);
     return new $srv();
     //$this->store = Wind::getComponent($this->bhv->isLocal ? 'windidLocalStorage' : 'windidStorage');
 }
Ejemplo n.º 8
0
 public function beforeAction($handlerAdapter)
 {
     parent::beforeAction($handlerAdapter);
     echo "<pre/>";
     $orderStatuses = $this->_getMyOrderDS()->getAllStatus();
     $shopOrders = $this->_getMyOrderDS()->getShopOrders(1, 11045, 1, $orderStatuses, '', -1, 2, 0);
     print_r($shopOrders);
     //UPDATE  `pw4t`.`pw_windid_user` SET  `password` =  'b3ff2df1b3ca95d9ae2c03d93f821201' WHERE  `pw_windid_user`.`uid` =1 LIMIT 1 ;
     //UPDATE  `pw4t`.`pw_user` SET  `password` =  'ece4f4a60b764339b94a07c84e338a27' WHERE  `pw_user`.`uid` =1 LIMIT 1 ;
     echo md5(md5('ece4f4a60b764339b94a07c84e338a27') . "2GGDpd");
     date_default_timezone_set("Asia/Shanghai");
     $now = date("Y-m-d H:i:s", strtotime('now'));
     echo $now;
     $info = $this->_getMyOrderDS()->updateOrderItemStatus("464,465", -1);
     $myOrderShops = $this->_getSchoolPeopleDS()->getPeopleSchedule($this->loginUser->uid, 11045, 0, '2013-08-08 00:00:00', '2013-08-08 23:59:59');
     $shopids = " -1 ";
     foreach ($myOrderShops as $day => $shopSchedules) {
         foreach ($shopSchedules as $shopid => $eachshopschedules) {
             $shopids = $shopids . "," . $shopid;
             foreach ($eachshopschedules as $key => &$eachschedule) {
                 $eachschedule['datetimeBegin'] = $day . " " . $eachschedule['datetimeBegin'];
                 $eachschedule['datetimeEnd'] = $day . " " . $eachschedule['datetimeEnd'];
                 $schedules[] = $eachschedule;
             }
         }
     }
     print_r($shopids);
     print_r($schedules);
     print_r($myOrderShops);
     echo "<br/>";
     $estimatetime = $this->_getShopDS()->getShopOrderTimeBase(1);
     print_r($estimatetime);
     date_default_timezone_set("Asia/Shanghai");
     $schoolSchedule = (include Wind::getRealPath('ROOT:conf.schoolOpenSchedule.php', true));
     $opening = $this->_getSchoolDS()->isSchoolOpenNow(11045);
     var_dump($opening);
     $result = $this->_getMyOrderDS()->getSchoolPeopleStatistics(11045, 10, 0);
     print_r($result);
     $time = Windid::getTime();
     echo "time:" . $time;
     echo "<br/>";
     echo "key_1: " . md5('1' . '||' . 'b6a76c3e4aa21dbf9aeee10bfaba1f2a');
     echo "<br/>";
     print md5(md5('1' . '||' . 'b6a76c3e4aa21dbf9aeee10bfaba1f2a') . $time);
     die;
 }
Ejemplo n.º 9
0
 public function defaultAvatar($uid, $type = 'face')
 {
     Wind::import('WINDID:service.upload.WindidUpload');
     $_avatar = array('.jpg' => '_big.jpg', '_middle.jpg' => '_middle.jpg', '_small.jpg' => '_small.jpg');
     $defaultBanDir = Wind::getRealDir('PUBLIC:') . 'res/images/face/';
     Wind::import('WINDID:service.config.srv.WindidStoreService');
     $srv = new WindidStoreService();
     $store = $srv->getStore();
     $fileDir = '/avatar/' . Windid::getUserDir($uid) . '/';
     foreach ($_avatar as $des => $org) {
         $toPath = $store->getAbsolutePath($uid . $des, $fileDir);
         $fromPath = $defaultBanDir . $type . $org;
         WindidUpload::createFolder(dirname($toPath));
         WindidUpload::copyFile($fromPath, $toPath);
         $store->save($toPath, $fileDir . $uid . $des);
     }
     return true;
 }
Ejemplo n.º 10
0
    /**
     * 获取头像上传代码
     *
     * @param int $uid 用户uid
     * @param int $getHtml 获取代码|配置
     * @return string|array
     */
    public function showFlash()
    {
        $uid = $this->getInput('uid');
        $getHtml = $this->getInput('getHtml');
        $client = Windid::client();
        $time = Windid::getTime();
        $key = WindidUtility::appKey($client->clientId, $time, $client->clientKey);
        $postUrl = "postAction=ra_postAction&redirectURL=/&requestURL=" . urlencode($client->serverUrl . "/windid/server.php?a=doavatar&uid=" . $uid . '&windidkey=' . $key . '&time=' . $time . '&clientid=' . $client->clientId . '&type=flash') . '&avatar=' . urlencode($this->getAvatar($uid, 'big') . '?r=' . rand(1, 99999));
        return $getHtml ? '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="700" height="430" id="rainbow" align="middle">
							<param name="movie" value="' . Windid::resUrl() . 'swf/avatar/avatar.swf?' . rand(0, 9999) . '" />
							<param name="quality" value="high" />
							<param name="bgcolor" value="#ffffff" />
							<param name="play" value="true" />
							<param name="loop" value="true" />
							<param name="wmode" value="opaque" />
							<param name="scale" value="showall" />
							<param name="menu" value="true" />
							<param name="devicefont" value="false" />
							<param name="salign" value="" />
							<param name="allowScriptAccess" value="always" />
							<param name="FlashVars" value="' . $postUrl . '"/>
							<embed src="' . Windid::resUrl() . 'swf/avatar/avatar.swf?' . rand(0, 9999) . '" quality="high" bgcolor="#ffffff" width="700" height="430" name="mycamera" align="middle" allowScriptAccess="always" allowFullScreen="false" scale="exactfit"  wmode="transparent" FlashVars="' . $postUrl . '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
						</object>' : array('width' => '500', 'height' => '405', 'id' => 'uploadAvatar', 'name' => 'uploadAvatar', 'src' => Windid::resUrl() . 'swf/avatar/avatar.swf', 'wmode' => 'transparent', 'postUrl' => $client->serverUrl . "/windid/server.php?a=doAvatar&uid=" . $uid . '&windidkey=' . $key . '&time=' . $time . '&clientid=' . $client->clientId . '&type=normal', 'token' => $key);
    }
Ejemplo n.º 11
0
 private function _getConfigDs()
 {
     return Windid::load('config.WindidConfig');
 }
Ejemplo n.º 12
0
 private function _getNotifyService()
 {
     return Windid::load('notify.srv.WindidNotifyServer');
 }
Ejemplo n.º 13
0
 function bind_user($uid = 0)
 {
     if ($uid == 0) {
         $uid = $this->get_uid();
     }
     Wind::import('SRV:user.srv.PwLoginService');
     $service = new PwLoginService();
     //$this->runHook('c_login_dorun', $login);
     Windid::load('user.WindidUser');
     $info = $service->sysUser($uid);
     $identity = PwLoginService::createLoginIdentify($info);
     $identity = base64_encode($identity);
     $userService = Wekit::load('user.srv.PwUserService');
     $userService->updateLastLoginData($info['uid'], $this->getRequest()->getClientIp());
     $userService->createIdentity($info['uid'], $info['password']);
     //到主页去
     $this->forwardRedirect(WindUrlHelper::createUrl('app/4tschool/index/run'));
     $this->showMessage('欢迎回来…', '/');
 }
Ejemplo n.º 14
0
 private function _getNotifyLogDs()
 {
     return Windid::load('notify.WindidNotifyLog');
 }
Ejemplo n.º 15
0
 private function _getNotifyClient()
 {
     return Windid::load('notify.srv.WindidNotifyClient');
 }
Ejemplo n.º 16
0
 protected function _getDao()
 {
     return Windid::loadDao('user.dao.WindidUserDao');
 }
Ejemplo n.º 17
0
 private function _getAreaDs()
 {
     return Windid::load('area.WindidArea');
 }
Ejemplo n.º 18
0
 /** 
  * 编辑用户信息操作
  * 
  * @return voido
  */
 public function doEditAction()
 {
     $uid = (int) $this->getInput('uid', 'post');
     if (!$uid) {
         $this->showError('WINDID:fail');
     }
     Wind::import('WINDID:service.user.dm.WindidUserDm');
     $dm = new WindidUserDm($uid);
     //用户信息
     $dm->setUsername($this->getInput('username', 'post'));
     list($password, $repassword) = $this->getInput(array('password', 'repassword'), 'post');
     if ($password) {
         if ($password != $repassword) {
             $this->showError('USER:user.error.-20');
         }
         $dm->setPassword($password);
     }
     $dm->setEmail($this->getInput('email', 'post'));
     list($question, $answer) = $this->getInput(array('question', 'answer'), 'post');
     switch ($question) {
         case '-2':
             $dm->setQuestion('', '');
             break;
         case '-1':
         default:
             break;
     }
     $dm->setRegdate(Pw::str2time($this->getInput('regdate', 'post')));
     $dm->setRegip($this->getInput('regip', 'post'));
     //基本资料
     $dm->setRealname($this->getInput('realname', 'post'));
     $dm->setGender($this->getInput('gender', 'post'));
     $birthday = $this->getInput('birthday', 'post');
     if ($birthday) {
         $bir = explode('-', $birthday);
         isset($bir[0]) && $dm->setByear($bir[0]);
         isset($bir[1]) && $dm->setBmonth($bir[1]);
         isset($bir[2]) && $dm->setBday($bir[2]);
     } else {
         $dm->setBday('')->setByear('')->setBmonth('');
     }
     list($hometown, $location) = $this->getInput(array('hometown', 'location'), 'post');
     /* @var $srv PwAreaService */
     $srv = Wekit::load('area.srv.PwAreaService');
     $areas = $srv->fetchAreaInfo(array($hometown, $location));
     $dm->setLocation($location, isset($areas[$location]) ? $areas[$location] : '');
     $dm->setHometown($hometown, isset($areas[$hometown]) ? $areas[$hometown] : '');
     $dm->setHomepage($this->getInput('homepage', 'post'));
     $dm->setProfile($this->getInput('profile', 'post'));
     //交易信息
     $dm->setAlipay($this->getInput('alipay', 'post'));
     $dm->setMobile($this->getInput('mobile', 'post'));
     //联系信息
     $dm->setEmail($this->getInput('email', 'post'));
     $dm->setAliww($this->getInput('aliww', 'post'));
     $dm->setQq($this->getInput('qq', 'post'));
     $dm->setMsn($this->getInput('msn', 'post'));
     $ds = Windid::load('user.WindidUser');
     $result = $ds->editUser($dm);
     if ($result instanceof PwError) {
         $this->showError($result->getError());
     }
     $srv = Windid::load('notify.srv.WindidNotifyClient');
     $srv->send('202', $dm->getData(), true);
     $this->showMessage('WINDID:success', 'windid/user/edit?uid=' . $uid);
 }
Ejemplo n.º 19
0
 /**
  * @return WindidSchool
  */
 protected function _getSchoolDs()
 {
     return Windid::load('school.WindidSchool');
 }
Ejemplo n.º 20
0
 /**
  * 执行用户注册
  */
 public function quickRegisterAction()
 {
     $registerService = new PwRegisterService();
     $registerService->setUserDm($this->_getUserDm());
     /*[u_regsiter]:插件扩展*/
     $this->runHook('c_register', $registerService);
     if (($info = $registerService->register()) instanceof PwError) {
         $this->showError($info->getError());
     } else {
         Wind::import('SRV:user.srv.PwLoginService');
         $service = new PwLoginService();
         Windid::load('user.WindidUser');
         $info = $service->sysUser($info['uid']);
         $identity = PwLoginService::createLoginIdentify($info);
         $identity = base64_encode($identity);
         $userService = Wekit::load('user.srv.PwUserService');
         $userService->createIdentity($info['uid'], $info['password']);
         $this->forwardRedirect(WindUrlHelper::createUrl('app/4tschool/orderpreview/run', array("message" => $message)));
     }
 }
Ejemplo n.º 21
0
 /**
  * 
  * Enter description here ...
  * @return PwUser
  */
 private function _getUserDs()
 {
     return Windid::load('user.WindidUser');
 }
Ejemplo n.º 22
0
 /**
  * @return WindidUserBlackDao
  */
 protected function _getBlacklistDao()
 {
     return Windid::loadDao('user.dao.WindidUserBlackDao');
 }
Ejemplo n.º 23
0
 private function _getAppDs()
 {
     return Windid::load('app.WindidApp');
 }
Ejemplo n.º 24
0
 /**
  * 获取地区的DAO
  *
  * @return WindidAreaDao
  */
 private function _getDao()
 {
     return Windid::loadDao('area.dao.WindidAreaDao');
 }
Ejemplo n.º 25
0
 /**
  * 获取附件上传时存储在本地的文件地址
  *
  * @param string $filename 文件名
  * @param string $dir 目录名
  * @return string
  */
 public function getAbsolutePath($filename, $dir)
 {
     return DATA_PATH . 'upload/' . gmdate('j', Windid::getTime()) . '/' . str_replace('/', '_', $dir) . $filename;
 }
Ejemplo n.º 26
0
<?php

require_once 'windid/src/windid/WindidApi.php';
require_once 'windid/src/windid/service/client/bo/WindidClientBo.php';
require_once 'windid/src/windid/library/WindidUtility.php';
$notify = array('999' => 'test', '101' => 'addUser', '111' => 'synLogin', '112' => 'synLogout', '201' => 'editUser', '202' => 'editUserInfo', '203' => 'uploadAvatar', '211' => 'editCredit', '222' => 'editMessageNum', '301' => 'deleteUser');
//check
$_windidkey = getInput('windidkey', 'get');
$_time = (int) getInput('time', 'get');
$_clentid = (int) getInput('clientid', 'get');
WindidClientBo::getInstance();
$client = Windid::client();
if (WindidUtility::appKey($client->clientId, $_time, $client->clientKey, $_GET, $_POST) != $_windidkey) {
    $this->showError('fail');
}
$time = Windid::getTime();
if ($time - $_time > 120) {
    showError('timeout');
}
$operation = (int) getInput('operation', 'get');
$uid = (int) getInput('uid', 'get');
if (!$uid) {
    showError('fail');
}
if (!isset($notify[$operation])) {
    showError('fail');
}
$method = $notify[$operation];
$notify = new notify();
if (!method_exists($notify, $method)) {
    showError('fail');
Ejemplo n.º 27
0
 private function _getMessageService()
 {
     return Windid::load('message.srv.WindidMessageService');
 }
Ejemplo n.º 28
0
 /**
  * @return WindidMessageDialogDao
  */
 protected function _getDialogDao()
 {
     return Windid::loadDao('message.dao.WindidMessageDialogDao');
 }
Ejemplo n.º 29
0
 /**
  * 学校Ds
  *
  * @return WindidSchool
  */
 private function _getDs()
 {
     return Windid::load('school.WindidSchool');
 }
Ejemplo n.º 30
0
 /**
  * 将数据持久化到数据库
  */
 public function flush()
 {
     $service = Windid::load('config.WindidConfig');
     $service->setConfigs($this->namespace, $this->config);
 }