切换导航条
此项目
正在载入...
登录
郭盛
/
areial
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郭盛
5 years ago
提交
8e2484af04b56614896bb08ee670cccd5b0fbc83
1 个父辈
32860120
1 个管道 的构建
通过
耗费 2 秒
修改订单状态
变更
3
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
111 行增加
和
4 行删除
application/admin/controller/Iphoneorder.php
application/admin/view/iphoneorder/edit.html
public/assets/js/backend/iphoneorder.js
application/admin/controller/Iphoneorder.php
查看文件 @
8e2484a
...
...
@@ -25,7 +25,7 @@ class Iphoneorder extends Backend
$this
->
model
=
new
\app\admin\model\Iphoneorder
;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
...
...
@@ -33,6 +33,45 @@ class Iphoneorder extends Backend
*/
/**
* 查看
*/
public
function
index
()
{
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
]);
if
(
$this
->
request
->
isAjax
())
{
//如果发送的来源是Selectpage,则转发到Selectpage
if
(
$this
->
request
->
request
(
'keyField'
))
{
return
$this
->
selectpage
();
}
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
();
$total
=
$this
->
model
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
count
();
$list
=
$this
->
model
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
limit
(
$offset
,
$limit
)
->
select
();
$list
=
collection
(
$list
)
->
toArray
();
foreach
(
$list
as
&
$v
){
$user
=
Db
::
name
(
'user'
)
->
where
(
'id'
,
$v
[
'user_id'
])
->
field
(
'id,nickname,mobile'
)
->
find
();
$v
[
'user_id'
]
=
$user
[
'nickname'
];
$v
[
'user_phone'
]
=
$user
[
'mobile'
];
}
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
}
return
$this
->
view
->
fetch
();
}
/**
* 添加
*/
public
function
add
()
...
...
@@ -41,6 +80,8 @@ class Iphoneorder extends Backend
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
$params
=
$this
->
preExcludeFields
(
$params
);
$params
[
'status'
]
=
1
;
$params
[
'num'
]
=
date
(
'Ymd'
)
.
substr
(
implode
(
NULL
,
array_map
(
'ord'
,
str_split
(
substr
(
uniqid
(),
7
,
13
),
1
))),
0
,
8
);
if
(
$this
->
dataLimit
&&
$this
->
dataLimitFieldAutoFill
)
{
$params
[
$this
->
dataLimitField
]
=
$this
->
auth
->
id
;
}
...
...
@@ -75,6 +116,71 @@ class Iphoneorder 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"
);
$user
=
Db
::
name
(
'user'
)
->
where
(
'id'
,
$params
[
'user_id'
])
->
find
();
//已经支付
if
(
$params
[
'status'
]
==
2
){
//判断金额
if
(
$params
[
'money'
]
>=
8000
){
$update
[
'is_vip'
]
=
1
;
$update
[
'money'
]
=
$user
[
'money'
]
+
$params
[
'money'
];
}
else
{
$update
[
'money'
]
=
$user
[
'money'
]
+
$params
[
'money'
];
}
Db
::
name
(
'user'
)
->
where
(
'id'
,
$user
[
'id'
])
->
update
(
$update
);
}
if
(
$params
)
{
$params
=
$this
->
preExcludeFields
(
$params
);
$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
);
}
$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/iphoneorder/edit.html
查看文件 @
8e2484a
...
...
@@ -13,7 +13,7 @@
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('
Status
')}:
</label>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('
支付状态
')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
{:build_radios('row[status]', ['1'=>'待支付', '2'=>'已支付'],$row.status)}
</div>
...
...
public/assets/js/backend/iphoneorder.js
查看文件 @
8e2484a
...
...
@@ -26,11 +26,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{
checkbox
:
true
},
{
field
:
'id'
,
title
:
__
(
'Id'
)},
{
field
:
'user_id'
,
title
:
__
(
'User_id'
)},
{
field
:
'user_phone'
,
title
:
__
(
'用户手机号'
)},
{
field
:
'money'
,
title
:
__
(
'Money'
),
operate
:
'BETWEEN'
},
{
field
:
'status'
,
title
:
__
(
'支付状态'
),
searchList
:
{
"1"
:
""
,
"2"
:
'已支付'
},
formatter
:
Table
.
api
.
formatter
.
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
},
//
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{
field
:
'operate'
,
title
:
__
(
'Operate'
),
table
:
table
,
events
:
Table
.
api
.
events
.
operate
,
formatter
:
Table
.
api
.
formatter
.
operate
}
]
]
...
...
请
注册
或
登录
后发表评论