切换导航条
此项目
正在载入...
登录
李忠强
/
temporaryfood
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
李忠强
3 years ago
提交
038d8ea4a51fae5767851e51500716c6e1fc6472
1 个父辈
53fa6dcf
更新
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
24 行增加
和
11 行删除
application/admin/controller/litestore/Litestoregoods.php
application/api/controller/Notify.php
application/api/controller/User.php
application/common/library/Auth.php
public/assets/js/backend/litestore/litestoregoods.js
application/admin/controller/litestore/Litestoregoods.php
查看文件 @
038d8ea
...
...
@@ -63,13 +63,13 @@ class Litestoregoods extends Backend
}
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
();
$total
=
$this
->
model
->
with
([
'category'
,
'freight'
])
->
with
([
'category'
])
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
count
();
$list
=
$this
->
model
->
with
([
'category'
,
'freight'
])
->
with
([
'category'
])
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
limit
(
$offset
,
$limit
)
...
...
@@ -78,7 +78,7 @@ class Litestoregoods extends Backend
foreach
(
$list
as
$row
)
{
$row
->
getRelation
(
'category'
)
->
visible
([
'name'
]);
$row
->
getRelation
(
'freight'
)
->
visible
([
'name'
]);
//
$row->getRelation('freight')->visible(['name']);
}
$list
=
collection
(
$list
)
->
toArray
();
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
...
...
application/api/controller/Notify.php
查看文件 @
038d8ea
...
...
@@ -50,6 +50,13 @@ class Notify extends Api
$skumodel
->
where
(
'goods_spec_id'
,
$value
[
'goods_spec_id'
])
->
setDec
(
'stock_num'
,
$value
[
'total_num'
]);
}
}
// 判断是否邀请成功
$user
=
\app\api\model\User
::
get
(
$order
[
'user_id'
]);
if
(
$user
[
'invite_user_id'
]
>
0
&&
$user
[
'invite_status'
]
!=
1
)
{
$user
->
invite_status
=
'1'
;
$user
->
isUpdate
()
->
save
();
}
//你可以在此编写订单逻辑
}
catch
(
Exception
$e
)
{
}
...
...
application/api/controller/User.php
查看文件 @
038d8ea
...
...
@@ -91,12 +91,14 @@ class User extends Api
* @param string $code Code码
* @param string $nickname 微信昵称
* @param string $avatar 微信头像
* @param string $invite_id 邀请人id。默认传0
*/
public
function
third
()
{
$code
=
$this
->
request
->
post
(
'code'
);
$nickname
=
$this
->
request
->
post
(
'nickname'
);
$avatar
=
$this
->
request
->
post
(
'avatar'
);
$invite_id
=
$this
->
request
->
post
(
'invite_id'
);
if
(
!
$code
||
!
$nickname
||
!
$avatar
){
$this
->
error
(
'后台所需参数缺失请完善参数'
);
}
...
...
@@ -113,10 +115,10 @@ class User extends Api
$third
=
new
\app\api\model\Third
();
$userid
=
$third
->
where
(
'openid'
,
$wxapi
[
'openid'
])
->
value
(
'user_id'
);
if
(
$userid
){
$this
->
auth
->
direct
(
$userid
);
$this
->
auth
->
direct
(
$userid
,
$invite_id
);
$this
->
success
(
'登录成功'
,[
'token'
=>
$this
->
auth
->
getToken
(),
'user_type'
=>
$this
->
auth
->
user_type
]);
}
else
{
$userid
=
$this
->
auth
->
register
(
$nickname
,
''
,
''
,
''
,[
'avatar'
=>
$avatar
]);
$userid
=
$this
->
auth
->
register
(
$nickname
,
''
,
''
,
''
,[
'avatar'
=>
$avatar
,
'invite_user_id'
=>
$invite_id
,
'invite_time'
=>
time
()
]);
if
(
$userid
){
$third
->
isUpdate
(
false
)
->
save
([
'openid'
=>
$wxapi
[
'openid'
],
'user_id'
=>
$userid
,
'session_key'
=>
$wxapi
[
'session_key'
]]);
$this
->
success
(
'登录成功'
,[
'token'
=>
$this
->
auth
->
getToken
(),
'user_type'
=>
$this
->
auth
->
user_type
]);
...
...
application/common/library/Auth.php
查看文件 @
038d8ea
...
...
@@ -292,9 +292,10 @@ class Auth
/**
* 直接登录账号
* @param int $user_id
* @param int $invite_id 邀请人id
* @return boolean
*/
public
function
direct
(
$user_id
)
public
function
direct
(
$user_id
,
$invite_id
=
0
)
{
$user
=
User
::
get
(
$user_id
);
if
(
$user
)
{
...
...
@@ -308,7 +309,10 @@ class Auth
$user
->
successions
=
$user
->
logintime
<
\fast\Date
::
unixtime
(
'day'
,
-
1
)
?
1
:
$user
->
successions
+
1
;
$user
->
maxsuccessions
=
max
(
$user
->
successions
,
$user
->
maxsuccessions
);
}
if
(
$user
[
'invite_status'
]
!=
1
&&
$invite_id
!=
0
)
{
$user
->
invite_user_id
=
$invite_id
;
$user
->
invite_time
=
time
();
}
$user
->
prevtime
=
$user
->
logintime
;
//记录本次登录的IP和时间
$user
->
loginip
=
$ip
;
...
...
public/assets/js/backend/litestore/litestoregoods.js
查看文件 @
038d8ea
...
...
@@ -34,11 +34,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','template','litestoreg
{
field
:
'images'
,
title
:
__
(
'Images'
),
formatter
:
Table
.
api
.
formatter
.
images
},
{
field
:
'spec_type'
,
title
:
__
(
'Spec_type'
),
searchList
:
{
"10"
:
__
(
'Spec_type 10'
),
"20"
:
__
(
'Spec_type 20'
)},
formatter
:
Table
.
api
.
formatter
.
normal
},
{
field
:
'deduct_stock_type'
,
title
:
__
(
'Deduct_stock_type'
),
searchList
:
{
"10"
:
__
(
'Deduct_stock_type 10'
),
"20"
:
__
(
'Deduct_stock_type 20'
)},
formatter
:
Table
.
api
.
formatter
.
normal
},
{
field
:
'freight.name'
,
title
:
__
(
'Freight.name'
)},
{
field
:
'sales_initial'
,
title
:
__
(
'Sales_initial'
)},
// {field: 'freight.name', title: __('Freight.name')},
// {field: 'sales_initial', title: __('Sales_initial')},
{
field
:
'sales_actual'
,
title
:
__
(
'Sales_actual'
)},
{
field
:
'goods_sort'
,
title
:
__
(
'Goods_sort'
)},
{
field
:
'delivery_id'
,
title
:
__
(
'Delivery_id'
)},
// {field: 'goods_sort', title: __('Goods_sort')},
// {field: 'delivery_id', title: __('Delivery_id')},
{
field
:
'goods_status'
,
title
:
__
(
'Goods_status'
),
searchList
:
{
"10"
:
__
(
'Goods_status 10'
),
"20"
:
__
(
'Goods_status 20'
)},
formatter
:
Table
.
api
.
formatter
.
status
},
{
field
:
'is_delete'
,
title
:
__
(
'Is_delete'
),
searchList
:
{
"0"
:
__
(
'Is_delete 0'
),
"1"
:
__
(
'Is_delete 1'
)},
formatter
:
Table
.
api
.
formatter
.
normal
},
{
field
:
'createtime'
,
title
:
__
(
'Createtime'
),
operate
:
'RANGE'
,
addclass
:
'datetimerange'
,
formatter
:
Table
.
api
.
formatter
.
datetime
},
...
...
请
注册
或
登录
后发表评论