切换导航条
此项目
正在载入...
登录
郭盛
/
areial
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郭盛
4 years ago
提交
9905f3cef7f4ba71f6159b69f9ac3c4e68867638
1 个父辈
9e273d0c
1 个管道 的构建
失败
耗费 7 秒
修改后台订单
变更
3
构建
1
显示空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
143 行增加
和
33 行删除
application/admin/controller/Iphone.php
application/admin/view/iphone/edit.html
public/assets/js/backend/iphone.js
application/admin/controller/Iphone.php
查看文件 @
9905f3c
...
...
@@ -2,6 +2,7 @@
namespace
app\admin\controller
;
use
app\api\controller\Pay
;
use
app\common\controller\Backend
;
use
think\Db
;
...
...
@@ -71,6 +72,7 @@ class Iphone extends Backend
$list
=
collection
(
$list
)
->
toArray
();
foreach
(
$list
as
$k
=>
$v
){
$list
[
$k
][
'user_id'
]
=
Db
::
name
(
'user'
)
->
where
(
'id'
,
$v
[
'user_id'
])
->
value
(
'nickname'
);
$list
[
$k
][
'user_phone'
]
=
Db
::
name
(
'user'
)
->
where
(
'id'
,
$v
[
'user_id'
])
->
value
(
'mobile'
);
}
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
...
...
@@ -78,4 +80,111 @@ class Iphone extends Backend
}
return
$this
->
view
->
fetch
();
}
/**
* 编辑
*/
public
function
edit
(
$ids
=
null
)
{
$row
=
$this
->
model
->
get
(
$ids
);
if
(
!
$row
)
{
$this
->
error
(
__
(
'No Results were found'
));
}
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
if
(
!
in_array
(
$row
[
$this
->
dataLimitField
],
$adminIds
))
{
$this
->
error
(
__
(
'You have no permission'
));
}
}
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
$params
=
$this
->
preExcludeFields
(
$params
);
//先查询一遍数据是否已经是支付状态
$data
=
Db
::
name
(
'iphone'
)
->
where
(
'id'
,
$ids
)
->
find
();
//查询用户余额
$user_info
=
Db
::
name
(
'user'
)
->
where
(
'id'
,
$data
[
'user_id'
])
->
find
();
$result
=
false
;
Db
::
startTrans
();
try
{
//是否采用模型验证
if
(
$this
->
modelValidate
)
{
$name
=
str_replace
(
"
\\
model
\\
"
,
"
\\
validate
\\
"
,
get_class
(
$this
->
model
));
$validate
=
is_bool
(
$this
->
modelValidate
)
?
(
$this
->
modelSceneValidate
?
$name
.
'.edit'
:
$name
)
:
$this
->
modelValidate
;
$row
->
validateFailException
(
true
)
->
validate
(
$validate
);
}
//未支付状态下才变更用户余额
if
(
$data
[
'status'
]
==
1
){
if
(
$params
[
'status'
]
==
2
){
//判断金额是否充足
if
(
$user_info
[
'money'
]
<
$data
[
'total'
]){
$this
->
error
(
'您的余额不足,请充值后购买'
);
}
else
{
//用户购买的什么素材
if
(
empty
(
$data
[
'video_id'
])){
$pic
=
Db
::
name
(
'pic'
)
->
where
(
'id'
,
$data
[
'pic_id'
])
->
find
();
//发送短信,通知客户
$mobile
=
$user_info
[
'mobile'
];
$content
=
"【仁甲看见SHOP】,感谢您购买仁甲看见SHOP素材。图片标题:
$pic[title],云盘地址:$pic[url]
"
;
//发送短信
$send
=
new
Pay
();
$send
->
sms
(
$mobile
,
$content
);
}
elseif
(
empty
(
$data
[
'pic_id'
])){
$video_id
=
unserialize
(
$data
[
'video_id'
]);
$video
=
Db
::
name
(
'video'
)
->
where
(
'id'
,
$video_id
[
'id'
])
->
find
();
//发送短信,通知客户
$mobile
=
$user_info
[
'mobile'
];
if
(
$video_id
[
'attr'
]
==
1
){
$content
=
"【仁甲看见SHOP】,感谢您购买仁甲看见SHOP素材。视频标题:
$video[title],云盘地址:$video[two_url]
"
;
}
elseif
(
$video_id
[
'attr'
]
==
2
){
$content
=
"【仁甲看见SHOP】,感谢您购买仁甲看见SHOP素材。视频标题:
$video[title],云盘地址:$video[four_url]
"
;
}
elseif
(
$video_id
[
'attr'
]
==
3
){
$content
=
"【仁甲看见SHOP】,感谢您购买仁甲看见SHOP素材。视频标题:
$video[title],云盘地址:$video[eight_url]
"
;
}
//发送短信
$send
=
new
Pay
();
$send
->
sms
(
$mobile
,
$content
);
}
$update
=
$user_info
[
'money'
]
-
$data
[
'total'
];
Db
::
name
(
'user'
)
->
where
(
'id'
,
$user_info
[
'id'
])
->
update
([
'money'
=>
$update
]);
}
}
}
$result
=
$row
->
allowField
(
true
)
->
save
(
$params
);
Db
::
commit
();
}
catch
(
ValidateException
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
catch
(
PDOException
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
catch
(
Exception
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
if
(
$result
!==
false
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were updated'
));
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
$this
->
view
->
assign
(
"row"
,
$row
);
return
$this
->
view
->
fetch
();
}
}
...
...
application/admin/view/iphone/edit.html
查看文件 @
9905f3c
<form
id=
"edit-form"
class=
"form-horizontal"
role=
"form"
data-toggle=
"validator"
method=
"POST"
action=
""
>
<!--<div class="form-group">-->
<!--<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>-->
<!--<div class="col-xs-12 col-sm-8">-->
<!--<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">-->
<!--</div>-->
<!--</div>-->
<!--<div class="form-group">-->
<!--<label class="control-label col-xs-12 col-sm-2">{:__('Pic_id')}:</label>-->
<!--<div class="col-xs-12 col-sm-8">-->
<!--<input id="c-pic_id" data-rule="required" data-source="pic/index" class="form-control selectpage" name="row[pic_id]" type="text" value="{$row.pic_id|htmlentities}">-->
<!--</div>-->
<!--</div>-->
<!--<div class="form-group">-->
<!--<label class="control-label col-xs-12 col-sm-2">{:__('Video_id')}:</label>-->
<!--<div class="col-xs-12 col-sm-8">-->
<!--<input id="c-video_id" data-rule="required" data-source="video/index" class="form-control selectpage" name="row[video_id]" type="text" value="{$row.video_id|htmlentities}">-->
<!--</div>-->
<!--</div>-->
<!--<div class="form-group">-->
<!--<label class="control-label col-xs-12 col-sm-2">{:__('Total')}:</label>-->
<!--<div class="col-xs-12 col-sm-8">-->
<!--<input id="c-total" class="form-control" step="0.01" name="row[total]" type="number" value="{$row.total|htmlentities}">-->
<!--</div>-->
<!--</div>-->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('
User_id
')}:
</label>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('
支付状态
')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-user_id"
data-rule=
"required"
data-source=
"user/user/index"
data-field=
"nickname"
class=
"form-control selectpage"
name=
"row[user_id]"
type=
"text"
value=
"{$row.user_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Pic_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-pic_id"
data-rule=
"required"
data-source=
"pic/index"
class=
"form-control selectpage"
name=
"row[pic_id]"
type=
"text"
value=
"{$row.pic_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Video_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-video_id"
data-rule=
"required"
data-source=
"video/index"
class=
"form-control selectpage"
name=
"row[video_id]"
type=
"text"
value=
"{$row.video_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Total')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-total"
class=
"form-control"
step=
"0.01"
name=
"row[total]"
type=
"number"
value=
"{$row.total|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Status')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-status"
class=
"form-control"
name=
"row[status]"
type=
"number"
value=
"{$row.status|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Num')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-num"
class=
"form-control"
name=
"row[num]"
type=
"text"
value=
"{$row.num|htmlentities}"
>
{:build_radios('row[status]', ['1'=>'待支付', '2'=>'已支付'],$row.status)}
</div>
</div>
<!--<div class="form-group">-->
<!--<label class="control-label col-xs-12 col-sm-2">{:__('Num')}:</label>-->
<!--<div class="col-xs-12 col-sm-8">-->
<!--<input id="c-num" class="form-control" name="row[num]" type="text" value="{$row.num|htmlentities}">-->
<!--</div>-->
<!--</div>-->
<div
class=
"form-group layer-footer"
>
<label
class=
"control-label col-xs-12 col-sm-2"
></label>
<div
class=
"col-xs-12 col-sm-8"
>
...
...
public/assets/js/backend/iphone.js
查看文件 @
9905f3c
...
...
@@ -26,10 +26,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{
checkbox
:
true
},
{
field
:
'id'
,
title
:
__
(
'Id'
)},
{
field
:
'user_id'
,
title
:
__
(
'用户昵称'
)},
{
field
:
'user_phone'
,
title
:
__
(
'用户手机号'
)},
{
field
:
'pic.title'
,
title
:
__
(
'Pic.title'
),
operate
:
'like'
},
{
field
:
'video.title'
,
title
:
__
(
'Video.title'
),
operate
:
'like'
},
{
field
:
'total'
,
title
:
__
(
'Total'
),
operate
:
'BETWEEN'
},
{
field
:
'status'
,
title
:
__
(
'
Status'
)
},
{
field
:
'status'
,
title
:
__
(
'
支付状态'
),
searchList
:
{
"1"
:
"待支付"
,
"2"
:
'已支付'
},
formatter
:
Table
.
api
.
formatter
.
status
},
{
field
:
'num'
,
title
:
__
(
'Num'
)},
{
field
:
'createtime'
,
title
:
__
(
'Createtime'
),
operate
:
'RANGE'
,
addclass
:
'datetimerange'
,
formatter
:
Table
.
api
.
formatter
.
datetime
},
// {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
...
...
请
注册
或
登录
后发表评论