Exemple #1
0
 public function submit($url, $params)
 {
     try {
         $requestUrl = $url . '?';
         if ($this->method == 'GET') {
             $requestUrl .= http_build_query($params);
             $postFields = null;
         } else {
             $postFields = $params;
         }
         $resp = U::curl($requestUrl, $postFields);
     } catch (Exception $e) {
         U::W($e->getCode() . ':' . $e->getMessage());
         return ['errcode' => $e->getCode(), 'errmsg' => $e->getMessage()];
     }
     if ("json" === $this->format) {
         $arr = json_decode($resp, true);
         if (null !== $arr) {
             return $arr;
         }
     } else {
         if ("xml" === $this->format) {
             $respObject = @simplexml_load_string($resp);
             if (false !== $respObject) {
                 return json_decode(json_encode($respObject), true);
             }
         }
     }
     return ['errcode' => 90000, 'errmsg' => 'HTTP_RESPONSE_NOT_WELL_FORMED'];
 }
 public function actionIndex()
 {
     U::W([__METHOD__, $_GET, $_POST]);
     $notify = new PayNotifyCallBack();
     $respXml = $notify->Handle(false);
     return $respXml;
 }
Exemple #3
0
 public static function hangbaoAjax($openid, $tcnx)
 {
     $hd201509t6 = self::findOne(['openid' => $openid]);
     if (empty($hd201509t6)) {
         U::W("----------hd201509t6 is null--------");
         return \yii\helpers\Json::encode(['code' => 1]);
     }
     //新用户 60:25:15 ---> 75:15:10
     $gailv1 = array(20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100);
     //76套餐以下 95:5:0
     $gailv2 = array(20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 50, 50, 50, 50, 50);
     //76套餐以上 40:40:20
     $gailv3 = array(20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100);
     //echo $a[mt_rand(0,99)];
     if ($tcnx == 0) {
         $hbme = $gailv1[mt_rand(0, 99)];
     } else {
         if ($tcnx == 1) {
             $hbme = $gailv2[mt_rand(0, 99)];
         } else {
             $hbme = $gailv3[mt_rand(0, 99)];
         }
     }
     $hd201509t6->status = 0;
     $hd201509t6->hbme = $hbme;
     //$hd201509t6->create_time = date('y-m-d h:i:s',time());
     $hd201509t6->save(false);
     return \yii\helpers\Json::encode(['code' => 0]);
 }
Exemple #4
0
 public static function toupiaoAjax($author_openid, $vote_openid)
 {
     $qingshi_vote = self::findOne(['vote_openid' => $vote_openid]);
     if (empty($qingshi_vote)) {
         $qingshi_vote = new \app\models\MQingshiVote();
     } else {
         //已经投过一次票了,提示用户已投过票,只能每人只能投一次票哟
         return \yii\helpers\Json::encode(['code' => 11]);
     }
     $qingshi_vote->author_openid = $author_openid;
     $qingshi_vote->vote_openid = $vote_openid;
     $qingshi_vote->save(false);
     //写入到投票表中;
     $qingshi_score = \app\models\MQingshiScore::findOne(['author_openid' => $author_openid]);
     U::W($qingshi_score);
     if (empty($qingshi_score)) {
         $qingshi_score = new \app\models\MQingshiScore();
     }
     $qa = \app\models\MQingshiAuthor::findOne(['author_openid' => $author_openid]);
     $qingshi_score->author_openid = $author_openid;
     $qingshi_score->score = $qingshi_score->score + 1;
     $qingshi_score->status = 0;
     $qingshi_score->create_time = $qa->create_time;
     $qingshi_score->save(false);
     return \yii\helpers\Json::encode(['code' => 0]);
 }
 /**
  * Updates an existing MQingshiAuthor model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         //return $this->redirect(['view', 'id' => $model->id]);
         /*
         const AUDIT_NONE = 0;
         const AUDIT_FAIL = 1;
         const AUDIT_PASS = 2;
         */
         if ($model->status == 1) {
             $msg = ":-( 你的投稿没有审核通过。没关系啦,还可以为小伙伴们拉票哟~";
             if (!$model->user->sendWxm($msg)) {
                 U::W("wx send failed");
             }
         } else {
             if ($model->status == 2) {
                 $msg = "恭喜!您的投稿已通过审核,快号召小伙伴们来投票吧~";
                 if (!$model->user->sendWxm($msg)) {
                     U::W("wx send failed");
                 }
             }
         }
         //return $this->redirect(['memberlist']);
         return $this->redirect(['index', 'model' => $model]);
     } else {
         return $this->render('update', ['model' => $model]);
     }
 }
 public function actionIndex()
 {
     U::W([__METHOD__, $_GET, $_POST]);
     //$this->layout = false;
     $this->layout = 'wapy';
     $alipay_config = Alipay::getAlipayConfig();
     $alipayNotify = new AlipayNotify($alipay_config);
     $verify_result = $alipayNotify->verifyReturn();
     if (!$verify_result) {
         Alipay::logResult(['Alipaycallback error', __METHOD__, $_GET, $_POST]);
         //return 'Alipaycallback error';
     }
     $result = $_GET['result'];
     if ($result != 'success') {
         Alipay::logResult(['Pay error', __METHOD__, $_GET, $_POST]);
         return 'Pay error';
     }
     $oid = $_GET['out_trade_no'];
     $model = MOrder::findOne($oid);
     if ($model === null) {
         U::W(['Invalid oid', $_GET, $_POST]);
         return "Invalid oid";
     }
     $model->pay_kind = MOrder::PAY_KIND_ALIWAP;
     $model->aliwap_trade_no = $_GET['trade_no'];
     $model->status = MOrder::STATUS_SUCCEEDED;
     if (!$model->save(false)) {
         U::W(['save db error', $_GET, $_POST, $model->getErrors()]);
         return 'system error';
     }
     //return 'Pay OK';
     return $this->render('index', ['gh_id' => $model->gh_id, 'openid' => $model->openid]);
 }
Exemple #7
0
 public static function rewardconfirmAjax($newfan_openid)
 {
     U::W("=============ivegetit===============");
     U::W($newfan_openid);
     $newfan_reward = self::findOne(['newfan_openid' => $newfan_openid]);
     $newfan_reward->getting_time = time();
     $newfan_reward->save(false);
     return \yii\helpers\Json::encode(['code' => 0]);
 }
Exemple #8
0
 public function submit($url, $params)
 {
     try {
         $requestUrl = $url . '?';
         if ($this->method == 'GET') {
             $requestUrl .= http_build_query($params);
             $postFields = null;
         } else {
             $postFields = $params;
         }
         if ($this->debug) {
             U::W(array($requestUrl, $postFields));
             $this->resp_code = ESms::OK_CURL;
             return;
         }
         //U::W(array($requestUrl, $postFields));
         $resp = U::curl($requestUrl, $postFields);
         if ($this->message_is_gbk) {
             $resp = iconv("GBK", "UTF-8//IGNORE", $resp);
         }
         //U::W($resp);
     } catch (Exception $e) {
         U::W(array(__FUNCTION__, get_class($this), 'ERROR_CURL', $url, $params));
         $this->resp_code = ESms::ERROR_CURL;
         $this->resp = $e->getCode() . ',' . $e->getMessage();
         return;
     }
     $respWellFormed = false;
     if ("json" == $this->format) {
         $respObject = json_decode($resp);
         if (null !== $respObject) {
             $respWellFormed = true;
         }
     } else {
         if ("xml" == $this->format) {
             //$respObject = @simplexml_load_string($resp);
             $respObject = @simplexml_load_string(trim($resp));
             if (false !== $respObject) {
                 $respWellFormed = true;
                 $respObject = json_decode(json_encode($respObject));
             }
         } else {
             $respWellFormed = true;
             $respObject = $resp;
         }
     }
     if (false === $respWellFormed) {
         U::W(array(__FUNCTION__, get_class($this), 'HTTP_RESPONSE_NOT_WELL_FORMED', $resp, $url, $params));
         $this->resp_code = ESms::ERROR_HTTP_RESPONSE_NOT_WELL_FORMED;
         $this->resp = 'HTTP_RESPONSE_NOT_WELL_FORMED';
         return;
     }
     $this->resp_code = ESms::OK_CURL;
     $this->resp = $respObject;
     //U::W($this->resp);
 }
Exemple #9
0
 public function beforeSave($insert)
 {
     if (parent::beforeSave($insert)) {
         if ($this->isNewRecord) {
             $this->token = U::generateRandomString(16);
         }
         return true;
     }
     return false;
 }
Exemple #10
0
 public static function diskwinnerAjax($openid)
 {
     U::W("-------------------------diskwinnerAjax-------------------------------");
     $disk = self::findOne(['openid' => $openid]);
     U::W($disk);
     $disk->win_time = time();
     $disk->win = 2;
     $disk->save(false);
     return \yii\helpers\Json::encode(['code' => 0]);
 }
Exemple #11
0
 public static function confirmAjax($openid)
 {
     $hd201509t2 = self::findOne(['openid' => $openid]);
     if (empty($hd201509t2)) {
         U::W("----------hd201509t2 is null--------");
         return \yii\helpers\Json::encode(['code' => 1]);
     }
     $hd201509t2->status = 1;
     $hd201509t2->create_time = date('y-m-d h:i:s', time());
     $hd201509t2->save(false);
     return \yii\helpers\Json::encode(['code' => 0]);
 }
Exemple #12
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']);
 }
Exemple #13
0
 public function S($mobiles_str, $message, $sendtime = '', $channel = null, $isOrder = false, $params = array())
 {
     if (empty($channel)) {
         if ($isOrder) {
             $channel = U::getRandomWeightedElement($this->_orderRoutesWeight);
         } else {
             $channel = U::getRandomWeightedElement($this->_commRoutesWeight);
         }
     }
     $route = $isOrder ? $this->_orderRoutes[$channel] : $this->_commRoutes[$channel];
     $route->S($mobiles_str, $message, $sendtime, $params);
     return $route;
 }
Exemple #14
0
 public function actionOfficeCampaignDetail()
 {
     $details = \app\models\MOfficeCampaignDetail::find()->all();
     foreach ($details as $detail) {
         $pic_filename = $detail->getPicFile();
         $pic_filename_new = $pic_filename . "-new.jpg";
         try {
             \app\models\U::compress_image_file($pic_filename);
             echo $pic_filename . " compressed." . PHP_EOL;
         } catch (Exception $e) {
             echo $e->getMessage();
             echo $pic_filename . PHP_EOL;
         }
     }
 }
 public function actionIndex()
 {
     U::W([__METHOD__, $_GET, $_POST]);
     $this->layout = false;
     $alipay_config = Alipay::getAlipayConfig();
     $alipayNotify = new AlipayNotify($alipay_config);
     $verify_result = $alipayNotify->verifyNotify();
     if (!$verify_result) {
         Alipay::logResult(['Alipaynotify sign error', __METHOD__, $_GET, $_POST]);
         return "fail";
     }
     if ($alipay_config['sign_type'] == 'MD5') {
         $respObject = @simplexml_load_string($_POST['notify_data']);
     } else {
         if ($alipay_config['sign_type'] == '0001') {
             $respObject = @simplexml_load_string($alipayNotify->decrypt($_POST['notify_data']));
         } else {
             Alipay::logResult(['Alipaynotify sign_type error', __METHOD__, $_GET, $_POST]);
         }
     }
     $arr = json_decode(json_encode($respObject), true);
     U::W($arr);
     $oid = $arr['out_trade_no'];
     $model = MOrder::findOne($oid);
     if ($model === null) {
         U::W(['Invalid oid', $_GET, $_POST, $arr]);
         return "success";
     }
     $model->pay_kind = MOrder::PAY_KIND_ALIWAP;
     $model->aliwap_trade_no = $arr['trade_no'];
     $model->aliwap_total_fee = $arr['total_fee'];
     $model->aliwap_trade_status = $arr['trade_status'];
     $model->aliwap_buyer_email = $arr['buyer_email'];
     $model->aliwap_quantity = $arr['quantity'];
     $model->aliwap_gmt_payment = $arr['gmt_payment'];
     if ($arr['trade_status'] == 'TRADE_FINISHED' || $arr['trade_status'] == 'TRADE_SUCCESS') {
         $model->status = MOrder::STATUS_SUCCEEDED;
     } else {
         U::W(['trade_status is not TRADE_FINISHED', $_GET, $_POST, $arr]);
     }
     if (!$model->save(false)) {
         U::W(['save db error', $_GET, $_POST, $arr, $model->getErrors()]);
     }
     return "success";
 }
Exemple #16
0
 public function actionIndex()
 {
     set_time_limit(0);
     ini_set('memory_limit', '-1');
     if (!ini_set('memory_limit', '-1')) {
         U::W("ini_set(memory_limit) error");
     }
     $time = microtime(true);
     U::W("###########" . __CLASS__ . " BEGIN");
     self::refreshAccessToken();
     if (date('H') == 10 || date('H') == 11 || date('H') == 16 || date('H') == 17 || date('H') == 20) {
         if (date('H') == 11) {
             self::smsMarketing(1);
         } else {
             self::smsMarketing(1);
         }
     }
     U::W("###########" . __CLASS__ . " END, (time: " . sprintf('%.3f', microtime(true) - $time) . "s)");
 }
Exemple #17
0
 public function run()
 {
     if (($exception = Yii::$app->getErrorHandler()->exception) === null) {
         return '';
     }
     if ($exception instanceof HttpException) {
         $code = $exception->statusCode;
     } else {
         $code = $exception->getCode();
     }
     if ($exception instanceof Exception) {
         $name = $exception->getName();
     } else {
         $name = $this->defaultName ?: Yii::t('yii', 'Error');
     }
     if ($code) {
         $name .= " (#{$code})";
     }
     if ($exception instanceof WxException) {
         $resp = json_decode($exception->getMessage(), true);
         $message = $resp['errmsg'];
         $message .= ':' . $resp['errcode'];
     } else {
         if ($exception instanceof HttpException) {
             $message = $exception->getMessage();
         } else {
             if ($exception instanceof UserException) {
                 $message = $exception->getMessage();
             } else {
                 $message = $this->defaultMessage ?: Yii::t('yii', 'An internal server error occurred.');
             }
         }
     }
     if (Yii::$app->getRequest()->getIsAjax()) {
         U::W([$name, $message]);
         return "{$name}: {$message}";
     } else {
         U::W([$name, $message]);
         return $this->controller->render($this->view ?: $this->id, ['name' => $name, 'message' => $message, 'exception' => $exception, 'code' => $exception->getCode()]);
     }
 }
Exemple #18
0
 private static function sms($mobile)
 {
     //        \Yii::$app->wx->setGhId(\app\models\MGh::GH_XIANGYANGUNICOM);
     $long_url = 'http://wosotech.com/wx/web/index.php?r=wapx/sm-qr' . '&mobile=' . $mobile;
     //        $short_url = \Yii::$app->wx->WxGetShortUrl($long_url);
     $short_url = DwzService::baidu($long_url);
     if (false == $short_url) {
         $short_url = DwzService::qqurl($long_url);
         if (false == $short_url) {
             $short_url = DwzService::so985($long_url);
             if (false == $short_url) {
                 \Yii::$app->wx->setGhId(MGh::GH_XIANGYANGUNICOM);
                 $short_url = \Yii::$app->wx->WxGetShortUrl($long_url);
             }
         }
     }
     $content = "【襄阳联通】诚邀您({$mobile})关注官方微信号,猛戳" . $short_url . '!最高50元红包即送!';
     U::yjhu_W(mb_strlen($content));
     //        $content = mb_substr($content, 0, 67);
     //        $content = $mobile . ' ' . $short_url;
     $s = \Yii::$app->sm->S($mobile, $content, '', null, true);
     //        $ret = \app\models\sm\ESmsGuodu::yjhu_test($mobile, $content);
     $ret = $s->isSendOk();
     if ($ret) {
         $smslog = SmsMarketingLog::findOne(['mobile' => $mobile]);
         if (empty($smslog)) {
             $smslog = new SmsMarketingLog();
             $smslog->mobile = $mobile;
             $smslog->first_sendtime = time();
             $smslog->last_sendtime = time();
             $smslog->send_count = 1;
             $smslog->save(false);
         } else {
             $smslog->send_count++;
             $smslog->last_sendtime = time();
             $smslog->save(false);
         }
     }
     return $ret;
 }
Exemple #19
0
 public static function getOfficeCampaignEndDate($date = null)
 {
     if ($date == null) {
         $timestamp = time();
     } else {
         $timestamp = strtotime($date);
     }
     //
     //        $year = date('Y', $timestamp);
     //        $month = date('m', $timestamp);
     //        $day = date('d', $timestamp);
     //        if ($day > self::CAMPAIGN_ENDDATE) {
     //            $month = $month + 1;
     //            if ($month > 12) {
     //                $year = $year + 1;
     //                $month = 1;
     //            }
     //        }
     //
     //        $end_time = sprintf("%04d-%02d-%02d 23:59:59", $year, $month, self::CAMPAIGN_ENDDATE);
     $end_date = \DateTime::createFromFormat("Y-m-d H:i:s", \app\models\U::getLastDate(date('Y', $timestamp), date('m', $timestamp)));
     return $end_date;
 }
Exemple #20
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;
 }
Exemple #21
0
 protected function onEventLocation()
 {
     //return Wechat::NO_RESP;
     $FromUserName = $this->getRequest('FromUserName');
     $gh_id = $this->getRequest('ToUserName');
     $model = MUser::findOne(['gh_id' => $gh_id, 'openid' => $FromUserName]);
     if ($model !== null) {
         $model->lat = $this->getRequest('Latitude');
         $model->lon = $this->getRequest('Longitude');
         $model->prec = $this->getRequest('Precision');
         $model->save(false);
         U::W("{$model->lat}, {$model->lon}");
     }
     return Wechat::NO_RESP;
 }
Exemple #22
0
 public static function confirmAjax($office_id, $cat)
 {
     $office = MOffice::findOne(['office_id' => $office_id]);
     if (empty($office)) {
         $score = 0;
     } else {
         $score = $office->score;
     }
     if ($cat == self::CAT_30YUAN_DAIJINJUAN) {
         $dh_score = self::CAT_30YUAN_DAIJINJUAN_SCORE;
     } else {
         if ($cat == self::CAT_100YUAN_DAIJINJUAN) {
             $dh_score = self::CAT_100YUAN_DAIJINJUAN_SCORE;
         } else {
             $dh_score = self::CAT_30YUAN_DAIJINJUAN_SCORE;
         }
     }
     if ($score < $dh_score) {
         U::W("----------score not enough--------");
         return \yii\helpers\Json::encode(['code' => 1]);
     } else {
         $office_score_event = new MOfficeScoreEvent();
         $office_score_event->gh_id = 'gh_03a74ac96138';
         $office_score_event->openid = '';
         $office_score_event->office_id = $office_id;
         $office_score_event->cat = $cat;
         $office_score_event->score = $dh_score;
         $office_score_event->memo = self::getCatNameOption($cat);
         $office_score_event->status = 0;
         $office_score_event->code = '';
         $office_score_event->create_time = date('y-m-d h:i:s', time());
         $office_score_event->save(false);
         $office = MOffice::findOne(['office_id' => $office_id]);
         $office->score = $office->score - $dh_score;
         $office->save(false);
     }
     return \yii\helpers\Json::encode(['code' => 0]);
 }
Exemple #23
0
        -->

        </ul>
    </div>

    <div data-role="footer" data-position="fixed">
        <h4>&copy; 襄阳联通 2015</h4>
    </div>
    <?php 
echo $this->render('menu', ['menuId' => 'menu1', 'gh_id' => $gh_id, 'openid' => $openid]);
?>
</div> <!-- page1 end -->

<?php 
$src = MSceneDetail::SRC_ID_SHARE_FRIEND;
$wid = implode('_', [U::getWid($gh_id, $openid), $src]);
$this->registerJsFile(Yii::$app->getRequest()->baseUrl . '/js/wechat.js');
$assetsPath = Yii::$app->getRequest()->baseUrl . '/images';
$appid = Yii::$app->wx->gh['appid'];
//$url = Yii::$app->wx->WxGetOauth2Url('snsapi_base', 'wap/mobilelist:'.Yii::$app->wx->getGhid());
$url = Yii::$app->wx->WxGetOauth2Url('snsapi_base', 'wap/mobilelist:' . Yii::$app->wx->getGhid() . ":wid={$wid}");
$myImg = Url::to("{$assetsPath}/share-icon.jpg", true);
$title = '特惠手机';
$desc = '多款热销机型,优惠大放送,快来瞄瞄吧~~ 心动不如行动!';
?>

<script>
	var dataForWeixin={
		appId:"<?php 
echo $appid;
?>
Exemple #24
0
 public static function setOutletLocationAjax($outlet_id, $latitude, $longitude)
 {
     $outlet = self::findOne(['outlet_id' => $outlet_id]);
     if (empty($outlet)) {
         return json_encode(['code' => -1, 'msg' => '该门店为空。']);
     }
     if ($outlet->setLocation($latitude, $longitude)) {
         //            if (empty($outlet->address)) {
         $outlet->updateAttributes(['address' => \app\models\U::getQqAddress($longitude, $latitude)]);
         //            }
         return json_encode(['code' => 0, 'msg' => '门店位置已更新。']);
     } else {
         return json_encode(['code' => -1, 'msg' => '门店位置无法保存。']);
     }
 }
Exemple #25
0
 */
$this->title = '员工推广详单';
$this->params['breadcrumbs'][] = ['label' => '员工推广成绩排行', 'url' => ['stafftop']];
//Html::a("aaa", ['stafftop']);
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="muser-index">

	<h1><?php 
//echo Html::encode($this->title)
?>
</h1>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'options' => ['class' => 'table-responsive'], 'tableOptions' => ['class' => 'table table-striped'], 'columns' => [['label' => false, 'attribute' => 'headimgurl', 'format' => 'html', 'value' => function ($model, $key, $index, $column) {
    $headimgurl = Html::img(U::getUserHeadimgurl($model->headimgurl, 46), ['style' => 'width:46px;']);
    return $headimgurl;
}], ['label' => '昵称', 'attribute' => 'nickname'], ['label' => '关注时间', 'attribute' => 'create_time']]]);
?>

</div>

<?php 
/*
//            'openid',    
//			'nickname',
//			'title',

    <p>
		<?php echo Html::a('Create User', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
Exemple #26
0
 public function sendSm($content)
 {
     try {
         if (empty($this->mobile) || !U::mobileIsValid($this->mobile)) {
             U::W(["manager's mobile is empty or invalid", $this->getAttributes(), __METHOD__]);
             return false;
         }
         U::W("balance before is " . \app\models\sm\ESmsGuodu::B());
         //$s = Yii::$app->sm->S($this->mobile, $content, '', 'guodu', true);
         $s = Yii::$app->sm->S($this->mobile, $content, '', null, true);
         //U::W($s->resp);
         $err_code = $s->getErrorMsg();
         $className = get_class($s);
         $err_code .= get_class($s);
         $smQueue = new MSmQueue();
         $smQueue->gh_id = $this->gh_id;
         $smQueue->receiver_mobile = $this->mobile;
         $smQueue->msg = $content;
         $smQueue->err_code = $err_code;
         if ($s->isSendOk()) {
             U::W('Send Sm OK');
             $smQueue->status = MSmQueue::STATUS_SENT;
         } else {
             U::W(['Send Sm ERR', $err_code, $s->resp]);
             $smQueue->status = MSmQueue::STATUS_ERR;
         }
         $smQueue->save(false);
         U::W("balance after is " . \app\models\sm\ESmsGuodu::B());
     } catch (\Exception $e) {
         U::W($e->getCode() . ':' . $e->getMessage());
     }
     return true;
 }
Exemple #27
0
 public function actionMemberupdate($id)
 {
     $model = MSceneDetail::findOne($id);
     if (!$model) {
         throw new NotFoundHttpException('no this gh');
     }
     if (\Yii::$app->request->isPost) {
         $model->load(\Yii::$app->request->post());
         if ($model->save()) {
             if ($model->status == MSceneDetail::STATUS_TIXIAN_OK) {
                 $msg = "充值成功";
             } else {
                 $msg = "充值失败";
             }
             if (!$model->user->sendWxm($msg)) {
                 U::W("wx send failed");
             }
             return $this->redirect(['memberlist']);
         } else {
             U::W($model->getErrors());
         }
     }
     return $this->render('memberupdate', ['model' => $model]);
 }
Exemple #28
0
    <h4><?php 
echo Html::encode($this->title);
?>
</h4>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <!--
    <p>
        <//?= Html::a('Create Morder', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    -->
    <p>
    <?php 
echo Html::a('下载 <i class="glyphicon glyphicon-arrow-down"></i>', U::current(['download' => 1]), ['class' => 'btn btn-success', 'data-pjax' => '0']);
?>
    </p>
    
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'showOnEmpty' => false, 'tableOptions' => ['class' => 'table table-striped'], 'columns' => ['oid', 'title', ['visible' => $isAdmin, 'attribute' => 'username'], ['visible' => $isAdmin, 'attribute' => 'usermobile'], 'create_time', ['attribute' => 'status', 'label' => '订单状态', 'value' => function ($model, $key, $index, $column) {
    return MOrder::getStatusOption($model->status);
}, 'filter' => MOrder::getStatusOption(), 'headerOptions' => array('style' => 'width:90px;')], ['class' => 'yii\\grid\\ActionColumn', 'headerOptions' => array('style' => 'width:90px;'), 'template' => $opt, 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('yii', 'Update'), 'data-pjax' => '0']);
}, 'delete' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, ['title' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', '确认要删除?'), 'data-method' => 'post', 'data-pjax' => '0']);
}]]]]);
?>

</div>
Exemple #29
0
<?php

use yii\helpers\Html;
use yii\helpers\Url;
use app\models\U;
use app\models\MDisk;
$this->title = '幸运大转盘';
$assetsPath = Yii::$app->getRequest()->baseUrl . '/../views/wap/games/disk/assets';
$gh_id = U::getSessionParam('gh_id');
$openid = U::getSessionParam('openid');
?>


<style type="text/css">

#diskstart{
	text-align: center;
}

#start {
	top: -268px;
	position: relative;
}

</style>


<div data-role="page" id="page1" data-theme="c">

	<?php 
echo $this->render('/wap/header1', ['menuId' => 'menu1', 'title' => '八月浪漫季']);
Exemple #30
0
 public function actionHd201509t6()
 {
     $this->layout = false;
     $gh_id = U::getSessionParam('gh_id');
     $openid = U::getSessionParam('openid');
     $wx_user = \app\models\MUser::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
     if (empty($wx_user) || $wx_user->subscribe === 0) {
         return $this->render('need_subscribe');
     }
     $bindMobiles = \app\models\OpenidBindMobile::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
     if (empty($bindMobiles)) {
         $url = \yii\helpers\Url::to();
         \Yii::$app->getSession()->set('RETURN_URL', $url);
         return $this->redirect(['wap/addbindmobile', 'gh_id' => $gh_id, 'openid' => $openid]);
     }
     $hd201509t5 = \app\models\MHd201509t5::findOne(['mobile' => $bindMobiles->mobile]);
     if (empty($hd201509t5)) {
         //不在能充值的用户表中,表明是新用户
         $tcnx_flag = 0;
         $yfzx = "";
         $fsc = "";
     } else {
         if ($hd201509t5->tcnx == 1) {
             //76元套餐以下
             $tcnx_flag = 1;
         } else {
             $tcnx_flag = 2;
         }
         $yfzx = $hd201509t5->yfzx;
         $fsc = $hd201509t5->fsc;
     }
     $hd201509t6 = \app\models\MHd201509t6::findOne(['mobile' => $bindMobiles->mobile]);
     if (empty($hd201509t6)) {
         $hd201509t6 = new \app\models\MHd201509t6();
         $hd201509t6->gh_id = $gh_id;
         $hd201509t6->openid = $openid;
         $hd201509t6->mobile = $bindMobiles->mobile;
         $hd201509t6->status = 0;
         $hd201509t6->yfzx = $yfzx;
         $hd201509t6->fsc = $fsc;
         $hd201509t6->tcnx = $tcnx_flag;
         $hd201509t6->hbme = 0;
         $hd201509t6->save(false);
     }
     return $this->render('hd201509t6', ['observer' => $wx_user, 'hd201509t6' => $hd201509t6]);
 }