Commit 62d73041165a13a64080241ad70f9622682d1509

Authored by xu
1 parent 3777f29b
Exists in master

app-wx

F 重新提交文件
app-wx/assets/AppAsset.php 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +<?php namespace app\wx\assets;
  2 +
  3 +use yii\web\View;
  4 +use yii\web\AssetBundle;
  5 +
  6 +/**
  7 + * Class AppAsset
  8 + * @package app\wx\assets
  9 + */
  10 +class AppAsset extends AssetBundle
  11 +{
  12 + public $sourcePath = '@webroot/dist';
  13 + public $css = [
  14 + 'css/mk7.css?v=0.0.9'
  15 + ];
  16 + public $js = [
  17 + 'js/mk7.js'
  18 + ];
  19 + public $jsOptions = [
  20 + 'position' => View::POS_HEAD
  21 + ];
  22 + public $depends = [
  23 + ];
  24 +
  25 +}
... ...
app-wx/config/.gitignore 0 → 100644
... ... @@ -0,0 +1,2 @@
  1 +main-local.php
  2 +params-local.php
0 3 \ No newline at end of file
... ...
app-wx/config/bootstrap.php 0 → 100644
... ... @@ -0,0 +1 @@
  1 +<?php
... ...
app-wx/config/main.php 0 → 100644
... ... @@ -0,0 +1,44 @@
  1 +<?php
  2 +$params = array_merge(
  3 + require(__DIR__ . '/../../common/config/params.php'),
  4 + require(__DIR__ . '/../../common/config/params-local.php'),
  5 + require(__DIR__ . '/params.php'),
  6 + require(__DIR__ . '/params-local.php')
  7 +);
  8 +
  9 +return [
  10 + 'id' => 'app-wx',
  11 + 'basePath' => dirname(__DIR__),
  12 + 'runtimePath' => Yii::getAlias('@rootRuntime').'/app-wx/',
  13 + 'bootstrap' => ['log'],
  14 + 'controllerNamespace' => 'app\wx\controllers',
  15 + 'defaultRoute' => 'order',
  16 + 'modules' => [
  17 +
  18 + 'home' => [
  19 + 'class' => 'app\wx\modules\home\Module',
  20 + ]
  21 + ],
  22 + 'components' => [
  23 + 'user' => [
  24 + 'class'=> 'app\wx\exts\User',
  25 + 'identityClass' => 'app\wx\models\User',
  26 + 'enableAutoLogin' => false,//是否启用自动登录
  27 + ],
  28 + 'errorHandler' => [
  29 + 'errorAction' => 'site/error',
  30 + ],
  31 + 'assetManager' => [
  32 + 'forceCopy' => true, //每次都发布文件
  33 + 'appendTimestamp' => true, //后面加上时间戳,防止缓存。
  34 + ],
  35 +
  36 + 'urlManager' => [
  37 + 'enablePrettyUrl' => true,
  38 + 'showScriptName' => false,
  39 + 'rules' => [
  40 + ],
  41 + ],
  42 + ],
  43 + 'params' => $params,
  44 +];
... ...
app-wx/config/params.php 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +<?php
  2 +return [
  3 + 'adminEmail' => 'admin@example.com',
  4 + 'VERSION' => 'v0.1.0 build 1', // 当前发布版本号: v0.1.0 是版本号 | build 1 是编译次数
  5 +];
... ...
app-wx/controllers/AppController.php 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +<?php
  2 +namespace app\wx\controllers;
  3 +
  4 +use Yii;
  5 +use yii\web\Controller;
  6 +
  7 +/**
  8 + * 该基类的主要作用是,提供一个便利的方法集成。
  9 + */
  10 +class AppController extends Controller
  11 +{
  12 + /** @var \yii\web\request **/
  13 + public $request;
  14 + /** @var \yii\web\response **/
  15 + public $response;
  16 +
  17 + /**
  18 + * @throws yii\web\HttpException
  19 + */
  20 + public function init()
  21 + {
  22 + parent::init();
  23 + $this->request = Yii::$app->getRequest();
  24 + $this->response = Yii::$app->getResponse();
  25 + }
  26 +
  27 + /**
  28 + * 渲染 JSON 数据结果
  29 + * @param $data
  30 + * @return string
  31 + */
  32 + public function renderJson($data)
  33 + {
  34 + return json_encode($data, JSON_UNESCAPED_UNICODE);
  35 + }
  36 +}
0 37 \ No newline at end of file
... ...
app-wx/controllers/BaseController.php 0 → 100644
... ... @@ -0,0 +1,281 @@
  1 +<?php
  2 +
  3 +namespace app\wx\controllers;
  4 +
  5 +use Yii;
  6 +use yii\helpers\Url;
  7 +use yii\web\BadRequestHttpException;
  8 +use yii\db\Query;
  9 +use app\wx\models\Engineer;
  10 +use common\helpers\WxHelper;
  11 +use common\helpers\ImageManager;
  12 +use common\exts\wechat\Log as WxLog;
  13 +use common\helpers\Log as AppLog;
  14 +use common\helpers\PerformanceUtils;
  15 +use common\models\SysSetting;
  16 +use domain\engineer\EngineerRole;
  17 +use domain\engineer\EngineerStatus;
  18 +use domain\engineer\EngineerSkillTagsRepository;
  19 +use stdClass;
  20 +use function header;
  21 +use function in_array;
  22 +use function md5;
  23 +use function str_replace;
  24 +use function urlencode;
  25 +
  26 +
  27 +/**
  28 + * 只有通过 微信 OAuth 验证后才能访问整个App,
  29 + * 这是所有应用控制器的基类
  30 + * Class BaseController
  31 + * @package app\wx\controllers
  32 + * @author lee.li <34923862@qq.com>
  33 + * @date 2015/07/01
  34 + */
  35 +class BaseController extends AppController
  36 +{
  37 + /**
  38 + * CSR验证,关闭后可以在不提交CSR验证码的情况下通过POST方式提交数据
  39 + * @var bool
  40 + */
  41 + public $enableCsrfValidation = false;
  42 + /** @var **/
  43 + protected $wx;
  44 + /** @var **/
  45 + protected $site;
  46 +
  47 + /**
  48 + * 初始化应用控制器,确保 mall id 的存在,有效启动程序,否则抛出异常。
  49 + * @throws yii\web\BadRequestHttpException
  50 + * @throws yii\web\BadRequestHttpException
  51 + */
  52 + public function init()
  53 + {
  54 +
  55 + $this->initTempFilePaths();
  56 +
  57 + parent::init();
  58 +
  59 + $wxArray = $this->getWxArray();
  60 +
  61 + //重置应用的名称
  62 + Yii::$app->name = $wxArray['name'];
  63 +
  64 + /**
  65 + * 微信服务号配置
  66 + */
  67 + $this->wx = new stdClass();
  68 + $this->site = new stdClass();
  69 +
  70 + $this->formatWx($wxArray);
  71 + $this->formatSite($wxArray);
  72 +
  73 + $view = Yii::$app->view;
  74 + $view->params['site']= $this->site;
  75 + }
  76 +
  77 + /**
  78 + * @return array|bool
  79 + */
  80 + private function getWxArray()
  81 + {
  82 + $wxArray = [
  83 + 'name' => '配件维修',
  84 + 'intro' => '报修',
  85 + 'logo_path' => '',
  86 + 'subscribe_title' => '报修',
  87 + 'subscribe_desc' => '报修',
  88 + 'subscribe_img' => '',
  89 + 'subscribe_url' => '',
  90 + 'appid' => 'appid',
  91 + 'appsecret' => 'appsecret',
  92 + 'token' => 'token'
  93 +
  94 + ];
  95 + return $wxArray;
  96 + }
  97 +
  98 + /**
  99 + * @param $wxArray
  100 + */
  101 + private function formatWx($wxArray)
  102 + {
  103 + /**
  104 + * 工程师微信服务号信息
  105 + */
  106 + $this->wx->name = $wxArray['name'];//名称
  107 + $this->wx->intro = $wxArray['intro'];//简介
  108 + $this->wx->logo_url = $wxArray['logo_path'];//路径
  109 + $this->wx->subscribe_title = $wxArray['subscribe_title']; // 公众号关注图文标题
  110 + $this->wx->subscribe_desc = $wxArray['subscribe_desc']; // 公众号关注图文描述
  111 + $this->wx->subscribe_img = $wxArray['subscribe_img']; // 公众号关注图文消息图片
  112 + $this->wx->subscribe_url = $wxArray['subscribe_url']; // 公众号关注图文url
  113 +
  114 + $this->wx->appid = $wxArray['appid'];// APPID
  115 + $this->wx->appsecret = $wxArray['appsecret'];//APPSECRET
  116 + $this->wx->token = $wxArray['token'];//微信TOKEN
  117 + }
  118 +
  119 + /**
  120 + * 获取 ID
  121 + * @return int|string
  122 + */
  123 + public function getEngineerId()
  124 + {
  125 + return 0;
  126 + }
  127 +
  128 + /**
  129 + * @param $wxArray
  130 + */
  131 + private function formatSite($wxArray)
  132 + {
  133 + /**
  134 + * 站点信息
  135 + */
  136 + $appUser = Yii::$app->getUser();
  137 + $url = Yii::$app->request->getHostInfo() . Yii::$app->request->url;
  138 + $this->site->url = $url;
  139 + if (YII_ENV_DEV) {
  140 + $this->site->base_url = Yii::$app->request->getHostInfo() . Yii::$app->request->baseUrl;
  141 + } else {
  142 + $this->site->base_url = Yii::$app->request->getHostInfo();
  143 + }
  144 +
  145 + $am = Yii::$app->view->getAssetManager();
  146 + $assets = $am->getBundle('app\wx\assets\AppAsset');
  147 +
  148 + $this->site->is_android = (int)$this->isAndroid();
  149 + $this->site->assets_url = $assets->baseUrl;
  150 + $this->site->is_login = !$appUser->isGuest;
  151 + $this->site->title = $wxArray['name'];
  152 + $search = array("\t", "\n", "\r");
  153 + $this->site->desc = str_replace($search, '<br/>', $wxArray['intro']);
  154 + $this->site->icon = $wxArray['logo_path'];
  155 +
  156 + // 携带当前用户的邀请码参数,实现推荐用户功能
  157 + $sn = '';
  158 +
  159 + $baseUrl = $this->site->base_url;
  160 + $this->site->user_bridge_url = $sn ? ($baseUrl . '/wechat/bridging?sn=' . $sn . '&tourl=' . urlencode($this->site->url)) : '';
  161 + $this->site->sn = $sn;
  162 +
  163 + $this->site->appid = 'appid';
  164 + $this->site->timestamp = time();
  165 + $this->site->noncestr = 'noncestr';
  166 + $this->site->signature = 'signature';
  167 + }
  168 +
  169 + /**
  170 + * @return yii\web\Response
  171 + */
  172 + protected function handleMallAccessCtrl()
  173 + {
  174 + //AppLog::DEBUG("BaseController: handleMallAccessCtrl()" );
  175 + $appUser = Yii::$app->getUser();
  176 + if(YII_ENV_DEV && $appUser->isGuest){
  177 + $uid = Yii::$app->params['testUID']; // 请在各自的config/params-local.php里配置
  178 + $appUser->login(0);
  179 + $this->goHome();
  180 + return ;
  181 + }
  182 + //test和 prod 环境,进行微信登陆
  183 + if ($appUser->isGuest){
  184 + $this->handleOAuthRedirect();
  185 + } else {
  186 + $path = $this->request->get('jumppath');
  187 + $model= $this->request->get('jumpmodel');
  188 + $paramOne= $this->request->get('paramOne');
  189 + if (!empty($path) && !empty($model)) {
  190 + $locationUrl = Yii::$app->params["baseUrl"]."/".$model."#".$path;
  191 + if (!empty($paramOne)) {
  192 + $locationUrl .= "/".urldecode($paramOne);
  193 + }
  194 + header("Location: $locationUrl");exit;
  195 + }
  196 + }
  197 +
  198 + }
  199 +
  200 + /**
  201 + * @return yii\web\Response
  202 + */
  203 + private function handleOAuthRedirect()
  204 + {
  205 + $sn = Yii::$app->request->get("sn");
  206 +
  207 + //Yii::$app->response->redirect($OAuthUrl)->send();
  208 + //Yii::$app->end();
  209 + }
  210 +
  211 +
  212 + /**
  213 + * 是否是IOS端
  214 + * 是否通过微信客户端来访问
  215 + * LOG 记录时发现,
  216 + * 在微信公众号里面第一次访问: $_SERVER ['HTTP_USER_AGENT'] 为 Mozilla/4.0
  217 + * 第二次访问: $_SERVER ['HTTP_USER_AGENT'] 为
  218 + * 苹果:
  219 + * Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13E238 MicroMessenger/6.3.16 NetType/WIFI Language/zh_CN
  220 + * 安卓(小米NOTE):
  221 + * Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9b4) Gecko/2008030317 Firefox/3.0b4
  222 + * @return bool
  223 + */
  224 + protected function isAndroid()
  225 + {
  226 +// if(false !== strpos($_SERVER ['HTTP_USER_AGENT'], 'Android') || !isset($_SERVER ['HTTP_USER_AGENT'])){
  227 +// return true;
  228 +// } else {
  229 +// return false;
  230 +// }
  231 + return true;
  232 + }
  233 +
  234 + //
  235 + public function setPhoneCode($phone, $code)
  236 + {
  237 + Yii::$app->session['v_'.$phone] = array('create_time' => time(),'vCode' => md5($phone.'_'.$code));
  238 + }
  239 +
  240 + public function getPhoneCode($phone)
  241 + {
  242 + return Yii::$app->session['v_'.$phone];
  243 + }
  244 +
  245 + // 默认是300秒
  246 + public function validatePhoneCode($phone, $code, $vaTime = 300)
  247 + {
  248 + $pCode = $this->getPhoneCode($phone);
  249 + $cTime = time();
  250 + if (empty($pCode)) {
  251 + return -3;
  252 + }
  253 + if ($cTime > ($pCode['create_time'] + $vaTime)) {
  254 + $this->unsetPhoneCode($phone);
  255 + return -1;
  256 + }
  257 + if($pCode['vCode'] == md5($phone.'_'.$code)){
  258 + return 0;
  259 + }else{
  260 + return -2;
  261 + }
  262 + }
  263 +
  264 + public function unsetPhoneCode($phone)
  265 + {
  266 + unset(Yii::$app->session['v_'.$phone]);
  267 + }
  268 +
  269 + /**
  270 + * 初始化web目录文件夹, 完成自动创建
  271 + */
  272 + private function initTempFilePaths()
  273 + {
  274 + // 临时文件
  275 + $webRoot = Yii::getAlias('@webroot');
  276 + $tmpFilePath = $webRoot . '/tmp';
  277 + if (!is_dir($tmpFilePath)) {
  278 + mkdir($tmpFilePath, 0777, true);
  279 + }
  280 + }
  281 +}
0 282 \ No newline at end of file
... ...
app-wx/controllers/ErrorController.php 0 → 100644
... ... @@ -0,0 +1,60 @@
  1 +<?php namespace app\wx\controllers;
  2 +
  3 +use common\models\SysSetting;
  4 +use yii;
  5 +
  6 +/**
  7 + * 错误控制
  8 + * Class ErrorController
  9 + * @package app\wx\controllers
  10 + */
  11 +class ErrorController extends yii\web\Controller
  12 +{
  13 + protected $site;
  14 + public function init()
  15 + {
  16 + \yii::$app->name = '系统通知';
  17 + $this->site = new \stdClass();
  18 + $this->getSite();
  19 + $view = \yii::$app->view;
  20 + $view->params['site'] = $this->site;
  21 + }
  22 +
  23 + public function getSite()
  24 + {
  25 +
  26 + $url = \yii::$app->request->getHostInfo() . \yii::$app->request->url;
  27 + $this->site->url = $url;
  28 + if(YII_ENV_DEV){
  29 + $this->site->base_url = \yii::$app->request->getHostInfo() . \yii::$app->request->baseUrl;
  30 + } else {
  31 + $this->site->base_url = \yii::$app->request->getHostInfo();
  32 + }
  33 + $this->site->assets_url = $url;
  34 + $this->site->title = '通知';
  35 + $this->site->desc = '';
  36 + $this->site->icon = '';
  37 + $this->site->appid = '';
  38 + $this->site->timestamp = '';
  39 + $this->site->noncestr = '';
  40 + $this->site->signature = '';
  41 + $this->site->user_bridge_url = '';
  42 + $this->site->sn = '';
  43 +
  44 + return $this->site;
  45 + }
  46 +
  47 + /** 系统暂停
  48 + * @return string
  49 + */
  50 + public function actionStop()
  51 + {
  52 + $this->layout = 'site';
  53 + \yii::$app->name = '系统通知';
  54 + $viewTpl = '@app/wx/views/site/error/stop.php';
  55 + $siteInfo = SysSetting::getClientSiteInfo();
  56 +
  57 + return $this->render($viewTpl,['stop_status'=> $siteInfo['stop'], 'stop_head'=> $siteInfo['stop_head'], 'stop_content'=> $siteInfo['stop_content']]);
  58 + }
  59 +
  60 +}
... ...
app-wx/controllers/SiteController.php 0 → 100644
... ... @@ -0,0 +1,199 @@
  1 +<?php
  2 +namespace app\wx\controllers;
  3 +
  4 +use Yii;
  5 +use app\wx\models\Engineer;
  6 +use common\models\EngineerProfile;
  7 +use common\helpers\WxHelper;
  8 +use common\models\SysSetting;
  9 +
  10 +use stdClass;
  11 +
  12 +/**
  13 + * Site-控制器
  14 + * Class SiteController
  15 + * @package app\wx\controllers
  16 + */
  17 +class SiteController extends BaseController
  18 +{
  19 + public $layout = 'site';
  20 +
  21 + /**
  22 + * @param yii\base\Action $action
  23 + * @return bool
  24 + * @throws yii\web\BadRequestHttpException
  25 + */
  26 + public function beforeAction($action)
  27 + {
  28 + $view = Yii::$app->view;
  29 + $view->params['site']= $this->site;
  30 +
  31 + //$this->handleMallAccessCtrl();
  32 + return parent::beforeAction($action);
  33 + }
  34 +
  35 + /**
  36 + * @return string
  37 + * @return string HTML
  38 + */
  39 + public function actionIndex()
  40 + {
  41 + //获取当前用户的模型model
  42 + $engineerId = $this->getEngineerId();
  43 + $engineer = new stdClass();
  44 + /**
  45 + * 构造user的共用信息
  46 + */
  47 + $engineer = $this->buildEngineerResult($engineerId);
  48 +
  49 + return $this->render('index',
  50 + [
  51 + 'engineer' => $engineer,
  52 + ]
  53 + );
  54 + }
  55 +
  56 + private function buildEngineerResult($engineerId)
  57 + {
  58 + $query = Engineer::find()
  59 + ->select(['engineer.id', 'engineer_profile.headimgurl','engineer_profile.nickname'])
  60 + ->leftJoin('engineer_profile', "engineer.id = engineer_profile.engineer_id")
  61 + ->where(['engineer.id' => $engineerId]);
  62 + $query->asArray();
  63 + $engineerArray = $query->one();
  64 +
  65 + if(empty($engineerArray)){
  66 + return false;
  67 + }
  68 +
  69 + $engineer = new stdClass();
  70 + $engineer->id = (int)$engineerArray['id'];
  71 + $engineer->headimgurl = $engineerArray['headimgurl'];
  72 + $engineer->nickname = $engineerArray['nickname'];
  73 + return $engineer;
  74 + }
  75 +
  76 +
  77 + /**
  78 + *
  79 + */
  80 + public function actionAjaxJweixin()
  81 + {
  82 + // 设置微信分享内容
  83 + $result = new stdClass();
  84 +
  85 + $engineerId = $this->getEngineerId();
  86 +
  87 + $baseUrl = $this->site->base_url;
  88 + if (isset($_GET['from'])) {
  89 + $url = $_GET['from'];
  90 + } else {
  91 + $url = $baseUrl;
  92 + }
  93 +
  94 + $sign = WxHelper::getWxJSSDK()->getSignContext($url);
  95 +
  96 + $result->appid = $sign->appId;
  97 + $result->timestamp = $sign->timestamp;
  98 + $result->noncestr = $sign->nonceStr;
  99 + $result->signature = $sign->signature;
  100 +
  101 +
  102 + //$sn = $engineer ? urlencode(base64_encode($engineer->id)) : '';
  103 + // 携带当前用户的邀请码参数,实现推荐用户功能
  104 + $sn = '';
  105 + $engineer = Engineer::findOne($engineerId);
  106 + if ($engineer) {
  107 + if (empty($engineer->invite_code)) {
  108 + $engineer->invite_code = Engineer::createInviteCode($engineerId);
  109 + $engineer->save();
  110 + }
  111 + $sn = $engineer->invite_code;
  112 + }
  113 + $result->user_bridge_url = $baseUrl . '/wechat/bridging?sn=' . $sn . '&tourl=' . urlencode($url);
  114 + $result->sn = $sn;
  115 +
  116 + if ($engineer) {
  117 + $profile = EngineerProfile::findOne(['engineer_id' => $engineer->id]);
  118 + $result->title = $this->wx->name;
  119 + $result->icon = $profile->headimgurl;
  120 + } else {
  121 + $result->title = $this->wx->name;
  122 + $result->icon = '';
  123 + }
  124 + $result->desc = $this->wx->intro;
  125 +
  126 +
  127 + return $this->renderJson($result);
  128 + }
  129 +
  130 + /*
  131 + * 错误页面
  132 + */
  133 + public function actionError()
  134 + {
  135 + $this->layout = '/error';
  136 +
  137 + $exception = Yii::$app->errorHandler->exception;
  138 + if ($exception && isset($exception->statusCode)) {
  139 + $code = $exception->statusCode;
  140 + }
  141 + // $viewTpl = 'error/' . $code . '.php';
  142 + $viewTpl = 'error/404.php';
  143 +
  144 + return $this->render($viewTpl);
  145 + }
  146 +
  147 + /** 封号提示
  148 + * @return string
  149 + */
  150 + public function actionBlock()
  151 + {
  152 + $this->layout = '/error';
  153 + $viewTpl = 'error/block.php';
  154 + $service_phone = SysSetting::getServicePhone();
  155 + return $this->render($viewTpl,['service_phone'=>$service_phone]);
  156 + }
  157 +
  158 + /** 关注提示
  159 + * @return string
  160 + */
  161 + public function actionSubscribe()
  162 + {
  163 + $this->layout = '/error';
  164 + $viewTpl = 'error/subscribe.php';
  165 + $service_phone = SysSetting::getServicePhone();
  166 + return $this->render($viewTpl,['service_phone'=>$service_phone]);
  167 + }
  168 +
  169 + /**
  170 + * 未授权提示
  171 + */
  172 + public function actionNoOauth()
  173 + {
  174 + $this->layout = '/error';
  175 + $viewTpl = 'error/block.php';
  176 + $id = $this->request->get('id');
  177 + $service_phone = SysSetting::getServicePhone();
  178 + $errorMsg = '当前没有权限查看该内容';
  179 + if ($id == 1) {
  180 + $errorMsg = '请进行认证以后再来查看该页面';
  181 + }
  182 + return $this->render($viewTpl,['service_phone'=>$service_phone, 'errorMsg' => $errorMsg]);
  183 + }
  184 +
  185 + public function actionIndex2()
  186 + {
  187 +
  188 + return $this->renderPartial('index2');
  189 + }
  190 +
  191 + /**
  192 + * 跳转到接单教程界面
  193 + */
  194 + public function actionToTutorialPage()
  195 + {
  196 + header("Location: http://mp.weixin.qq.com/mp/homepage?__biz=MzIyNDc5ODMwOA==&hid=1&sn=4f8b8972dc5f471a85618dde0f6a5987&scene=18");
  197 + exit;
  198 + }
  199 +}
... ...
app-wx/exts/User.php 0 → 100644
... ... @@ -0,0 +1,112 @@
  1 +<?php
  2 +namespace app\wx\exts;
  3 +
  4 +use Yii;
  5 +use yii\web\Cookie;
  6 +use yii\web\User as AppUser;
  7 +
  8 +/**
  9 + * Class User
  10 + * @package app\wx\exts
  11 + */
  12 +class User extends AppUser
  13 +{
  14 +
  15 + /** @var 工程师用户ID **/
  16 + private $_id = null;
  17 +
  18 +
  19 +
  20 + /**
  21 + * @var string the class name of the [[identity]] object.
  22 + */
  23 + public $identityClassForMall;
  24 +
  25 + /**
  26 + * @inheritdoc
  27 + */
  28 + public function switchIdentity($identity, $duration = 0)
  29 + {
  30 + $this->setIdentity($identity);
  31 +
  32 + if (!$this->enableSession) {
  33 + return;
  34 + }
  35 +
  36 + /* Ensure any existing identity cookies are removed. */
  37 + if ($this->enableAutoLogin) {
  38 + Yii::$app->getResponse()->getCookies()->remove(new Cookie($this->identityCookie));
  39 + }
  40 +
  41 + $session = Yii::$app->getSession();
  42 + if (!YII_ENV_TEST) {
  43 + $session->regenerateID(true);
  44 + }
  45 +
  46 + $session->remove($this->idParam);
  47 + $session->remove($this->authTimeoutParam);
  48 +
  49 + if ($identity) {
  50 + $session->set($this->idParam, $identity->getId());
  51 +
  52 + if ($this->authTimeout !== null) {
  53 + $session->set($this->authTimeoutParam, time() + $this->authTimeout);
  54 + }
  55 + if ($this->absoluteAuthTimeout !== null) {
  56 + $session->set($this->absoluteAuthTimeoutParam, time() + $this->absoluteAuthTimeout);
  57 + }
  58 + if ($duration > 0 && $this->enableAutoLogin) {
  59 + $this->sendIdentityCookie($identity, $duration);
  60 + }
  61 + }
  62 + }
  63 +
  64 + /**
  65 + * @inheritdoc
  66 + */
  67 + protected function renewAuthStatus()
  68 + {
  69 + $session = Yii::$app->getSession();
  70 + $id = $session->getHasSessionId() || $session->getIsActive() ? $session->get($this->idParam) : null;
  71 +
  72 + if ($id === null) {
  73 + $identity = null;
  74 + } else {
  75 + $class = 'app\wx\models\Engineer';
  76 + $identity = $class::findIdentity($id);
  77 + }
  78 +
  79 + $this->setIdentity($identity);
  80 +
  81 + if ($identity !== null && ($this->authTimeout !== null || $this->absoluteAuthTimeout !== null)) {
  82 + $expire = $this->authTimeout !== null ? $session->get($this->authTimeoutParam) : null;
  83 + $expireAbsolute = $this->absoluteAuthTimeout !== null ? $session->get($this->absoluteAuthTimeoutParam) : null;
  84 + if ($expire !== null && $expire < time() || $expireAbsolute !== null && $expireAbsolute < time()) {
  85 + $this->logout(false);
  86 + } elseif ($this->authTimeout !== null) {
  87 + $session->set($this->authTimeoutParam, time() + $this->authTimeout);
  88 + }
  89 + }
  90 +
  91 + if ($this->enableAutoLogin) {
  92 + if ($this->getIsGuest()) {
  93 + $this->loginByCookie();
  94 + } elseif ($this->autoRenewCookie) {
  95 + $this->renewIdentityCookie();
  96 + }
  97 + }
  98 + }
  99 +
  100 +
  101 + /**
  102 + * @return int
  103 + */
  104 + public function getId()
  105 + {
  106 + if(null === $this->_id){
  107 + $session = Yii::$app->getSession();
  108 + $this->_id = $session->getHasSessionId() || $session->getIsActive() ? $session->get($this->idParam) : null;
  109 + }
  110 + return (int)$this->_id;
  111 + }
  112 +}
... ...
app-wx/helpers/Sort.php 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +<?php
  2 +namespace app\wx\helpers;
  3 +
  4 +use yii;
  5 +use yii\data\Sort as dataSort;
  6 +
  7 +/**
  8 + * Class Sort
  9 + * @package app\wx\helpers
  10 + */
  11 +class Sort extends dataSort
  12 +{
  13 + /**
  14 + * @param $model
  15 + * @param array $extraAttrbutes
  16 + */
  17 + public function setAttributes($model, $extraAttrbutes = [])
  18 + {
  19 + foreach ($model->attributes() as $attribute) {
  20 + $this->attributes[$attribute] = [
  21 + 'asc' => [$attribute => SORT_ASC],
  22 + 'desc' => [$attribute => SORT_DESC],
  23 + 'label' => $model->getAttributeLabel($attribute),
  24 + ];
  25 + }
  26 +
  27 + if ($extraAttrbutes) {
  28 + foreach ($extraAttrbutes as $k => $label) {
  29 + $this->attributes[$k] = [
  30 + 'asc' => [$k => SORT_ASC],
  31 + 'desc' => [$k => SORT_DESC],
  32 + 'label' => $label,
  33 + ];
  34 + }
  35 + }
  36 + }
  37 +}
0 38 \ No newline at end of file
... ...
app-wx/index.html 0 → 100644
... ... @@ -0,0 +1 @@
  1 +index
... ...
app-wx/models/User.php 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +<?php
  2 +
  3 +namespace app\wx\models;
  4 +
  5 +use Yii;
  6 +use yii\log\Logger;
  7 +use yii\base\Exception;
  8 +use common\models\EngineerProfile as EngineerProfileModel;
  9 +use common\models\Address as AddressModel;
  10 +use domain\finance\models\EngineerWallet as EngineerWalletModel;
  11 +
  12 +/**
  13 + * Class User
  14 + * @package app\wx\models
  15 + */
  16 +class User
  17 +{
  18 +
  19 + public function register()
  20 + {
  21 +
  22 + }
  23 +
  24 + /** @inheritdoc */
  25 + public function beforeSave($insert)
  26 + {
  27 +
  28 + }
  29 +
  30 + /** @inheritdoc */
  31 + public function afterSave($insert, $changedAttributes)
  32 + {
  33 +
  34 + }
  35 +
  36 +
  37 +}
... ...
app-wx/models/UserIdentity.php 0 → 100644
... ... @@ -0,0 +1,78 @@
  1 +<?php namespace app\wx\models;
  2 +
  3 +use yii;
  4 +use yii\web\IdentityInterface;
  5 +
  6 +/**
  7 + * Class UserIdentity
  8 + * @package app\wx\models
  9 + */
  10 +class UserIdentity implements IdentityInterface
  11 +{
  12 + /**
  13 + * @var null
  14 + */
  15 + static $id = null;
  16 +
  17 + /**
  18 + * @param int|string $id
  19 + * @return IdentityInterface
  20 + */
  21 + public static function findIdentity($id)
  22 + {
  23 + self::getIdFromSession();
  24 + return new UserIdentity();
  25 + }
  26 +
  27 + /**
  28 + * @param mixed $token
  29 + * @param null $type
  30 + * @return IdentityInterface
  31 + */
  32 + public static function findIdentityByAccessToken($token, $type = null)
  33 + {
  34 + return self::getIdFromSession();
  35 + return new UserIdentity();
  36 + }
  37 +
  38 + /**
  39 + * @return int|string $id
  40 + */
  41 + public function getId()
  42 + {
  43 + return self::getIdFromSession();
  44 + }
  45 +
  46 + /**
  47 + *不启动自动登录,AuthKey 是用来设定到cookie的字符串
  48 + *
  49 + */
  50 + public function getAuthKey()
  51 + {
  52 + return "";
  53 + }
  54 +
  55 + /**
  56 + * 不启动自动登录,这里默认返回true
  57 + * @param string $authKey
  58 + */
  59 + public function validateAuthKey($authKey)
  60 + {
  61 + return true;
  62 + }
  63 +
  64 + /**
  65 + * @return mixed|null
  66 + */
  67 + protected static function getIdFromSession()
  68 + {
  69 + if (null === self::$id){
  70 + $user = \Yii::$app->getUser();
  71 + $session = Yii::$app->getSession();
  72 + $id = $session->getHasSessionId() || $session->getIsActive() ? $session->get($user->idParam) : null;
  73 + self::$id = $id;
  74 + }
  75 +
  76 + return self::$id;
  77 + }
  78 +}
0 79 \ No newline at end of file
... ...
app-wx/modules/BaseModule.php 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +<?php namespace app\wx\modules;
  2 +
  3 +/**
  4 + * Class BaseModule
  5 + * @package app\wx\modules
  6 + */
  7 +class BaseModule extends \yii\base\Module
  8 +{
  9 + public function init()
  10 + {
  11 + parent::init();
  12 + }
  13 +}
0 14 \ No newline at end of file
... ...
app-wx/modules/home/Module.php 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +<?php
  2 +
  3 +namespace app\wx\modules\home;
  4 +
  5 +use yii\base\Module as BaseModule;
  6 +
  7 +/**
  8 + * Class Module
  9 + * @package app\wx\modules
  10 + */
  11 +class Module extends BaseModule
  12 +{
  13 + public function init()
  14 + {
  15 + parent::init();
  16 + }
  17 +}
0 18 \ No newline at end of file
... ...
app-wx/modules/home/controllers/BaseController.php 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +<?php
  2 +
  3 +namespace app\wx\modules\home\controllers;
  4 +
  5 +use Yii;
  6 +use app\wx\controllers\BaseController as AppBaseController;
  7 +
  8 +/**
  9 + * Class BaseController
  10 + * @package app\wx\modules\toutiao\controllers
  11 + */
  12 +class BaseController extends AppBaseController
  13 +{
  14 + public $layout = 'main';
  15 +
  16 + /**
  17 + * @throws yii\web\BadRequestHttpException
  18 + */
  19 + public function init()
  20 + {
  21 + parent::init(); // TODO: Change the autogenerated stub
  22 +
  23 + }
  24 +}
0 25 \ No newline at end of file
... ...
app-wx/modules/home/controllers/DefaultController.php 0 → 100644
... ... @@ -0,0 +1,29 @@
  1 +<?php
  2 +
  3 +namespace app\wx\modules\home\controllers;
  4 +
  5 +use common\helpers\ImageManager;
  6 +use common\models\EngineerProfile;
  7 +use domain\toutiao\TtDefaultImageRepository;
  8 +use domain\toutiao\TtNewsImageRepository;
  9 +use domain\toutiao\TtNewsRepository;
  10 +use domain\toutiao\TtType;
  11 +use Yii;
  12 +use stdClass;
  13 +
  14 +/**
  15 + * 控制器
  16 + */
  17 +class DefaultController extends BaseController
  18 +{
  19 +
  20 + /**
  21 + * 首页
  22 + */
  23 + public function actionIndex()
  24 + {
  25 + return $this->render('index');
  26 + }
  27 +
  28 +
  29 +}
0 30 \ No newline at end of file
... ...
app-wx/modules/home/views/default/index.php 0 → 100644
... ... @@ -0,0 +1,38 @@
  1 +<?php
  2 +
  3 +use yii\helpers\Url;
  4 +
  5 +$baseUrl = Url::base(true);
  6 +$assets = $this->getAssetManager();
  7 +$asset = $assets->getBundle('app\wx\assets\AppAsset');
  8 +
  9 +function img($file, $path = '/i/')
  10 +{
  11 + return \Yii::$app->request->baseUrl . $path.$file;
  12 +}
  13 +?>
  14 +<style>
  15 +
  16 +</style>
  17 +<div class="views">
  18 + <div class="view view-main">
  19 + <?=$this->render("@app/views/widgets/ui-loading")?>
  20 + </div>
  21 +</div>
  22 +
  23 +<?=$this->render('pages/index-template', ['asset' => $asset])?>
  24 +<?=$this->render('pages/register-template', ['asset' => $asset])?>
  25 +
  26 +<script>
  27 + require.config({baseUrl: $site.assets_url + '/js/',urlArgs : "v=" + require.version});
  28 + require([
  29 + 'home-app'
  30 + ],
  31 + function(app){
  32 + app.bootstrap({
  33 + baseUrl: $site.base_url
  34 + });
  35 + });
  36 +</script>
  37 +
  38 +<?=$this->render("@app/views/widgets/stat-code")?>
... ...
app-wx/modules/home/views/default/pages/index-template.php 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +<?php
  2 +
  3 +use yii\helpers\Url;
  4 +
  5 +$baseUrl = Url::base(true);
  6 +?>
  7 +<style>
  8 +#index{}
  9 +
  10 +</style>
  11 +<script id="index-template" type="text/template">
  12 + <div class="pages">
  13 + <div class="page" id="index" style="background: #f2f3f6">
  14 + <div class="page-content">
  15 +
  16 + </div>
  17 +
  18 + </div>
  19 + </div>
  20 +</script>
... ...
app-wx/modules/home/views/default/pages/register-template.php 0 → 100644
... ... @@ -0,0 +1,45 @@
  1 +<?php
  2 +
  3 +use yii\helpers\Url;
  4 +
  5 +$baseUrl = Url::base(true);
  6 +?>
  7 +<style>
  8 + body,div,p,span,input{padding: 0;margin: 0}
  9 + input{-webkit-appearance: none;}
  10 + #register{}
  11 + #register .input-list{padding:1rem;box-sizing: border-box}
  12 + #register .input-row-cls{width:100%;margin-top:0.7rem;}
  13 + #register .input-list .input-div{line-height: 1.25rem;font-size: 1rem;}
  14 + #register .input-list .input-cls{width:100%;line-height: inherit;font-size: inherit;border:1px solid #ccc;padding:0.3rem;box-sizing: border-box}
  15 + #register .input-list .validation-code{display:flex;align-items: center}
  16 + #register .input-list .get-code-cls{width: 7rem;font-size: 0.8rem;display: flex;align-items: center;justify-content:center;background:#f25601;color:#fff;padding:0.302rem 0.3rem;box-sizing: border-box;border: 1px solid #f25601;
  17 + border-left:0;}
  18 +
  19 +</style>
  20 +<script id="register-template" type="text/template">
  21 + <div class="pages">
  22 + <div class="page" id="register" style="background: #fff">
  23 + <div class="page-content">
  24 + <div class="input-list">
  25 + <div class="input-row-cls"><label class="input-label-cls">车厂名称</label><div class="input-div"><input class="input-cls" type="text" placeholder="输入车厂名称" /></div></div>
  26 +
  27 + <div class="input-row-cls"><label class="input-label-cls">手机号码</label><div class="input-div"><input class="input-cls" type="number" placeholder="输入手机号码" /></div></div>
  28 +
  29 + <div class="input-row-cls">
  30 + <label class="input-label-cls">验证码</label>
  31 + <div class="input-div validation-code">
  32 + <input class="input-cls" type="text" placeholder="" style="border-right: 0;"/>
  33 + <div class="get-code-cls">获取验证码</div>
  34 + </div>
  35 + </div>
  36 + </div>
  37 + <div style="padding:1rem;box-sizing: border-box">
  38 + <div>上传营业执照</div>
  39 + <div></div>
  40 + </div>
  41 + <div style="padding:1rem;box-sizing:border-box"><div style="width:70%; padding:1rem;text-align:center;box-sizing: border-box;color:#fff;background:#f25601;margin: 0 auto;">注册</div></div>
  42 + </div>
  43 + </div>
  44 + </div>
  45 +</script>
... ...
app-wx/modules/home/views/layouts/main.php 0 → 100644
... ... @@ -0,0 +1,43 @@
  1 +<?php
  2 +
  3 +use app\wx\assets\AppAsset;
  4 +use yii\helpers\Html;
  5 +
  6 +AppAsset::register($this);
  7 +
  8 +$site = $this->params['site'];
  9 +
  10 +$this->title = \yii::$app->name;
  11 +$assets = $this->getAssetManager();
  12 +$asset = $assets->getBundle('app\wx\assets\AppAsset');
  13 +?>
  14 +<?php $this->beginPage() ?>
  15 +<!DOCTYPE HTML>
  16 +
  17 +<html lang="<?= \yii::$app->language ?>">
  18 +<head>
  19 +<meta charset="<?= \yii::$app->charset ?>">
  20 +<meta name="apple-mobile-web-app-capable" content="yes">
  21 +<meta name="apple-mobile-web-app-status-bar-style" content="black">
  22 +<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
  23 +<meta http-equiv="Pragma" content="no-cache">
  24 +<meta http-equiv="Expires" content="0">
  25 +<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
  26 +<?= Html::csrfMetaTags() ?>
  27 +<title><?= Html::encode($this->title) ?></title>
  28 +<script>
  29 + <?=$this->render("@app/views/widgets/js-site", ['site' => $site])?>
  30 +</script>
  31 +<?php $this->head() ?>
  32 +<style>
  33 +
  34 +</style>
  35 +</head>
  36 +<body>
  37 +<?php $this->beginBody() ?>
  38 +<?=$content?>
  39 +<?php $this->endBody() ?>
  40 +</body>
  41 +</html>
  42 +<?php $this->endPage() ?>
  43 +
... ...
app-wx/views/layouts/error.php 0 → 100644
... ... @@ -0,0 +1,29 @@
  1 +<?php
  2 +use yii\helpers\Html;
  3 +use app\wx\assets\AppAsset;
  4 +AppAsset::register($this);
  5 +
  6 +
  7 +?>
  8 +<?php $this->beginPage() ?>
  9 +<!DOCTYPE html>
  10 +<html lang="<?=yii::$app->language ?>">
  11 +<head>
  12 + <meta charset="<?=yii::$app->charset ?>">
  13 + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
  14 + <?= Html::csrfMetaTags() ?>
  15 + <title><?= Html::encode($this->title) ?></title>
  16 + <?php $this->head() ?>
  17 + <style>
  18 +
  19 + </style>
  20 +</head>
  21 +<body>
  22 +<?php $this->beginBody() ?>
  23 +
  24 +<?=$content?>
  25 +
  26 +<?php $this->endBody() ?>
  27 +</body>
  28 +</html>
  29 +<?php $this->endPage() ?>
... ...
app-wx/views/layouts/main.php 0 → 100644
... ... @@ -0,0 +1,34 @@
  1 +<?php
  2 +use yii\helpers\Html;
  3 +use app\wx\assets\AppAsset;
  4 +AppAsset::register($this);
  5 +
  6 +$this->title = \yii::$app->name;
  7 +$baseUrl = yii::getAlias('@web');
  8 +$assets = $this->getAssetManager();
  9 +$asset = $assets->getBundle('app\wx\assets\AppAsset');
  10 +$site = $this->params['site'];
  11 +?>
  12 +<?php $this->beginPage() ?>
  13 +<!DOCTYPE html>
  14 +
  15 +<html lang="<?=yii::$app->language ?>">
  16 +<head>
  17 +<meta charset="<?=yii::$app->charset ?>">
  18 +<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
  19 +<?= Html::csrfMetaTags() ?>
  20 +<title><?= Html::encode($this->title) ?></title>
  21 +<script>
  22 + <?=$this->render("/widgets/js-site", ['site' => $site])?>
  23 +</script>
  24 +<?php $this->head() ?>
  25 +</head>
  26 +<body>
  27 +<?php $this->beginBody() ?>
  28 +
  29 +<?=$content?>
  30 +
  31 +<?php $this->endBody() ?>
  32 +</body>
  33 +</html>
  34 +<?php $this->endPage() ?>
... ...
app-wx/views/layouts/site.php 0 → 100644
... ... @@ -0,0 +1,33 @@
  1 +<?php
  2 +use yii\helpers\Html;
  3 +use app\wx\assets\AppAsset;
  4 +AppAsset::register($this);
  5 +
  6 +$this->title = \yii::$app->name;
  7 +$baseUrl = yii::getAlias('@web');
  8 +$assets = $this->getAssetManager();
  9 +$asset = $assets->getBundle('app\wx\assets\AppAsset');
  10 +$site = $this->params['site'];
  11 +?>
  12 +<?php $this->beginPage() ?>
  13 +<!DOCTYPE html>
  14 +<html lang="<?=yii::$app->language ?>">
  15 +<head>
  16 +<meta charset="<?=yii::$app->charset ?>">
  17 + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
  18 + <?= Html::csrfMetaTags() ?>
  19 + <title><?= Html::encode($this->title) ?></title>
  20 + <script>
  21 + <?=$this->render("/widgets/js-site", ['site' => $site])?>
  22 + </script>
  23 + <?php $this->head() ?>
  24 +</head>
  25 +<body>
  26 +<?php $this->beginBody() ?>
  27 +
  28 +<?=$content?>
  29 +
  30 +<?php $this->endBody() ?>
  31 +</body>
  32 +</html>
  33 +<?php $this->endPage() ?>
... ...
app-wx/views/layouts/test.php 0 → 100644
... ... @@ -0,0 +1,33 @@
  1 +<?php
  2 +use yii\helpers\Html;
  3 +use app\wx\assets\AppAsset;
  4 +AppAsset::register($this);
  5 +
  6 +$this->title = \yii::$app->name;
  7 +$baseUrl = yii::getAlias('@web');
  8 +$assets = $this->getAssetManager();
  9 +$asset = $assets->getBundle('app\wx\assets\AppAsset');
  10 +$site = $this->params['site'];
  11 +?>
  12 +<?php $this->beginPage() ?>
  13 +<!DOCTYPE html>
  14 +<html lang="<?=yii::$app->language ?>">
  15 +<head>
  16 +<meta charset="<?=yii::$app->charset ?>">
  17 + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
  18 + <?= Html::csrfMetaTags() ?>
  19 + <title><?= Html::encode($this->title) ?></title>
  20 + <script>
  21 + <?=$this->render("/widgets/js-site", ['site' => $site])?>
  22 + </script>
  23 + <?php $this->head() ?>
  24 +</head>
  25 +<body>
  26 +<?php $this->beginBody() ?>
  27 +
  28 +<?=$content?>
  29 +
  30 +<?php $this->endBody() ?>
  31 +</body>
  32 +</html>
  33 +<?php $this->endPage() ?>
... ...
app-wx/views/site/error/400.php 0 → 100644
... ... @@ -0,0 +1,51 @@
  1 +<?php
  2 +use yii\helpers\Url;
  3 +$assets = $this->getAssetManager();
  4 +$asset = $assets->getBundle('app\wx\assets\AppAsset');
  5 +?>
  6 +<style>
  7 + .error-wrap {
  8 + margin:0 auto;
  9 + width:95%;
  10 + margin-top: 50px;
  11 + padding: 0 5px;
  12 + font-size: 18px;
  13 + font-weight: bold;
  14 + }
  15 +</style>
  16 +
  17 +<div class="error-wrap">
  18 + <div style="text-align: center"><img src="<?= $asset->baseUrl . '/i/error.jpg' ?>" /></div>
  19 + <div style="margin-bottom: 10px">一瞬间,访客风起云涌,页面进不去了...</div>
  20 + <div style="">我们将在<span id="num" class="text-danger">10</span>秒后为您跳转回首页</div>
  21 + <div style="line-height: 28px;margin-top: 30px;">
  22 + <p>在使用系统的过程中,遇到问题或者有好的建议,请一定告诉我们。我们深宅多年练就的功能,就是为了化问题为神奇。</p>
  23 +
  24 + <p style="margin-bottom: 30px"> 邮箱:tech@jiwork.com (求约)</p>
  25 + </div>
  26 +</div>
  27 +
  28 +<script>
  29 +
  30 + function countDown(period, intv, callback) {
  31 + var num = document.getElementById("num");
  32 + var timeRemain = period - 1;
  33 + var setText = function (text) {
  34 + num.innerHTML = text;
  35 + }
  36 + var t = setInterval(function () {
  37 + setText(timeRemain);
  38 + timeRemain -= 1;
  39 + if (timeRemain < 0) {
  40 + clearInterval(t);
  41 + if (callback) {
  42 + callback();
  43 + }
  44 + }
  45 + }, intv);
  46 + }
  47 +
  48 + countDown(10, 1000, function () {
  49 + location.href = "<?php echo Url::home(); ?>";
  50 + });
  51 +</script>
0 52 \ No newline at end of file
... ...
app-wx/views/site/error/403.php 0 → 100644
... ... @@ -0,0 +1,51 @@
  1 +<?php
  2 +use yii\helpers\Url;
  3 +$assets = $this->getAssetManager();
  4 +$asset = $assets->getBundle('app\wx\assets\AppAsset');
  5 +?>
  6 +<style>
  7 + .error-wrap {
  8 + margin:0 auto;
  9 + width:95%;
  10 + margin-top: 50px;
  11 + padding: 0 5px;
  12 + font-size: 18px;
  13 + font-weight: bold;
  14 + }
  15 +</style>
  16 +
  17 +<div class="error-wrap">
  18 + <div style="text-align: center"><img src="<?= $asset->baseUrl . '/i/error.jpg' ?>" /></div>
  19 + <div style="margin-bottom: 10px">一瞬间,访客风起云涌,页面进不去了...</div>
  20 + <div style="">我们将在<span id="num" class="text-danger">10</span>秒后为您跳转回首页</div>
  21 + <div style="line-height: 28px;margin-top: 30px;">
  22 + <p>在使用系统的过程中,遇到问题或者有好的建议,请一定告诉我们。我们深宅多年练就的功能,就是为了化问题为神奇。</p>
  23 +
  24 + <p style="margin-bottom: 30px"> 邮箱:tech@jiwork.com (求约)</p>
  25 + </div>
  26 +</div>
  27 +
  28 +<script>
  29 +
  30 + function countDown(period, intv, callback) {
  31 + var num = document.getElementById("num");
  32 + var timeRemain = period - 1;
  33 + var setText = function (text) {
  34 + num.innerHTML = text;
  35 + }
  36 + var t = setInterval(function () {
  37 + setText(timeRemain);
  38 + timeRemain -= 1;
  39 + if (timeRemain < 0) {
  40 + clearInterval(t);
  41 + if (callback) {
  42 + callback();
  43 + }
  44 + }
  45 + }, intv);
  46 + }
  47 +
  48 + countDown(10, 1000, function () {
  49 + location.href = "<?php echo Url::home(); ?>";
  50 + });
  51 +</script>
0 52 \ No newline at end of file
... ...
app-wx/views/site/error/404.php 0 → 100644
... ... @@ -0,0 +1,51 @@
  1 +<?php
  2 +use yii\helpers\Url;
  3 +$assets = $this->getAssetManager();
  4 +$asset = $assets->getBundle('app\wx\assets\AppAsset');
  5 +?>
  6 +<style>
  7 + .error-wrap {
  8 + margin:0 auto;
  9 + width:90%;
  10 + margin-top: 20px;
  11 + padding: 0 20px;
  12 + font-size: 18px;
  13 + font-weight: bold;
  14 + }
  15 +</style>
  16 +
  17 +<div class="error-wrap">
  18 + <div style="text-align: center"><i class="iconfont icon-kulian" style="font-size: 100pt "></i></div>
  19 + <div style="margin-bottom: 10px">一瞬间,访客风起云涌,页面进不去了...</div>
  20 + <div style="">我们将在<span id="num" class="text-danger">10</span>秒后为您跳转回首页</div>
  21 + <div style="line-height: 28px;margin-top: 30px;">
  22 + <p>在使用系统的过程中,遇到问题或者有好的建议,请一定告诉我们。我们深宅多年练就的功能,就是为了化问题为神奇。</p>
  23 +
  24 + <p style="margin-bottom: 30px"> 邮箱:tech@jiwork.com (求约)</p>
  25 + </div>
  26 +</div>
  27 +
  28 +<script>
  29 +
  30 + function countDown(period, intv, callback) {
  31 + var num = document.getElementById("num");
  32 + var timeRemain = period - 1;
  33 + var setText = function (text) {
  34 + num.innerHTML = text;
  35 + }
  36 + var t = setInterval(function () {
  37 + setText(timeRemain);
  38 + timeRemain -= 1;
  39 + if (timeRemain < 0) {
  40 + clearInterval(t);
  41 + if (callback) {
  42 + callback();
  43 + }
  44 + }
  45 + }, intv);
  46 + }
  47 +
  48 + countDown(10, 1000, function () {
  49 + location.href = "<?php echo Url::home(); ?>";
  50 + });
  51 +</script>
0 52 \ No newline at end of file
... ...
app-wx/views/site/error/block.php 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +<?php
  2 +use yii\helpers\Url;
  3 +$assets = $this->getAssetManager();
  4 +$asset = $assets->getBundle('app\wx\assets\AppAsset');
  5 +$baseUrl = Url::base(true);
  6 +?>
  7 +<style>
  8 + .error-wrap {
  9 + margin:0 auto;
  10 + width:90%;
  11 + margin-top: 20px;
  12 + padding: 0 20px;
  13 + font-size: 15px;
  14 + color: #666;
  15 + }
  16 +</style>
  17 +
  18 +<div class="error-wrap">
  19 + <div style="text-align: center">
  20 + <span style="display:block;width:100%;margin:0 auto;margin-top:80px;"><img style="width=105px; height: 105px;" src="<?=$baseUrl?>/i/tauth/forbidden.png" /></span>
  21 + <?php if(isset($errorMsg)) {?>
  22 + <div style="width:100%;text-align: center;margin:0 auto;margin-top: 20px;line-height:1.6rem"><?=$errorMsg?></div>
  23 + <?php } else {?>
  24 + <div style="width:100%;text-align: center;margin:0 auto;margin-top: 20px;line-height:1.6rem">对不起,您的账号已被封<br/>请联系客服: <?=$service_phone?></div>
  25 + <?php } ?>
  26 +
  27 + </div>
  28 +</div>
0 29 \ No newline at end of file
... ...
app-wx/views/site/index.php 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +<?php
  2 +$assets = $this->getAssetManager();
  3 +$asset = $assets->getBundle('app\wx\assets\AppAsset');
  4 +?>
  5 +
  6 +<div class="views">
  7 + <div id="view-index" class="view view-main">
  8 + <?=$this->render("/widgets/ui-loading")?>
  9 + </div>
  10 +</div>
  11 +<?=$this->render("_index-template", ['engineer'=>$engineer, 'asset' => $asset])?>
  12 +<script>
  13 + require.config({baseUrl: $site.assets_url + '/js/',urlArgs : "v=" + require.version});
  14 + require([
  15 + 'site-app',
  16 + ],
  17 + function(app) {
  18 + app.bootstrap({
  19 + baseUrl: $site.base_url
  20 + });
  21 + });
  22 +
  23 +</script>
  24 +
  25 +<?=$this->render("/widgets/stat-code")?>
0 26 \ No newline at end of file
... ...
app-wx/views/test/pay.php 0 → 100644
... ... @@ -0,0 +1,42 @@
  1 +<html>
  2 +<head>
  3 + <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
  4 + <meta name="viewport" content="width=device-width, initial-scale=1"/>
  5 + <title>微信支付样例-支付</title>
  6 + <script type="text/javascript">
  7 + //调用微信JS api 支付
  8 + function jsApiCall()
  9 + {
  10 + WeixinJSBridge.invoke(
  11 + 'getBrandWCPayRequest',
  12 + <?php echo $jsApiParameters; ?>,
  13 + function(res){
  14 + WeixinJSBridge.log(res.err_msg);
  15 + alert(res.err_code+res.err_desc+res.err_msg);
  16 + }
  17 + );
  18 + }
  19 +
  20 + function callpay()
  21 + {
  22 + if (typeof WeixinJSBridge == "undefined"){
  23 + if( document.addEventListener ){
  24 + document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
  25 + }else if (document.attachEvent){
  26 + document.attachEvent('WeixinJSBridgeReady', jsApiCall);
  27 + document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
  28 + }
  29 + }else{
  30 + jsApiCall();
  31 + }
  32 + }
  33 + </script>
  34 +</head>
  35 +<body>
  36 + <br/>
  37 + <font color="#9ACD32"><b>该笔订单支付金额为<span style="color:#f00;font-size:50px">1分</span>钱</b></font><br/><br/>
  38 + <div align="center">
  39 + <button style="width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer; color:white; font-size:16px;" type="button" onclick="callpay()" >立即支付</button>
  40 + </div>
  41 +</body>
  42 +</html>
0 43 \ No newline at end of file
... ...
app-wx/views/widgets/footer-bar.php 0 → 100644
... ... @@ -0,0 +1,43 @@
  1 +<?php
  2 +use yii\helpers\Url;
  3 +?>
  4 +<style>
  5 + .toolbar .toolbar-inner {
  6 + background: #fff;
  7 + }
  8 + .toolbar .toolbar-inner a.active {
  9 + color: #dd2727;
  10 + background: #fff;
  11 + }
  12 + .toolbar .toolbar-inner .badge {
  13 + color: #fff;
  14 + background: #dd2727;
  15 + }
  16 + .toolbar .toolbar-inner .iconfont {
  17 + font-size:22px;
  18 + }
  19 +</style>
  20 +<div class="toolbar tabbar tabbar-labels toolbar-fixed">
  21 + <div class="toolbar-inner" style="border: 0; padding: 0;">
  22 + <a href="<?=Url::toRoute(['/order'])?>" class="tab-link <?php if('order' == $label):?>active<?php endif;?> home-link">
  23 + <i class="icon iconfont <?=(''==$label) ? 'icon-home-fill' : 'icon-home'?>"></i>
  24 + <span class="tabbar-label">首页</span>
  25 + </a>
  26 + <!--
  27 + <a href="<?=Url::toRoute(['/cat'])?>" class="tab-link <?php if('cat' == $label):?>active<?php endif;?> cat-link">
  28 + <i class="icon iconfont <?=('cat'==$label) ? 'icon-search-list-fill' : 'icon-search-list'?>"></i>
  29 + <span class="tabbar-label">搜索</span>
  30 + </a>
  31 + <a href="<?=Url::toRoute('/cart')?>" class="tab-link <?php if('cart' == $label):?>active<?php endif;?> cart-link">
  32 + <i class="icon iconfont <?=('cart'==$label) ? 'icon-cart-fill' : 'icon-cart'?>">
  33 + <span class="badge">0</span>
  34 + </i>
  35 + <span class="tabbar-label">购物车</span>
  36 + </a>
  37 + -->
  38 + <a href="<?=Url::toRoute(['/user'])?>" class="tab-link <?php if('user' == $label):?>active<?php endif;?> user-link">
  39 + <i class="icon iconfont <?=('user'==$label) ? 'icon-my-fill' : 'icon-my'?>"></i>
  40 + <span class="tabbar-label">我</span>
  41 + </a>
  42 + </div>
  43 +</div>
0 44 \ No newline at end of file
... ...
app-wx/views/widgets/js-site.php 0 → 100644
... ... @@ -0,0 +1,14 @@
  1 +window.$site = {
  2 + base_url : '<?=$site->base_url?>',
  3 + assets_url : '<?=$site->assets_url?>',
  4 + title: '<?=$site->title?>',
  5 + desc: '<?=$site->desc?>',
  6 + url: '<?=$site->url?>',
  7 + icon: '<?=$site->icon?>',
  8 + appid: '<?=$site->appid?>',
  9 + timestamp: '<?=$site->timestamp?>',
  10 + noncestr: '<?=$site->noncestr?>',//noncestr
  11 + signature: '<?=$site->signature?>',//signature
  12 + user_bridge_url: '<?=$site->user_bridge_url?>',
  13 + sn: '<?=$site->sn ?>'
  14 +}
0 15 \ No newline at end of file
... ...
app-wx/views/widgets/stat-code.php 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +<?php
  2 +$site = $this->params['site'];
  3 +
  4 +?>
  5 +<?php if(isset($site->stat_code)):?>
  6 + <?=$site->stat_code?>
  7 +<?php endif;?>
0 8 \ No newline at end of file
... ...
app-wx/views/widgets/ui-loading.php 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +<!--预载入页面动画-->
  2 +<div class="ui-loading-block" id="ui-loading">
  3 + <div class="ui-loading-cnt">
  4 +<!-- <i class="ui-loading-bright"></i>-->
  5 + <div class="spinner">
  6 + <div class="bounce1"></div>
  7 + <div class="bounce2"></div>
  8 + <div class="bounce3"></div></div>
  9 + <div id="loader-inner"><p></p></div>
  10 + </div>
  11 +</div>
  12 +<!--//预载入页面动画-->
  13 +<script>
  14 + window['waitingTime'] = 10000; // 显示重新加载的等待时间,默认10s
  15 + window['loaderTimer'] = setTimeout(function(){
  16 + var loaderTips = document.getElementById('loader-inner');
  17 + var tips = document.createElement('p');
  18 + tips.className = 'notice';
  19 + if(loaderTips){
  20 + tips.innerHTML = '加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;" style="color: #0EA2F8">重新加载</a>';
  21 + loaderTips.appendChild(tips);
  22 + }
  23 + },window['waitingTime']);
  24 +</script>
0 25 \ No newline at end of file
... ...