Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zuiketang
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
zuiketang
Commits
4be5dfae
Commit
4be5dfae
authored
Oct 19, 2016
by
xiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加移动端支付宝支付
parent
7e786f11
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
126 additions
and
5 deletions
+126
-5
MobileDetect.php
src/common/components/MobileDetect.php
+58
-0
AliPay.php
src/common/libs/alipay/AliPay.php
+1
-1
composer.json
src/composer.json
+2
-1
composer.lock
src/composer.lock
+56
-2
params-local.php
src/environments/dev/common/config/params-local.php
+1
-0
params-local.php
src/environments/prod/common/config/params-local.php
+1
-0
main.php
src/frontend/config/main.php
+4
-1
HomeController.php
src/frontend/controllers/HomeController.php
+3
-0
No files found.
src/common/components/MobileDetect.php
0 → 100644
View file @
4be5dfae
<?php
/**
* Created by PhpStorm.
* User: xiabin
* Date: 2016/10/19
* Time: 下午3:52
*/
namespace
common\components
;
use
yii\base\Object
;
/**
* 移动设备检测功能
* @link http://mobiledetect.net/
*
* @example
* //注册一个检测移动设备组件
* Yii::$app->set('deviceDetect', [
* 'class' => 'common\service\DeviceDetect',
* ]);
* //使用
* Yii::$app->deviceDetect->isMobile();
*
* Class MyMobileDetect
*/
class
MobileDetect
extends
Object
{
/**
* @var
*/
private
$detector
;
/**
*init
*/
public
function
init
()
{
parent
::
init
();
$this
->
detector
=
new
\Detection\MobileDetect
();
}
/**
* @param string $name
* @param array $params
* @return mixed
*/
public
function
__call
(
$name
,
$params
)
{
return
call_user_func_array
(
array
(
$this
->
detector
,
$name
),
$params
);
}
}
\ No newline at end of file
src/common/libs/alipay/AliPay.php
View file @
4be5dfae
...
@@ -12,7 +12,7 @@ namespace common\libs\alipay;
...
@@ -12,7 +12,7 @@ namespace common\libs\alipay;
use
DOMDocument
;
use
DOMDocument
;
use
yii\helpers\ArrayHelper
;
use
yii\helpers\ArrayHelper
;
require_once
(
dirname
(
__FILE__
)
.
"/libs/alipay_core.function.php"
);
require_once
(
dirname
(
__FILE__
)
.
"/libs/alipay_core.function.php"
);
require_once
(
dirname
(
__FILE__
)
.
"/libs/alipay_md5.function.php"
);
require_once
(
dirname
(
__FILE__
)
.
"/libs/alipay_md5.function.php"
);
class
AliPay
class
AliPay
...
...
src/composer.json
View file @
4be5dfae
...
@@ -17,7 +17,8 @@
...
@@ -17,7 +17,8 @@
"guzzlehttp/guzzle"
:
"^6.2"
,
"guzzlehttp/guzzle"
:
"^6.2"
,
"qiniu/php-sdk"
:
"^7.0"
,
"qiniu/php-sdk"
:
"^7.0"
,
"light/yii2-xmlparser"
:
"*"
,
"light/yii2-xmlparser"
:
"*"
,
"2amigos/yii2-qrcode-helper"
:
"*"
"2amigos/yii2-qrcode-helper"
:
"*"
,
"mobiledetect/mobiledetectlib"
:
"^2.8"
},
},
"require-dev"
:
{
"require-dev"
:
{
"yiisoft/yii2-codeception"
:
"*"
,
"yiisoft/yii2-codeception"
:
"*"
,
...
...
src/composer.lock
View file @
4be5dfae
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
"This file is @generated automatically"
],
],
"hash": "
553e6afb2f94832a2b21ea5d6301d656
",
"hash": "
4454b16ac08c05c643766291ce0b6335
",
"content-hash": "
b2a9e1b6aa19ba113948022d2525b40b
",
"content-hash": "
7cd14e3280f6fcccf735c7641fab4a28
",
"packages": [
"packages": [
{
{
"name": "2amigos/yii2-qrcode-helper",
"name": "2amigos/yii2-qrcode-helper",
...
@@ -572,6 +572,60 @@
...
@@ -572,6 +572,60 @@
],
],
"time": "2015-08-15 16:07:34"
"time": "2015-08-15 16:07:34"
},
},
{
"name": "mobiledetect/mobiledetectlib",
"version": "2.8.22",
"source": {
"type": "git",
"url": "https://github.com/serbanghita/Mobile-Detect.git",
"reference": "53cddae0c272a478b24a4b5fb60d0f838caf70b6"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/serbanghita/Mobile-Detect/53cddae0c272a478b24a4b5fb60d0f838caf70b6.zip",
"reference": "53cddae0c272a478b24a4b5fb60d0f838caf70b6",
"shasum": ""
},
"require": {
"php": ">=5.0.0"
},
"require-dev": {
"codeclimate/php-test-reporter": "dev-master",
"johnkary/phpunit-speedtrap": "~1.0@dev",
"phpunit/phpunit": "*"
},
"type": "library",
"autoload": {
"classmap": [
"Mobile_Detect.php"
],
"psr-0": {
"Detection": "namespaced/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Serban Ghita",
"email": "serbanghita@gmail.com",
"homepage": "http://mobiledetect.net",
"role": "Developer"
}
],
"description": "Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.",
"homepage": "https://github.com/serbanghita/Mobile-Detect",
"keywords": [
"detect mobile devices",
"mobile",
"mobile detect",
"mobile detector",
"php mobile detect"
],
"time": "2016-04-24 09:47:16"
},
{
{
"name": "psr/http-message",
"name": "psr/http-message",
"version": "1.0.1",
"version": "1.0.1",
...
...
src/environments/dev/common/config/params-local.php
View file @
4be5dfae
...
@@ -22,6 +22,7 @@ return [
...
@@ -22,6 +22,7 @@ return [
'transport'
=>
'http'
,
'transport'
=>
'http'
,
'payment_type'
=>
'1'
,
'payment_type'
=>
'1'
,
'service'
=>
'create_direct_pay_by_user'
,
'service'
=>
'create_direct_pay_by_user'
,
'wap_service'
=>
'alipay.wap.create.direct.pay.by.user'
,
],
],
// 'weixinpay'=>[
// 'weixinpay'=>[
// 'appid'=>'wx180521eb22e9d7af',
// 'appid'=>'wx180521eb22e9d7af',
...
...
src/environments/prod/common/config/params-local.php
View file @
4be5dfae
...
@@ -22,6 +22,7 @@ return [
...
@@ -22,6 +22,7 @@ return [
'transport'
=>
'http'
,
'transport'
=>
'http'
,
'payment_type'
=>
'1'
,
'payment_type'
=>
'1'
,
'service'
=>
'create_direct_pay_by_user'
,
'service'
=>
'create_direct_pay_by_user'
,
'wap_service'
=>
'alipay.wap.create.direct.pay.by.user'
,
],
],
// 'weixinpay'=>[
// 'weixinpay'=>[
// 'appid'=>'wx180521eb22e9d7af',
// 'appid'=>'wx180521eb22e9d7af',
...
...
src/frontend/config/main.php
View file @
4be5dfae
...
@@ -13,6 +13,9 @@ return [
...
@@ -13,6 +13,9 @@ return [
'controllerNamespace'
=>
'frontend\controllers'
,
'controllerNamespace'
=>
'frontend\controllers'
,
'defaultRoute'
=>
'user-center'
,
'defaultRoute'
=>
'user-center'
,
'components'
=>
[
'components'
=>
[
'deviceDetect'
=>
[
'class'
=>
'common\components\MobileDetect'
,
],
'request'
=>
[
'request'
=>
[
'csrfParam'
=>
'_csrf-frontend'
,
'csrfParam'
=>
'_csrf-frontend'
,
],
],
...
@@ -20,7 +23,7 @@ return [
...
@@ -20,7 +23,7 @@ return [
'appendTimestamp'
=>
TRUE
,
'appendTimestamp'
=>
TRUE
,
//'baseUrl' => 'http://www.baidu.com/',
//'baseUrl' => 'http://www.baidu.com/',
'bundles'
=>
[
'bundles'
=>
[
'yii\web\JqueryAsset'
=>
false
,
'yii\web\JqueryAsset'
=>
FALSE
,
]
]
],
],
'user'
=>
[
'user'
=>
[
...
...
src/frontend/controllers/HomeController.php
View file @
4be5dfae
...
@@ -401,6 +401,9 @@ class HomeController extends \yii\web\Controller
...
@@ -401,6 +401,9 @@ class HomeController extends \yii\web\Controller
"total_fee"
=>
$price
,
//付款金额
"total_fee"
=>
$price
,
//付款金额
"body"
=>
'云崖购买'
,
//商品描述
"body"
=>
'云崖购买'
,
//商品描述
);
);
if
(
Yii
::
$app
->
deviceDetect
->
isMobile
()
or
TRUE
)
{
$parameter
[
'service'
]
=
\Yii
::
$app
->
params
[
'alipay'
][
'wap_service'
];
}
$html_text
=
$alipay
->
buildRequestForm
(
$parameter
,
"get"
,
"确认"
);
$html_text
=
$alipay
->
buildRequestForm
(
$parameter
,
"get"
,
"确认"
);
echo
$html_text
;
echo
$html_text
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment