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
9 months ago
by
lizhilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
7badbbc0
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
166 additions
and
66 deletions
+166
-66
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
+16
-24
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
+13
-12
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()
}
return
Merchant
::
find
(
$vel
)
->
name
??
''
;
});
$grid
->
column
(
'phone'
,
'手机号'
);
$grid
->
column
(
'phone'
,
'手机号'
)
->
display
(
function
(
$val
)
{
return
$val
?
$val
:
''
;
});
$grid
->
column
(
'amount'
);
//$grid->column('status');
$grid
->
column
(
'status'
)
...
...
This diff is collapsed.
Click to expand it.
app/Admin/Controllers/MerchantController.php
View file @
da3a04d6
...
...
@@ -100,7 +100,7 @@ protected function form()
$forms
->
select
(
'cityId'
,
'城市'
);
$forms
->
text
(
'contacts'
,
'联系人'
);
$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
(
'distance'
,
'配送范围(Km)'
);
$forms
->
image
(
'business_license'
,
'营业执照'
)
...
...
This diff is collapsed.
Click to expand it.
app/Admin/Controllers/OrderInfoController.php
View file @
da3a04d6
...
...
@@ -12,8 +12,10 @@
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Widgets\Card
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
App\Admin\Forms\VerifierCodeForm
;
use
Dcat\Admin\Admin
;
class
OrderInfoController
extends
AdminController
...
...
@@ -36,17 +38,35 @@ protected function grid()
return
OrderGoodsList
::
make
([
'order_id'
=>
$this
->
id
]);
});
$grid
->
column
(
'goods_amount'
,
'订单总金额'
);
$grid
->
column
(
'merchant.name'
,
'所属商家'
);
$grid
->
column
(
'merchant.province_id'
,
'所在省市'
)
->
display
(
function
(
$val
)
{
if
(
$val
)
{
$proObj
=
City
::
where
(
"city_id"
,
$val
)
->
first
();
// $grid->column('merchant.name', '所属商家');
// $grid->column('merchant.province_id', '所在省市')->display(function ($val) {
// if ($val) {
// $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
();
$proname
=
$proObj
->
name
??
''
;
$cityname
=
$cityObj
->
name
??
''
;
return
$proname
.
" "
.
$cityname
;
}
else
{
return
''
;
$content
.=
$proname
.
" "
.
$cityname
;
}
$card
=
new
Card
(
null
,
$content
);
return
"<div style='padding:10px 10px 0;width:100%;'>
$card
</div>"
;
});
$grid
->
column
(
'store_id'
,
'快递代收点'
)
->
display
(
function
(
$val
)
{
...
...
@@ -56,14 +76,32 @@ protected function grid()
$res
=
$obj
->
address
;
}
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
)
{
$res
=
''
;
if
(
$this
->
area
)
{
$res
=
$this
->
area
.
"("
.
$this
->
address
.
")"
;
}
return
$res
;
});
})
->
limit
(
10
)
;
$grid
->
column
(
'created_at'
,
'下单时间'
);
$grid
->
column
(
'order_status'
,
'状态'
)
->
display
(
function
(
$val
)
{
$options
=
OrderInfo
::
STATUS_OPTIONS
;
...
...
@@ -79,8 +117,25 @@ protected function grid()
return
VerifierCodeForm
::
make
()
->
payload
([
'id'
=>
$this
->
id
]);
});
$grid
->
column
(
'verification_code'
,
'核销码'
)
->
limit
(
10
);
$grid
->
column
(
'verifier'
,
'核销员'
);
$grid
->
column
(
'verification_at'
,
'核销时间'
);
$grid
->
column
(
'verifier'
,
'核销信息'
)
->
if
(
function
(
$column
)
{
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->disableActions();
...
...
This diff is collapsed.
Click to expand it.
app/Admin/Controllers/ShareController.php
View file @
da3a04d6
...
...
@@ -31,41 +31,33 @@ protected function grid()
$sp_type
=
request
()
->
get
(
'sp_type'
)
??
''
;
return
Grid
::
make
(
User
::
with
([
'shuser'
]),
function
(
Grid
$grid
)
use
(
$uid
,
$phone
,
$name
,
$sp_type
)
{
$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
)
{
$grid
->
model
()
->
where
(
'spuid'
,
$uid
)
->
where
(
'phone'
,
$phone
)
->
where
(
'name'
,
$name
)
->
where
(
$where
)
->
orderBy
(
'created_at'
,
'DESC'
);
}
else
{
}
else
if
(
$sp_type
==
2
)
{
$grid
->
model
()
->
where
(
'second_spuid'
,
$uid
)
->
where
(
'phone'
,
$phone
)
->
where
(
'name'
,
$name
)
->
where
(
$where
)
->
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'
);
}
else
{
$grid
->
model
()
->
where
(
'second_spuid'
,
$uid
)
->
orderBy
(
'created_at'
,
'DESC'
);
}
}
else
{
$grid
->
model
()
->
where
(
'spuid'
,
$uid
)
->
orWhere
(
'second_spuid'
,
$uid
)
->
where
(
$where
)
->
orderBy
(
'created_at'
,
'DESC'
);
}
}
else
{
$grid
->
model
()
->
where
(
'spuid'
,
$uid
)
->
orWhere
(
'second_spuid'
,
$uid
)
->
orderBy
(
'created_at'
,
'DESC'
);
}
//$grid->column('id')->sortable();
$grid
->
column
(
'name'
,
'昵称'
);
$grid
->
column
(
'phone'
,
'手机号'
);
...
...
This diff is collapsed.
Click to expand it.
app/Admin/Controllers/UserBuycodeCheckController.php
View file @
da3a04d6
...
...
@@ -35,7 +35,7 @@ protected function grid()
return
$column
->
getValue
()
==
0
;
})
->
display
(
'点击审批'
)
->
modal
(
function
(
Grid\Displayers\Modal
$modal
)
{
// 标题
$modal
->
title
(
'
提现
审核'
);
$modal
->
title
(
'
直购码
审核'
);
// 自定义图标
$modal
->
icon
(
'feather icon-edit'
);
// 传递当前行字段值
...
...
This diff is collapsed.
Click to expand it.
app/Admin/Forms/CheckBuycode.php
View file @
da3a04d6
...
...
@@ -43,14 +43,14 @@ public function handle(array $input)
try
{
$status
=
(
int
)
$input
[
'status'
];
//审核状态 0:审核中 1:通过 2:拒绝
$checkObj
->
status
=
$status
;
if
(
$checkObj
->
save
())
{
if
(
$status
==
1
)
{
$uObj
=
User
::
find
(
$userId
);
$uObj
->
buycode
=
$checkObj
->
after_code
;
$uObj
->
merchant_id
=
$merObj
->
id
;
$uObj
->
save
();
}
$checkObj
->
save
();
DB
::
commit
();
Log
::
add
(
'直购码变更'
,
$checkObj
->
toArray
());
}
catch
(
\Exception
$exception
)
{
...
...
This diff is collapsed.
Click to expand it.
app/Admin/Renderable/MerchantStoreSkuList.php
View file @
da3a04d6
...
...
@@ -17,7 +17,7 @@ public function grid(): Grid
$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
->
model
()
->
where
(
'mgs_id'
,
$mgs_id
);
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Api/GoodController.php
View file @
da3a04d6
...
...
@@ -263,7 +263,7 @@ public function getDetail(Request $request)
'id'
=>
$goods
->
id
,
'goods_img'
=>
$cover
,
'goods_price'
=>
$mer_id
?
$dg_price
:
$market_price
,
'market_price'
=>
$
userObj
?
$market_price
:
''
,
'market_price'
=>
$
mer_id
?
$market_price
:
''
,
'stock'
=>
$stock
,
'goods_name'
=>
$goods
->
goods_name
,
'sale'
=>
$goods
->
sale
??
0
,
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Api/IncomeController.php
View file @
da3a04d6
...
...
@@ -6,6 +6,7 @@
use
App\Models\Carousel
;
use
App\Models\User
;
use
App\Models\Income
;
use
App\Models\Merchant
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
...
...
@@ -48,14 +49,26 @@ public function add(Request $request)
$useObj
=
$request
->
user
();
$type
=
$request
->
type
??
0
;
$money
=
$request
->
money
?
(
float
)
$request
->
money
:
0
;
Log
::
add
(
'提现用户信息'
,
$useObj
->
toArray
());
if
(
!
in_array
(
$type
,
[
1
,
2
,]))
{
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
}
if
(
$money
<
1
)
{
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
);
}
...
...
@@ -64,12 +77,14 @@ public function add(Request $request)
$comObj
=
new
Income
();
$comObj
->
user_type
=
$type
;
$comObj
->
um_id
=
$u
seObj
->
id
;
$comObj
->
um_id
=
$u
m_
id
;
$comObj
->
openid
=
$useObj
->
openid
;
$comObj
->
phone
=
$phone
;
$comObj
->
amount
=
$money
;
$comObj
->
status
=
0
;
$comObj
->
save
();
DB
::
commit
();
return
$this
->
JsonResponse
(
''
);
}
catch
(
\Exception
$exception
)
{
Log
::
add
(
'添加提现失败'
,
$exception
->
getMessage
());
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Api/LoginController.php
View file @
da3a04d6
...
...
@@ -68,6 +68,7 @@ public function getOpenid(Request $request)
]);
}
//用户端登录
public
function
login
(
Request
$request
)
{
$code
=
$request
->
code
??
''
;
...
...
@@ -82,7 +83,7 @@ public function login(Request $request)
$res
=
$this
->
decryptData
(
$session_key
,
$encryptedData
,
$iv
,
$data
);
if
(
$res
!=
0
)
{
Log
::
add
(
'登录截取结果'
,
$res
);
return
$this
->
JsonResponse
(
''
,
'参数异常'
,
201
);
return
$this
->
JsonResponse
(
''
,
'参数异常'
.
$res
,
201
);
}
$user
=
User
::
where
([
'phone'
=>
$data
->
phoneNumber
])
->
first
();
if
(
!
$user
)
{
...
...
@@ -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
)
{
$request
->
user
()
->
tokens
()
->
delete
();
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Api/OrderController.php
View file @
da3a04d6
...
...
@@ -518,8 +518,8 @@ public function scanCodeDetail(Request $request)
$delivery
[
'contacts'
]
=
$sObj
->
contacts
;
$delivery
[
'phone'
]
=
$sObj
->
phone
;
$delivery
[
'address'
]
=
$sObj
->
address
;
$delivery
[
'lat'
]
=
isset
(
$latlngArr
[
1
])
?
$latlngArr
[
1
]
:
''
;
$delivery
[
'lng'
]
=
isset
(
$latlngArr
[
0
])
?
$latlngArr
[
0
]
:
''
;
$delivery
[
'lat'
]
=
isset
(
$latlngArr
[
0
])
?
$latlngArr
[
0
]
:
''
;
$delivery
[
'lng'
]
=
isset
(
$latlngArr
[
1
])
?
$latlngArr
[
1
]
:
''
;
}
$data
=
[
...
...
@@ -570,8 +570,8 @@ public function OrderInfo(Request $request)
$delivery
[
'contacts'
]
=
$sObj
->
contacts
;
$delivery
[
'phone'
]
=
$sObj
->
phone
;
$delivery
[
'address'
]
=
$sObj
->
address
;
$delivery
[
'lat'
]
=
isset
(
$latlngArr
[
1
])
?
$latlngArr
[
1
]
:
''
;
$delivery
[
'lng'
]
=
isset
(
$latlngArr
[
0
])
?
$latlngArr
[
0
]
:
''
;
$delivery
[
'lat'
]
=
isset
(
$latlngArr
[
0
])
?
$latlngArr
[
0
]
:
''
;
$delivery
[
'lng'
]
=
isset
(
$latlngArr
[
1
])
?
$latlngArr
[
1
]
:
''
;
}
//订单状态
$order_status
=
$orderObj
->
order_status
;
...
...
@@ -665,15 +665,16 @@ public function orderCollect(Request $request)
//上月数据统计
$lastMonth
=
[];
if
(
date
(
'd'
)
<
10
)
{
$firstDayOfLastMonth
=
date
(
'Y-m-01 00:00:00'
,
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
[
'pickedCount'
]
=
OrderInfoModel
::
where
(
$where
)
->
where
(
'pay_status'
,
1
)
->
whereIn
(
'order_status'
,
[
3
,
4
])
->
whereBetween
(
'created_at'
,
[
$firstDayOfLastMonth
,
$ninthDayOfLastMonth
])
->
count
();
$lastMonth
[
'waitCount'
]
=
OrderInfoModel
::
where
(
$where
)
->
where
(
'pay_status'
,
1
)
->
where
(
"order_status"
,
2
)
->
whereBetween
(
'created_at'
,
[
$firstDayOfLastMonth
,
$ninthDayOfLastMonth
])
->
count
();
//本月订单商品销量
$goods_number
=
OrderGoods
::
where
(
'merchant_id'
,
$merchant_id
)
->
whereBetween
(
'created_at'
,
[
$firstDayOfMonth
,
$lastDayOfMonth
])
->
sum
(
'goods_number'
);
$lastMonth
[
'stockCount'
]
=
$goods_number
+
$currentStock
;
}
$firstDayOfLastMonth
=
date
(
'Y-m-01 00:00:00'
,
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
[
'pickedCount'
]
=
OrderInfoModel
::
where
(
$where
)
->
where
(
'pay_status'
,
1
)
->
whereIn
(
'order_status'
,
[
3
,
4
])
->
whereBetween
(
'created_at'
,
[
$firstDayOfLastMonth
,
$ninthDayOfLastMonth
])
->
count
();
$lastMonth
[
'waitCount'
]
=
OrderInfoModel
::
where
(
$where
)
->
where
(
'pay_status'
,
1
)
->
where
(
"order_status"
,
2
)
->
whereBetween
(
'created_at'
,
[
$firstDayOfLastMonth
,
$ninthDayOfLastMonth
])
->
count
();
//本月订单商品销量
$goods_number
=
OrderGoods
::
where
(
'merchant_id'
,
$merchant_id
)
->
whereBetween
(
'created_at'
,
[
$firstDayOfMonth
,
$lastDayOfMonth
])
->
sum
(
'goods_number'
);
$lastMonth
[
'stockCount'
]
=
$goods_number
+
$currentStock
;
return
$this
->
JsonResponse
([
'current'
=>
$currentMonth
?
$currentMonth
:
new
\stdClass
(),
'last'
=>
$lastMonth
?
$lastMonth
:
new
\stdClass
()]);
}
}
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Api/StoreAdminUsersController.php
View file @
da3a04d6
...
...
@@ -64,11 +64,12 @@ public function info(Request $request)
$merchant_id
=
$muser
->
merchant_id
;
$store_id
=
$muser
->
store_id
;
$total_revenue
=
$balance
=
$cashout
=
0
;
$store_name
=
''
;
$store_name
=
$merchant_name
=
''
;
if
(
$merchant_id
)
{
$merObj
=
Merchant
::
where
(
'id'
,
$merchant_id
)
->
first
();
$buycode
=
$merObj
->
buycode
;
$phone
=
$merObj
->
phone
;
$merchant_name
=
$merObj
->
name
;
$total_revenue
=
$merObj
->
total_revenue
??
0
;
$balance
=
$merObj
->
balance
??
0
;
$cashout
=
$total_revenue
-
$balance
;
...
...
@@ -81,8 +82,9 @@ public function info(Request $request)
return
$this
->
JsonResponse
([
'user_id'
=>
$muser
->
id
,
'username'
=>
$muser
->
username
,
'merchant_name'
=>
$m
user
->
name
,
'merchant_name'
=>
$m
erchant_
name
,
'phone'
=>
$phone
,
'openid'
=>
$muser
->
openid
??
''
,
'avatar'
=>
$muser
->
avatar
?
env
(
'IMAGE_URL'
)
.
$muser
->
avatar
:
env
(
'NO_AVATAR_IMAGE_URL'
),
'merchant_id'
=>
$muser
->
merchant_id
,
'buycode'
=>
$buycode
,
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Api/StoreController.php
View file @
da3a04d6
...
...
@@ -51,8 +51,8 @@ public function checkDistance(Request $request)
->
select
([
'id'
,
'title'
,
'lat_lng'
,
'distance'
])
->
get
();
foreach
(
$list
as
$key
=>
$val
)
{
$atng
=
$val
->
lat_lng
?
explode
(
','
,
$val
->
lat_lng
)
:
[];
$lat2
=
$atng
[
1
];
$lng2
=
$atng
[
0
];
$lat2
=
$atng
[
0
];
$lng2
=
$atng
[
1
];
$res
=
(
$lat1
&&
$lat2
)
?
$this
->
haversineDistance
(
$lat1
,
$lng1
,
$lat2
,
$lng2
)
:
''
;
if
(
$res
<=
$val
->
distance
)
{
$flag
=
true
;
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Api/UserController.php
View file @
da3a04d6
...
...
@@ -96,7 +96,7 @@ public function showShoppingCart(Request $request)
foreach
(
$shoppingCart
as
$key
=>
$item
)
{
$tmp
=
[];
$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
)
{
unset
(
$shoppingCart
[
$key
]);
continue
;
...
...
@@ -172,7 +172,7 @@ public function info(Request $request)
return
$this
->
JsonResponse
([
'user_id'
=>
$user
->
id
,
'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_sec'
=>
$user
->
phone
?
substr
(
$user
->
phone
,
0
,
3
)
.
"****"
.
substr
(
$user
->
phone
,
7
)
:
''
,
//'status' => $user->status,
...
...
This diff is collapsed.
Click to expand it.
app/Models/User.php
View file @
da3a04d6
...
...
@@ -7,11 +7,14 @@
use
Illuminate\Foundation\Auth\User
as
Authenticatable
;
use
Illuminate\Notifications\Notifiable
;
use
Laravel\Sanctum\HasApiTokens
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
use
Dcat\Admin\Traits\HasDateTimeFormatter
;
class
User
extends
Authenticatable
{
use
HasApiTokens
,
HasFactory
,
Notifiable
;
use
HasDateTimeFormatter
;
use
SoftDeletes
;
public
const
USER_STATUS
=
[
...
...
This diff is collapsed.
Click to expand it.
routes/api.php
View file @
da3a04d6
...
...
@@ -23,7 +23,7 @@
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'
);
//测试登录
...
...
@@ -80,6 +80,8 @@
Route
::
get
(
'merchant-info'
,
'StoreAdminUsersController@info'
);
//获取商户端用户资料
Route
::
post
(
'merchant-login'
,
'LoginController@merchantLogin'
);
//商户端授权登录
Route
::
get
(
'logout'
,
'LoginController@logout'
);
//登出
Route
::
get
(
'home'
,
'UserController@home'
);
//首页数据
...
...
This diff is collapsed.
Click to expand it.
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