Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
T
taote
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
李达
taote
Commits
783fdbee
提交
783fdbee
authored
9月 01, 2021
作者:
caiwenxin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
初始化开发分支
上级
2ec9bc74
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
30 个修改的文件
包含
1213 行增加
和
41 行删除
+1213
-41
.gitignore
.gitignore
+2
-0
common.php
application/admin/common.php
+1
-1
TtCode.php
application/admin/controller/TtCode.php
+43
-0
TtEx.php
application/admin/controller/TtEx.php
+40
-0
TtLevelReward.php
application/admin/controller/TtLevelReward.php
+90
-1
tt_ex.php
application/admin/lang/zh-cn/tt_ex.php
+21
-0
Backend.php
application/admin/library/traits/Backend.php
+136
-0
TtEx.php
application/admin/model/TtEx.php
+74
-0
TtEx.php
application/admin/validate/TtEx.php
+27
-0
index.html
application/admin/view/tt_code/index.html
+2
-2
index.html
application/admin/view/tt_distribution/index.html
+2
-2
add.html
application/admin/view/tt_ex/add.html
+112
-0
edit.html
application/admin/view/tt_ex/edit.html
+112
-0
index.html
application/admin/view/tt_ex/index.html
+35
-0
edit.html
application/admin/view/tt_level_reward/edit.html
+2
-1
index.html
application/admin/view/tt_level_reward/index.html
+2
-2
Index.php
application/api/controller/Index.php
+3
-0
User.php
application/api/controller/User.php
+26
-6
common.php
application/common.php
+17
-0
Auth.php
application/common/library/Auth.php
+12
-8
TtCode.php
application/common/model/TtCode.php
+32
-0
TtDistribution.php
application/common/model/TtDistribution.php
+20
-0
TtLevelReward.php
application/common/model/TtLevelReward.php
+30
-0
User.php
application/common/model/User.php
+246
-1
User.php
application/index/controller/User.php
+1
-1
tt_code.js
public/assets/js/backend/tt_code.js
+17
-5
tt_distribution.js
public/assets/js/backend/tt_distribution.js
+22
-7
tt_ex.js
public/assets/js/backend/tt_ex.js
+67
-0
tt_level_reward.js
public/assets/js/backend/tt_level_reward.js
+19
-4
taote.zip
taote.zip
+0
-0
没有找到文件。
.gitignore
浏览文件 @
783fdbee
...
...
@@ -16,3 +16,5 @@ composer.lock
.svn
.vscode
node_modules
application/database.php
public/nginx.htaccess
application/admin/common.php
浏览文件 @
783fdbee
...
...
@@ -199,7 +199,7 @@ if (!function_exists('build_suffix_image')) {
/**
* 生成文件后缀图片
* @param string $suffix 后缀
* @param null
$background
* @param null $background
* @return string
*/
function
build_suffix_image
(
$suffix
,
$background
=
null
)
...
...
application/admin/controller/TtCode.php
浏览文件 @
783fdbee
...
...
@@ -18,6 +18,8 @@ class TtCode extends Backend
*/
protected
$model
=
null
;
protected
$noNeedRight
=
[
'admin_user'
];
public
function
_initialize
()
{
parent
::
_initialize
();
...
...
@@ -36,5 +38,46 @@ class TtCode extends Backend
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
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
();
$list
=
$this
->
model
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
paginate
(
$limit
);
foreach
(
$list
as
$key
=>
$value
)
{
$list
[
$key
][
'user_id'
]
=
\app\admin\model\User
::
where
(
'id'
,
$value
[
'user_id'
])
->
value
(
'nickname'
);
}
$result
=
array
(
"total"
=>
$list
->
total
(),
"rows"
=>
$list
->
items
());
return
json
(
$result
);
}
return
$this
->
view
->
fetch
();
}
/**
* 搜索下拉框
*/
public
function
admin_user
()
{
$user
=
\app\admin\model\User
::
select
();
$user
=
collection
(
$user
)
->
toArray
();
foreach
(
$user
as
$key
=>
$value
)
{
$user
[
$key
][
'name'
]
=
$value
[
'nickname'
];
}
return
$user
;
}
}
application/admin/controller/TtEx.php
0 → 100644
浏览文件 @
783fdbee
<?php
namespace
app\admin\controller
;
use
app\common\controller\Backend
;
/**
* 订单管理
*
* @icon fa fa-circle-o
*/
class
TtEx
extends
Backend
{
/**
* TtEx模型对象
* @var \app\admin\model\TtEx
*/
protected
$model
=
null
;
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
model
=
new
\app\admin\model\TtEx
;
}
public
function
import
()
{
parent
::
importOrder
();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}
application/admin/controller/TtLevelReward.php
浏览文件 @
783fdbee
...
...
@@ -3,7 +3,15 @@
namespace
app\admin\controller
;
use
app\common\controller\Backend
;
use
app\admin\library\Auth
;
use
Exception
;
use
PhpOffice\PhpSpreadsheet\Cell\Coordinate
;
use
PhpOffice\PhpSpreadsheet\Reader\Xlsx
;
use
PhpOffice\PhpSpreadsheet\Reader\Xls
;
use
PhpOffice\PhpSpreadsheet\Reader\Csv
;
use
think\Db
;
use
think\exception\PDOException
;
use
think\exception\ValidateException
;
/**
* 平级奖励
*
...
...
@@ -36,5 +44,86 @@ class TtLevelReward extends Backend
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
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
();
$list
=
$this
->
model
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
paginate
(
$limit
);
foreach
(
$list
as
$key
=>
$value
)
{
$list
[
$key
][
'group_id'
]
=
\app\admin\model\UserGroup
::
where
(
'id'
,
$value
[
'group_id'
])
->
value
(
'name'
);
}
$result
=
array
(
"total"
=>
$list
->
total
(),
"rows"
=>
$list
->
items
());
return
json
(
$result
);
}
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
);
$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
);
$this
->
view
->
assign
(
'group_id'
,
build_select
(
'row[group_id]'
,
\app\admin\model\UserGroup
::
column
(
'id,name'
),
$row
[
'group_id'
],
[
'class'
=>
'form-control selectpicker'
,
'disabled'
]));
return
$this
->
view
->
fetch
();
}
}
application/admin/lang/zh-cn/tt_ex.php
0 → 100644
浏览文件 @
783fdbee
<?php
return
[
'Order_id'
=>
'订单id'
,
'Enddate'
=>
'订单完结时间'
,
'Create_time'
=>
'订单创建时间'
,
'Pay_time'
=>
'订单支付时间'
,
'Refund_time'
=>
'退款申请时间'
,
'Channel_id'
=>
'一级渠道id'
,
'Channel_name'
=>
'一级渠道名称'
,
'Code_id'
=>
'推广者id'
,
'Real_money'
=>
'卖家实收金额'
,
'Shop_id'
=>
'商品id'
,
'Shop_name'
=>
'商品名称'
,
'Shop_price'
=>
'商品价格'
,
'Shop_quantity'
=>
'商品数量'
,
'Class_three_name'
=>
'下单日商品叶子类目名称'
,
'Class_two_name'
=>
'下单日商品一级类目名称'
,
'Class_name'
=>
'商品行业大组名称'
,
'Name'
=>
'名称'
];
application/admin/library/traits/Backend.php
浏览文件 @
783fdbee
...
...
@@ -479,4 +479,140 @@ trait Backend
$this
->
success
();
}
/**
* 导入订单
*/
protected
function
importOrder
()
{
$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
();
if
(
$currentColumn
==
1
){
$val
=
decimalNotation
(
$val
);
}
$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
();
}
}
application/admin/model/TtEx.php
0 → 100644
浏览文件 @
783fdbee
<?php
namespace
app\admin\model
;
use
think\Model
;
class
TtEx
extends
Model
{
// 表名
protected
$name
=
'tt_ex'
;
// 自动写入时间戳字段
protected
$autoWriteTimestamp
=
false
;
// 定义时间戳字段名
protected
$createTime
=
false
;
protected
$updateTime
=
false
;
protected
$deleteTime
=
false
;
// 追加属性
protected
$append
=
[
'create_time_text'
,
'pay_time_text'
,
'refund_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
;
}
public
function
getPayTimeTextAttr
(
$value
,
$data
)
{
$value
=
$value
?
$value
:
(
isset
(
$data
[
'pay_time'
])
?
$data
[
'pay_time'
]
:
''
);
return
is_numeric
(
$value
)
?
date
(
"Y-m-d H:i:s"
,
$value
)
:
$value
;
}
public
function
getRefundTimeTextAttr
(
$value
,
$data
)
{
$value
=
$value
?
$value
:
(
isset
(
$data
[
'refund_time'
])
?
$data
[
'refund_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
);
}
protected
function
setPayTimeAttr
(
$value
)
{
return
$value
===
''
?
null
:
(
$value
&&
!
is_numeric
(
$value
)
?
strtotime
(
$value
)
:
$value
);
}
protected
function
setRefundTimeAttr
(
$value
)
{
return
$value
===
''
?
null
:
(
$value
&&
!
is_numeric
(
$value
)
?
strtotime
(
$value
)
:
$value
);
}
}
application/admin/validate/TtEx.php
0 → 100644
浏览文件 @
783fdbee
<?php
namespace
app\admin\validate
;
use
think\Validate
;
class
TtEx
extends
Validate
{
/**
* 验证规则
*/
protected
$rule
=
[
];
/**
* 提示消息
*/
protected
$message
=
[
];
/**
* 验证场景
*/
protected
$scene
=
[
'add'
=>
[],
'edit'
=>
[],
];
}
application/admin/view/tt_code/index.html
浏览文件 @
783fdbee
...
...
@@ -17,7 +17,7 @@
<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('tt_code/add')?'':'hide'}"
title=
"{:__('Add')}"
><i
class=
"fa fa-plus"
></i>
{:__('Add')}
</a>
<
!-- <
a href="javascript:;" class="btn btn-success btn-add {:$auth->check('tt_code/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('tt_code/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('tt_code/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('tt_code/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>
...
...
@@ -28,7 +28,7 @@
<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>
-->
</div>
...
...
application/admin/view/tt_distribution/index.html
浏览文件 @
783fdbee
...
...
@@ -7,7 +7,7 @@
<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('tt_distribution/add')?'':'hide'}"
title=
"{:__('Add')}"
><i
class=
"fa fa-plus"
></i>
{:__('Add')}
</a>
<
!-- <
a href="javascript:;" class="btn btn-success btn-add {:$auth->check('tt_distribution/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('tt_distribution/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('tt_distribution/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('tt_distribution/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>
...
...
@@ -18,7 +18,7 @@
<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>
-->
</div>
...
...
application/admin/view/tt_ex/add.html
0 → 100644
浏览文件 @
783fdbee
<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"
>
{:__('Order_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-order_id"
data-rule=
"required"
data-source=
"order/index"
class=
"form-control selectpage"
name=
"row[order_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Enddate')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-enddate"
class=
"form-control"
name=
"row[enddate]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Create_time')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-create_time"
class=
"form-control datetimepicker"
data-date-format=
"YYYY-MM-DD HH:mm:ss"
data-use-current=
"true"
name=
"row[create_time]"
type=
"text"
value=
"{:date('Y-m-d H:i:s')}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Pay_time')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-pay_time"
class=
"form-control datetimepicker"
data-date-format=
"YYYY-MM-DD HH:mm:ss"
data-use-current=
"true"
name=
"row[pay_time]"
type=
"text"
value=
"{:date('Y-m-d H:i:s')}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Refund_time')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-refund_time"
class=
"form-control datetimepicker"
data-date-format=
"YYYY-MM-DD HH:mm:ss"
data-use-current=
"true"
name=
"row[refund_time]"
type=
"text"
value=
"{:date('Y-m-d H:i:s')}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Channel_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-channel_id"
data-rule=
"required"
data-source=
"channel/index"
class=
"form-control selectpage"
name=
"row[channel_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Channel_name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-channel_name"
class=
"form-control"
name=
"row[channel_name]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Code_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-code_id"
data-rule=
"required"
data-source=
"code/index"
class=
"form-control selectpage"
name=
"row[code_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Real_money')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-real_money"
class=
"form-control"
name=
"row[real_money]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Shop_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-shop_id"
data-rule=
"required"
data-source=
"shop/index"
class=
"form-control selectpage"
name=
"row[shop_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Shop_name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-shop_name"
class=
"form-control"
name=
"row[shop_name]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Shop_price')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-shop_price"
class=
"form-control"
name=
"row[shop_price]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Shop_quantity')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-shop_quantity"
class=
"form-control"
name=
"row[shop_quantity]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Class_three_name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-class_three_name"
class=
"form-control"
name=
"row[class_three_name]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Class_two_name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-class_two_name"
class=
"form-control"
name=
"row[class_two_name]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Class_name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-class_name"
class=
"form-control"
name=
"row[class_name]"
type=
"text"
value=
""
>
</div>
</div>
<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=
""
>
</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/tt_ex/edit.html
0 → 100644
浏览文件 @
783fdbee
<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"
>
{:__('Order_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-order_id"
data-rule=
"required"
data-source=
"order/index"
class=
"form-control selectpage"
name=
"row[order_id]"
type=
"text"
value=
"{$row.order_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Enddate')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-enddate"
class=
"form-control"
name=
"row[enddate]"
type=
"text"
value=
"{$row.enddate|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Create_time')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-create_time"
class=
"form-control datetimepicker"
data-date-format=
"YYYY-MM-DD HH:mm:ss"
data-use-current=
"true"
name=
"row[create_time]"
type=
"text"
value=
"{:$row.create_time?datetime($row.create_time):''}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Pay_time')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-pay_time"
class=
"form-control datetimepicker"
data-date-format=
"YYYY-MM-DD HH:mm:ss"
data-use-current=
"true"
name=
"row[pay_time]"
type=
"text"
value=
"{:$row.pay_time?datetime($row.pay_time):''}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Refund_time')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-refund_time"
class=
"form-control datetimepicker"
data-date-format=
"YYYY-MM-DD HH:mm:ss"
data-use-current=
"true"
name=
"row[refund_time]"
type=
"text"
value=
"{:$row.refund_time?datetime($row.refund_time):''}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Channel_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-channel_id"
data-rule=
"required"
data-source=
"channel/index"
class=
"form-control selectpage"
name=
"row[channel_id]"
type=
"text"
value=
"{$row.channel_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Channel_name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-channel_name"
class=
"form-control"
name=
"row[channel_name]"
type=
"text"
value=
"{$row.channel_name|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Code_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-code_id"
data-rule=
"required"
data-source=
"code/index"
class=
"form-control selectpage"
name=
"row[code_id]"
type=
"text"
value=
"{$row.code_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Real_money')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-real_money"
class=
"form-control"
name=
"row[real_money]"
type=
"text"
value=
"{$row.real_money|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Shop_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-shop_id"
data-rule=
"required"
data-source=
"shop/index"
class=
"form-control selectpage"
name=
"row[shop_id]"
type=
"text"
value=
"{$row.shop_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Shop_name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-shop_name"
class=
"form-control"
name=
"row[shop_name]"
type=
"text"
value=
"{$row.shop_name|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Shop_price')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-shop_price"
class=
"form-control"
name=
"row[shop_price]"
type=
"text"
value=
"{$row.shop_price|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Shop_quantity')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-shop_quantity"
class=
"form-control"
name=
"row[shop_quantity]"
type=
"text"
value=
"{$row.shop_quantity|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Class_three_name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-class_three_name"
class=
"form-control"
name=
"row[class_three_name]"
type=
"text"
value=
"{$row.class_three_name|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Class_two_name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-class_two_name"
class=
"form-control"
name=
"row[class_two_name]"
type=
"text"
value=
"{$row.class_two_name|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Class_name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-class_name"
class=
"form-control"
name=
"row[class_name]"
type=
"text"
value=
"{$row.class_name|htmlentities}"
>
</div>
</div>
<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 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/tt_ex/index.html
0 → 100644
浏览文件 @
783fdbee
<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('tt_ex/add')?'':'hide'}"
title=
"{:__('Add')}"
><i
class=
"fa fa-plus"
></i>
{:__('Add')}
</a>
<a
href=
"javascript:;"
class=
"btn btn-success btn-edit btn-disabled disabled {:$auth->check('tt_ex/edit')?'':'hide'}"
title=
"{:__('Edit')}"
><i
class=
"fa fa-pencil"
></i>
{:__('Edit')}
</a>
<a
href=
"javascript:;"
class=
"btn btn-danger btn-del btn-disabled disabled {:$auth->check('tt_ex/del')?'':'hide'}"
title=
"{:__('Delete')}"
><i
class=
"fa fa-trash"
></i>
{:__('Delete')}
</a>
<a
href=
"javascript:;"
class=
"btn btn-danger btn-import {:$auth->check('tt_ex/import')?'':'hide'}"
title=
"{:__('Import')}"
id=
"btn-import-file"
data-url=
"ajax/upload"
data-mimetype=
"csv,xls,xlsx"
data-multiple=
"false"
><i
class=
"fa fa-upload"
></i>
{:__('Import')}
</a>
<div
class=
"dropdown btn-group {:$auth->check('tt_ex/multi')?'':'hide'}"
>
<a
class=
"btn btn-primary btn-more dropdown-toggle btn-disabled disabled"
data-toggle=
"dropdown"
><i
class=
"fa fa-cog"
></i>
{:__('More')}
</a>
<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('tt_ex/edit')}"
data-operate-del=
"{:$auth->check('tt_ex/del')}"
width=
"100%"
>
</table>
</div>
</div>
</div>
</div>
</div>
application/admin/view/tt_level_reward/edit.html
浏览文件 @
783fdbee
...
...
@@ -3,7 +3,8 @@
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Group_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-group_id"
data-rule=
"required"
data-source=
"group/index"
class=
"form-control selectpage"
name=
"row[group_id]"
type=
"text"
value=
"{$row.group_id|htmlentities}"
>
{$group_id}
<!-- <input id="c-group_id" data-rule="required" data-source="group/index" class="form-control selectpage" name="row[group_id]" type="text" value="{$row.group_id|htmlentities}"> -->
</div>
</div>
<div
class=
"form-group"
>
...
...
application/admin/view/tt_level_reward/index.html
浏览文件 @
783fdbee
...
...
@@ -7,7 +7,7 @@
<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('tt_level_reward/add')?'':'hide'}"
title=
"{:__('Add')}"
><i
class=
"fa fa-plus"
></i>
{:__('Add')}
</a>
<
!-- <
a href="javascript:;" class="btn btn-success btn-add {:$auth->check('tt_level_reward/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('tt_level_reward/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('tt_level_reward/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('tt_level_reward/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>
...
...
@@ -18,7 +18,7 @@
<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>
-->
</div>
...
...
application/api/controller/Index.php
浏览文件 @
783fdbee
...
...
@@ -3,6 +3,7 @@
namespace
app\api\controller
;
use
app\common\controller\Api
;
use
app\common\model\User
;
/**
* 首页接口
...
...
@@ -20,4 +21,6 @@ class Index extends Api
{
$this
->
success
(
'请求成功'
);
}
}
application/api/controller/User.php
浏览文件 @
783fdbee
...
...
@@ -2,12 +2,12 @@
namespace
app\api\controller
;
use
app\admin\model\TtCode
;
use
app\common\controller\Api
;
use
app\common\library\Ems
;
use
app\common\library\Sms
;
use
fast\Random
;
use
think\Validate
;
/**
* 会员接口
*/
...
...
@@ -37,15 +37,27 @@ class User extends Api
*/
public
function
login
()
{
$account
=
$this
->
request
->
request
(
'
account
'
);
$account
=
$this
->
request
->
request
(
'
username
'
);
$password
=
$this
->
request
->
request
(
'password'
);
if
(
!
$account
||
!
$password
)
{
$this
->
error
(
__
(
'Invalid parameters'
));
}
$ret
=
$this
->
auth
->
login
(
$account
,
$password
);
$ret
=
$this
->
auth
->
login
(
$account
,
$password
,
\app\common\model\User
::
TYPE_TT
);
if
(
$ret
)
{
$data
=
[
'userinfo'
=>
$this
->
auth
->
getUserinfo
()];
$this
->
success
(
__
(
'Logged in successful'
),
$data
);
//检查并处理押金
$res
=
\app\common\model\User
::
depositChange
(
$data
[
'userinfo'
][
'id'
]);
switch
(
$res
[
'code'
]){
case
1
:
$this
->
success
(
__
(
'Logged in successful'
),
$data
);
break
;
case
2
:
$this
->
error
(
'登录失败,账户异常'
);
break
;
default
:
$this
->
error
(
'系统异常'
);
break
;
}
}
else
{
$this
->
error
(
$this
->
auth
->
getError
());
}
...
...
@@ -105,6 +117,7 @@ class User extends Api
$email
=
$this
->
request
->
request
(
'email'
);
$mobile
=
$this
->
request
->
request
(
'mobile'
);
$code
=
$this
->
request
->
request
(
'code'
);
$code_tt
=
$this
->
request
->
request
(
'code_tt'
);
if
(
!
$username
||
!
$password
)
{
$this
->
error
(
__
(
'Invalid parameters'
));
}
...
...
@@ -118,8 +131,13 @@ class User extends Api
if
(
!
$ret
)
{
$this
->
error
(
__
(
'Captcha is incorrect'
));
}
$ret
=
$this
->
auth
->
register
(
$username
,
$password
,
$email
,
$mobile
,
[]);
if
(
$ret
)
{
$ttCodeInfo
=
TtCode
::
where
(
'code'
,
$code_tt
)
->
where
(
'parent_id'
,
'>'
,
0
)
->
where
(
'status'
,
0
)
->
find
();
if
(
empty
(
$ttCodeInfo
)){
$this
->
error
(
'无效的站长码'
);
}
$ret
=
$this
->
auth
->
register
(
$username
,
$password
,
$email
,
$mobile
,
[],[],
$ttCodeInfo
[
'parent_id'
],
\app\common\model\User
::
TYPE_TT
);
$resMoney
=
\app\common\model\User
::
money
(
10
,
$ttCodeInfo
[
'parent_id'
],
'拉新注册'
);
if
(
$ret
&&
$resMoney
){
$data
=
[
'userinfo'
=>
$this
->
auth
->
getUserinfo
()];
$this
->
success
(
__
(
'Sign up successful'
),
$data
);
}
else
{
...
...
@@ -323,4 +341,6 @@ class User extends Api
$this
->
error
(
$this
->
auth
->
getError
());
}
}
}
application/common.php
浏览文件 @
783fdbee
...
...
@@ -478,3 +478,20 @@ if (!function_exists('check_ip_allowed')) {
}
}
}
if
(
!
function_exists
(
'decimalNotation'
)){
/*还原科学计数*/
function
decimalNotation
(
$num
)
{
$parts
=
explode
(
'E'
,
$num
);
if
(
count
(
$parts
)
!=
2
)
{
return
$num
;
}
$exp
=
abs
(
end
(
$parts
))
+
3
;
$decimal
=
number_format
(
$num
,
$exp
,
'.'
,
''
);
$decimal
=
rtrim
(
$decimal
,
'0'
);
return
rtrim
(
$decimal
,
'.'
);
}
}
\ No newline at end of file
application/common/library/Auth.php
浏览文件 @
783fdbee
...
...
@@ -131,23 +131,23 @@ class Auth
* @param array $extend 扩展参数
* @return boolean
*/
public
function
register
(
$username
,
$password
,
$email
=
''
,
$mobile
=
''
,
$popularizeId
=
''
,
$extend
=
[])
public
function
register
(
$username
,
$password
,
$email
=
''
,
$mobile
=
''
,
$popularizeId
=
''
,
$extend
=
[]
,
$parent_id
=
''
,
$type
=
User
::
TYPE_YNS
)
{
// 检测用户名、昵称、邮箱、手机号是否存在
if
(
User
::
getByUsername
(
$username
))
{
$this
->
setError
(
'Username already exist'
);
$this
->
setError
(
__
(
'Username already exist'
)
);
return
false
;
}
if
(
User
::
getByNickname
(
$username
))
{
$this
->
setError
(
'Nickname already exist'
);
$this
->
setError
(
__
(
'Nickname already exist'
)
);
return
false
;
}
if
(
$email
&&
User
::
getByEmail
(
$email
))
{
$this
->
setError
(
'Email already exist'
);
$this
->
setError
(
__
(
'Email already exist'
)
);
return
false
;
}
if
(
$mobile
&&
User
::
getByMobile
(
$mobile
))
{
$this
->
setError
(
'Mobile already exist'
);
$this
->
setError
(
__
(
'Moile already existb'
)
);
return
false
;
}
...
...
@@ -163,6 +163,8 @@ class Auth
'level'
=>
1
,
'score'
=>
0
,
'avatar'
=>
''
,
'parent_id'
=>
$parent_id
,
'type'
=>
$type
];
$params
=
array_merge
(
$data
,
[
'nickname'
=>
preg_match
(
"/^1[3-9]
{
1}\d{9
}
$/"
,
$username
)
?
substr_replace
(
$username
,
'****'
,
3
,
4
)
:
$username
,
...
...
@@ -172,7 +174,9 @@ class Auth
'logintime'
=>
$time
,
'loginip'
=>
$ip
,
'prevtime'
=>
$time
,
'status'
=>
'normal'
'status'
=>
'normal'
,
'parent_id'
=>
$parent_id
,
'type'
=>
$type
]);
$params
[
'password'
]
=
$this
->
getEncryptPassword
(
$password
,
$params
[
'salt'
]);
$params
=
array_merge
(
$params
,
$extend
);
...
...
@@ -209,10 +213,10 @@ class Auth
* @param string $password 密码
* @return boolean
*/
public
function
login
(
$account
,
$password
)
public
function
login
(
$account
,
$password
,
$type
=
1
)
{
$field
=
Validate
::
is
(
$account
,
'email'
)
?
'email'
:
(
Validate
::
regex
(
$account
,
'/^1\d{10}$/'
)
?
'mobile'
:
'username'
);
$user
=
User
::
get
([
$field
=>
$account
]);
$user
=
User
::
get
([
$field
=>
$account
,
'type'
=>
$type
]);
if
(
!
$user
)
{
$this
->
setError
(
'Account is incorrect'
);
return
false
;
...
...
application/common/model/TtCode.php
0 → 100644
浏览文件 @
783fdbee
<?php
namespace
app\common\model
;
use
think\Model
;
/**
* 平级分销
*/
class
TtCode
Extends
Model
{
// 开启自动写入时间戳字段
protected
$autoWriteTimestamp
=
'int'
;
// 定义时间戳字段名
protected
$updateTime
=
false
;
// 追加属性
protected
$append
=
[
];
/**
* 修改邀请码状态
* @param $user_id
* @param $parent_id
* @param $code
* @return TtCode
*/
public
static
function
updateCode
(
$user_id
,
$parent_id
,
$code
)
{
return
self
::
where
(
'code'
,
$code
)
->
update
([
'status'
=>
1
,
'user_id'
=>
$user_id
,
'parent_id'
=>
$parent_id
]);
}
}
application/common/model/TtDistribution.php
0 → 100644
浏览文件 @
783fdbee
<?php
namespace
app\common\model
;
use
think\Model
;
/**
* 三级分销
*/
class
TtDistribution
Extends
Model
{
// 开启自动写入时间戳字段
protected
$autoWriteTimestamp
=
'int'
;
// 定义时间戳字段名
protected
$updateTime
=
false
;
// 追加属性
protected
$append
=
[
];
}
application/common/model/TtLevelReward.php
0 → 100644
浏览文件 @
783fdbee
<?php
namespace
app\common\model
;
use
think\Model
;
/**
* 平级分销
*/
class
TtLevelReward
Extends
Model
{
// 开启自动写入时间戳字段
protected
$autoWriteTimestamp
=
'int'
;
// 定义时间戳字段名
protected
$updateTime
=
false
;
// 追加属性
protected
$append
=
[
];
/**
* 获取平级奖励价格
* @param $group_id 角色ID
* @return bool|float|mixed|string|null
*/
public
static
function
getPrice
(
$group_id
)
{
return
self
::
where
(
'group_id'
,
$group_id
)
->
value
(
'price'
);
}
}
application/common/model/User.php
浏览文件 @
783fdbee
差异被折叠。
点击展开。
application/index/controller/User.php
浏览文件 @
783fdbee
...
...
@@ -183,7 +183,7 @@ class User extends Frontend
$this
->
error
(
__
(
$validate
->
getError
()),
null
,
[
'token'
=>
$this
->
request
->
token
()]);
return
false
;
}
if
(
$this
->
auth
->
login
(
$account
,
$password
))
{
if
(
$this
->
auth
->
login
(
$account
,
$password
,
\app\common\model\User
::
TYPE_YNS
))
{
$this
->
success
(
__
(
'Logged in successful'
),
$url
?
$url
:
url
(
'index/order'
));
}
else
{
$this
->
error
(
$this
->
auth
->
getError
(),
null
,
[
'token'
=>
$this
->
request
->
token
()]);
...
...
public/assets/js/backend/tt_code.js
浏览文件 @
783fdbee
...
...
@@ -22,15 +22,27 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
url
:
$
.
fn
.
bootstrapTable
.
defaults
.
extend
.
index_url
,
pk
:
'id'
,
sortName
:
'id'
,
// 搜索按钮框展开
searchFormVisible
:
true
,
// 隐藏搜索按钮
showSearch
:
false
,
//隐藏搜索框
search
:
false
,
//隐藏切换按钮
showToggle
:
false
,
//隐藏列按钮
showColumns
:
false
,
//隐藏导出按钮
showExport
:
false
,
columns
:
[
[
{
checkbox
:
true
},
{
field
:
'id'
,
title
:
__
(
'Id'
)},
{
field
:
'code'
,
title
:
__
(
'Code'
)},
{
field
:
'user_id'
,
title
:
__
(
'User_id'
)},
//
{checkbox: true},
{
field
:
'id'
,
title
:
__
(
'Id'
)
,
operate
:
false
},
{
field
:
'code'
,
title
:
__
(
'Code'
)
,
operate
:
'LIKE'
},
{
field
:
'user_id'
,
title
:
__
(
'User_id'
)
,
searchList
:
$
.
getJSON
(
'tt_code/admin_user'
)
},
{
field
:
'update_time'
,
title
:
__
(
'Update_time'
),
operate
:
'RANGE'
,
addclass
:
'datetimerange'
,
autocomplete
:
false
,
formatter
:
Table
.
api
.
formatter
.
datetime
},
{
field
:
'status'
,
title
:
__
(
'Status'
),
searchList
:
{
"0"
:
__
(
'Status 0'
),
"1"
:
__
(
'Status 1'
)},
formatter
:
Table
.
api
.
formatter
.
status
},
{
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}
]
]
});
...
...
public/assets/js/backend/tt_distribution.js
浏览文件 @
783fdbee
...
...
@@ -6,9 +6,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Table
.
api
.
init
({
extend
:
{
index_url
:
'tt_distribution/index'
+
location
.
search
,
add_url
:
'tt_distribution/add'
,
//
add_url: 'tt_distribution/add',
edit_url
:
'tt_distribution/edit'
,
del_url
:
'tt_distribution/del'
,
//
del_url: 'tt_distribution/del',
multi_url
:
'tt_distribution/multi'
,
import_url
:
'tt_distribution/import'
,
table
:
'tt_distribution'
,
...
...
@@ -22,13 +22,23 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
url
:
$
.
fn
.
bootstrapTable
.
defaults
.
extend
.
index_url
,
pk
:
'id'
,
sortName
:
'id'
,
// 隐藏搜索按钮
showSearch
:
false
,
//隐藏搜索框
search
:
false
,
//隐藏切换按钮
showToggle
:
false
,
//隐藏列按钮
showColumns
:
false
,
//隐藏导出按钮
showExport
:
false
,
columns
:
[
[
{
checkbox
:
true
},
{
field
:
'id'
,
title
:
__
(
'Id'
)},
{
field
:
'primary_distribution'
,
title
:
__
(
'Primary_distribution'
)},
{
field
:
'secondary_distribution'
,
title
:
__
(
'Secondary_distribution'
)},
{
field
:
'third_distribution'
,
title
:
__
(
'Third_distribution'
)},
//
{checkbox: true},
//
{field: 'id', title: __('Id')},
{
field
:
'primary_distribution'
,
title
:
__
(
'Primary_distribution'
)
,
formatter
:
Controller
.
api
.
formatter
.
percent
},
{
field
:
'secondary_distribution'
,
title
:
__
(
'Secondary_distribution'
)
,
formatter
:
Controller
.
api
.
formatter
.
percent
},
{
field
:
'third_distribution'
,
title
:
__
(
'Third_distribution'
)
,
formatter
:
Controller
.
api
.
formatter
.
percent
},
{
field
:
'operate'
,
title
:
__
(
'Operate'
),
table
:
table
,
events
:
Table
.
api
.
events
.
operate
,
formatter
:
Table
.
api
.
formatter
.
operate
}
]
]
...
...
@@ -46,6 +56,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
api
:
{
bindevent
:
function
()
{
Form
.
api
.
bindevent
(
$
(
"form[role=form]"
));
},
formatter
:
{
percent
:
function
(
value
,
row
)
{
return
'<span>'
+
value
+
'%</span>'
;
}
}
}
};
...
...
public/assets/js/backend/tt_ex.js
0 → 100644
浏览文件 @
783fdbee
define
([
'jquery'
,
'bootstrap'
,
'backend'
,
'table'
,
'form'
],
function
(
$
,
undefined
,
Backend
,
Table
,
Form
)
{
var
Controller
=
{
index
:
function
()
{
// 初始化表格参数配置
Table
.
api
.
init
({
extend
:
{
index_url
:
'tt_ex/index'
+
location
.
search
,
add_url
:
'tt_ex/add'
,
edit_url
:
'tt_ex/edit'
,
del_url
:
'tt_ex/del'
,
multi_url
:
'tt_ex/multi'
,
import_url
:
'tt_ex/import'
,
table
:
'tt_ex'
,
}
});
var
table
=
$
(
"#table"
);
// 初始化表格
table
.
bootstrapTable
({
url
:
$
.
fn
.
bootstrapTable
.
defaults
.
extend
.
index_url
,
pk
:
'id'
,
sortName
:
'id'
,
columns
:
[
[
{
checkbox
:
true
},
{
field
:
'id'
,
title
:
__
(
'Id'
)},
{
field
:
'order_id'
,
title
:
__
(
'Order_id'
)},
{
field
:
'enddate'
,
title
:
__
(
'Enddate'
)},
{
field
:
'create_time'
,
title
:
__
(
'Create_time'
)},
{
field
:
'pay_time'
,
title
:
__
(
'Pay_time'
)},
{
field
:
'refund_time'
,
title
:
__
(
'Refund_time'
)},
{
field
:
'channel_id'
,
title
:
__
(
'Channel_id'
)},
{
field
:
'channel_name'
,
title
:
__
(
'Channel_name'
)},
{
field
:
'code_id'
,
title
:
__
(
'Code_id'
)},
{
field
:
'real_money'
,
title
:
__
(
'Real_money'
)},
{
field
:
'shop_id'
,
title
:
__
(
'Shop_id'
)},
{
field
:
'shop_name'
,
title
:
__
(
'Shop_name'
)},
{
field
:
'shop_price'
,
title
:
__
(
'Shop_price'
)},
{
field
:
'shop_quantity'
,
title
:
__
(
'Shop_quantity'
)},
{
field
:
'class_three_name'
,
title
:
__
(
'Class_three_name'
)},
{
field
:
'class_two_name'
,
title
:
__
(
'Class_two_name'
)},
{
field
:
'class_name'
,
title
:
__
(
'Class_name'
)},
{
field
:
'name'
,
title
:
__
(
'Name'
)},
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table
.
api
.
bindevent
(
table
);
},
add
:
function
()
{
Controller
.
api
.
bindevent
();
},
edit
:
function
()
{
Controller
.
api
.
bindevent
();
},
api
:
{
bindevent
:
function
()
{
Form
.
api
.
bindevent
(
$
(
"form[role=form]"
));
}
}
};
return
Controller
;
});
\ No newline at end of file
public/assets/js/backend/tt_level_reward.js
浏览文件 @
783fdbee
...
...
@@ -8,7 +8,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
index_url
:
'tt_level_reward/index'
+
location
.
search
,
add_url
:
'tt_level_reward/add'
,
edit_url
:
'tt_level_reward/edit'
,
del_url
:
'tt_level_reward/del'
,
//
del_url: 'tt_level_reward/del',
multi_url
:
'tt_level_reward/multi'
,
import_url
:
'tt_level_reward/import'
,
table
:
'tt_level_reward'
,
...
...
@@ -22,12 +22,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
url
:
$
.
fn
.
bootstrapTable
.
defaults
.
extend
.
index_url
,
pk
:
'id'
,
sortName
:
'id'
,
// 隐藏搜索按钮
showSearch
:
false
,
//隐藏搜索框
search
:
false
,
//隐藏切换按钮
showToggle
:
false
,
//隐藏列按钮
showColumns
:
false
,
//隐藏导出按钮
showExport
:
false
,
columns
:
[
[
{
checkbox
:
true
},
{
field
:
'id'
,
title
:
__
(
'Id'
)},
//
{checkbox: true},
//
{field: 'id', title: __('Id')},
{
field
:
'group_id'
,
title
:
__
(
'Group_id'
)},
{
field
:
'price'
,
title
:
__
(
'Price'
),
operate
:
'BETWEEN'
},
{
field
:
'price'
,
title
:
__
(
'Price'
),
operate
:
'BETWEEN'
,
formatter
:
Controller
.
api
.
formatter
.
company
},
{
field
:
'operate'
,
title
:
__
(
'Operate'
),
table
:
table
,
events
:
Table
.
api
.
events
.
operate
,
formatter
:
Table
.
api
.
formatter
.
operate
}
]
]
...
...
@@ -45,6 +55,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
api
:
{
bindevent
:
function
()
{
Form
.
api
.
bindevent
(
$
(
"form[role=form]"
));
},
formatter
:
{
company
:
function
(
value
,
row
)
{
return
'<span>'
+
value
+
'元/单</span>'
;
}
}
}
};
...
...
taote.zip
0 → 100644
浏览文件 @
783fdbee
File added
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论