Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
service
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
aimeiyue
service
Commits
da3a04d6
Commit
da3a04d6
authored
Oct 08, 2024
by
lizhilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
7badbbc0
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
157 additions
and
57 deletions
+157
-57
app/Admin/Controllers/IncomeController.php
+3
-1
app/Admin/Controllers/MerchantController.php
+1
-1
app/Admin/Controllers/OrderInfoController.php
+66
-11
app/Admin/Controllers/ShareController.php
+14
-22
app/Admin/Controllers/UserBuycodeCheckController.php
+1
-1
app/Admin/Forms/CheckBuycode.php
+2
-2
app/Admin/Renderable/MerchantStoreSkuList.php
+1
-1
app/Http/Controllers/Api/GoodController.php
+1
-1
app/Http/Controllers/Api/IncomeController.php
+18
-3
app/Http/Controllers/Api/LoginController.php
+29
-1
app/Http/Controllers/Api/OrderController.php
+6
-5
app/Http/Controllers/Api/StoreAdminUsersController.php
+4
-2
app/Http/Controllers/Api/StoreController.php
+2
-2
app/Http/Controllers/Api/UserController.php
+2
-2
app/Models/User.php
+4
-1
routes/api.php
+3
-1
No files found.
app/Admin/Controllers/IncomeController.php
View file @
da3a04d6
...
@@ -31,7 +31,9 @@ protected function grid()
...
@@ -31,7 +31,9 @@ protected function grid()
}
}
return
Merchant
::
find
(
$vel
)
->
name
??
''
;
return
Merchant
::
find
(
$vel
)
->
name
??
''
;
});
});
$grid
->
column
(
'phone'
,
'手机号'
);
$grid
->
column
(
'phone'
,
'手机号'
)
->
display
(
function
(
$val
)
{
return
$val
?
$val
:
''
;
});
$grid
->
column
(
'amount'
);
$grid
->
column
(
'amount'
);
//$grid->column('status');
//$grid->column('status');
$grid
->
column
(
'status'
)
$grid
->
column
(
'status'
)
...
...
app/Admin/Controllers/MerchantController.php
View file @
da3a04d6
...
@@ -100,7 +100,7 @@ protected function form()
...
@@ -100,7 +100,7 @@ protected function form()
$forms
->
select
(
'cityId'
,
'城市'
);
$forms
->
select
(
'cityId'
,
'城市'
);
$forms
->
text
(
'contacts'
,
'联系人'
);
$forms
->
text
(
'contacts'
,
'联系人'
);
$forms
->
text
(
'phone'
,
'手机号'
);
$forms
->
text
(
'phone'
,
'手机号'
);
$forms
->
text
(
'lat_lng'
,
'经纬度'
)
->
help
(
'<a href="https://lbs.
amap.com/tools/picker" target="_blank">点击获取高德
地图坐标</a>'
);
$forms
->
text
(
'lat_lng'
,
'经纬度'
)
->
help
(
'<a href="https://lbs.
qq.com/getPoint/" target="_blank">点击获取腾讯
地图坐标</a>'
);
$forms
->
text
(
'address'
,
'详细地址'
);
$forms
->
text
(
'address'
,
'详细地址'
);
$forms
->
text
(
'distance'
,
'配送范围(Km)'
);
$forms
->
text
(
'distance'
,
'配送范围(Km)'
);
$forms
->
image
(
'business_license'
,
'营业执照'
)
$forms
->
image
(
'business_license'
,
'营业执照'
)
...
...
app/Admin/Controllers/OrderInfoController.php
View file @
da3a04d6
...
@@ -12,8 +12,10 @@
...
@@ -12,8 +12,10 @@
use
Dcat\Admin\Form
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Widgets\Card
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
App\Admin\Forms\VerifierCodeForm
;
use
App\Admin\Forms\VerifierCodeForm
;
use
Dcat\Admin\Admin
;
class
OrderInfoController
extends
AdminController
class
OrderInfoController
extends
AdminController
...
@@ -36,17 +38,35 @@ protected function grid()
...
@@ -36,17 +38,35 @@ protected function grid()
return
OrderGoodsList
::
make
([
'order_id'
=>
$this
->
id
]);
return
OrderGoodsList
::
make
([
'order_id'
=>
$this
->
id
]);
});
});
$grid
->
column
(
'goods_amount'
,
'订单总金额'
);
$grid
->
column
(
'goods_amount'
,
'订单总金额'
);
$grid
->
column
(
'merchant.name'
,
'所属商家'
);
// $grid->column('merchant.name', '所属商家');
$grid
->
column
(
'merchant.province_id'
,
'所在省市'
)
->
display
(
function
(
$val
)
{
// $grid->column('merchant.province_id', '所在省市')->display(function ($val) {
if
(
$val
)
{
// if ($val) {
$proObj
=
City
::
where
(
"city_id"
,
$val
)
->
first
();
// $proObj = City::where("city_id", $val)->first();
// $cityObj = City::where("city_id", $this->merchant->city_id)->first();
// $proname = $proObj->name ?? '';
// $cityname = $cityObj->name ?? '';
// return $proname . " " . $cityname;
// } else {
// return '';
// }
// });
$grid
->
column
(
'merchant.province_id'
,
'商家信息'
)
->
display
(
'点击查看'
)
->
modal
(
function
(
$modal
)
{
//设置弹窗标题
$modal
->
title
(
'商家信息'
);
$company
=
$this
->
merchant
->
name
??
''
;
$content
=
$company
.
"<br/>"
;
$province_id
=
$this
->
merchant
->
province_id
??
''
;
if
(
$province_id
)
{
$proObj
=
City
::
where
(
"city_id"
,
$province_id
)
->
first
();
$cityObj
=
City
::
where
(
"city_id"
,
$this
->
merchant
->
city_id
)
->
first
();
$cityObj
=
City
::
where
(
"city_id"
,
$this
->
merchant
->
city_id
)
->
first
();
$proname
=
$proObj
->
name
??
''
;
$proname
=
$proObj
->
name
??
''
;
$cityname
=
$cityObj
->
name
??
''
;
$cityname
=
$cityObj
->
name
??
''
;
return
$proname
.
" "
.
$cityname
;
$content
.=
$proname
.
" "
.
$cityname
;
}
else
{
return
''
;
}
}
$card
=
new
Card
(
null
,
$content
);
return
"<div style='padding:10px 10px 0;width:100%;'>
$card
</div>"
;
});
});
$grid
->
column
(
'store_id'
,
'快递代收点'
)
->
display
(
function
(
$val
)
{
$grid
->
column
(
'store_id'
,
'快递代收点'
)
->
display
(
function
(
$val
)
{
...
@@ -56,14 +76,32 @@ protected function grid()
...
@@ -56,14 +76,32 @@ protected function grid()
$res
=
$obj
->
address
;
$res
=
$obj
->
address
;
}
}
return
$res
;
return
$res
;
});
})
->
limit
(
10
);
// $grid->column('store_id', '快递代收点222')->if(function ($column) {
// $val = $column->getValue();
// return $val ? $val : '';
// })->display('点击查看')->modal(function ($modal) {
// //设置弹窗标题
// $modal->title('详情');
// $res = null;
// if ($this->store_id) {
// $obj = Store::where('id', $this->store_id)->first();
// $res = $obj->address;
// }
// $card = new Card(null, $res);
// return "<div style='padding:10px 10px 0;width:100%;'>$card</div>";
// })->else(function ($column) {
// return '';
// });
$grid
->
column
(
'address_id'
,
'送货上门'
)
->
display
(
function
(
$val
)
{
$grid
->
column
(
'address_id'
,
'送货上门'
)
->
display
(
function
(
$val
)
{
$res
=
''
;
$res
=
''
;
if
(
$this
->
area
)
{
if
(
$this
->
area
)
{
$res
=
$this
->
area
.
"("
.
$this
->
address
.
")"
;
$res
=
$this
->
area
.
"("
.
$this
->
address
.
")"
;
}
}
return
$res
;
return
$res
;
});
})
->
limit
(
10
)
;
$grid
->
column
(
'created_at'
,
'下单时间'
);
$grid
->
column
(
'created_at'
,
'下单时间'
);
$grid
->
column
(
'order_status'
,
'状态'
)
->
display
(
function
(
$val
)
{
$grid
->
column
(
'order_status'
,
'状态'
)
->
display
(
function
(
$val
)
{
$options
=
OrderInfo
::
STATUS_OPTIONS
;
$options
=
OrderInfo
::
STATUS_OPTIONS
;
...
@@ -79,8 +117,25 @@ protected function grid()
...
@@ -79,8 +117,25 @@ protected function grid()
return
VerifierCodeForm
::
make
()
->
payload
([
'id'
=>
$this
->
id
]);
return
VerifierCodeForm
::
make
()
->
payload
([
'id'
=>
$this
->
id
]);
});
});
$grid
->
column
(
'verification_code'
,
'核销码'
)
->
limit
(
10
);
$grid
->
column
(
'verification_code'
,
'核销码'
)
->
limit
(
10
);
$grid
->
column
(
'verifier'
,
'核销员'
);
$grid
->
column
(
'verifier'
,
'核销信息'
)
->
if
(
function
(
$column
)
{
$grid
->
column
(
'verification_at'
,
'核销时间'
);
return
$column
->
getValue
();
})
->
display
(
'点击查看'
)
->
modal
(
function
(
$modal
)
{
//设置弹窗标题
$modal
->
title
(
'核销信息'
);
$content
=
""
;
if
(
$this
->
verifier
)
{
$content
.=
"核销员:"
.
$this
->
verifier
.
"<br/>"
;
}
if
(
$this
->
verification_at
)
{
$content
.=
"核销时间:"
.
$this
->
verification_at
.
"<br/>"
;
}
$card
=
new
Card
(
null
,
$content
);
return
"<div style='padding:10px 10px 0;width:100%;'>
$card
</div>"
;
})
->
else
(
function
(
$column
)
{
return
''
;
});
//$grid->column('updated_at')->sortable();
//$grid->column('updated_at')->sortable();
//$grid->disableActions();
//$grid->disableActions();
...
...
app/Admin/Controllers/ShareController.php
View file @
da3a04d6
...
@@ -31,40 +31,32 @@ protected function grid()
...
@@ -31,40 +31,32 @@ protected function grid()
$sp_type
=
request
()
->
get
(
'sp_type'
)
??
''
;
$sp_type
=
request
()
->
get
(
'sp_type'
)
??
''
;
return
Grid
::
make
(
User
::
with
([
'shuser'
]),
function
(
Grid
$grid
)
use
(
$uid
,
$phone
,
$name
,
$sp_type
)
{
return
Grid
::
make
(
User
::
with
([
'shuser'
]),
function
(
Grid
$grid
)
use
(
$uid
,
$phone
,
$name
,
$sp_type
)
{
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
addTableClass
([
'table-text-center'
]);
if
(
$phone
&&
$name
&&
$sp_type
)
{
$where
=
[];
if
(
$phone
)
{
$where
[
'phone'
]
=
$phone
;
}
if
(
$name
)
{
$where
[
'name'
]
=
$name
;
}
if
(
$phone
||
$name
||
$sp_type
)
{
if
(
$sp_type
==
1
)
{
if
(
$sp_type
==
1
)
{
$grid
->
model
()
->
where
(
'spuid'
,
$uid
)
$grid
->
model
()
->
where
(
'spuid'
,
$uid
)
->
where
(
'phone'
,
$phone
)
->
where
(
$where
)
->
where
(
'name'
,
$name
)
->
orderBy
(
'created_at'
,
'DESC'
);
->
orderBy
(
'created_at'
,
'DESC'
);
}
else
{
}
else
if
(
$sp_type
==
2
)
{
$grid
->
model
()
->
where
(
'second_spuid'
,
$uid
)
$grid
->
model
()
->
where
(
'second_spuid'
,
$uid
)
->
where
(
'phone'
,
$phone
)
->
where
(
$where
)
->
where
(
'name'
,
$name
)
->
orderBy
(
'created_at'
,
'DESC'
);
}
}
else
{
if
(
$phone
)
{
$grid
->
model
()
->
where
(
'spuid'
,
$uid
)
->
where
(
'phone'
,
$phone
)
->
orderBy
(
'created_at'
,
'DESC'
);
}
elseif
(
$name
)
{
$grid
->
model
()
->
where
(
'spuid'
,
$uid
)
->
where
(
'name'
,
$name
)
->
orderBy
(
'created_at'
,
'DESC'
);
}
elseif
(
$sp_type
)
{
if
(
$sp_type
==
1
)
{
$grid
->
model
()
->
where
(
'spuid'
,
$uid
)
->
orderBy
(
'created_at'
,
'DESC'
);
->
orderBy
(
'created_at'
,
'DESC'
);
}
else
{
}
else
{
$grid
->
model
()
->
where
(
'second_spuid'
,
$uid
)
$grid
->
model
()
->
where
(
'spuid'
,
$uid
)
->
orWhere
(
'second_spuid'
,
$uid
)
->
where
(
$where
)
->
orderBy
(
'created_at'
,
'DESC'
);
->
orderBy
(
'created_at'
,
'DESC'
);
}
}
}
else
{
}
else
{
$grid
->
model
()
->
where
(
'spuid'
,
$uid
)
->
orWhere
(
'second_spuid'
,
$uid
)
$grid
->
model
()
->
where
(
'spuid'
,
$uid
)
->
orWhere
(
'second_spuid'
,
$uid
)
->
orderBy
(
'created_at'
,
'DESC'
);
->
orderBy
(
'created_at'
,
'DESC'
);
}
}
}
//$grid->column('id')->sortable();
//$grid->column('id')->sortable();
$grid
->
column
(
'name'
,
'昵称'
);
$grid
->
column
(
'name'
,
'昵称'
);
...
...
app/Admin/Controllers/UserBuycodeCheckController.php
View file @
da3a04d6
...
@@ -35,7 +35,7 @@ protected function grid()
...
@@ -35,7 +35,7 @@ protected function grid()
return
$column
->
getValue
()
==
0
;
return
$column
->
getValue
()
==
0
;
})
->
display
(
'点击审批'
)
->
modal
(
function
(
Grid\Displayers\Modal
$modal
)
{
})
->
display
(
'点击审批'
)
->
modal
(
function
(
Grid\Displayers\Modal
$modal
)
{
// 标题
// 标题
$modal
->
title
(
'
提现
审核'
);
$modal
->
title
(
'
直购码
审核'
);
// 自定义图标
// 自定义图标
$modal
->
icon
(
'feather icon-edit'
);
$modal
->
icon
(
'feather icon-edit'
);
// 传递当前行字段值
// 传递当前行字段值
...
...
app/Admin/Forms/CheckBuycode.php
View file @
da3a04d6
...
@@ -43,14 +43,14 @@ public function handle(array $input)
...
@@ -43,14 +43,14 @@ public function handle(array $input)
try
{
try
{
$status
=
(
int
)
$input
[
'status'
];
//审核状态 0:审核中 1:通过 2:拒绝
$status
=
(
int
)
$input
[
'status'
];
//审核状态 0:审核中 1:通过 2:拒绝
$checkObj
->
status
=
$status
;
$checkObj
->
status
=
$status
;
if
(
$status
==
1
)
{
if
(
$checkObj
->
save
())
{
$uObj
=
User
::
find
(
$userId
);
$uObj
=
User
::
find
(
$userId
);
$uObj
->
buycode
=
$checkObj
->
after_code
;
$uObj
->
buycode
=
$checkObj
->
after_code
;
$uObj
->
merchant_id
=
$merObj
->
id
;
$uObj
->
merchant_id
=
$merObj
->
id
;
$uObj
->
save
();
$uObj
->
save
();
}
}
$checkObj
->
save
();
DB
::
commit
();
DB
::
commit
();
Log
::
add
(
'直购码变更'
,
$checkObj
->
toArray
());
Log
::
add
(
'直购码变更'
,
$checkObj
->
toArray
());
}
catch
(
\Exception
$exception
)
{
}
catch
(
\Exception
$exception
)
{
...
...
app/Admin/Renderable/MerchantStoreSkuList.php
View file @
da3a04d6
...
@@ -17,7 +17,7 @@ public function grid(): Grid
...
@@ -17,7 +17,7 @@ public function grid(): Grid
$mgs_id
=
$this
->
payload
[
'mgs_id'
]
??
0
;
$mgs_id
=
$this
->
payload
[
'mgs_id'
]
??
0
;
return
Grid
::
make
(
MerchantGoodSku
::
with
([
'attr'
]),
function
(
Grid
$grid
)
use
(
$mgs_id
,
$merid
)
{
return
Grid
::
make
(
MerchantGoodSku
::
with
([
'attr'
]),
function
(
Grid
$grid
)
use
(
$mgs_id
)
{
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
model
()
->
where
(
'mgs_id'
,
$mgs_id
);
$grid
->
model
()
->
where
(
'mgs_id'
,
$mgs_id
);
...
...
app/Http/Controllers/Api/GoodController.php
View file @
da3a04d6
...
@@ -263,7 +263,7 @@ public function getDetail(Request $request)
...
@@ -263,7 +263,7 @@ public function getDetail(Request $request)
'id'
=>
$goods
->
id
,
'id'
=>
$goods
->
id
,
'goods_img'
=>
$cover
,
'goods_img'
=>
$cover
,
'goods_price'
=>
$mer_id
?
$dg_price
:
$market_price
,
'goods_price'
=>
$mer_id
?
$dg_price
:
$market_price
,
'market_price'
=>
$
userObj
?
$market_price
:
''
,
'market_price'
=>
$
mer_id
?
$market_price
:
''
,
'stock'
=>
$stock
,
'stock'
=>
$stock
,
'goods_name'
=>
$goods
->
goods_name
,
'goods_name'
=>
$goods
->
goods_name
,
'sale'
=>
$goods
->
sale
??
0
,
'sale'
=>
$goods
->
sale
??
0
,
...
...
app/Http/Controllers/Api/IncomeController.php
View file @
da3a04d6
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
use
App\Models\Carousel
;
use
App\Models\Carousel
;
use
App\Models\User
;
use
App\Models\User
;
use
App\Models\Income
;
use
App\Models\Income
;
use
App\Models\Merchant
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
...
@@ -48,14 +49,26 @@ public function add(Request $request)
...
@@ -48,14 +49,26 @@ public function add(Request $request)
$useObj
=
$request
->
user
();
$useObj
=
$request
->
user
();
$type
=
$request
->
type
??
0
;
$type
=
$request
->
type
??
0
;
$money
=
$request
->
money
?
(
float
)
$request
->
money
:
0
;
$money
=
$request
->
money
?
(
float
)
$request
->
money
:
0
;
Log
::
add
(
'提现用户信息'
,
$useObj
->
toArray
());
if
(
!
in_array
(
$type
,
[
1
,
2
,]))
{
if
(
!
in_array
(
$type
,
[
1
,
2
,]))
{
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
}
}
if
(
$money
<
1
)
{
if
(
$money
<
1
)
{
return
$this
->
JsonResponse
(
''
,
'提现金额1元起'
,
500
);
return
$this
->
JsonResponse
(
''
,
'提现金额1元起'
,
500
);
}
}
if
(
$useObj
->
balance
<
$money
)
{
$balance
=
$useObj
->
balance
??
''
;
$phone
=
$useObj
->
phone
??
''
;
$um_id
=
$useObj
->
id
;
$role_id
=
$useObj
->
role_id
??
''
;
if
(
$role_id
==
1
)
{
//商家
$merId
=
$useObj
->
merchant_id
;
$merObj
=
Merchant
::
find
(
$merId
);
$um_id
=
$merId
;
$phone
=
$merObj
->
phone
;
$balance
=
$merObj
->
balance
;
}
if
(
$balance
<
$money
)
{
return
$this
->
JsonResponse
(
''
,
'余额不足'
,
500
);
return
$this
->
JsonResponse
(
''
,
'余额不足'
,
500
);
}
}
...
@@ -64,12 +77,14 @@ public function add(Request $request)
...
@@ -64,12 +77,14 @@ public function add(Request $request)
$comObj
=
new
Income
();
$comObj
=
new
Income
();
$comObj
->
user_type
=
$type
;
$comObj
->
user_type
=
$type
;
$comObj
->
um_id
=
$u
seObj
->
id
;
$comObj
->
um_id
=
$u
m_
id
;
$comObj
->
openid
=
$useObj
->
openid
;
$comObj
->
openid
=
$useObj
->
openid
;
$comObj
->
phone
=
$phone
;
$comObj
->
amount
=
$money
;
$comObj
->
amount
=
$money
;
$comObj
->
status
=
0
;
$comObj
->
status
=
0
;
$comObj
->
save
();
$comObj
->
save
();
DB
::
commit
();
DB
::
commit
();
return
$this
->
JsonResponse
(
''
);
return
$this
->
JsonResponse
(
''
);
}
catch
(
\Exception
$exception
)
{
}
catch
(
\Exception
$exception
)
{
Log
::
add
(
'添加提现失败'
,
$exception
->
getMessage
());
Log
::
add
(
'添加提现失败'
,
$exception
->
getMessage
());
...
...
app/Http/Controllers/Api/LoginController.php
View file @
da3a04d6
...
@@ -68,6 +68,7 @@ public function getOpenid(Request $request)
...
@@ -68,6 +68,7 @@ public function getOpenid(Request $request)
]);
]);
}
}
//用户端登录
public
function
login
(
Request
$request
)
public
function
login
(
Request
$request
)
{
{
$code
=
$request
->
code
??
''
;
$code
=
$request
->
code
??
''
;
...
@@ -82,7 +83,7 @@ public function login(Request $request)
...
@@ -82,7 +83,7 @@ public function login(Request $request)
$res
=
$this
->
decryptData
(
$session_key
,
$encryptedData
,
$iv
,
$data
);
$res
=
$this
->
decryptData
(
$session_key
,
$encryptedData
,
$iv
,
$data
);
if
(
$res
!=
0
)
{
if
(
$res
!=
0
)
{
Log
::
add
(
'登录截取结果'
,
$res
);
Log
::
add
(
'登录截取结果'
,
$res
);
return
$this
->
JsonResponse
(
''
,
'参数异常'
,
201
);
return
$this
->
JsonResponse
(
''
,
'参数异常'
.
$res
,
201
);
}
}
$user
=
User
::
where
([
'phone'
=>
$data
->
phoneNumber
])
->
first
();
$user
=
User
::
where
([
'phone'
=>
$data
->
phoneNumber
])
->
first
();
if
(
!
$user
)
{
if
(
!
$user
)
{
...
@@ -105,6 +106,33 @@ public function login(Request $request)
...
@@ -105,6 +106,33 @@ public function login(Request $request)
]);
]);
}
}
//商户端授权绑定账号密码(提现时)
public
function
merchantLogin
(
Request
$request
)
{
$muser
=
$request
->
user
();
$appid
=
env
(
'XCX_MERCHENT_APPID'
);
$secret
=
env
(
'XCX_MERCHENT_SECRET'
);
$code
=
$request
->
code
??
''
;
if
(
!
$code
)
{
return
$this
->
JsonResponse
(
''
,
'无效参数Code'
,
201
);
}
$url
=
'https://api.weixin.qq.com/sns/jscode2session?appid='
.
$appid
.
'&secret='
.
$secret
.
'&js_code='
.
$code
.
'&grant_type=authorization_code'
;
$result
=
json_decode
(
file_get_contents
(
$url
),
true
);
if
(
isset
(
$result
[
'errcode'
]))
{
Log
::
add
(
'商户端授权请求微信接口异常'
,
$result
);
return
$this
->
JsonResponse
(
''
,
'请求微信接口异常'
,
201
);
}
$openId
=
$result
[
'openid'
];
if
(
!
$muser
->
openid
&&
$openId
)
{
$muser
->
openid
=
$openId
;
$muser
->
save
();
}
return
$this
->
JsonResponse
(
''
);
}
public
function
logout
(
Request
$request
)
public
function
logout
(
Request
$request
)
{
{
$request
->
user
()
->
tokens
()
->
delete
();
$request
->
user
()
->
tokens
()
->
delete
();
...
...
app/Http/Controllers/Api/OrderController.php
View file @
da3a04d6
...
@@ -518,8 +518,8 @@ public function scanCodeDetail(Request $request)
...
@@ -518,8 +518,8 @@ public function scanCodeDetail(Request $request)
$delivery
[
'contacts'
]
=
$sObj
->
contacts
;
$delivery
[
'contacts'
]
=
$sObj
->
contacts
;
$delivery
[
'phone'
]
=
$sObj
->
phone
;
$delivery
[
'phone'
]
=
$sObj
->
phone
;
$delivery
[
'address'
]
=
$sObj
->
address
;
$delivery
[
'address'
]
=
$sObj
->
address
;
$delivery
[
'lat'
]
=
isset
(
$latlngArr
[
1
])
?
$latlngArr
[
1
]
:
''
;
$delivery
[
'lat'
]
=
isset
(
$latlngArr
[
0
])
?
$latlngArr
[
0
]
:
''
;
$delivery
[
'lng'
]
=
isset
(
$latlngArr
[
0
])
?
$latlngArr
[
0
]
:
''
;
$delivery
[
'lng'
]
=
isset
(
$latlngArr
[
1
])
?
$latlngArr
[
1
]
:
''
;
}
}
$data
=
[
$data
=
[
...
@@ -570,8 +570,8 @@ public function OrderInfo(Request $request)
...
@@ -570,8 +570,8 @@ public function OrderInfo(Request $request)
$delivery
[
'contacts'
]
=
$sObj
->
contacts
;
$delivery
[
'contacts'
]
=
$sObj
->
contacts
;
$delivery
[
'phone'
]
=
$sObj
->
phone
;
$delivery
[
'phone'
]
=
$sObj
->
phone
;
$delivery
[
'address'
]
=
$sObj
->
address
;
$delivery
[
'address'
]
=
$sObj
->
address
;
$delivery
[
'lat'
]
=
isset
(
$latlngArr
[
1
])
?
$latlngArr
[
1
]
:
''
;
$delivery
[
'lat'
]
=
isset
(
$latlngArr
[
0
])
?
$latlngArr
[
0
]
:
''
;
$delivery
[
'lng'
]
=
isset
(
$latlngArr
[
0
])
?
$latlngArr
[
0
]
:
''
;
$delivery
[
'lng'
]
=
isset
(
$latlngArr
[
1
])
?
$latlngArr
[
1
]
:
''
;
}
}
//订单状态
//订单状态
$order_status
=
$orderObj
->
order_status
;
$order_status
=
$orderObj
->
order_status
;
...
@@ -665,6 +665,7 @@ public function orderCollect(Request $request)
...
@@ -665,6 +665,7 @@ public function orderCollect(Request $request)
//上月数据统计
//上月数据统计
$lastMonth
=
[];
$lastMonth
=
[];
if
(
date
(
'd'
)
<
10
)
{
if
(
date
(
'd'
)
<
10
)
{
}
$firstDayOfLastMonth
=
date
(
'Y-m-01 00:00:00'
,
strtotime
(
'-1 month'
,
time
()));
$firstDayOfLastMonth
=
date
(
'Y-m-01 00:00:00'
,
strtotime
(
'-1 month'
,
time
()));
$ninthDayOfLastMonth
=
date
(
'Y-m-t 23:59:59'
,
strtotime
(
'-1 month'
,
time
()));
$ninthDayOfLastMonth
=
date
(
'Y-m-t 23:59:59'
,
strtotime
(
'-1 month'
,
time
()));
$lastMonth
[
'buyCount'
]
=
OrderInfoModel
::
where
(
$where
)
->
where
(
'pay_status'
,
1
)
->
whereBetween
(
'created_at'
,
[
$firstDayOfLastMonth
,
$ninthDayOfLastMonth
])
->
count
();
$lastMonth
[
'buyCount'
]
=
OrderInfoModel
::
where
(
$where
)
->
where
(
'pay_status'
,
1
)
->
whereBetween
(
'created_at'
,
[
$firstDayOfLastMonth
,
$ninthDayOfLastMonth
])
->
count
();
...
@@ -673,7 +674,7 @@ public function orderCollect(Request $request)
...
@@ -673,7 +674,7 @@ public function orderCollect(Request $request)
//本月订单商品销量
//本月订单商品销量
$goods_number
=
OrderGoods
::
where
(
'merchant_id'
,
$merchant_id
)
->
whereBetween
(
'created_at'
,
[
$firstDayOfMonth
,
$lastDayOfMonth
])
->
sum
(
'goods_number'
);
$goods_number
=
OrderGoods
::
where
(
'merchant_id'
,
$merchant_id
)
->
whereBetween
(
'created_at'
,
[
$firstDayOfMonth
,
$lastDayOfMonth
])
->
sum
(
'goods_number'
);
$lastMonth
[
'stockCount'
]
=
$goods_number
+
$currentStock
;
$lastMonth
[
'stockCount'
]
=
$goods_number
+
$currentStock
;
}
return
$this
->
JsonResponse
([
'current'
=>
$currentMonth
?
$currentMonth
:
new
\stdClass
(),
'last'
=>
$lastMonth
?
$lastMonth
:
new
\stdClass
()]);
return
$this
->
JsonResponse
([
'current'
=>
$currentMonth
?
$currentMonth
:
new
\stdClass
(),
'last'
=>
$lastMonth
?
$lastMonth
:
new
\stdClass
()]);
}
}
}
}
app/Http/Controllers/Api/StoreAdminUsersController.php
View file @
da3a04d6
...
@@ -64,11 +64,12 @@ public function info(Request $request)
...
@@ -64,11 +64,12 @@ public function info(Request $request)
$merchant_id
=
$muser
->
merchant_id
;
$merchant_id
=
$muser
->
merchant_id
;
$store_id
=
$muser
->
store_id
;
$store_id
=
$muser
->
store_id
;
$total_revenue
=
$balance
=
$cashout
=
0
;
$total_revenue
=
$balance
=
$cashout
=
0
;
$store_name
=
''
;
$store_name
=
$merchant_name
=
''
;
if
(
$merchant_id
)
{
if
(
$merchant_id
)
{
$merObj
=
Merchant
::
where
(
'id'
,
$merchant_id
)
->
first
();
$merObj
=
Merchant
::
where
(
'id'
,
$merchant_id
)
->
first
();
$buycode
=
$merObj
->
buycode
;
$buycode
=
$merObj
->
buycode
;
$phone
=
$merObj
->
phone
;
$phone
=
$merObj
->
phone
;
$merchant_name
=
$merObj
->
name
;
$total_revenue
=
$merObj
->
total_revenue
??
0
;
$total_revenue
=
$merObj
->
total_revenue
??
0
;
$balance
=
$merObj
->
balance
??
0
;
$balance
=
$merObj
->
balance
??
0
;
$cashout
=
$total_revenue
-
$balance
;
$cashout
=
$total_revenue
-
$balance
;
...
@@ -81,8 +82,9 @@ public function info(Request $request)
...
@@ -81,8 +82,9 @@ public function info(Request $request)
return
$this
->
JsonResponse
([
return
$this
->
JsonResponse
([
'user_id'
=>
$muser
->
id
,
'user_id'
=>
$muser
->
id
,
'username'
=>
$muser
->
username
,
'username'
=>
$muser
->
username
,
'merchant_name'
=>
$m
user
->
name
,
'merchant_name'
=>
$m
erchant_
name
,
'phone'
=>
$phone
,
'phone'
=>
$phone
,
'openid'
=>
$muser
->
openid
??
''
,
'avatar'
=>
$muser
->
avatar
?
env
(
'IMAGE_URL'
)
.
$muser
->
avatar
:
env
(
'NO_AVATAR_IMAGE_URL'
),
'avatar'
=>
$muser
->
avatar
?
env
(
'IMAGE_URL'
)
.
$muser
->
avatar
:
env
(
'NO_AVATAR_IMAGE_URL'
),
'merchant_id'
=>
$muser
->
merchant_id
,
'merchant_id'
=>
$muser
->
merchant_id
,
'buycode'
=>
$buycode
,
'buycode'
=>
$buycode
,
...
...
app/Http/Controllers/Api/StoreController.php
View file @
da3a04d6
...
@@ -51,8 +51,8 @@ public function checkDistance(Request $request)
...
@@ -51,8 +51,8 @@ public function checkDistance(Request $request)
->
select
([
'id'
,
'title'
,
'lat_lng'
,
'distance'
])
->
get
();
->
select
([
'id'
,
'title'
,
'lat_lng'
,
'distance'
])
->
get
();
foreach
(
$list
as
$key
=>
$val
)
{
foreach
(
$list
as
$key
=>
$val
)
{
$atng
=
$val
->
lat_lng
?
explode
(
','
,
$val
->
lat_lng
)
:
[];
$atng
=
$val
->
lat_lng
?
explode
(
','
,
$val
->
lat_lng
)
:
[];
$lat2
=
$atng
[
1
];
$lat2
=
$atng
[
0
];
$lng2
=
$atng
[
0
];
$lng2
=
$atng
[
1
];
$res
=
(
$lat1
&&
$lat2
)
?
$this
->
haversineDistance
(
$lat1
,
$lng1
,
$lat2
,
$lng2
)
:
''
;
$res
=
(
$lat1
&&
$lat2
)
?
$this
->
haversineDistance
(
$lat1
,
$lng1
,
$lat2
,
$lng2
)
:
''
;
if
(
$res
<=
$val
->
distance
)
{
if
(
$res
<=
$val
->
distance
)
{
$flag
=
true
;
$flag
=
true
;
...
...
app/Http/Controllers/Api/UserController.php
View file @
da3a04d6
...
@@ -96,7 +96,7 @@ public function showShoppingCart(Request $request)
...
@@ -96,7 +96,7 @@ public function showShoppingCart(Request $request)
foreach
(
$shoppingCart
as
$key
=>
$item
)
{
foreach
(
$shoppingCart
as
$key
=>
$item
)
{
$tmp
=
[];
$tmp
=
[];
$goodsAttrObj
=
GoodSku
::
where
(
"goods_id"
,
$item
[
'goods_id'
])
->
where
(
"attr_sn"
,
$item
[
'attr_sn'
])
->
first
();
$goodsAttrObj
=
GoodSku
::
where
(
"goods_id"
,
$item
[
'goods_id'
])
->
where
(
"attr_sn"
,
$item
[
'attr_sn'
])
->
first
();
$goodsObj
=
Good
::
where
(
"id"
,
$item
[
'goods_id'
])
->
first
();
$goodsObj
=
Good
::
where
(
"id"
,
$item
[
'goods_id'
])
->
where
(
'is_show'
,
1
)
->
first
();
if
(
!
$goodsAttrObj
||
!
$goodsObj
)
{
if
(
!
$goodsAttrObj
||
!
$goodsObj
)
{
unset
(
$shoppingCart
[
$key
]);
unset
(
$shoppingCart
[
$key
]);
continue
;
continue
;
...
@@ -172,7 +172,7 @@ public function info(Request $request)
...
@@ -172,7 +172,7 @@ public function info(Request $request)
return
$this
->
JsonResponse
([
return
$this
->
JsonResponse
([
'user_id'
=>
$user
->
id
,
'user_id'
=>
$user
->
id
,
'nickname'
=>
$user
->
name
,
'nickname'
=>
$user
->
name
,
'avatar'
=>
$user
->
avatar
?
env
(
'IMAGE_URL'
)
.
$user
->
avatar
:
env
(
'
IMAGE_URL'
)
.
'/wximg/my.png'
,
'avatar'
=>
$user
->
avatar
?
env
(
'IMAGE_URL'
)
.
$user
->
avatar
:
env
(
'
NO_AVATAR_IMAGE_URL'
)
,
'phone'
=>
$user
->
phone
,
'phone'
=>
$user
->
phone
,
'phone_sec'
=>
$user
->
phone
?
substr
(
$user
->
phone
,
0
,
3
)
.
"****"
.
substr
(
$user
->
phone
,
7
)
:
''
,
'phone_sec'
=>
$user
->
phone
?
substr
(
$user
->
phone
,
0
,
3
)
.
"****"
.
substr
(
$user
->
phone
,
7
)
:
''
,
//'status' => $user->status,
//'status' => $user->status,
...
...
app/Models/User.php
View file @
da3a04d6
...
@@ -7,11 +7,14 @@
...
@@ -7,11 +7,14 @@
use
Illuminate\Foundation\Auth\User
as
Authenticatable
;
use
Illuminate\Foundation\Auth\User
as
Authenticatable
;
use
Illuminate\Notifications\Notifiable
;
use
Illuminate\Notifications\Notifiable
;
use
Laravel\Sanctum\HasApiTokens
;
use
Laravel\Sanctum\HasApiTokens
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
use
Dcat\Admin\Traits\HasDateTimeFormatter
;
class
User
extends
Authenticatable
class
User
extends
Authenticatable
{
{
use
HasApiTokens
,
HasFactory
,
Notifiable
;
use
HasApiTokens
,
HasFactory
,
Notifiable
;
use
HasDateTimeFormatter
;
use
SoftDeletes
;
public
const
USER_STATUS
=
[
public
const
USER_STATUS
=
[
...
...
routes/api.php
View file @
da3a04d6
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
Route
::
post
(
'get-openid'
,
'LoginController@getOpenid'
);
//获取openid
Route
::
post
(
'get-openid'
,
'LoginController@getOpenid'
);
//获取openid
Route
::
post
(
'login'
,
'LoginController@login'
)
->
name
(
'login'
);
//授权登录
Route
::
post
(
'login'
,
'LoginController@login'
)
->
name
(
'login'
);
//
用户端
授权登录
Route
::
get
(
'test-login'
,
'LoginController@testLogin'
);
//测试登录
Route
::
get
(
'test-login'
,
'LoginController@testLogin'
);
//测试登录
...
@@ -80,6 +80,8 @@
...
@@ -80,6 +80,8 @@
Route
::
get
(
'merchant-info'
,
'StoreAdminUsersController@info'
);
//获取商户端用户资料
Route
::
get
(
'merchant-info'
,
'StoreAdminUsersController@info'
);
//获取商户端用户资料
Route
::
post
(
'merchant-login'
,
'LoginController@merchantLogin'
);
//商户端授权登录
Route
::
get
(
'logout'
,
'LoginController@logout'
);
//登出
Route
::
get
(
'logout'
,
'LoginController@logout'
);
//登出
Route
::
get
(
'home'
,
'UserController@home'
);
//首页数据
Route
::
get
(
'home'
,
'UserController@home'
);
//首页数据
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment