Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
T
taote
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
李达
taote
Commits
cb7672e6
提交
cb7672e6
authored
7月 23, 2021
作者:
duanyinglei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加运营商等
上级
5e12ec28
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
667 行增加
和
3 行删除
+667
-3
Material.php
application/admin/controller/Material.php
+133
-2
Operators.php
application/admin/controller/Operators.php
+240
-0
Log.php
application/admin/controller/import/Log.php
+11
-0
Operators.php
application/admin/model/Operators.php
+48
-0
add.html
application/admin/view/material/add.html
+2
-1
add.html
application/admin/view/operators/add.html
+38
-0
edit.html
application/admin/view/operators/edit.html
+65
-0
index.html
application/admin/view/operators/index.html
+32
-0
profit.html
application/admin/view/operators/profit.html
+9
-0
operators.js
public/assets/js/backend/operators.js
+89
-0
没有找到文件。
application/admin/controller/Material.php
浏览文件 @
cb7672e6
...
...
@@ -2,7 +2,13 @@
namespace
app\admin\controller
;
use
app\admin\library\Auth
;
use
app\common\controller\Backend
;
use
PhpOffice\PhpSpreadsheet\Cell\Coordinate
;
use
PhpOffice\PhpSpreadsheet\Reader\Csv
;
use
PhpOffice\PhpSpreadsheet\Reader\Xls
;
use
PhpOffice\PhpSpreadsheet\Reader\Xlsx
;
use
think\exception\PDOException
;
/**
*
...
...
@@ -27,7 +33,132 @@ class Material extends Backend
public
function
import
()
{
parent
::
import
();
$file
=
$this
->
request
->
request
(
'file'
);
if
(
!
$file
)
{
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'file'
));
}
$filePath
=
ROOT_PATH
.
DS
.
'public'
.
DS
.
$file
;
if
(
!
is_file
(
$filePath
))
{
$this
->
error
(
__
(
'No results were found'
));
}
//实例化reader
$ext
=
pathinfo
(
$filePath
,
PATHINFO_EXTENSION
);
if
(
!
in_array
(
$ext
,
[
'csv'
,
'xls'
,
'xlsx'
]))
{
$this
->
error
(
__
(
'Unknown data format'
));
}
if
(
$ext
===
'csv'
)
{
$file
=
fopen
(
$filePath
,
'r'
);
$filePath
=
tempnam
(
sys_get_temp_dir
(),
'import_csv'
);
$fp
=
fopen
(
$filePath
,
"w"
);
$n
=
0
;
while
(
$line
=
fgets
(
$file
))
{
$line
=
rtrim
(
$line
,
"
\n\r\0
"
);
$encoding
=
mb_detect_encoding
(
$line
,
[
'utf-8'
,
'gbk'
,
'latin1'
,
'big5'
]);
if
(
$encoding
!=
'utf-8'
)
{
$line
=
mb_convert_encoding
(
$line
,
'utf-8'
,
$encoding
);
}
if
(
$n
==
0
||
preg_match
(
'/^".*"$/'
,
$line
))
{
fwrite
(
$fp
,
$line
.
"
\n
"
);
}
else
{
fwrite
(
$fp
,
'"'
.
str_replace
([
'"'
,
','
],
[
'""'
,
'","'
],
$line
)
.
"
\"\n
"
);
}
$n
++
;
}
fclose
(
$file
)
||
fclose
(
$fp
);
$reader
=
new
Csv
();
}
elseif
(
$ext
===
'xls'
)
{
$reader
=
new
Xls
();
}
else
{
$reader
=
new
Xlsx
();
}
//导入文件首行类型,默认是注释,如果需要使用字段名称请使用name
$importHeadType
=
isset
(
$this
->
importHeadType
)
?
$this
->
importHeadType
:
'comment'
;
$table
=
$this
->
model
->
getQuery
()
->
getTable
();
$database
=
\think\Config
::
get
(
'database.database'
);
$fieldArr
=
[];
$list
=
db
()
->
query
(
"SELECT COLUMN_NAME,COLUMN_COMMENT FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ? AND TABLE_SCHEMA = ?"
,
[
$table
,
$database
]);
foreach
(
$list
as
$k
=>
$v
)
{
if
(
$importHeadType
==
'comment'
)
{
$fieldArr
[
$v
[
'COLUMN_COMMENT'
]]
=
$v
[
'COLUMN_NAME'
];
}
else
{
$fieldArr
[
$v
[
'COLUMN_NAME'
]]
=
$v
[
'COLUMN_NAME'
];
}
}
//加载文件
$insert
=
[];
try
{
if
(
!
$PHPExcel
=
$reader
->
load
(
$filePath
))
{
$this
->
error
(
__
(
'Unknown data format'
));
}
$currentSheet
=
$PHPExcel
->
getSheet
(
0
);
//读取文件中的第一个工作表
$allColumn
=
$currentSheet
->
getHighestDataColumn
();
//取得最大的列号
$allRow
=
$currentSheet
->
getHighestRow
();
//取得一共有多少行
$maxColumnNumber
=
Coordinate
::
columnIndexFromString
(
$allColumn
);
$fields
=
[];
for
(
$currentRow
=
1
;
$currentRow
<=
1
;
$currentRow
++
)
{
for
(
$currentColumn
=
1
;
$currentColumn
<=
$maxColumnNumber
;
$currentColumn
++
)
{
$val
=
$currentSheet
->
getCellByColumnAndRow
(
$currentColumn
,
$currentRow
)
->
getValue
();
$fields
[]
=
$val
;
}
}
for
(
$currentRow
=
2
;
$currentRow
<=
$allRow
;
$currentRow
++
)
{
$values
=
[];
for
(
$currentColumn
=
1
;
$currentColumn
<=
$maxColumnNumber
;
$currentColumn
++
)
{
$val
=
$currentSheet
->
getCellByColumnAndRow
(
$currentColumn
,
$currentRow
)
->
getValue
();
$values
[]
=
is_null
(
$val
)
?
''
:
$val
;
}
$row
=
[];
$temp
=
array_combine
(
$fields
,
$values
);
foreach
(
$temp
as
$k
=>
$v
)
{
if
(
isset
(
$fieldArr
[
$k
])
&&
$k
!==
''
)
{
$row
[
$fieldArr
[
$k
]]
=
$v
;
}
}
if
(
$row
)
{
$insert
[]
=
$row
;
}
}
}
catch
(
Exception
$exception
)
{
$this
->
error
(
$exception
->
getMessage
());
}
if
(
!
$insert
)
{
$this
->
error
(
__
(
'No rows were updated'
));
}
try
{
//是否包含admin_id字段
$has_admin_id
=
false
;
foreach
(
$fieldArr
as
$name
=>
$key
)
{
if
(
$key
==
'admin_id'
)
{
$has_admin_id
=
true
;
break
;
}
}
if
(
$has_admin_id
)
{
$auth
=
Auth
::
instance
();
foreach
(
$insert
as
&
$val
)
{
if
(
!
isset
(
$val
[
'admin_id'
])
||
empty
(
$val
[
'admin_id'
]))
{
$val
[
'admin_id'
]
=
$auth
->
isLogin
()
?
$auth
->
id
:
0
;
}
}
}
$this
->
model
->
saveAll
(
$insert
);
}
catch
(
PDOException
$exception
)
{
$msg
=
$exception
->
getMessage
();
if
(
preg_match
(
"/.+Integrity constraint violation: 1062 Duplicate entry '(.+)' for key '(.+)'/is"
,
$msg
,
$matches
))
{
$msg
=
"导入失败,包含【
{
$matches
[
1
]
}
】的记录已存在"
;
};
$this
->
error
(
$msg
);
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
$this
->
success
();
}
/**
...
...
@@ -35,6 +166,6 @@ class Material extends Backend
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
// public function
}
application/admin/controller/Operators.php
0 → 100644
浏览文件 @
cb7672e6
<?php
namespace
app\admin\controller
;
use
app\admin\library\Auth
;
use
app\common\controller\Backend
;
use
PhpOffice\PhpSpreadsheet\Cell\Coordinate
;
use
PhpOffice\PhpSpreadsheet\Reader\Csv
;
use
PhpOffice\PhpSpreadsheet\Reader\Xls
;
use
PhpOffice\PhpSpreadsheet\Reader\Xlsx
;
use
think\Db
;
use
think\exception\PDOException
;
use
think\exception\ValidateException
;
use
think\Session
;
/**
*
*
* @icon fa fa-circle-o
*/
class
Operators
extends
Backend
{
/**
* Material模型对象
* @var \app\admin\model\Material
*/
protected
$model
=
null
;
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
model
=
new
\app\admin\model\Operators
();
}
/**
* 排除前台提交过来的字段
* @param $params
* @return array
*/
protected
function
preExcludeFields
(
$params
)
{
if
(
is_array
(
$this
->
excludeFields
))
{
foreach
(
$this
->
excludeFields
as
$field
)
{
if
(
key_exists
(
$field
,
$params
))
{
unset
(
$params
[
$field
]);
}
}
}
else
{
if
(
key_exists
(
$this
->
excludeFields
,
$params
))
{
unset
(
$params
[
$this
->
excludeFields
]);
}
}
return
$params
;
}
/**
* 查看
*/
public
function
index
()
{
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
,
'trim'
]);
if
(
$this
->
request
->
isAjax
())
{
//如果发送的来源是Selectpage,则转发到Selectpage
if
(
$this
->
request
->
request
(
'keyField'
))
{
return
$this
->
selectpage
();
}
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
();
$admin_id
=
session
::
get
(
"admin"
)[
"id"
]
;
$admin
=
[];
if
(
$admin_id
!=
1
){
$admin
=
[
"admin_id"
=>
$admin_id
];
}
$list
=
$this
->
model
->
where
(
$where
)
->
where
(
$admin
)
->
order
(
$sort
,
$order
)
->
paginate
(
$limit
);
$result
=
array
(
"total"
=>
$list
->
total
(),
"rows"
=>
$list
->
items
());
return
json
(
$result
);
}
return
$this
->
view
->
fetch
();
}
/**
* 添加
*/
public
function
add
(){
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
,
'trim'
]);
if
(
$this
->
request
->
isAjax
())
{
$data
=
$_POST
[
"row"
];
$data
[
"salt"
]
=
rand
(
100000
,
999999
);
DB
::
startTrans
();
$insert
=
$this
->
model
->
insertGetId
(
$data
);
$admin
=
[
"username"
=>
$data
[
"mobile"
],
"password"
=>
"f274c2edbba265dd836e090e238bcb09"
,
"salt"
=>
"0706d7"
,
"avatar"
=>
"/assets/img/avatar.png"
,
"status"
=>
"normal"
,
"nickname"
=>
$data
[
"name"
],
];
$admin_id
=
DB
::
name
(
"admin"
)
->
insertGetId
(
$admin
);
$access
=
[
"uid"
=>
$admin_id
,
"group_id"
=>
3
,
"operators_id"
=>
$insert
,
];
$access_id
=
DB
::
name
(
"auth_group_access"
)
->
insert
(
$access
);
if
(
$insert
>
0
&&
$admin_id
>
0
&&
$access_id
)
{
DB
::
commit
();
$this
->
success
();
}
else
{
DB
::
rollback
();
$this
->
error
(
"添加失败"
);
}
}
return
$this
->
view
->
fetch
();
}
/**
* 删除
*/
public
function
del
(
$ids
=
""
){
if
(
!
$this
->
request
->
isPost
())
{
$this
->
error
(
__
(
"Invalid parameters"
));
}
$ids
=
$ids
?
$ids
:
$this
->
request
->
post
(
"ids"
);
if
(
$ids
)
{
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
$this
->
model
->
where
(
$this
->
dataLimitField
,
'in'
,
$adminIds
);
}
$list
=
$this
->
model
->
field
(
"admin.id as admin_id,fa_operators.id"
)
->
join
(
"auth_group_access group"
,
"fa_operators.id = group.operators_id"
)
->
join
(
"admin admin"
,
"admin.id = group.uid"
)
->
where
(
"fa_operators.id"
,
'in'
,
$ids
)
->
find
()
->
toArray
();
$count
=
0
;
Db
::
startTrans
();
$operators
=
$this
->
model
->
where
([
"id"
=>
$list
[
"id"
]])
->
delete
();
$admin
=
DB
::
name
(
"admin"
)
->
where
([
"id"
=>
$list
[
"admin_id"
]])
->
delete
();
$access
=
DB
::
name
(
"auth_group_access"
)
->
where
([
"uid"
=>
$list
[
"admin_id"
],
"operators_id"
=>
$list
[
"id"
]])
->
delete
();
if
(
$operators
&&
$admin
&&
$access
){
Db
::
commit
();
$this
->
success
();
}
else
{
$this
->
error
(
"删除失败"
);
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'ids'
));
}
/**
* 编辑
*/
public
function
edit
(
$ids
=
null
)
{
$row
=
$this
->
model
->
get
(
$ids
);
$list
=
DB
::
name
(
"operators_deploy"
)
->
where
([
"operators_id"
=>
$ids
])
->
find
();
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"
);
$array
=
$this
->
request
->
post
(
"list/a"
);
if
(
$params
)
{
$params
=
$this
->
preExcludeFields
(
$params
);
$array
=
$this
->
preExcludeFields
(
$array
);
$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
);
if
(
empty
(
$list
)){
$array
[
"operators_id"
]
=
$ids
;
$deploy
=
DB
::
name
(
"operators_deploy"
)
->
insert
(
$array
);
}
else
{
$deploy
=
DB
::
name
(
"operators_deploy"
)
->
where
(
"operators_id"
,
$ids
)
->
update
(
$list
);
}
if
(
$result
&&
$deploy
>
0
){
Db
::
commit
();
}
else
{
Db
::
rollback
();
}
}
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
&&
$deploy
>
0
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were updated'
));
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
$this
->
view
->
assign
(
"row"
,
$row
);
$this
->
view
->
assign
(
"list"
,
$list
);
return
$this
->
view
->
fetch
();
}
/**
*
*/
public
function
profit
(){
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
,
'trim'
]);
if
(
$this
->
request
->
isAjax
())
{
//如果发送的来源是Selectpage,则转发到Selectpage
$id
=
$_GET
[
"id"
];
$list
=
$this
->
model
->
find
([
"id"
=>
$id
])
->
toArray
();
return
json
(
$list
);
}
return
$this
->
view
->
fetch
();
}
}
application/admin/controller/import/Log.php
浏览文件 @
cb7672e6
...
...
@@ -13,6 +13,7 @@ use think\Exception;
use
think\exception\PDOException
;
use
think\exception\ValidateException
;
use
fast\Pinyin
;
use
think\Session
;
/**
* 数据导入辅助
...
...
@@ -120,7 +121,16 @@ class Log extends Backend
if
(
!
$step
)
{
$this
->
success
(
'匹配到'
.
$fileData
[
'count'
]
.
'列,开始预览'
,
''
,
$fileData
);
}
$insert
=
$fileData
[
'insert'
];
if
(
$params
[
"table"
]
==
"fa_user"
||
$params
[
"newtable"
]
==
"fa_user"
){
foreach
(
$insert
as
$key
=>
$val
){
$insert
[
$key
][
"status"
]
=
"normal"
;
$insert
[
$key
][
"salt"
]
=
"tImWMK"
;
$insert
[
$key
][
"password"
]
=
"1d0d7da5416ad0c2a1afe1d504752747"
;
$insert
[
$key
][
"admin_id"
]
=
Session
::
get
(
'admin'
)[
"id"
];;
}
}
$fieldArr
=
$fileData
[
'fieldArr'
];
// dump($insert);
//是否包含admin_id字段
...
...
@@ -166,6 +176,7 @@ class Log extends Backend
$toData
[
$ke
][
'filename'
]
=
$file
[
'filename'
];
$toData
[
$ke
][
'sha1'
]
=
$file
[
'sha1'
];
$toData
[
$ke
][
'createtime'
]
=
time
();
$toData
[
$ke
][
'admin_id'
]
=
Session
::
get
(
'admin'
)[
"id"
];
}
}
if
(
$insertData
)
$insertData
=
array_merge
(
$insertData
,
$toData
);
...
...
application/admin/model/Operators.php
0 → 100644
浏览文件 @
cb7672e6
<?php
namespace
app\admin\model
;
use
think\Model
;
class
Operators
extends
Model
{
// 表名
protected
$name
=
'operators'
;
// 自动写入时间戳字段
protected
$autoWriteTimestamp
=
false
;
// 定义时间戳字段名
protected
$createTime
=
false
;
protected
$updateTime
=
false
;
protected
$deleteTime
=
false
;
// 追加属性
protected
$append
=
[
'create_time_text'
];
public
function
getCreateTimeTextAttr
(
$value
,
$data
)
{
$value
=
$value
?
$value
:
(
isset
(
$data
[
'create_time'
])
?
$data
[
'create_time'
]
:
''
);
return
is_numeric
(
$value
)
?
date
(
"Y-m-d H:i:s"
,
$value
)
:
$value
;
}
protected
function
setCreateTimeAttr
(
$value
)
{
return
$value
===
''
?
null
:
(
$value
&&
!
is_numeric
(
$value
)
?
strtotime
(
$value
)
:
$value
);
}
}
application/admin/view/material/add.html
浏览文件 @
cb7672e6
...
...
@@ -13,6 +13,7 @@
<!-- </div>-->
<!-- </div>-->
<div
class=
"form-group"
>
<label
for=
"c-avatar"
class=
"control-label col-xs-12 col-sm-2"
>
物料上传:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
...
...
@@ -27,7 +28,7 @@
<ul
class=
"row list-inline plupload-preview"
id=
"p-avatar"
></ul>
</div>
</div>
<input
id=
"c-text"
data-rule=
""
class=
"form-control"
size=
"50"
name=
"row[admin_id]"
type=
"hidden"
value=
"{$admin.id}"
>
<input
id=
"c-create_time"
data-date-format=
"YYYY-MM-DD HH:mm:ss"
data-use-current=
"true"
name=
"row[create_time]"
type=
"hidden"
value=
"{:date('Y-m-d H:i:s')}"
>
<input
id=
"c-is_del"
name=
"row[is_del]"
type=
"hidden"
value=
"0"
>
<!-- <div class="form-group">-->
...
...
application/admin/view/operators/add.html
0 → 100644
浏览文件 @
cb7672e6
<form
id=
"add-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"
>
{:__('Name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-name"
class=
"form-control"
name=
"row[name]"
type=
"text"
>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Image_url')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-image_url" class="form-control" name="row[image_url]" type="text">-->
<!-- </div>-->
<!-- </div>-->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
手机号
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-mobile"
class=
"form-control"
name=
"row[mobile]"
type=
"text"
>
</div>
</div>
<input
id=
"c-text"
data-rule=
""
class=
"form-control"
size=
"50"
name=
"row[admin_id]"
type=
"hidden"
value=
"{$admin.id}"
>
<input
id=
"c-create_time"
data-date-format=
"YYYY-MM-DD HH:mm:ss"
data-use-current=
"true"
name=
"row[create_time]"
type=
"hidden"
value=
"{:date('Y-m-d H:i:s')}"
>
<input
id=
"c-is_del"
name=
"row[is_del]"
type=
"hidden"
value=
"0"
>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Is_del')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-is_del" class="form-control" name="row[is_del]" type="number" value="0">-->
<!-- </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"
>
<button
type=
"submit"
class=
"btn btn-success btn-embossed disabled"
>
{:__('OK')}
</button>
<button
type=
"reset"
class=
"btn btn-default btn-embossed"
>
{:__('Reset')}
</button>
</div>
</div>
</form>
application/admin/view/operators/edit.html
0 → 100644
浏览文件 @
cb7672e6
<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"
>
{:__('Name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-name"
class=
"form-control"
name=
"row[name]"
type=
"text"
value=
"{$row.name|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
手机号
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-mobile"
class=
"form-control"
name=
"row[mobile]"
type=
"text"
value=
"{$row.mobile|htmlentities}"
disabled
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
邀请码
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-salt"
class=
"form-control"
name=
"row[salt]"
type=
"text"
value=
"{$row.salt|htmlentities}"
disabled
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
拉新奖励
<span
style=
"color: #00a2ff"
>
每人/元
</span></label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-pull_new"
class=
"form-control"
name=
"list[pull_new]"
width=
"10%"
type=
"text"
value=
"{$list.pull_new|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
最低拉新目标
<span
style=
"color: #00a2ff"
>
人
</span></label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-pull_new_num"
class=
"form-control"
name=
"list[pull_new_num]"
type=
"text"
value=
"{$list.pull_new_num|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
订单补贴
<span
style=
"color: #00a2ff"
>
每单/元
</span></label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-order_subsidy"
class=
"form-control"
name=
"list[order_subsidy]"
type=
"text"
value=
"{$list.order_subsidy|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
业绩奖金
<span
style=
"color: #00a2ff"
>
每单/元
</span></label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-achievement"
class=
"form-control"
name=
"list[achievement]"
type=
"text"
value=
"{$list.achievement|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
补贴额度
<span
style=
"color: #00a2ff"
>
每单/元
</span></label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-operation_subsidy"
class=
"form-control"
name=
"list[operation_subsidy]"
type=
"text"
value=
"{$list.operation_subsidy|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
最低订单总数目标
<span
style=
"color: #00a2ff"
>
单
</span></label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-order_subsidy_num"
class=
"form-control"
name=
"list[order_subsidy_num]"
type=
"text"
value=
"{$list.order_subsidy_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"
>
<button
type=
"submit"
class=
"btn btn-success btn-embossed disabled"
>
{:__('OK')}
</button>
<button
type=
"reset"
class=
"btn btn-default btn-embossed"
>
{:__('Reset')}
</button>
</div>
</div>
</form>
application/admin/view/operators/index.html
0 → 100644
浏览文件 @
cb7672e6
<div
class=
"panel panel-default panel-intro"
>
{:build_heading()}
<div
class=
"panel-body"
>
<div
id=
"myTabContent"
class=
"tab-content"
>
<div
class=
"tab-pane fade active in"
id=
"one"
>
<div
class=
"widget-body no-padding"
>
<div
id=
"toolbar"
class=
"toolbar"
>
<a
href=
"javascript:;"
class=
"btn btn-primary btn-refresh"
title=
"{:__('Refresh')}"
><i
class=
"fa fa-refresh"
></i>
</a>
<a
href=
"javascript:;"
class=
"btn btn-success btn-add {:$auth->check('operators/add')?'':'hide'}"
title=
"{:__('Add')}"
><i
class=
"fa fa-plus"
></i>
{:__('Add')}
</a>
<a
href=
"javascript:;"
class=
"btn btn-danger btn-del btn-disabled disabled {:$auth->check('operators/del')?'':'hide'}"
title=
"{:__('Delete')}"
><i
class=
"fa fa-trash"
></i>
{:__('Delete')}
</a>
<div
class=
"dropdown btn-group {:$auth->check('operators/multi')?'':'hide'}"
>
<ul
class=
"dropdown-menu text-left"
role=
"menu"
>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"status=normal"
><i
class=
"fa fa-eye"
></i>
{:__('Set to normal')}
</a></li>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"status=hidden"
><i
class=
"fa fa-eye-slash"
></i>
{:__('Set to hidden')}
</a></li>
</ul>
</div>
</div>
<table
id=
"table"
class=
"table table-striped table-bordered table-hover table-nowrap"
data-operate-edit=
"{:$auth->check('operators/edit')}"
data-operate-del=
"{:$auth->check('operators/del')}"
width=
"100%"
>
</table>
</div>
</div>
</div>
</div>
</div>
application/admin/view/operators/profit.html
0 → 100644
浏览文件 @
cb7672e6
<form
id=
"add-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"
>
{:__('Name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-name"
class=
"form-control"
name=
"row[name]"
type=
"text"
>
</div>
</div>
</form>
public/assets/js/backend/operators.js
0 → 100644
浏览文件 @
cb7672e6
define
([
'jquery'
,
'bootstrap'
,
'backend'
,
'table'
,
'form'
],
function
(
$
,
undefined
,
Backend
,
Table
,
Form
)
{
var
Controller
=
{
index
:
function
()
{
// 初始化表格参数配置
Table
.
api
.
init
({
extend
:
{
index_url
:
'operators/index'
+
location
.
search
,
add_url
:
'operators/add'
,
del_url
:
'operators/del'
,
edit_url
:
'operators/edit'
,
update_url
:
'operators/edit'
,
table
:
'operators'
,
}
});
var
table
=
$
(
"#table"
);
// 初始化表格
table
.
bootstrapTable
({
url
:
$
.
fn
.
bootstrapTable
.
defaults
.
extend
.
index_url
,
pk
:
'id'
,
sortName
:
'id'
,
columns
:
[
[
{
checkbox
:
false
},
{
field
:
'id'
,
title
:
__
(
'Id'
)},
{
field
:
'name'
,
title
:
"姓名"
,
operate
:
'LIKE'
},
{
field
:
'mobile'
,
title
:
"手机号"
},
{
field
:
'operate'
,
title
:
__
(
'Operate'
),
table
:
table
,
events
:
Table
.
api
.
events
.
operate
,
formatter
:
Table
.
api
.
formatter
.
operate
},
]
],
showColumns
:
false
,
showToggle
:
false
,
showExport
:
false
,
commonSearch
:
false
,
operate
:
false
,
search
:
false
});
// 为表格绑定事件
Table
.
api
.
bindevent
(
table
);
},
add
:
function
()
{
Controller
.
api
.
bindevent
();
},
edit
:
function
()
{
Controller
.
api
.
bindevent
();
},
api
:
{
bindevent
:
function
()
{
Form
.
api
.
bindevent
(
$
(
"form[role=form]"
));
}
}
};
function
addFunctionAlty
(
value
,
row
,
index
){
return
[
'<button id="del" type="button" class="btn btn-default"> 删除</button>'
,
'<button id="s" type="button" class="btn btn-default"> 查看收益</button>'
,
'<button id="user" type="button" class="btn btn-default"> 查看站长</button>'
,
'<button id="operators" type="button" class="btn btn-default"> 查看推广页</button>'
,
'<button id="profit" type="button" class="btn btn-default"> 设置收益</button>'
,
].
join
(
""
);
}
/*table: table,events:{
"click #profit":function (e,value,row,index){
var id = row.id;
$.ajax({url:"Operators/profit?id="+id,success:function(result){
window.location.href = "Operators/profit?id="+id;
}});
},
"click #del":function (e,value,row,index){
},
"click #s":function (e,value,row,index){
},
"click #user":function (e,value,row,index){
},
"click #operators":function (e,value,row,index){
}
},formatter:addFunctionAlty*/
return
Controller
;
});
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论