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
24311f3e
Commit
24311f3e
authored
Oct 18, 2016
by
杨培
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
5ba89a1c
ae2cacc2
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
63 additions
and
48 deletions
+63
-48
AliPay.php
src/common/libs/alipay/AliPay.php
+1
-1
AlipayNotify.php
src/common/libs/alipay/AlipayNotify.php
+2
-1
Course.php
src/common/models/Course.php
+23
-10
Orders.php
src/common/models/Orders.php
+2
-1
User.php
src/common/models/User.php
+7
-6
m160927_104153_users_init.php
src/console/migrations/m160927_104153_users_init.php
+1
-0
m160927_121107_course_init.php
src/console/migrations/m160927_121107_course_init.php
+1
-1
m160927_122231_orders_init.php
src/console/migrations/m160927_122231_orders_init.php
+1
-1
PayController.php
src/frontend/controllers/PayController.php
+21
-22
SignupForm.php
src/frontend/models/SignupForm.php
+1
-0
video-intro.vue
src/frontend/web/js/home/components/video-intro.vue
+1
-1
video-play.vue
src/frontend/web/js/home/components/video-play.vue
+2
-4
No files found.
src/common/libs/alipay/AliPay.php
View file @
24311f3e
...
@@ -105,7 +105,7 @@ class AliPay
...
@@ -105,7 +105,7 @@ class AliPay
"partner"
=>
$this
->
alipay_config
[
'partner'
],
"partner"
=>
$this
->
alipay_config
[
'partner'
],
"seller_id"
=>
$this
->
alipay_config
[
'seller_id'
],
"seller_id"
=>
$this
->
alipay_config
[
'seller_id'
],
"payment_type"
=>
$this
->
alipay_config
[
'payment_type'
],
"payment_type"
=>
$this
->
alipay_config
[
'payment_type'
],
"
return_url"
=>
$this
->
alipay_config
[
'return
_url'
],
"
notify_url"
=>
$this
->
alipay_config
[
'notify
_url'
],
"_input_charset"
=>
trim
(
strtolower
(
$this
->
alipay_config
[
'input_charset'
]))
"_input_charset"
=>
trim
(
strtolower
(
$this
->
alipay_config
[
'input_charset'
]))
],
$para_temp
);
],
$para_temp
);
...
...
src/common/libs/alipay/AlipayNotify.php
View file @
24311f3e
...
@@ -8,7 +8,8 @@
...
@@ -8,7 +8,8 @@
namespace
common\libs\alipay
;
namespace
common\libs\alipay
;
require_once
(
dirname
(
__FILE__
)
.
"/libs/alipay_core.function.php"
);
require_once
(
dirname
(
__FILE__
)
.
"/libs/alipay_md5.function.php"
);
class
AlipayNotify
class
AlipayNotify
{
{
/**
/**
...
...
src/common/models/Course.php
View file @
24311f3e
...
@@ -13,14 +13,18 @@ use yii\redis\ActiveRecord;
...
@@ -13,14 +13,18 @@ use yii\redis\ActiveRecord;
*
*
* @property integer $id
* @property integer $id
* @property integer $user_id
* @property integer $user_id
* @property integer $class
ed
_id
* @property integer $class_id
* @property string $name
* @property string $name
* @property
integer
$price
* @property
string
$price
* @property integer $free_time
* @property integer $free_time
* @property string $intro
* @property string $intro
* @property string $preview_pic
* @property string $preview_pic
* @property integer $recommend
* @property integer $recommend
* @property integer $status
* @property integer $status
* @property integer $play_count
* @property integer $comment_count
* @property integer $favorite_count
* @property integer $support_count
* @property integer $created_at
* @property integer $created_at
* @property integer $updated_at
* @property integer $updated_at
*/
*/
...
@@ -80,7 +84,7 @@ class Course extends \yii\db\ActiveRecord
...
@@ -80,7 +84,7 @@ class Course extends \yii\db\ActiveRecord
[
'name'
,
'string'
,
'length'
=>
[
1
,
60
]],
[
'name'
,
'string'
,
'length'
=>
[
1
,
60
]],
[[
'user_id'
,
'class_id'
],
'integer'
],
[[
'user_id'
,
'class_id'
],
'integer'
],
[
'intro'
,
'string'
],
[
'intro'
,
'string'
],
[
'price'
,
'integer'
,
'min'
=>
0
,
'max'
=>
9999
],
[
[
'price'
],
'number'
],
[
'free_time'
,
'integer'
,
'min'
=>
0
,
'max'
=>
15
],
[
'free_time'
,
'integer'
,
'min'
=>
0
,
'max'
=>
15
],
[
'recommend'
,
'boolean'
],
[
'recommend'
,
'boolean'
],
[[
'recommend'
,
'comment_count'
,
'favorite_count'
,
'support_count'
,
'play_count'
],
'default'
,
'value'
=>
0
],
[[
'recommend'
,
'comment_count'
,
'favorite_count'
,
'support_count'
,
'play_count'
],
'default'
,
'value'
=>
0
],
...
@@ -94,13 +98,22 @@ class Course extends \yii\db\ActiveRecord
...
@@ -94,13 +98,22 @@ class Course extends \yii\db\ActiveRecord
public
function
attributeLabels
()
public
function
attributeLabels
()
{
{
return
[
return
[
'teacher'
=>
'讲师'
,
'id'
=>
'ID'
,
'name'
=>
'标题'
,
'user_id'
=>
'User ID'
,
'price'
=>
'价格'
,
'class_id'
=>
'Class ID'
,
'free_time'
=>
'免费试看'
,
'name'
=>
'Name'
,
'intro'
=>
'课程介绍'
,
'price'
=>
'Price'
,
'preview_pic'
=>
'预览图'
,
'free_time'
=>
'Free Time'
,
'favorite_count'
=>
'favorite_count'
'intro'
=>
'Intro'
,
'preview_pic'
=>
'Preview Pic'
,
'recommend'
=>
'0 表示推荐 1推荐'
,
'status'
=>
'0 未审核 1 审核通过 2 审核不通过 3 锁定 '
,
'play_count'
=>
'播放次数'
,
'comment_count'
=>
'评论次数'
,
'favorite_count'
=>
'收藏次数'
,
'support_count'
=>
'点赞次数'
,
'created_at'
=>
'Created At'
,
'updated_at'
=>
'Updated At'
,
];
];
}
}
...
...
src/common/models/Orders.php
View file @
24311f3e
...
@@ -60,7 +60,8 @@ class Orders extends \yii\db\ActiveRecord
...
@@ -60,7 +60,8 @@ class Orders extends \yii\db\ActiveRecord
return
[
return
[
[[
'user_id'
,
'course_id'
,
'number'
,
'credit'
,
'pay_order'
],
'required'
],
[[
'user_id'
,
'course_id'
,
'number'
,
'credit'
,
'pay_order'
],
'required'
],
[[
'user_id'
,
'course_id'
,
'status'
,
'created_at'
,
'updated_at'
],
'integer'
],
[[
'user_id'
,
'course_id'
,
'status'
,
'created_at'
,
'updated_at'
],
'integer'
],
[[
'number'
,
'credit'
],
'string'
,
'max'
=>
32
],
[[
'number'
],
'string'
,
'max'
=>
32
],
[[
'credit'
],
'number'
],
[[
'pay_order'
],
'string'
,
'max'
=>
64
],
[[
'pay_order'
],
'string'
,
'max'
=>
64
],
];
];
}
}
...
...
src/common/models/User.php
View file @
24311f3e
...
@@ -76,7 +76,7 @@ class User extends ActiveRecord implements IdentityInterface
...
@@ -76,7 +76,7 @@ class User extends ActiveRecord implements IdentityInterface
public
function
rules
()
public
function
rules
()
{
{
return
[
return
[
[[
'username'
,
'auth_key'
,
'password_hash'
,
'telephone'
,
'ip'
,
'logged_at'
],
'required'
],
[[
'username'
,
'auth_key'
,
'password_hash'
,
'telephone'
,
'ip'
,
'
from'
,
'
logged_at'
],
'required'
],
[[
'role'
,
'status'
],
'integer'
],
[[
'role'
,
'status'
],
'integer'
],
[[
'created_at'
,
'updated_at'
,
'logged_at'
],
'safe'
],
[[
'created_at'
,
'updated_at'
,
'logged_at'
],
'safe'
],
[[
'username'
,
'auth_key'
,
'wx_open_id'
,
'ip'
],
'string'
,
'max'
=>
32
],
[[
'username'
,
'auth_key'
,
'wx_open_id'
,
'ip'
],
'string'
,
'max'
=>
32
],
...
@@ -106,6 +106,7 @@ class User extends ActiveRecord implements IdentityInterface
...
@@ -106,6 +106,7 @@ class User extends ActiveRecord implements IdentityInterface
'avatar'
=>
'avatar'
,
'avatar'
=>
'avatar'
,
'wx_open_id'
=>
'wx_open_id'
,
'wx_open_id'
=>
'wx_open_id'
,
'ip'
=>
'ip'
,
'ip'
=>
'ip'
,
'from'
=>
'from'
,
'created_at'
=>
'created_at'
,
'created_at'
=>
'created_at'
,
'updated_at'
=>
'updated_at'
,
'updated_at'
=>
'updated_at'
,
'logged_at'
=>
'logged_at'
,
'logged_at'
=>
'logged_at'
,
...
@@ -177,22 +178,22 @@ class User extends ActiveRecord implements IdentityInterface
...
@@ -177,22 +178,22 @@ class User extends ActiveRecord implements IdentityInterface
/**
/**
* 获取用户头像 URL
* 获取用户头像 URL
*
*
* @param string $avatar
* @param string $avatar
* @param string $size 头像尺寸,目前仅支持 m,留空返回原图
* @param string $size 头像尺寸,目前仅支持 m,留空返回原图
* @return string
* @return string
*/
*/
public
static
function
getAvatarUrl
(
$avatar
,
$size
=
'm'
)
public
static
function
getAvatarUrl
(
$avatar
,
$size
=
'm'
)
{
{
if
(
!
$avatar
)
{
if
(
!
$avatar
)
{
return
\frontend\assets\AppAsset
::
getStaticUrl
(
'img/avatarMax.png'
)
;
return
\frontend\assets\AppAsset
::
getStaticUrl
(
'img/avatarMax.png'
);
}
}
$url
=
Yii
::
$app
->
qiniu
->
getUrl
(
'public'
,
$avatar
);
$url
=
Yii
::
$app
->
qiniu
->
getUrl
(
'public'
,
$avatar
);
return
$size
?
$url
.
"-
{
$size
}
.avatar"
:
$url
;
return
$size
?
$url
.
"-
{
$size
}
.avatar"
:
$url
;
}
}
/**
/**
* @inheritdoc
* @inheritdoc
*/
*/
...
...
src/console/migrations/m160927_104153_users_init.php
View file @
24311f3e
...
@@ -26,6 +26,7 @@ class m160927_104153_users_init extends Migration
...
@@ -26,6 +26,7 @@ class m160927_104153_users_init extends Migration
'avatar'
=>
$this
->
string
(
128
)
->
notNull
()
->
defaultValue
(
''
),
'avatar'
=>
$this
->
string
(
128
)
->
notNull
()
->
defaultValue
(
''
),
'wx_open_id'
=>
$this
->
string
(
32
)
->
defaultValue
(
''
)
->
comment
(
'登录微信id'
),
'wx_open_id'
=>
$this
->
string
(
32
)
->
defaultValue
(
''
)
->
comment
(
'登录微信id'
),
'ip'
=>
$this
->
string
(
32
)
->
notNull
(),
'ip'
=>
$this
->
string
(
32
)
->
notNull
(),
'from'
=>
$this
->
integer
()
->
unsigned
()
->
defaultValue
(
0
)
->
comment
(
'0 来自注册 其它为某个user_id'
),
'created_at'
=>
$this
->
integer
()
->
notNull
(),
'created_at'
=>
$this
->
integer
()
->
notNull
(),
'updated_at'
=>
$this
->
integer
()
->
notNull
(),
'updated_at'
=>
$this
->
integer
()
->
notNull
(),
'logged_at'
=>
$this
->
integer
()
->
notNull
()
'logged_at'
=>
$this
->
integer
()
->
notNull
()
...
...
src/console/migrations/m160927_121107_course_init.php
View file @
24311f3e
...
@@ -19,7 +19,7 @@ class m160927_121107_course_init extends Migration
...
@@ -19,7 +19,7 @@ class m160927_121107_course_init extends Migration
'user_id'
=>
$this
->
integer
()
->
notNull
()
->
unsigned
(),
'user_id'
=>
$this
->
integer
()
->
notNull
()
->
unsigned
(),
'class_id'
=>
$this
->
integer
(
10
)
->
notNull
()
->
unsigned
(),
'class_id'
=>
$this
->
integer
(
10
)
->
notNull
()
->
unsigned
(),
'name'
=>
$this
->
string
(
32
)
->
notNull
(),
'name'
=>
$this
->
string
(
32
)
->
notNull
(),
'price'
=>
$this
->
integer
(
10
)
->
notNull
()
->
defaultValue
(
0
),
'price'
=>
$this
->
decimal
(
6
,
2
)
->
unsigned
(
)
->
notNull
()
->
defaultValue
(
0
),
'free_time'
=>
$this
->
integer
(
10
)
->
notNull
()
->
defaultValue
(
0
),
'free_time'
=>
$this
->
integer
(
10
)
->
notNull
()
->
defaultValue
(
0
),
'intro'
=>
$this
->
text
()
->
notNull
(),
'intro'
=>
$this
->
text
()
->
notNull
(),
'preview_pic'
=>
$this
->
string
(
255
)
->
notNull
(),
'preview_pic'
=>
$this
->
string
(
255
)
->
notNull
(),
...
...
src/console/migrations/m160927_122231_orders_init.php
View file @
24311f3e
...
@@ -19,7 +19,7 @@ class m160927_122231_orders_init extends Migration
...
@@ -19,7 +19,7 @@ class m160927_122231_orders_init extends Migration
'user_id'
=>
$this
->
integer
()
->
notNull
()
->
unsigned
(),
'user_id'
=>
$this
->
integer
()
->
notNull
()
->
unsigned
(),
'course_id'
=>
$this
->
integer
()
->
notNull
()
->
unsigned
(),
'course_id'
=>
$this
->
integer
()
->
notNull
()
->
unsigned
(),
'number'
=>
$this
->
string
(
32
)
->
notNull
(),
'number'
=>
$this
->
string
(
32
)
->
notNull
(),
'credit'
=>
$this
->
string
(
32
)
->
notNull
()
->
comment
(
'消费'
),
'credit'
=>
$this
->
decimal
(
6
,
2
)
-
unsigned
(
)
->
notNull
()
->
comment
(
'消费'
),
'status'
=>
$this
->
smallInteger
()
->
notNull
()
->
defaultValue
(
0
)
->
unsigned
()
->
comment
(
'0 未支付 1 已支付'
),
'status'
=>
$this
->
smallInteger
()
->
notNull
()
->
defaultValue
(
0
)
->
unsigned
()
->
comment
(
'0 未支付 1 已支付'
),
'pay_order'
=>
$this
->
string
(
64
)
->
notNull
()
->
comment
(
'第三方支付订单'
),
'pay_order'
=>
$this
->
string
(
64
)
->
notNull
()
->
comment
(
'第三方支付订单'
),
'created_at'
=>
$this
->
integer
()
->
notNull
(),
'created_at'
=>
$this
->
integer
()
->
notNull
(),
...
...
src/frontend/controllers/PayController.php
View file @
24311f3e
...
@@ -42,7 +42,6 @@ class PayController extends Controller
...
@@ -42,7 +42,6 @@ class PayController extends Controller
//获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表
//获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表
//商户订单号
//商户订单号
$out_trade_no
=
$_POST
[
'out_trade_no'
];
$out_trade_no
=
$_POST
[
'out_trade_no'
];
$trade_no
=
$_POST
[
'trade_no'
];
$trade_no
=
$_POST
[
'trade_no'
];
...
@@ -50,28 +49,28 @@ class PayController extends Controller
...
@@ -50,28 +49,28 @@ class PayController extends Controller
$order
=
Orders
::
findOne
([
'number'
=>
$out_trade_no
]);
$order
=
Orders
::
findOne
([
'number'
=>
$out_trade_no
]);
if
(
$order
!==
NULL
and
$order
->
status
!==
Orders
::
PAID
)
{
//交易状态
//交易状态
$trade_status
=
$_POST
[
'trade_status'
];
$trade_status
=
$_POST
[
'trade_status'
];
//并添加消费记录
//并添加消费记录
$consume
=
new
Consume
();
$consume
=
new
Consume
();
$consume
->
orders_id
=
$order
->
id
;
$consume
->
orders_id
=
$order
->
id
;
$consume
->
user_id
=
$order
->
user_id
;
$consume
->
user_id
=
$order
->
user_id
;
$consume
->
save
();
$consume
->
save
();
//添加收入记录
//添加收入记录
$income
=
new
Income
();
$income
=
new
Income
();
$income
->
orders_id
=
$order
->
id
;
$income
->
orders_id
=
$order
->
id
;
$courseInfo
=
Course
::
findBaseInfoByCourseId
(
$order
->
course_id
);
$courseInfo
=
Course
::
findBaseInfoByCourseId
(
$order
->
course_id
);
$income
->
user_id
=
$courseInfo
[
'user_id'
];
$income
->
user_id
=
$courseInfo
[
'user_id'
];
$income
->
save
();
$income
->
save
();
if
(
$trade_status
==
'TRADE_FINISHED'
or
$trade_status
==
'TRADE_SUCCESS'
)
{
if
(
$trade_status
==
'TRADE_FINISHED'
or
$trade_status
==
'TRADE_SUCCESS'
)
{
$order
->
pay_order
=
$trade_no
;
$order
->
pay_order
=
$trade_no
;
$order
->
status
=
Orders
::
PAID
;
$order
->
status
=
Orders
::
PAID
;
$order
->
update
();
$order
->
update
();
}
}
}
//——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
//——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
echo
"success"
;
//请不要修改或删除
echo
"success"
;
//请不要修改或删除
...
...
src/frontend/models/SignupForm.php
View file @
24311f3e
...
@@ -59,6 +59,7 @@ class SignupForm extends Model
...
@@ -59,6 +59,7 @@ class SignupForm extends Model
$user
->
logged_at
=
time
();
$user
->
logged_at
=
time
();
$user
->
avatar
=
''
;
$user
->
avatar
=
''
;
$user
->
ip
=
Utils
::
getRealIP
();
$user
->
ip
=
Utils
::
getRealIP
();
$user
->
from
=
$this
->
from
;
if
(
!
$user
->
save
())
{
if
(
!
$user
->
save
())
{
Yii
::
getLogger
()
->
log
(
$user
->
getErrors
(),
Logger
::
LEVEL_ERROR
);
Yii
::
getLogger
()
->
log
(
$user
->
getErrors
(),
Logger
::
LEVEL_ERROR
);
$user
=
NULL
;
$user
=
NULL
;
...
...
src/frontend/web/js/home/components/video-intro.vue
View file @
24311f3e
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<div
class=
"video-description"
>
<div
class=
"video-description"
>
<div
class=
"title"
>
视频介绍
</div>
<div
class=
"title"
>
视频介绍
</div>
<div
class=
"text"
>
<div
class=
"text"
>
{{
coursewareInfo
.
intro
}}
{{
{
coursewareInfo
.
intro
}
}
}
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
...
src/frontend/web/js/home/components/video-play.vue
View file @
24311f3e
...
@@ -59,7 +59,7 @@
...
@@ -59,7 +59,7 @@
<div v-show="
showQrcode
" class="
wecat
-
qrcode
">
<div v-show="
showQrcode
" class="
wecat
-
qrcode
">
<div class="
top
-
back
-
a
">
<div class="
top
-
back
-
a
">
<a href="
javascript
:;
" @click="
showQrcode
=
false
">
<
返回支付渠道选择</a>
<a href="
javascript
:;
" @click="
showQrcode
=
false
">
<
返回支付渠道选择</a>
</div>
</div>
<div class="
qrcode
-
img
">
<div class="
qrcode
-
img
">
<img :src="
getWeixinPayQrcode
(
coursewareInfo
.
course_id
)
">
<img :src="
getWeixinPayQrcode
(
coursewareInfo
.
course_id
)
">
...
@@ -82,9 +82,7 @@
...
@@ -82,9 +82,7 @@
<div class="
teacher
-
info
text
-
center
">
<div class="
teacher
-
info
text
-
center
">
<img :src="
getFullPic
(
item
.
avatar
)
">
<img :src="
getFullPic
(
item
.
avatar
)
">
<h3>{{item.name
}}
</h3>
<h3>{{item.name
}}
</h3>
<p class="
teacher
-
detail
">
<p class="
teacher
-
detail
">{{{item.intro
}}
}
</p>
{{item.intro
}}
</p>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
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