切换导航条
此项目
正在载入...
登录
景龙
/
feipin
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
景龙
6 years ago
提交
79ddbafb318240dc675b6c4fd70c5e44ae8d99d4
1 个父辈
b6ddea66
1 个管道 的构建
通过
耗费 10 秒
增加提交废品表单审核通过之后增加积分
变更
7
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
7 个修改的文件
包含
107 行增加
和
5 行删除
application/admin/controller/Porder.php
application/admin/controller/Sell.php
application/admin/lang/zh-cn.php
application/admin/lang/zh-cn/sell.php
application/api/controller/Sell.php
public/assets/js/backend/porder.js
public/assets/js/backend/sell.js
application/admin/controller/Porder.php
查看文件 @
79ddbaf
...
...
@@ -108,12 +108,14 @@ class Porder extends Backend
if
(
$ids
)
{
$pk
=
$this
->
model
->
getPk
();
$res
=
$this
->
model
->
where
(
$pk
,
'='
,
$ids
)
->
find
();
Db
::
startTrans
();
if
(
$res
[
'is_due'
]
==
0
)
{
$data
=
$this
->
model
->
where
(
$pk
,
'='
,
$ids
)
->
find
();
$userModel
=
new
User
();
$money
=
(
1
-
$this
->
percent
)
*
$data
[
'total_price'
];
//用户账户增加余额
$result
=
$userModel
->
where
([
'id'
=>
$data
[
's_uid'
],
'status'
=>
'normal'
])
->
setInc
(
'money'
,
$money
);
//平台账户增加余额
$platformModel
=
new
Platform
();
$account_balance
=
$this
->
percent
*
$data
[
'total_price'
];
...
...
@@ -121,8 +123,10 @@ class Porder extends Backend
//订单更新扣取费用字段
$result2
=
$this
->
model
->
where
(
$pk
,
'='
,
$ids
)
->
update
([
'is_due'
=>
1
]);
if
(
$result
&&
$result1
&&
$result2
){
Db
::
commit
();
$this
->
success
(
'扣取成功'
);
}
else
{
Db
::
rollback
();
$this
->
error
(
'扣取失败'
);
}
}
else
{
...
...
application/admin/controller/Sell.php
查看文件 @
79ddbaf
...
...
@@ -3,7 +3,8 @@
namespace
app\admin\controller
;
use
app\common\controller\Backend
;
use
app\admin\model\User
;
use
think\Db
;
/**
* 卖废品管理
*
...
...
@@ -74,4 +75,44 @@ class Sell extends Backend
}
return
$this
->
view
->
fetch
();
}
//审核通过
public
function
adopt
(
$ids
){
if
(
$ids
)
{
$pk
=
$this
->
model
->
getPk
();
$result2
=
$this
->
model
->
where
(
$pk
,
'='
,
$ids
)
->
update
([
'status'
=>
1
]);
//给自己增加积分
$data
=
$this
->
model
->
where
(
$pk
,
'='
,
$ids
)
->
find
();
$userModel
=
new
User
();
$scoreRule
=
Db
::
name
(
'score'
)
->
where
(
'set_rule'
,
'like'
,
'%卖废品%'
)
->
field
(
'set_score'
)
->
find
();
$score
=
0
;
if
(
$scoreRule
)
{
$score
=
$scoreRule
[
'set_score'
];
}
$result
=
$userModel
->
where
([
'id'
=>
$data
[
'uid'
],
'status'
=>
'normal'
])
->
setInc
(
'score'
,
$score
);
if
(
$result2
&&
$result
)
{
$this
->
success
(
'成功'
);
}
else
{
$this
->
error
(
'失败'
);
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'ids'
));
}
//审核驳回
public
function
reject
(
$ids
){
if
(
$ids
)
{
$pk
=
$this
->
model
->
getPk
();
$result2
=
$this
->
model
->
where
(
$pk
,
'='
,
$ids
)
->
update
([
'status'
=>
2
]);
if
(
$result2
)
{
$this
->
success
(
'成功'
);
}
else
{
$this
->
error
(
'失败'
);
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'ids'
));
}
}
...
...
application/admin/lang/zh-cn.php
查看文件 @
79ddbaf
...
...
@@ -66,6 +66,9 @@ return [
'pre_list'
=>
'预约单'
,
'purchase'
=>
'购买'
,
'in_audit'
=>
'审核中'
,
'adopt'
=>
'通过'
,
'reject'
=>
'驳回'
,
'Locked'
=>
'锁定'
,
'Submit'
=>
'提交'
,
...
...
application/admin/lang/zh-cn/sell.php
查看文件 @
79ddbaf
...
...
@@ -8,6 +8,7 @@ return [
'Pre_time'
=>
'预约时间'
,
'Images'
=>
'废品图片'
,
'Description'
=>
'废品描述'
,
'status'
=>
'状态'
,
'Createtime'
=>
'创建时间'
,
'User.username'
=>
'用户名'
,
'User.avatar'
=>
'头像'
...
...
application/api/controller/Sell.php
查看文件 @
79ddbaf
...
...
@@ -62,8 +62,8 @@ class Sell extends Api
$data
[
'images'
]
=
$sell_data
[
'images'
];
$data
=
$sell
::
create
(
$data
);
//给自己增加积分
$data1
=
$person
->
getPersonScore
(
'person_sell'
);
if
(
$data
&&
$data1
){
// $data1 = $person->getPersonScore('person_sell');
if
(
$data
){
$this
->
success
(
'保存成功'
);
}
else
{
$this
->
error
(
'保存失败'
);
...
...
public/assets/js/backend/porder.js
查看文件 @
79ddbaf
...
...
@@ -45,11 +45,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
text
:
__
(
'完成'
),
title
:
__
(
'完成'
),
classname
:
'btn btn-xs btn-success btn-magic btn-ajax'
,
icon
:
'fa
fa-magic
'
,
icon
:
'fa'
,
url
:
'porder/finish'
,
confirm
:
'确认完成'
,
success
:
function
(
data
,
ret
)
{
Layer
.
alert
(
ret
.
msg
);
$
(
".btn-refresh"
).
trigger
(
"click"
);
//如果需要阻止成功提示,则必须使用return false;
//return false;
},
...
...
public/assets/js/backend/sell.js
查看文件 @
79ddbaf
...
...
@@ -31,8 +31,60 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{
field
:
'address'
,
title
:
__
(
'Address'
)},
{
field
:
'pre_date'
,
title
:
__
(
'Pre_date'
),
operate
:
'RANGE'
,
addclass
:
'datetimerange'
},
{
field
:
'pre_time'
,
title
:
__
(
'Pre_time'
)},
{
field
:
'status'
,
title
:
__
(
'status'
),
formatter
:
Table
.
api
.
formatter
.
flag
,
searchList
:
{
0
:
__
(
'in_audit'
),
1
:
__
(
'adopt'
),
2
:
__
(
'reject'
)}},
{
field
:
'createtime'
,
title
:
__
(
'Createtime'
),
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
}
{
field
:
'operate'
,
title
:
__
(
'Operate'
),
table
:
table
,
events
:
Table
.
api
.
events
.
operate
,
formatter
:
Table
.
api
.
formatter
.
operate
,
buttons
:
[
{
name
:
'ajax'
,
text
:
__
(
'通过'
),
title
:
__
(
'通过'
),
classname
:
'btn btn-xs btn-success btn-magic btn-ajax'
,
icon
:
'fa'
,
url
:
'sell/adopt'
,
confirm
:
'确认通过'
,
success
:
function
(
data
,
ret
)
{
Layer
.
alert
(
ret
.
msg
);
$
(
".btn-refresh"
).
trigger
(
"click"
);
//如果需要阻止成功提示,则必须使用return false;
//return false;
},
error
:
function
(
data
,
ret
)
{
Layer
.
alert
(
ret
.
msg
);
return
false
;
},
visible
:
function
(
row
)
{
if
(
row
.
status
==
1
){
return
false
;
//隐藏
}
else
{
return
true
;
}
}
},
{
name
:
'ajax'
,
text
:
__
(
'驳回'
),
title
:
__
(
'驳回'
),
classname
:
'btn btn-xs btn-danger btn-magic btn-ajax'
,
icon
:
'fa'
,
url
:
'sell/reject'
,
confirm
:
'确认驳回'
,
success
:
function
(
data
,
ret
)
{
Layer
.
alert
(
ret
.
msg
);
$
(
".btn-refresh"
).
trigger
(
"click"
);
//如果需要阻止成功提示,则必须使用return false;
//return false;
},
error
:
function
(
data
,
ret
)
{
Layer
.
alert
(
ret
.
msg
);
return
false
;
},
visible
:
function
(
row
)
{
if
(
row
.
status
==
2
){
return
false
;
//隐藏
}
else
{
return
true
;
}
}
}
]}
]
]
});
...
...
请
注册
或
登录
后发表评论