Ejemplo n.º 1
0
 public static function getModelByMobile($mobile)
 {
     $model = null;
     if (\Yii::$app->mutex->acquire(self::tableName(), self::SCENE_LOCK_WAIT_TIME_SECOND)) {
         $model = self::findOne(['mobile' => $mobile]);
         if (empty($model)) {
             $model = new self();
             $model->mobile = $mobile;
             $model->created_at = time();
             $model->save(false);
         }
         \Yii::$app->mutex->release(self::tableName());
         if ($model->updated_at + $model->expire_seconds < time()) {
             $gh_id = MGh::GH_XIANGYANGUNICOM;
             \Yii::$app->wx->setGhId($gh_id);
             $scene_id = $model->scene_id + 100000;
             $arr = \Yii::$app->wx->WxgetQRCode($scene_id, 0, 300);
             $model->updated_at = time();
             $model->ticket = $arr['ticket'];
             $model->expire_seconds = $arr['expire_seconds'];
             $model->url = $arr['url'];
             $qr_url = \Yii::$app->wx->WxGetQRUrl($arr['ticket']);
             $log_file_path = \Yii::$app->getRuntimePath() . DIRECTORY_SEPARATOR . 'qr' . DIRECTORY_SEPARATOR . "{$gh_id}_{$scene_id}.jpg";
             Wechat::downloadFile($qr_url, $log_file_path);
             $model->qr_url = \Yii::$app->getRequest()->baseUrl . "/../runtime/qr/{$gh_id}_{$scene_id}.jpg";
             $model->save(false);
         }
     } else {
         \Yii::error('acquire lock error');
     }
     return $model;
 }
Ejemplo n.º 2
0
 public function actionValid($token)
 {
     if (0) {
         $_GET['signature'] = '228c2744ce651fb61cceb461c48fa03c608c1299';
         $_GET['echostr'] = '6372428126615300095';
         $_GET['timestamp'] = '1402529705';
         $_GET['nonce'] = '1023195716';
     }
     if (!Wechat::checkSignature($token)) {
         U::W(['Invalid Signature in actionValid()', $_GET]);
     }
     die($_GET['echostr']);
 }
Ejemplo n.º 3
0
 public function getQrImageUrl()
 {
     $gh_id = $this->gh_id;
     if (empty($this->scene_id)) {
         $newFlag = true;
         $gh = MGh::findOne($gh_id);
         $scene_id = $gh->newSceneId();
         $this->scene_id = $scene_id;
         //U::W("scene_id=$scene_id");
     } else {
         $newFlag = false;
         $scene_id = $this->scene_id;
     }
     $log_file_path = Yii::$app->getRuntimePath() . DIRECTORY_SEPARATOR . 'qr' . DIRECTORY_SEPARATOR . "{$gh_id}_{$scene_id}.jpg";
     //U::W($log_file_path);
     if (!file_exists($log_file_path)) {
         Yii::$app->wx->setGhId($gh_id);
         $arr = Yii::$app->wx->WxgetQRCode($scene_id, true);
         if (empty($arr['ticket'])) {
             U::W([__METHOD__, $arr]);
         }
         $url = Yii::$app->wx->WxGetQRUrl($arr['ticket']);
         Wechat::downloadFile($url, $log_file_path);
     }
     if ($newFlag) {
         if ($this->save(false)) {
             $gh->save(false);
         }
     }
     if (Yii::$app->getRequest()->getIsConsoleRequest()) {
         $url = '';
     } else {
         $url = Yii::$app->getRequest()->baseUrl . "/../runtime/qr/{$gh_id}_{$scene_id}.jpg";
     }
     //U::W($url);
     return $url;
 }
Ejemplo n.º 4
0
 protected function onTextOld()
 {
     $openid = $this->getRequest('FromUserName');
     $gh_id = $this->getRequest('ToUserName');
     while (1) {
         $Content = $this->getRequest('Content');
         $msg = trim($Content);
         $state = $this->getState($gh_id, $openid);
         if ($msg == '0' && $state != self::STATE_NONE) {
             U::W('deleteState');
             $this->deleteState($gh_id, $openid);
             return $this->responseText("谢谢,再见!");
         }
         U::W($state);
         switch ($state) {
             case self::STATE_NONE:
                 //if ($msg !== 'Xy')
                 if ($msg == 'New') {
                     $url = Url::to(['wapx/staffsearch', 'gh_id' => $gh_id, 'openid' => $openid], true);
                     return $this->responseText("see my score? <a href=\"{$url}\">click me</a>");
                 } else {
                     if ($msg == '.debug') {
                         $url = Url::to(['wapx/staffsearch', 'gh_id' => $gh_id, 'openid' => $openid], true);
                         return $this->responseText("see my score? <a href=\"{$url}\">click me</a>");
                     }
                 }
                 if ($msg !== 'Xy') {
                     //return Wechat::NO_RESP;
                     $model = MUser::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
                     $items = array(new RespNewsItem("{$model->nickname}, 欢迎进入襄阳联通官方微信营业厅", '猛戳进入首页!', Url::to('images/metro-intro.jpg', true), Url::to(['wap/home', 'gh_id' => $gh_id, 'openid' => $openid], true)));
                     return $this->responseNews($items);
                 }
                 $model = MStaff::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
                 if ($model === null) {
                     $this->setState($gh_id, $openid, self::STATE_MOBILE);
                     return $this->responseText("请输入手机号, 0:退出");
                 } else {
                     if (empty($model->office_id)) {
                         $this->setState($gh_id, $openid, self::STATE_OFFICE);
                         return $this->responseText($this->getOfficePrompt($gh_id));
                     } else {
                         $this->setState($gh_id, $openid, self::STATE_MENU_ONE);
                         return $this->responseText(self::PROMPT_MENU_ONE);
                     }
                 }
                 break;
             case self::STATE_MOBILE:
                 if (!is_numeric($msg) || substr($msg, 0, 1) !== '1' || strlen($msg) != 11) {
                     return $this->responseText("无效的手机号!\n\n" . "请重新输入手机号, 0:退出");
                 }
                 $model = MStaff::findOne(['mobile' => $msg]);
                 if ($model === null) {
                     return $this->responseText("非襄阳联通员工手机号!\n\n" . "请重新输入手机号, 0:退出");
                 }
                 $model->gh_id = $gh_id;
                 $model->openid = $openid;
                 $model->save(false);
                 if (empty($model->office_id)) {
                     $this->setState($gh_id, $openid, self::STATE_OFFICE);
                     $str = $this->getOfficePrompt($gh_id);
                     return $this->responseText("{$model->name},您好!\n,{$str}");
                 } else {
                     $this->setState($gh_id, $openid, self::STATE_MENU_ONE);
                     return $this->responseText(self::PROMPT_MENU_ONE);
                 }
             case self::STATE_OFFICE:
                 //$offices =MOffice::find()->where(['gh_id'=>$gh_id])->asArray()->all();
                 $offices = MOffice::find()->where("gh_id = '{$gh_id}' AND office_id <=25 ")->asArray()->all();
                 $office_ids = [];
                 foreach ($offices as $office) {
                     $office_ids[] = $office['office_id'];
                 }
                 if (!is_numeric($msg) || $msg < 0 || !in_array($msg, $office_ids)) {
                     return $this->responseText("无效的部门号!\n\n" . $this->getOfficePrompt($gh_id));
                 }
                 $model = MStaff::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
                 $model->office_id = $msg;
                 $model->save(false);
                 $this->setState($gh_id, $openid, self::STATE_MENU_ONE);
                 return $this->responseText(self::PROMPT_MENU_ONE);
             case self::STATE_CHANGE_MOBILE:
                 if (!is_numeric($msg) || substr($msg, 0, 1) !== '1' || strlen($msg) != 11) {
                     return $this->responseText("无效的手机号!\n\n" . "请重新输入手机号, 0:退出");
                 }
                 $model = MStaff::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
                 $model->mobile = $msg;
                 $model->save(false);
                 $this->setState($gh_id, $openid, self::STATE_MENU_ONE);
                 return $this->responseText(self::PROMPT_MENU_ONE);
             case self::STATE_MENU_ONE:
                 if (!is_numeric($msg) || $msg < 0 || $msg > 7) {
                     return $this->responseText("输入无效!\n\n" . self::PROMPT_MENU_ONE);
                 }
                 switch ($msg) {
                     case 1:
                         //U::W('enter 111111');
                         $model = MUser::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
                         if (empty($model->scene_id)) {
                             $gh = MGh::findOne($gh_id);
                             $scene_id = $gh->newSceneId();
                             $gh->save(false);
                             $model->scene_id = $scene_id;
                             $model->save(false);
                             //U::W("new a scene_id=$scene_id");
                         } else {
                             $scene_id = $model->scene_id;
                             //U::W("old scene_id=$scene_id");
                         }
                         $log_file_path = Yii::$app->getRuntimePath() . DIRECTORY_SEPARATOR . 'qr' . DIRECTORY_SEPARATOR . "{$gh_id}_{$scene_id}.jpg";
                         //U::W($log_file_path);
                         if (!file_exists($log_file_path)) {
                             $arr = $this->WxgetQRCode($scene_id, true);
                             $url = $this->WxGetQRUrl($arr['ticket']);
                             Wechat::downloadFile($url, $log_file_path);
                         }
                         //$url = Url::to(['wap/aboutqr','name'=>$model->nickname, 'qrurl'=>Yii::$app->getRequest()->baseUrl."/../runtime/qr/{$gh_id}_{$scene_id}.jpg"],true);
                         $url = "http://mp.weixin.qq.com/s?__biz=MzA4ODkwOTYxMA==&mid=203659175&idx=1&sn=0efaf2269fb7ba6a022f5c31d0d5e255#rd";
                         //U::W($url);
                         $msg = ['touser' => $openid, 'msgtype' => 'text', 'text' => ['content' => "如何使用个人的二维码? <a href=\"{$url}\">点击这里...</a>"]];
                         $arr = $this->WxMessageCustomSend($msg);
                         return $this->responseLocalImage('image', $log_file_path);
                     case 2:
                         $model = MUser::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
                         if ($model->scene_id == 0) {
                             $count = 0;
                         } else {
                             $count = MUser::find()->where(['gh_id' => $gh_id, 'scene_pid' => $model->scene_id])->count();
                         }
                         return $this->responseText("你的推广人数是:{$count}\n\n" . self::PROMPT_MENU_ONE);
                     case 3:
                         $staff = MStaff::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
                         if (empty($staff->office_id)) {
                             $this->setState($gh_id, $openid, self::STATE_OFFICE);
                             return $this->responseText($this->getOfficePrompt($gh_id));
                         }
                         $model = MOffice::findOne($staff->office_id);
                         if ($model === null) {
                             $this->setState($gh_id, $openid, self::STATE_OFFICE);
                             $str = $this->getOfficePrompt($gh_id);
                             return $this->responseText("invalid office id\n,{$str}");
                         }
                         if (empty($model->scene_id)) {
                             $gh = MGh::findOne($gh_id);
                             $scene_id = $gh->newSceneId();
                             $gh->save(false);
                             $model->scene_id = $scene_id;
                             $model->save(false);
                             U::W("scene_id={$scene_id}");
                         } else {
                             $scene_id = $model->scene_id;
                         }
                         $log_file_path = Yii::$app->getRuntimePath() . DIRECTORY_SEPARATOR . 'qr' . DIRECTORY_SEPARATOR . "{$gh_id}_{$scene_id}.jpg";
                         //U::W($log_file_path);
                         if (!file_exists($log_file_path)) {
                             $arr = $this->WxgetQRCode($scene_id, true);
                             $url = $this->WxGetQRUrl($arr['ticket']);
                             Wechat::downloadFile($url, $log_file_path);
                         }
                         //$msg = ['touser'=>$openid, 'msgtype'=>'text', 'text'=>['content'=>'如何使用部门的二维码? <a href="http://baidu.com">点击这里...</a>']];
                         //$url = Url::to(['wap/aboutqr','name'=>$model->title, 'qrurl'=>Yii::$app->getRequest()->baseUrl."/../runtime/qr/{$gh_id}_{$scene_id}.jpg"],true);
                         $url = "http://mp.weixin.qq.com/s?__biz=MzA4ODkwOTYxMA==&mid=203659175&idx=1&sn=0efaf2269fb7ba6a022f5c31d0d5e255#rd";
                         $msg = ['touser' => $openid, 'msgtype' => 'text', 'text' => ['content' => "如何使用部门的二维码? <a href=\"{$url}\">点击这里...</a>"]];
                         $arr = $this->WxMessageCustomSend($msg);
                         return $this->responseLocalImage('image', $log_file_path);
                     case 4:
                         $staff = MStaff::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
                         if (empty($staff->office_id)) {
                             $this->setState($gh_id, $openid, self::STATE_OFFICE);
                             return $this->responseText($this->getOfficePrompt($gh_id));
                         }
                         $model = MOffice::findOne($staff->office_id);
                         if ($model === null) {
                             $this->setState($gh_id, $openid, self::STATE_OFFICE);
                             $str = $this->getOfficePrompt($gh_id);
                             return $this->responseText("invalid office id\n,{$str}");
                         }
                         if ($model->scene_id == 0) {
                             $count = 0;
                         } else {
                             $count = MUser::find()->where(['gh_id' => $gh_id, 'scene_pid' => $model->scene_id])->count();
                         }
                         //U::W($user->office_id);
                         //U::W('a1111111111');
                         $staffs = MStaff::find()->where(['gh_id' => $gh_id, 'office_id' => $staff->office_id])->asArray()->all();
                         $openids = [];
                         //U::W($staffs);
                         foreach ($staffs as $staff) {
                             if (!empty($staff['openid'])) {
                                 $openids[] = $staff['openid'];
                             }
                         }
                         if (empty($openids)) {
                             $staff_count = 0;
                         } else {
                             $users = MUser::find()->where(['gh_id' => $gh_id, 'openid' => $openids])->asArray()->all();
                             $scene_ids = [];
                             foreach ($users as $user) {
                                 if ($user['scene_id'] != 0) {
                                     $scene_ids[] = $user['scene_id'];
                                 }
                             }
                             if (empty($scene_ids)) {
                                 $staff_count = 0;
                             } else {
                                 $staff_count = MUser::find()->where(['gh_id' => $gh_id, 'scene_pid' => $scene_ids])->count();
                             }
                         }
                         return $this->responseText("部门所属员工推广人数是:{$staff_count}\n部门推广人数是:{$count}\n\n" . self::PROMPT_MENU_ONE);
                     case 5:
                         $this->setState($gh_id, $openid, self::STATE_CHANGE_MOBILE);
                         return $this->responseText("请重新输入手机号, 0:退出");
                     case 6:
                         $staff = MStaff::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
                         $current_office_id = empty($staff->office_id) ? '' : "当前所属部门号:{$staff->office_id}\n";
                         $this->setState($gh_id, $openid, self::STATE_OFFICE);
                         return $this->responseText($current_office_id . $this->getOfficePrompt($gh_id));
                     case 7:
                         $staff = MStaff::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
                         if ($staff !== null) {
                             $staff->openid = '';
                             $staff->save(false);
                             return $this->responseText("成功解除微信号与员工之间的绑定!\n\n" . self::PROMPT_MENU_ONE);
                         } else {
                             return $this->responseText("你不需要解除绑定\n\n" . self::PROMPT_MENU_ONE);
                         }
                     default:
                         return $this->responseText("输入无效!\n\n" . self::PROMPT_MENU_ONE);
                 }
                 return $this->responseText(self::PROMPT_MENU_ONE);
         }
     }
 }
Ejemplo n.º 5
0
 public function getQrImageUrl2()
 {
     $gh_id = $this->gh_id;
     if (empty($this->scene_id)) {
         // hbhe
         if (yii::$app->mutex->acquire(MStaff::SCENE_LOCK, MStaff::SCENE_LOCK_WAIT_TIME_SECOND)) {
             $this->scene_id = MStaff::newSceneId($this->gh_id);
             $this->save(false);
             //yii::$app->mutex->release($lock);
             yii::$app->mutex->release(MStaff::SCENE_LOCK);
         } else {
             yii::error('acquire lock error');
         }
     }
     $scene_id = $this->scene_id;
     $office_id = $this->office_id;
     $office = MOffice::findOne(['office_id' => $office_id]);
     $office_title = $office->title;
     //$log_file_path = Yii::$app->getRuntimePath().DIRECTORY_SEPARATOR.'qr'.DIRECTORY_SEPARATOR."{$gh_id}_{$scene_id}.jpg";
     $log_file_path = Yii::$app->getRuntimePath() . DIRECTORY_SEPARATOR . 'qr-all-offices' . DIRECTORY_SEPARATOR . "{$scene_id}_{$office_title}.jpg";
     if (!file_exists($log_file_path) || filesize($log_file_path) == 0) {
         Yii::$app->wx->setGhId($gh_id);
         $arr = Yii::$app->wx->WxgetQRCode($scene_id, true);
         $url = Yii::$app->wx->WxGetQRUrl($arr['ticket']);
         Wechat::downloadFile($url, $log_file_path);
     }
     //$url = Yii::$app->getRequest()->baseUrl."/../runtime/qr/{$gh_id}_{$scene_id}.jpg";
     //return $url;
 }
Ejemplo n.º 6
0
<?php 
$this->head();
?>
</head>

<body>
<?php 
$this->beginBody();
?>

	<?php 
use app\models\Wechat;
use app\models\MyWechat;
Yii::$app->wx->setParameterComm();
Yii::$app->wx->setParameter("body", urlencode("testjsjsjsjsa"));
Yii::$app->wx->setParameter("out_trade_no", Wechat::generateOutTradeNo());
Yii::$app->wx->setParameter("total_fee", "1");
Yii::$app->wx->setParameter("spbill_create_ip", "127.0.0.1");
?>

	<script language="javascript">
	function callpay()
	{
		WeixinJSBridge.invoke('getBrandWCPayRequest',<?php 
echo Yii::$app->wx->create_biz_package();
?>
,function(res){
		WeixinJSBridge.log(res.err_msg);
		alert(res.err_code+res.err_desc+res.err_msg);
		if(res.err_msg == 'get_brand_wcpay_request:ok') {
			alert('ok');
Ejemplo n.º 7
0
 public function actionCreateMenu()
 {
     $gh_id = Yii::$app->wx->getGhid();
     if ($gh_id == MGh::GH_WOSO) {
         $menu = new \app\models\WxMenu([new \app\models\ButtonComplex('产品', [new \app\models\ButtonView('自由组合', Yii::$app->wx->WxGetOauth2Url('snsapi_base', "wap/diy:{$gh_id}")), new \app\models\ButtonView('demo', 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf0e81c3bee622d60&redirect_uri=http%3A%2F%2Fnba.bluewebgame.com%2Foauth_response.php&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect'), new \app\models\ButtonView('沃商城', Yii::$app->wx->WxGetOauth2Url('snsapi_base', "wap/mall:{$gh_id}")), new \app\models\ButtonView('明星产品', Yii::$app->wx->WxGetOauth2Url('snsapi_base', "wap/product:{$gh_id}"))]), new \app\models\ButtonView('促销商品', "http://wosotech.com/wx/web/index.php?r=wap/prom&gh_id={$gh_id}"), new \app\models\ButtonComplex('我的服务', [new \app\models\ButtonView('我的订单', Yii::$app->wx->WxGetOauth2Url('snsapi_base', "wap/order:{$gh_id}")), new \app\models\ButtonView('jsphp', 'http://wosotech.com/wx/web/jsphp.php'), new \app\models\ButtonView('靓号运程', Yii::$app->wx->WxGetOauth2Url('snsapi_base', "wap/luck:{$gh_id}")), new \app\models\ButtonView('游戏2048', Yii::$app->wx->WxGetOauth2Url('snsapi_base', "wap/g2048:{$gh_id}")), new \app\models\ButtonView('幸运大转盘', Yii::$app->wx->WxGetOauth2Url('snsapi_base', "wap/disk:{$gh_id}"))])]);
     } else {
         if ($gh_id == MGh::GH_XIANGYANGUNICOM) {
             $menu = new \app\models\WxMenu([new \app\models\ButtonComplex('沃资讯', [new \app\models\ButtonView('新年喜乐惠', 'http://mp.weixin.qq.com/s?__biz=MzA4ODkwOTYxMA==&mid=207197445&idx=1&sn=aee84b19e349c436bd30fe9ac6f488d7#rd'), new \app\models\ButtonView('1折流量包抢购', 'http://mp.weixin.qq.com/s?__biz=MzA4ODkwOTYxMA==&mid=207197175&idx=1&sn=7fc569fb57c99db9be6abc973374aed3#rd'), new \app\models\ButtonView('玩转流量', Yii::$app->wx->WxGetOauth2Url('snsapi_base', "wap/showpage:{$gh_id}")), new \app\models\ButtonView('玩转4G', Yii::$app->wx->WxGetOauth2Url('snsapi_base', "wap/show4ginfo:{$gh_id}"))]), new \app\models\ButtonComplex('沃业务', [new \app\models\ButtonView('你好,2015', Yii::$app->wx->WxGetOauth2Url('snsapi_base', "wap/showdoubledaninfo:{$gh_id}")), new \app\models\ButtonView('老友季焕新机', Yii::$app->wx->WxGetOauth2Url('snsapi_base', "wap/showk1info:{$gh_id}")), new \app\models\ButtonView('微信店铺', Yii::$app->wx->WxGetOauth2Url('snsapi_base', "wap/wlmshop:{$gh_id}"))]), new \app\models\ButtonComplex('沃服务', [new \app\models\ButtonView('话费查询', 'http://wap.10010.com/t/query/queryRealTimeFeeInfo.htm?menuId=000200010001'), new \app\models\ButtonView('话费充值', 'http://upay.10010.com/npfwap/npfMobWap/bankcharge/index.html?version=null&desmobile=8E2104B024B5116C9EA24F8EE55A29A8#/bankcharge'), new \app\models\ButtonView('流量查询', 'http://wap.10010.com/t/operationservice/queryRunoff.htm?menuId=000200020001'), new \app\models\ButtonView('流量抽奖第3季', 'http://wap.hb165.com/llphb3/#rd'), new \app\models\ButtonView('用户吐槽', 'http://wsq.qq.com/reflow/263163652-1044?_wv=1&source=')])]);
         } else {
             if ($gh_id == MGh::GH_HOYA) {
                 $menu = new \app\models\WxMenu([new \app\models\ButtonComplex('走进爱迪', [new \app\models\ButtonView('关于爱迪', 'http://wosotech.com/wx/web/index.php?r=yss/adabout'), new \app\models\ButtonView('校区查询', 'http://baidu.com'), new \app\models\ButtonView('教师风采', 'http://wosotech.com/wx/web/index.php?r=yss/teacher'), new \app\models\ButtonView('爱迪宝贝秀', 'http://baidu.com'), new \app\models\ButtonView('走进爱迪', 'http://baidu.com')]), new \app\models\ButtonComplex('预约优惠', [new \app\models\ButtonView('我要预约', 'http://baidu.com'), new \app\models\ButtonView('课程介绍', 'http://baidu.com'), new \app\models\ButtonView('近期活动', 'http://baidu.com'), new \app\models\ButtonView('教师风采x', 'http://wosotech.com/wx/web/index.php?r=yss/teacherx'), new \app\models\ButtonView('教师风采y', 'http://wosotech.com/wx/web/index.php?r=yss/teachery')]), new \app\models\ButtonComplex('宝贝查询', [new \app\models\ButtonView('签到记录', 'http://baidu.com'), new \app\models\ButtonView('宝贝相册', 'http://baidu.com'), new \app\models\ButtonView('宝贝课表', 'http://baidu.com'), new \app\models\ButtonView('推荐有礼', 'http://baidu.com')])]);
             } else {
                 die("invalid gh_id={$gh_id}");
             }
         }
     }
     $menu_json = Wechat::json_encode($menu);
     U::W([$menu, $menu_json]);
     $arr = Yii::$app->wx->WxMenuCreate($menu);
     U::W($arr);
     return;
 }
Ejemplo n.º 8
0
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'encodeLabels' => false, 'items' => [['label' => '首页', 'url' => ['/site/index']], ['label' => '营业厅', 'visible' => Yii::$app->user->isOffice, 'items' => [['label' => '订单管理', 'url' => ['/order/index'], 'linkOptions' => ['data-method' => 'post']], ['label' => '员工管理', 'url' => ['/order/stafflist'], 'linkOptions' => ['data-method' => 'post']], ['label' => '粉丝管理', 'url' => ['/admin/index'], 'linkOptions' => ['data-method' => 'post']], ['label' => '客户管理', 'url' => ['/custom/index'], 'linkOptions' => ['data-method' => 'post']], ['label' => '推广查询', 'url' => ['/accesslog/index'], 'linkOptions' => ['data-method' => 'post']]]], ['label' => '管理', 'visible' => Yii::$app->user->isAdmin, 'items' => [['label' => '订单管理', 'url' => ['/order/index'], 'linkOptions' => ['data-method' => 'post']], ['label' => '新品预订名单', 'url' => ['/order/iphone6sub'], 'linkOptions' => ['data-method' => 'post']], '<li class="divider"></li>', ['label' => '员工管理', 'url' => ['/order/stafflist'], 'linkOptions' => ['data-method' => 'post']], ['label' => '员工推广成绩排行', 'url' => ['/order/stafftop'], 'linkOptions' => ['data-method' => 'post']], ['label' => '营业厅管理', 'url' => ['/order/officelist'], 'linkOptions' => ['data-method' => 'post']], ['label' => '营业厅推广成绩排行', 'url' => ['/order/officetop'], 'linkOptions' => ['data-method' => 'post']], ['label' => '客户管理', 'url' => ['/custom/index'], 'linkOptions' => ['data-method' => 'post']], ['label' => '客户常见问题', 'url' => ['/unicom-faq/index'], 'linkOptions' => ['data-method' => 'post']], ['label' => '客户统计', 'url' => ['/order/officecustomstat'], 'linkOptions' => ['data-method' => 'post']], ['label' => '消息中心', 'url' => ['/messagebox/index'], 'linkOptions' => ['data-method' => 'post']], '<li class="divider"></li>', ['label' => '促销活动管理', 'url' => ['/activity/index'], 'linkOptions' => ['data-method' => 'post']], '<li class="divider"></li>', ['label' => '商品管理', 'url' => ['/admin/itemlist'], 'linkOptions' => ['data-method' => 'post']], ['label' => '商品套餐管理', 'url' => ['/admin/pkglist'], 'linkOptions' => ['data-method' => 'post']], '<li class="divider"></li>', ['label' => '粉丝管理', 'url' => ['/admin/index'], 'linkOptions' => ['data-method' => 'post']], ['label' => '推广查询', 'url' => ['/accesslog/index'], 'linkOptions' => ['data-method' => 'post']], '<li class="divider"></li>', ['label' => '微信菜单配置', 'url' => ['/wxmenu/index'], 'linkOptions' => ['data-method' => 'post']], ['label' => '菜单动作设置', 'url' => ['/wxaction/index'], 'linkOptions' => ['data-method' => 'post']], ['label' => '图片管理', 'url' => ['/photo/index'], 'linkOptions' => ['data-method' => 'post']], ['label' => '单图文', 'url' => ['/article/index'], 'linkOptions' => ['data-method' => 'post']], ['label' => '多图文', 'url' => ['/articlemult/index'], 'linkOptions' => ['data-method' => 'post']], '<li class="divider"></li>', ['label' => '用户账户管理', 'url' => ['/useraccount/index'], 'linkOptions' => ['data-method' => 'post']], ['label' => '测速图片', 'url' => ['/heatmap/index'], 'linkOptions' => ['data-method' => 'post']]]], Yii::$app->user->isGuest ? ['label' => '登录', 'url' => ['/site/login']] : ['label' => '<span class="glyphicon glyphicon-user"></span> ' . Html::encode(Yii::$app->user->identity->username), 'items' => [['label' => '公众号管理', 'url' => ['/admin/ghlist'], 'linkOptions' => ['data-method' => 'post'], 'visible' => Yii::$app->user->isRoot], ['label' => '修改设置', 'url' => ['/site/profile'], 'linkOptions' => ['data-method' => 'post']], '<li class="divider"></li>', ['label' => '退出', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']]]]]]);
NavBar::end();
?>

        <div class="container">
            <?php 
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
            <?php 
echo $content;
?>
        </div>
    </div>

	<?php 
if (!\app\models\Wechat::supportWeixinPay()) {
    ?>
    <footer class="footer">
        <div class="container">
<!--
            <p class="pull-left">&copy; 沃手科技 <?php 
    echo date('Y');
    ?>
 (鄂ICP备14010852号)</p>
-->
            <p class="pull-left">&copy; 沃手科技 <?php 
    echo date('Y');
    ?>
</p>
            <p class="pull-right">
			<?php 
Ejemplo n.º 9
0
 public function actionAddbindmobile($gh_id, $openid)
 {
     $this->layout = 'wap';
     $model = new OpenidBindMobile();
     $model->gh_id = $gh_id;
     $model->openid = $openid;
     $model->setScenario('bind_mobile');
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         //非自营厅渠道新增会员时,+积分100
         $user = MUser::findOne(['openid' => $openid]);
         $office = MOffice::findOne(['office_id' => $user->belongto]);
         if (!empty($office)) {
             if ($office->is_selfOperated == 0) {
                 //wx_office_score_event 增加一条记录
                 $offce_score_event = new MOfficeScoreEvent();
                 $offce_score_event->gh_id = $gh_id;
                 $offce_score_event->openid = $openid;
                 $offce_score_event->office_id = $user->belongto;
                 $offce_score_event->cat = MOfficeScoreEvent::CAT_ADD_NEW_MEMBER;
                 $offce_score_event->create_time = date('y-m-d h:i:s', time());
                 $offce_score_event->score = MOfficeScoreEvent::CAT_ADD_NEW_MEMBER_SCORE;
                 $offce_score_event->memo = '新增会员';
                 $offce_score_event->save(false);
                 //wx_office表中对应渠道score 加100分
                 $office->score = $office->score + 100;
                 $office->save(false);
             }
         }
         Yii::$app->wx->setGhId($gh_id);
         $url = Url::to(['hyzx1', 'gh_id' => $gh_id, 'openid' => $openid], true);
         Yii::$app->wx->WxTemplateSend(Wechat::getTemplateBindSuccessNotify($openid, $url, "{$model->user->nickname},您的手机号码已成功绑定襄阳联通官方微信营业厅", "您已成为襄阳联通的会员,可随时查询话费余额,办理业务,参与更多专享优惠!", $model->mobile, date('Y-m-d')));
         $url = Yii::$app->getSession()->get('RETURN_URL');
         if (!empty($url)) {
             return $this->redirect($url);
         } else {
             Yii::$app->session->setFlash('success', '恭喜您,会员注册成功!');
             return $this->refresh();
         }
     }
     $searchModel = new OpenidBindMobileSearch();
     $searchModel->gh_id = $gh_id;
     $searchModel->openid = $openid;
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('addbindmobile', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'model' => $model]);
 }
Ejemplo n.º 10
0
 public static function exportToWechat($gh_id)
 {
     Yii::$app->wx->setGhId($gh_id);
     $buttons = static::getButtonsFromDb($gh_id);
     if (empty($buttons)) {
         return false;
     }
     $menu = new WxMenu($buttons);
     $menu_json = Wechat::json_encode($menu);
     U::W([$menu, $menu_json]);
     try {
         $arr = Yii::$app->wx->WxMenuCreate($menu);
     } catch (\Exception $e) {
         return false;
     }
     U::W($arr);
     return true;
 }
Ejemplo n.º 11
0
 protected function onClick()
 {
     $this->saveAccessLogAll();
     $Content = $this->getRequest('EventKey');
     if (($resp = $this->handleKeyword($Content)) !== false) {
         return $resp;
     }
     return parent::onClick();
 }
Ejemplo n.º 12
0
 public function sendSmAlert($balance)
 {
     $url = '';
     $first = '沃手科技:短信余量不足鸟!!!';
     $remark = "短信余量: {$balance}, 请沃手科技相关人员尽快联系购买短信";
     $msg = Wechat::getTemplateDonateMobileBill($this->openid, $url, $first, $remark, '', '');
     Yii::$app->wx->setGhId($this->gh_id);
     $arr = Yii::$app->wx->WxTemplateSend($msg);
     return $arr;
 }