Пример #1
0
 public function run()
 {
     if (Yii::app()->user->isGuest) {
         $this->controller->bodyCss = 'access';
         if (!Yii::app()->session['wechat']) {
             $this->controller->redirect('/wechat/wechatconnect');
         }
     } else {
         $this->controller->redirect(Assist::getAccessURL());
     }
 }
Пример #2
0
 public function run()
 {
     $this->controller->pageTitle = 'Login';
     if (Yii::app()->user->isGuest) {
         if (Yii::app()->request->isAjaxRequest) {
             $mobile = Yii::app()->request->getParam('mobile');
             $code = Yii::app()->request->getParam('code');
             $email = Yii::app()->request->getParam('email');
             $password = Yii::app()->request->getParam('password');
             $bind = Yii::app()->request->getParam('bind');
             $_identity = new UserIdentity();
             if ($mobile) {
                 Yii::log($code, CLogger::LEVEL_ERROR);
                 $_identity->authMobile($mobile, $code, $bind);
                 if ($_identity->errorCode === UserIdentity::ERROR_NONE) {
                     $duration = 86400;
                     Yii::app()->user->login($_identity, $duration);
                     echo CJSON::encode(array('code' => 200, 'message' => 'success'));
                     //$this->controller->redirect(Yii::app()->user->getReturnUrl(Assist::getDefaultURL()));
                 } elseif ($_identity->errorCode === UserIdentity::ERROR_CODE_INVALID) {
                     echo CJSON::encode(array('code' => 500, 'message' => '验证码不正确'));
                 } elseif ($_identity->errorCode === UserIdentity::ERROR_MOBILE_INVALID) {
                     echo CJSON::encode(array('code' => 500, 'message' => '手机号未注册'));
                 } else {
                     echo CJSON::encode(array('code' => 500, 'message' => '登录错误'));
                 }
             } elseif ($email) {
                 $_identity->authMail($email, $password, $bind);
                 if ($_identity->errorCode === UserIdentity::ERROR_NONE) {
                     $duration = 86400;
                     Yii::app()->user->login($_identity, $duration);
                     echo CJSON::encode(array('code' => 200, 'message' => 'success'));
                     //$this->controller->redirect(Assist::getDefaultURL());
                     //$this->controller->redirect(Yii::app()->user->getReturnUrl(Assist::getDefaultURL()));
                 } elseif ($_identity->errorCode === UserIdentity::ERROR_MAIL_INVALID) {
                     echo CJSON::encode(array('code' => 500, 'message' => '邮箱未注册'));
                 } elseif ($_identity->errorCode === UserIdentity::ERROR_PASSWORD_INVALID) {
                     echo CJSON::encode(array('code' => 500, 'message' => '密码错误'));
                 } else {
                     echo CJSON::encode(array('code' => 500, 'message' => '登录错误'));
                 }
             } else {
                 throw new CHttpException('405', '参数错误');
             }
         } else {
             $this->controller->render('login');
         }
     } else {
         $this->controller->redirect(Assist::getAccessURL());
     }
 }
Пример #3
0
 public function run()
 {
     if (Yii::app()->user->isGuest) {
         $this->controller->bodyCss = 'access';
         // if(!empty(Yii::app()->session['user'])){
         // 	$this->controller->redirect('/registered/productlist');
         // }else{
         $this->controller->redirect('/wechat/wechatconnect');
         // }
     } else {
         $this->controller->redirect(Assist::getAccessURL());
     }
     // $this->controller->render('index');
 }
 public function run()
 {
     if (Yii::app()->user->isGuest) {
         if (Assist::isWeixin()) {
             $code = Yii::app()->request->getParam('code');
             $state = Yii::app()->request->getParam('state');
             if (empty($code)) {
                 throw new CException(Yii::t('yii', '授权码缺失'));
             } else {
                 $wechat = Yii::app()->params['partner']['wechat'];
                 $params = array('appid' => $wechat['appid'], 'secret' => $wechat['appsecret'], 'code' => $code, 'grant_type' => 'authorization_code');
                 try {
                     $output = Yii::app()->curl->get($wechat['oauth2']['token'], $params);
                     $value = json_decode($output, true);
                     if (Yii::app()->curl->getStatus() == 200 && isset($value['access_token'])) {
                         $userinfo = json_decode(Yii::app()->curl->get($wechat['oauth2']['userinfo'], array('access_token' => $value['access_token'], 'openid' => $value['openid'], 'lang' => 'zh_CN')), true);
                         if (Yii::app()->curl->getStatus() == 200 && isset($userinfo['unionid'])) {
                             $_identity = new UserIdentity();
                             $_identity->authWechat($userinfo, $value['openid']);
                             if ($_identity->errorCode === UserIdentity::ERROR_NONE) {
                                 $duration = 86400;
                                 Yii::app()->user->login($_identity, $duration);
                                 $this->controller->redirect(Assist::getAccessURL());
                                 // $this->controller->redirect(Yii::app()->user->getReturnUrl(Assist::getDefaultURL()));
                             } elseif ($_identity->errorCode === UserIdentity::ERROR_NO_BIND) {
                                 Yii::app()->session['wechat'] = null;
                                 $this->controller->render('index');
                             }
                         } else {
                             throw new CException(Yii::t('yii', '密钥错误或丢失。'));
                         }
                     } else {
                         Yii::log(print_r($value, true), CLogger::LEVEL_ERROR, 'user.wx.auth');
                         throw new CException(Yii::t('yii', '获取有效凭证失败'));
                     }
                 } catch (Exception $e) {
                     $this->controller->render('index');
                     // throw new CException(Yii::t('yii', $e->getMessage() ?: '内部服务错误'));
                 }
             }
         } else {
             throw new CHttpException(403, Yii::t('yii', '仅支持微信访问'));
         }
     } else {
         $this->controller->redirect(Assist::getDefaultURL());
     }
 }
Пример #5
0
 public function filterWechat($filterChain)
 {
     if (Assist::isWeixin()) {
         // if(!Yii::app()->session['wechat']) {
         // 	if(!strpos(Yii::app()->request->getPathInfo(), 'wechatconnect')){
         // 		$this->redirect('/wechat/wechatconnect');
         // 		return false;
         // 	}
         // }
         $filterChain->run();
         return true;
     } else {
         // echo 'ERROR';
         $this->layout = '//layouts/error';
         $this->render('/site/error', array('code' => 403, 'message' => yii::t('yii', 'Only login in wechat')));
     }
 }
Пример #6
0
 /**
  * 
  * 获取jsapi支付的参数
  * @param array $UnifiedOrderResult 统一支付接口返回的数据
  * @throws WxPayException
  * 
  * @return json数据,可直接填入js函数作为参数
  */
 public function GetJsApiParameters($UnifiedOrderResult)
 {
     if (!array_key_exists("appid", $UnifiedOrderResult) || !array_key_exists("prepay_id", $UnifiedOrderResult) || $UnifiedOrderResult['prepay_id'] == "") {
         // throw new WxPayException("参数错误");
         Yii::log('WxJsPayHelper 71line', CLogger::LEVEL_ERROR, 'WxJsPayHelper');
         Yii::app()->request->redirect(Assist::getDefaultURL());
     }
     $jsapi = new WxPayJsApiPay();
     $jsapi->SetAppid($UnifiedOrderResult["appid"]);
     $timeStamp = time();
     $jsapi->SetTimeStamp($timeStamp);
     $jsapi->SetNonceStr(WxPayApi::getNonceStr());
     $jsapi->SetPackage("prepay_id=" . $UnifiedOrderResult['prepay_id']);
     $jsapi->SetSignType("MD5");
     $jsapi->SetPaySign($jsapi->MakeSign());
     $parameters = json_encode($jsapi->GetValues());
     return $parameters;
 }
Пример #7
0
 public function run()
 {
     $this->controller->pageTitle = "Profile";
     if (Yii::app()->request->isAjaxRequest) {
         $id = Yii::app()->user->id;
         $user = User::model()->findByAttributes(array('id' => $id));
         $user->nickName = Yii::app()->request->getParam('nickName');
         $user->portrait = Yii::app()->request->getParam('portrait');
         Yii::app()->user->setState('portrait', Yii::app()->request->getParam('portrait'));
         $user->background = Yii::app()->request->getParam('background');
         $user->title = Yii::app()->request->getParam('title');
         $user->website = Yii::app()->request->getParam('website');
         $user->description = Assist::removeXSS(Yii::app()->request->getParam('description'));
         $user->birthday = Yii::app()->request->getParam('birthday');
         $user->gender = Yii::app()->request->getParam('gender');
         $user->location = Yii::app()->request->getParam('hub');
         $skills = preg_replace('/,+/', ',', Yii::app()->request->getParam('skills'));
         $skills = preg_replace('/,+/', ',', $skills);
         $user->skills = trim($skills, ',');
         $interests = preg_replace('/,+/', ',', Yii::app()->request->getParam('interests'));
         $interests = preg_replace('/,+/', ',', $interests);
         $user->interests = trim($interests, ',');
         //$user->wechatid = Yii::app()->request->getParam('wechatid');
         $user->facebookid = Yii::app()->request->getParam('facebookid');
         $user->twitterid = Yii::app()->request->getParam('twitterid');
         $user->linkedinid = Yii::app()->request->getParam('linkedinid');
         $user->instagramid = Yii::app()->request->getParam('instagramid');
         $status = Yii::app()->request->getParam('status');
         $code = Code::model()->findByAttributes(array('userId' => $id));
         if ($status == 1) {
             $user->status = 2;
         }
         $havecode = empty($code) ? 0 : 1;
         if ($user->save()) {
             echo CJSON::encode(array('code' => 200, 'message' => 'success', 'data' => $havecode));
         }
     } else {
         $id = Yii::app()->user->id;
         $user = User::model()->findByAttributes(array('id' => $id));
         $proxy = new CHub();
         $hub = $proxy->getHubList();
         $this->controller->render('updateProfile', array('user' => $user, 'hub' => $hub['data']));
     }
 }
Пример #8
0
 public function run()
 {
     $this->controller->pageTitle = "New Post";
     $this->controller->pageTitle = "New Post";
     if (Yii::app()->request->isAjaxRequest) {
         $img = Yii::app()->request->getParam('img');
         $content = CHtml::encode(Assist::removeXSS(Yii::app()->request->getParam('content')));
         $content = preg_replace('/\\n/mi', '<br/>', $content);
         $proxy = new Posts();
         $proxy->content = $content;
         $proxy->picture = $img;
         $proxy->userId = Yii::app()->user->id;
         $proxy->createTime = date('Y-m-d H:i:s', time());
         $proxy->save();
         echo CJSON::encode(array('code' => 200, 'message' => 'SUCCESS'));
     } else {
         $this->controller->render('newpost');
     }
 }
Пример #9
0
 public function multi(&$process)
 {
     if (!empty($this->_obj)) {
         $this->_obj->multi($process);
     }
     if (!empty($process)) {
         $api_info = array();
         $ids = Assist::get_fields($process, 'aid');
         if ($ids) {
             $api_info = (new \app\models\Api())->get_info_fieldid($ids);
         }
         if (!empty($api_info)) {
             foreach ($api_info as $uk => $uv) {
                 $api_info[$uv['id']] = $uv;
             }
         }
         foreach ($process as $pk => $pv) {
             $process[$pk]['api_name'] = isset($api_info[$pv['aid']]['api_name']) ? $api_info[$pv['aid']]['api_name'] : '';
         }
     }
 }
Пример #10
0
 public function multi(&$process)
 {
     if (!empty($this->_obj)) {
         $this->_obj->multi($process);
     }
     if (!empty($process)) {
         $user_info = array();
         $ids = Assist::get_fields($process, 'uid');
         if ($ids) {
             $user_info = (new \app\models\User())->get_info_fieldid($ids);
         }
         if (!empty($user_info)) {
             foreach ($user_info as $uk => $uv) {
                 $user_info[$uv['id']] = $uv;
             }
         }
         foreach ($process as $pk => $pv) {
             $process[$pk]['username'] = isset($user_info[$pv['uid']]['username']) ? $user_info[$pv['uid']]['username'] : '';
             $process[$pk]['project'] = isset($user_info[$pv['uid']]['project']) ? $user_info[$pv['uid']]['project'] : '';
             $process[$pk]['department'] = isset($user_info[$pv['uid']]['department']) ? $user_info[$pv['uid']]['department'] : '';
         }
     }
 }
Пример #11
0
 public function run()
 {
     if (Yii::app()->user->isGuest) {
         if (Assist::isWeixin()) {
             //login valid for ajax request
             $returnurl = Yii::app()->request->getParam('returnurl');
             //->encodeURIComponent
             if (!empty($returnurl)) {
                 Yii::app()->user->setReturnUrl($returnurl);
                 //urldecode($returnurl)
             }
             $wechat = Yii::app()->params['partner']['wechat'];
             $params = array('appid' => $wechat['appid'], 'redirect_uri' => 'http://hubapp.livenaked.com' . $wechat['oauth2']['callback'], 'response_type' => 'code', 'scope' => $wechat['oauth2']['scope'][1], 'state' => 1);
             $url = $wechat['oauth2']['authorize'] . http_build_query($params) . '#wechat_redirect';
             $this->controller->redirect($url);
         } else {
             // throw new CException(Yii::t('yii', '请在微信客户端打开链接'));
             throw new CHttpException(403, Yii::t('yii', '请在微信客户端打开链接'));
         }
     } else {
         $this->controller->redirect(Assist::getDefaultURL());
     }
 }
Пример #12
0
				<p class="companyName"><?php 
    echo $value['companyName'];
    ?>
</p>
				<p class="location"><?php 
    echo $value['location'];
    ?>
</p>
				<p class="time"><?php 
    echo CDate::dgm($value['createTime']);
    ?>
</p>
			</div>
			<p class="content">
				<?php 
    echo Assist::removeXSS(Assist::removeEmoji($value['content']));
    ?>
			</p>
			<?php 
    if ($value['picture']) {
        ?>
			<img src="<?php 
        echo $value['picture'];
        ?>
" alt="" class="face">
			<?php 
    }
    ?>
		</div>
		<?php 
}
Пример #13
0
			<p class="companyName"><?php 
echo $data['post']['companyName'];
?>
</p>
			<p class="location"><?php 
echo $data['post']['location'];
?>
</p>
			<p class="time"><?php 
echo CDate::dgm($data['post']['createTime']);
?>
</p>
		</div>
		<p class="content">
			<?php 
echo Assist::removeXSS(Assist::removeEmoji($data['post']['content']));
?>
		</p>
		<?php 
if ($data['post']['picture']) {
    ?>
		<img src="<?php 
    echo $data['post']['picture'];
    ?>
" alt="" class="face">
		<?php 
}
?>
		<div class="footerWrapper">
			<p><span class="like_num"><?php 
echo $data['post']['like_num'];
Пример #14
0
 public function run()
 {
     if (Yii::app()->user->isGuest) {
         $user = Yii::app()->session['user'];
         $identity = new UserIdentity($user);
         $identity->registAuth($user);
         $duration = Yii::app()->getComponent('session')->getTimeout();
         Yii::app()->user->login($identity, $duration);
         // Yii::log(print_r($user,1), CLogger::LEVEL_ERROR,'222');
         $tuser = User::model()->findByAttributes(array('id' => $user['id']));
         $tuser->status = 1;
         $tuser->save();
         $this->controller->redirect('/user/updateProfile');
     } else {
         $tem = User::model()->findByAttributes(array('id' => Yii::app()->user->id));
         $status = $tem->status;
         $type = $tem->type;
         if ($type == 1) {
             switch ($status) {
                 case 1:
                     $this->controller->redirect('/user/updateProfile');
                     break;
                 default:
                     $user = User::model()->findByAttributes(array('id' => Yii::app()->user->id));
                     Yii::app()->user->setState('portrait', $user->portrait);
                     $this->controller->redirect(Assist::getDefaultURL());
                     break;
             }
         } else {
             if ($type == 2) {
                 switch ($status) {
                     case 1:
                         $this->controller->redirect('/user/updateProfile');
                         break;
                     default:
                         $user = User::model()->findByAttributes(array('id' => Yii::app()->user->id));
                         Yii::app()->user->setState('portrait', $user->portrait);
                         $this->controller->redirect(Assist::getDefaultURL());
                         break;
                 }
             } else {
                 if ($type == 3) {
                     switch ($status) {
                         case 1:
                             $this->controller->redirect('/user/updateProfile');
                             break;
                         case 2:
                             $this->controller->redirect('/company/updateProfile');
                             break;
                         case 3:
                             $this->controller->redirect('/registered/code');
                             break;
                         default:
                             $user = User::model()->findByAttributes(array('id' => Yii::app()->user->id));
                             Yii::app()->user->setState('portrait', $user->portrait);
                             $this->controller->redirect(Assist::getDefaultURL());
                             break;
                     }
                 }
             }
         }
         // Yii::log($status, CLogger::LEVEL_ERROR,'status');
         // switch ($status) {
         // 	case 1:
         // 		$this->controller->redirect('/user/updateProfile');
         // 		break;
         // 	case 2:
         // 		$this->controller->redirect('/company/updateProfile');
         // 	case 21:
         // 		$this->controller->redirect('/user/updateProfile');
         // 	case 22:
         // 		$this->controller->redirect('/user/updatecompany');
         // 	default:
         // 		$user= User::model()->findByAttributes(array('id'=>Yii::app()->user->id));
         // 		Yii::app()->user->setState('portrait',$user->portrait);
         // 		$this->controller->redirect(Assist::getDefaultURL());
         // 		break;
         // }
     }
 }
Пример #15
0
 public function actionCompany()
 {
     try {
         $list = Yii::app()->user->orderlist;
         $date = Yii::app()->user->orderdate;
         $months = Yii::app()->user->ordermonths;
     } catch (Exception $e) {
         echo 'fail';
         die;
     }
     if (Yii::app()->user->isGuest) {
         $userId = Yii::app()->session['user']['id'];
     } else {
         $userId = Yii::app()->user->id;
     }
     $wechat = Yii::app()->params['partner']['wechat'];
     $jsapi = new WxJsPayHelper();
     $openid = $jsapi->GetOpenid();
     $this->bodyCss = 'orderDetail';
     $totalPrice = 0;
     foreach ($list as &$value) {
         $product = CompanyProduct::model()->findByAttributes(array('id' => $value['id']));
         $value['name'] = $product->name;
         $value['price'] = $product->price;
         $value['type'] = $product->type;
         $totalPrice = $totalPrice + $value['price'] * $value['num'];
     }
     $order = new COrder();
     $newOrder = $order->create(array('userId' => $userId, 'type' => 2, 'price' => $totalPrice, 'orderTime' => date('YmdHis'), 'hubId' => 1));
     $orderId = $newOrder['data']['orderId'];
     $endDate = date('Y-m-d', strtotime($date) + (date('t', strtotime($date)) - 1) * $months * 60 * 60 * 24);
     foreach ($list as $v) {
         $companyProduct = $order->createCompanyProduct(array('cproductId' => $v['id'], 'startDate' => $date, 'endDate' => $endDate, 'orderId' => $orderId, 'num' => $v['num']));
         Coding::makeCode(array('userId' => $userId, 'type' => $v['type'], 'startDate' => $date, 'endDate' => $endDate, 'times' => $v['num'], 'ordercompanyProductId' => $companyProduct['data']['id']));
     }
     $input = new WxPayUnifiedOrder();
     $input->SetBody('Company product');
     // $input->SetAttach(date('Ymd',$date));
     $input->SetOut_trade_no((string) $orderId);
     $input->SetTotal_fee($totalPrice / 100);
     $input->SetTime_start(date('YmdHis'));
     $input->SetTime_expire(Assist::getOrderExpireTime(time()));
     $input->SetProduct_id(1);
     $input->SetNotify_url('http://hubapp.livenaked.com' . $wechat['payment']['notify']);
     $input->SetTrade_type('JSAPI');
     $input->SetOpenid($openid);
     Yii::log(print_r($input->values, 1), CLogger::LEVEL_ERROR, 'input');
     $bill = WxPayApi::unifiedOrder($input);
     $jsApiParameters = $jsapi->GetJsApiParameters($bill);
     $this->render('company', array('list' => $list, 'date' => $date, 'months' => $months, 'totalPrice' => $totalPrice, 'jsparams' => $jsApiParameters));
 }
Пример #16
0
 public function run($id = null)
 {
     $this->controller->pageTitle = "Company";
     if (!$id) {
         if (Yii::app()->request->isAjaxRequest) {
             $id = Yii::app()->request->getParam('id');
             $name = Yii::app()->request->getParam('name');
             $service = Yii::app()->request->getParam('service');
             $result = Company::model()->findByAttributes(array('name' => $name));
             if ($result && $result['ownerId'] != Yii::app()->user->id) {
                 echo CJSON::encode(array('code' => 400, 'message' => 'HAVING'));
                 die;
             } else {
                 if (!$id) {
                     $company = new Company();
                     $now = date('Y-m-d H:i:s');
                     $company->createTime = $now;
                     $company->save();
                     $companyid = Company::model()->findByAttributes(array('createTime' => $now));
                     for ($i = 0; $i < count($service); $i++) {
                         $proxy = new Service_company();
                         $proxy->serviceId = $service[$i];
                         $proxy->companyId = $companyid['id'];
                         $proxy->save();
                     }
                 } else {
                     $company = Company::model()->findByAttributes(array('id' => $id));
                     $company->updateTime = date('Y-m-d H:i:s');
                     $proxy = Service_company::model()->findAllByAttributes(array('companyId' => $id));
                     foreach ($proxy as $list) {
                         $list->status = 0;
                         $list->save();
                     }
                     for ($i = 0; $i < count($service); $i++) {
                         $dp = new Service_company();
                         $dp->serviceId = $service[$i];
                         $dp->companyId = $company['id'];
                         $dp->save();
                     }
                 }
                 $company->name = $name;
                 $company->ownerId = Yii::app()->user->id;
                 // FIXME
                 $company->email = Yii::app()->request->getParam('email');
                 $company->phone = Yii::app()->request->getParam('phone');
                 $company->website = Yii::app()->request->getParam('website');
                 $company->logo = Yii::app()->request->getParam('logo');
                 $company->location = User::model()->findByAttributes(array('id' => Yii::app()->user->id))['location'];
                 $company->background = Yii::app()->request->getParam('background');
                 $company->introduction = Assist::removeXSS(Yii::app()->request->getParam('introduction'));
                 $company->facebookid = Yii::app()->request->getParam('facebookid');
                 $company->linkedinid = Yii::app()->request->getParam('linkedinid');
                 $company->save();
                 $user = User::model()->findByAttributes(array('id' => Yii::app()->user->id));
                 if ($user['type'] == 1) {
                     $user->status = 4;
                 } else {
                     if ($user['type'] == 3) {
                         $user->status = 4;
                     }
                 }
                 $user->company = $company->id;
                 $user->save();
                 //所有公司员工设置公司
                 $code = Code::model()->findAllByAttributes(array('userId' => Yii::app()->user->id, 'status' => 1));
                 if ($code) {
                     foreach ($code as $list) {
                         $user = CodeUsed::model()->findAll('codeId=' . $list['id']);
                         if ($user) {
                             foreach ($user as $value) {
                                 $item = User::model()->findByAttributes(array('id' => $value['userId']));
                                 $item->company = $company->id;
                                 $item->save();
                             }
                         }
                     }
                 }
                 echo CJSON::encode(array('code' => 200, 'message' => 'SUCCESS', 'data' => array('status' => $status)));
             }
         } else {
             $firservice = Service::model()->findAll("parentId is null");
             foreach ($firservice as $key) {
                 $a[$key['name']] = Service::model()->findAllByAttributes(array('parentId' => $key['id']));
                 // array_push($a,$key['name']);
             }
             $this->controller->render('updateProfile', array('totalservice' => $a));
         }
     } else {
         $id = Yii::app()->request->getParam('id');
         $company = Company::model()->findByAttributes(array('id' => $id));
         $myservice = Service_company::model()->findAllByAttributes(array('companyId' => $company['id'], 'status' => 1));
         $user = User::model()->findByAttributes(array('id' => Yii::app()->user->id));
         foreach ($myservice as $list) {
             $array[] = Service::model()->findByAttributes(array('id' => $list['serviceId']));
         }
         $firservice = Service::model()->findAll("parentId is null");
         foreach ($firservice as $key) {
             $a[$key['name']] = Service::model()->findAllByAttributes(array('parentId' => $key['id']));
             // array_push($a,$key['name']);
         }
         // var_dump($a);die;
         $this->controller->render('updateProfile', array('company' => $company, 'status' => $user['status'], 'myservice' => $array, 'totalservice' => $a));
     }
 }
Пример #17
0
	<div class="content">
		<?php 
for ($i = 0, $date = date("U"); $i < $num; $i++) {
    ?>
		<div class="month">
			<p class="memberType">Monthly Membership</p>
			<h2><?php 
    echo $name;
    ?>
</h2>
			<p class="date"><?php 
    echo date("Y/m/d", $date);
    ?>
-<?php 
    echo date("Y/m/d", $date + Assist::timestampToMonthTimestamp($date) - 86400);
    $date = $date + Assist::timestampToMonthTimestamp($date);
    ?>
</p>
			<div class="price"><h3>&yen;<?php 
    echo $price;
    ?>
</h3></div>
		</div>
		<?php 
}
?>
		<div class="day">
			<h2>Total</h2>
			<h3 class="price">&yen;<?php 
echo $num * $price;
?>
Пример #18
0
 public static function updateLastMsg($senderId, $recId, $msg)
 {
     $lastMsg = mb_substr(Assist::removeXSS($msg), 0, 50, 'utf-8');
     if ($senderId == 0) {
         //系统消息/通知
         $mr = MessageRelation::model()->findBySql('select * from messageRelation where id1=:senderId and id2=0', array(':senderId' => Yii::app()->user->id));
         $senderID = Yii::app()->user->id;
         $RecID = 0;
     } else {
         //私聊
         $mr = MessageRelation::model()->findBySql('select * from messageRelation where (id1=:senderId and id2=:recId) or (id1=:recId and id2=:senderId)', array(':senderId' => $senderId, ':recId' => $recId));
         $senderID = $senderId;
         $RecID = $recId;
     }
     if ($mr) {
         $mr->lastMsg = $lastMsg;
         $mr->utime = time();
         $mr->save();
     } else {
         $mrelation = new MessageRelation();
         $mrelation->id1 = $senderID;
         $mrelation->id2 = $RecID;
         $mrelation->lastMsg = $lastMsg;
         $mrelation->utime = time();
         $mrelation->save();
         //新建用户关系时添加对方为当前登录用户的好友
         usleep(200 * 1000);
         if ($RecID == 0) {
             self::getInstance()->addFriend(Yii::app()->user->id, Yii::app()->params['partner']['emchat']['sysAccount']['name']);
         } elseif ($senderID == Yii::app()->user->id) {
             self::getInstance()->addFriend($senderID, $RecID);
         } else {
             self::getInstance()->addFriend($RecID, $senderID);
         }
     }
 }
Пример #19
0
<div id="newpost">
	<textarea class='content' placeholder="What do you need?Ask the community." rows="7"></textarea>
	<div id='img_container'>
		<p class="addimage" id='selectimg'></p>
	</div>
	<a class='footer'>SUBMIT</a>
</div>
<script type="text/javascript">
	var domain = '<?php 
echo Assist::getOSSToken()['domain'];
?>
',
    	token = '<?php 
echo Assist::getOSSToken()['uptoken'];
?>
';
    	token = eval('(' + token + ')')
</script>
<?php 
$cs = Yii::app()->clientScript;
$js = $this->renderPartial('_newpostjs', null, true);
$cs->registerScript('post', $js, CClientScript::POS_END);