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
54d948a1
Commit
54d948a1
authored
Sep 29, 2024
by
lizhilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
c08df54b
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
38 additions
and
63 deletions
+38
-63
app/Admin/Controllers/MerchantGoodsStoreController.php
+11
-14
app/Admin/Controllers/OrderInfoController.php
+2
-3
app/Admin/Controllers/ShareController.php
+10
-2
app/Admin/Forms/MerchantStoreForms.php
+2
-1
app/Admin/Renderable/MerchantStoreSkuList.php
+2
-2
app/Http/Controllers/Api/CommentController.php
+3
-2
app/Http/Controllers/Api/GoodController.php
+1
-1
app/Http/Controllers/Api/MerchantController.php
+2
-2
app/Http/Controllers/Api/StoreAdminUsersController.php
+3
-1
app/Models/OrderDivideRecord.php
+1
-1
app/Models/Pay.php
+1
-1
app/Models/User.php
+0
-33
No files found.
app/Admin/Controllers/MerchantGoodsStoreController.php
View file @
54d948a1
...
@@ -95,20 +95,7 @@ protected function form()
...
@@ -95,20 +95,7 @@ protected function form()
$form
->
display
(
'id'
);
$form
->
display
(
'id'
);
$form
->
select
(
'merchant_id'
,
'商家名称'
)
->
options
(
Merchant
::
whereNull
(
'deleted_at'
)
->
get
()
->
pluck
(
'name'
,
'id'
))
->
rules
(
'required'
);
//->load('merchat_id', '/get-merchat-list');
$form
->
select
(
'merchant_id'
,
'商家名称'
)
->
options
(
Merchant
::
whereNull
(
'deleted_at'
)
->
get
()
->
pluck
(
'name'
,
'id'
))
->
rules
(
'required'
);
//->load('merchat_id', '/get-merchat-list');
$form
->
select
(
'goods_id'
,
'添加商品'
)
->
options
((
new
Good
())
->
limit
(
100
)
->
get
()
->
pluck
(
'goods_name'
,
'id'
))
->
rules
(
'required'
);
//->load('merchat_id', '/get-merchat-list');
$form
->
select
(
'goods_id'
,
'添加商品'
)
->
options
((
new
Good
())
->
limit
(
100
)
->
get
()
->
pluck
(
'goods_name'
,
'id'
))
->
rules
(
'required'
);
//->load('merchat_id', '/get-merchat-list');
// // 城市
// $form->select('city_id', '城市');
// $form->hasMany('store_desc', '添加门店', function (\Dcat\Admin\Widgets\Form $forms) {
// $forms->text('title', '门店名称')->required();
// $forms->text('lat_lng', '经纬度')->help('<a href="https://lbs.amap.com/tools/picker" target="_blank">点击获取高德地图坐标</a>');
// $forms->text('address', '详细地址');
// $forms->text('distance', '配送范围(Km)');
// $forms->image('business_license', '营业执照')
// ->accept('jpg,jpeg,png')
// ->maxSize(4096)
// ->url('upload/merchant')
// ->help('仅支持jpg、jpeg、png格式图片上传')
// ->autoUpload();
// });
$form
->
disableCreatingCheck
();
$form
->
disableCreatingCheck
();
$form
->
disableEditingCheck
();
$form
->
disableEditingCheck
();
...
@@ -117,6 +104,16 @@ protected function form()
...
@@ -117,6 +104,16 @@ protected function form()
$form
->
disableViewButton
();
$form
->
disableViewButton
();
});
});
$form
->
submitted
(
function
(
Form
$form
)
{
$merchant_id
=
isset
(
$_POST
[
'merchant_id'
])
?
$_POST
[
'merchant_id'
]
:
0
;
$goods_id
=
isset
(
$_POST
[
'goods_id'
])
?
$_POST
[
'goods_id'
]
:
0
;
$count
=
MerchantStore
::
where
([
'goods_id'
=>
$goods_id
,
'merchant_id'
=>
$merchant_id
])
->
count
();
if
(
$count
)
{
$form
->
responseValidationMessages
(
'goods_id'
,
"该商品已添加!"
);
}
});
$form
->
saved
(
$form
->
saved
(
function
(
Form
$form
,
$result
)
{
function
(
Form
$form
,
$result
)
{
$merchant_gid
=
$form
->
getKey
();
$merchant_gid
=
$form
->
getKey
();
...
...
app/Admin/Controllers/OrderInfoController.php
View file @
54d948a1
...
@@ -58,9 +58,8 @@ protected function grid()
...
@@ -58,9 +58,8 @@ protected function grid()
});
});
$grid
->
column
(
'address_id'
,
'送货上门'
)
->
display
(
function
(
$val
)
{
$grid
->
column
(
'address_id'
,
'送货上门'
)
->
display
(
function
(
$val
)
{
$res
=
''
;
$res
=
''
;
if
(
$val
)
{
if
(
$this
->
area
)
{
$obj
=
UserAddress
::
where
(
'id'
,
$val
)
->
first
();
$res
=
$this
->
area
.
"("
.
$this
->
address
.
")"
;
$res
=
$obj
->
area
;
}
}
return
$res
;
return
$res
;
});
});
...
...
app/Admin/Controllers/ShareController.php
View file @
54d948a1
...
@@ -26,7 +26,7 @@ protected function grid()
...
@@ -26,7 +26,7 @@ protected function grid()
$uid
=
request
()
->
get
(
'id'
);
$uid
=
request
()
->
get
(
'id'
);
return
Grid
::
make
(
User
::
with
([
'shuser'
]),
function
(
Grid
$grid
)
use
(
$uid
)
{
return
Grid
::
make
(
User
::
with
([
'shuser'
]),
function
(
Grid
$grid
)
use
(
$uid
)
{
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
model
()
->
where
(
'spuid'
,
$uid
)
->
orderBy
(
'created_at'
,
'DESC'
);
$grid
->
model
()
->
where
(
'spuid'
,
$uid
)
->
or
where
(
'second_spuid'
,
$uid
)
->
or
derBy
(
'created_at'
,
'DESC'
);
//$grid->column('id')->sortable();
//$grid->column('id')->sortable();
$grid
->
column
(
'name'
,
'昵称'
);
$grid
->
column
(
'name'
,
'昵称'
);
$grid
->
column
(
'phone'
,
'手机号'
);
$grid
->
column
(
'phone'
,
'手机号'
);
...
@@ -48,7 +48,15 @@ protected function grid()
...
@@ -48,7 +48,15 @@ protected function grid()
$filter
->
panel
();
$filter
->
panel
();
$filter
->
like
(
'name'
,
'昵称'
)
->
width
(
3
);
$filter
->
like
(
'name'
,
'昵称'
)
->
width
(
3
);
$filter
->
like
(
'phone'
,
'用户手机号'
)
->
width
(
3
);
$filter
->
like
(
'phone'
,
'用户手机号'
)
->
width
(
3
);
$filter
->
equal
(
'sp_type'
,
'直推/间推'
)
->
select
([
'1'
=>
'直推'
,
'2'
=>
'间推'
])
->
width
(
3
);
$filter
->
equal
(
'custom_field'
,
'自定义字段'
)
->
select
([
'1'
=>
'直推'
,
'2'
=>
'间推'
])
->
where
(
function
(
$query
)
{
// 自定义查询逻辑
$sp_type
=
request
(
'sp_type'
);
if
(
$sp_type
==
1
)
{
$query
->
where
(
'spuid'
,
$sp_type
);
}
else
{
$query
->
where
(
'second_spuid'
,
$sp_type
);
}
});
//$filter->between('created_at', '注册时间')->datetime()->width(4);
//$filter->between('created_at', '注册时间')->datetime()->width(4);
});
});
});
});
...
...
app/Admin/Forms/MerchantStoreForms.php
View file @
54d948a1
...
@@ -47,7 +47,7 @@ public function handle(array $input)
...
@@ -47,7 +47,7 @@ public function handle(array $input)
$merStock
=
MerchantGoodSku
::
where
([
'goods_id'
=>
$goods_id
,
'attr_id'
=>
$vv
])
->
sum
(
'stock'
);
$merStock
=
MerchantGoodSku
::
where
([
'goods_id'
=>
$goods_id
,
'attr_id'
=>
$vv
])
->
sum
(
'stock'
);
$surplusStock
=
$gskuObj
->
stock
-
$merStock
;
//可供库存数量
$surplusStock
=
$gskuObj
->
stock
-
$merStock
;
//可供库存数量
$stockNum
=
(
$surplusStock
>=
$stocks
[
$kk
]
&&
$stocks
[
$kk
])
?
(
int
)
$stocks
[
$kk
]
:
0
;
$stockNum
=
(
$surplusStock
>=
$stocks
[
$kk
]
&&
$stocks
[
$kk
])
?
(
int
)
$stocks
[
$kk
]
:
0
;
if
(
$stockNum
)
{
//查下库存记录是否存在
//查下库存记录是否存在
$skuObj
=
MerchantGoodSku
::
where
([
'mgs_id'
=>
$mgs_id
,
'goods_id'
=>
$goods_id
,
'attr_id'
=>
$vv
])
->
first
();
$skuObj
=
MerchantGoodSku
::
where
([
'mgs_id'
=>
$mgs_id
,
'goods_id'
=>
$goods_id
,
'attr_id'
=>
$vv
])
->
first
();
if
(
$skuObj
)
{
if
(
$skuObj
)
{
...
@@ -70,6 +70,7 @@ public function handle(array $input)
...
@@ -70,6 +70,7 @@ public function handle(array $input)
$logData
[
$kk
][
'change'
]
=
$stockNum
;
$logData
[
$kk
][
'change'
]
=
$stockNum
;
$logData
[
$kk
][
'created_at'
]
=
date
(
'Y-m-d H:i:s'
);
$logData
[
$kk
][
'created_at'
]
=
date
(
'Y-m-d H:i:s'
);
}
}
}
$this
->
addStoreLog
(
$logData
);
$this
->
addStoreLog
(
$logData
);
return
$this
return
$this
...
...
app/Admin/Renderable/MerchantStoreSkuList.php
View file @
54d948a1
...
@@ -22,8 +22,8 @@ public function grid(): Grid
...
@@ -22,8 +22,8 @@ public function grid(): Grid
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
model
()
->
where
(
'mgs_id'
,
$mgs_id
);
$grid
->
model
()
->
where
(
'mgs_id'
,
$mgs_id
);
$grid
->
column
(
'attr.attr_val'
,
'规格'
);
$grid
->
column
(
'attr.attr_val'
,
'规格'
);
//
$grid->column('attr.market_price', '零售价');
$grid
->
column
(
'attr.market_price'
,
'零售价'
);
//
$grid->column('attr.cg_price', '代购价');
$grid
->
column
(
'attr.cg_price'
,
'代购价'
);
$grid
->
column
(
'stock'
,
'剩余库存'
);
$grid
->
column
(
'stock'
,
'剩余库存'
);
$grid
->
disableCreateButton
();
$grid
->
disableCreateButton
();
...
...
app/Http/Controllers/Api/CommentController.php
View file @
54d948a1
...
@@ -47,9 +47,10 @@ public function add(Request $request)
...
@@ -47,9 +47,10 @@ public function add(Request $request)
DB
::
commit
();
DB
::
commit
();
//2分钟执行订单分佣
//2分钟执行订单分佣
$count
=
OrderGoods
::
where
(
'order_id'
,
$oid
)
->
where
(
'is_comment'
,
0
)
->
count
();
$count
=
OrderGoods
::
where
(
'order_id'
,
$oid
)
->
where
(
'is_comment'
,
0
)
->
count
();
//
Log::add('订单商品评论' . $og_id, ['num' => $count]);
Log
::
add
(
'订单商品评论'
.
$og_id
,
[
'num'
=>
$count
]);
if
(
$count
==
0
)
{
if
(
$count
==
0
)
{
$this
->
dispatch
(
new
AutoCompleteOrder
(
$orderObj
,
120
));
Log
::
add
(
'调用分佣'
,
$orderObj
->
toArray
());
$this
->
dispatch
(
new
AutoCompleteOrder
(
$orderObj
,
10
));
}
}
return
$this
->
JsonResponse
(
''
);
return
$this
->
JsonResponse
(
''
);
}
catch
(
\Exception
$exception
)
{
}
catch
(
\Exception
$exception
)
{
...
...
app/Http/Controllers/Api/GoodController.php
View file @
54d948a1
...
@@ -262,7 +262,7 @@ public function getDetail(Request $request)
...
@@ -262,7 +262,7 @@ public function getDetail(Request $request)
$data
=
[
$data
=
[
'id'
=>
$goods
->
id
,
'id'
=>
$goods
->
id
,
'goods_img'
=>
$cover
,
'goods_img'
=>
$cover
,
'
dg_price'
=>
$dg
_price
,
'
goods_price'
=>
$mer_id
?
$dg_price
:
$market
_price
,
'market_price'
=>
$market_price
,
'market_price'
=>
$market_price
,
'stock'
=>
$stock
,
'stock'
=>
$stock
,
'goods_name'
=>
$goods
->
goods_name
,
'goods_name'
=>
$goods
->
goods_name
,
...
...
app/Http/Controllers/Api/MerchantController.php
View file @
54d948a1
...
@@ -13,9 +13,9 @@ class MerchantController extends BaseController
...
@@ -13,9 +13,9 @@ class MerchantController extends BaseController
//绑定直购码用户列表
//绑定直购码用户列表
public
function
getUserList
(
Request
$request
)
public
function
getUserList
(
Request
$request
)
{
{
$mer_id
=
$request
->
user
()
->
id
;
$mer_id
=
$request
->
user
()
->
merchant_
id
;
$merObj
=
Merchant
::
where
(
'id'
,
$mer_id
)
->
first
();
$merObj
=
Merchant
::
where
(
'id'
,
$mer_id
)
->
first
();
$buycode
=
$merObj
->
buycode
;
$buycode
=
$merObj
->
buycode
??
''
;
if
(
!
$buycode
)
{
if
(
!
$buycode
)
{
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
}
}
...
...
app/Http/Controllers/Api/StoreAdminUsersController.php
View file @
54d948a1
...
@@ -68,6 +68,7 @@ public function info(Request $request)
...
@@ -68,6 +68,7 @@ public function info(Request $request)
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
;
$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
;
...
@@ -75,12 +76,13 @@ public function info(Request $request)
...
@@ -75,12 +76,13 @@ public function info(Request $request)
if
(
$store_id
)
{
if
(
$store_id
)
{
$storeObj
=
Store
::
where
(
'id'
,
$store_id
)
->
first
();
$storeObj
=
Store
::
where
(
'id'
,
$store_id
)
->
first
();
$store_name
=
$storeObj
->
title
;
$store_name
=
$storeObj
->
title
;
$phone
=
$storeObj
->
phone
;
}
}
return
$this
->
JsonResponse
([
return
$this
->
JsonResponse
([
'user_id'
=>
$muser
->
id
,
'user_id'
=>
$muser
->
id
,
'username'
=>
$muser
->
username
,
'username'
=>
$muser
->
username
,
'merchant_name'
=>
$muser
->
name
,
'merchant_name'
=>
$muser
->
name
,
'phone'
=>
$
muser
->
phone
,
'phone'
=>
$phone
,
'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/Models/OrderDivideRecord.php
View file @
54d948a1
...
@@ -71,7 +71,7 @@ public static function divide($order_id)
...
@@ -71,7 +71,7 @@ public static function divide($order_id)
}
}
}
}
public
function
addRecord
(
$og_id
,
$order_id
,
$goods_amount
,
$divide_price
,
$commission
,
$um_id
,
$user_id
,
$sh_type
)
public
static
function
addRecord
(
$og_id
,
$order_id
,
$goods_amount
,
$divide_price
,
$commission
,
$um_id
,
$user_id
,
$sh_type
)
{
{
$recordObj
=
new
self
();
$recordObj
=
new
self
();
$recordObj
->
order_id
=
$order_id
;
$recordObj
->
order_id
=
$order_id
;
...
...
app/Models/Pay.php
View file @
54d948a1
...
@@ -103,7 +103,7 @@ public static function payNotify($fields = [])
...
@@ -103,7 +103,7 @@ public static function payNotify($fields = [])
//商户规格库存
//商户规格库存
$mgsObj
=
MerchantGoodSku
::
where
([
'goods_id'
=>
$gid
,
'attr_id'
=>
$attr_id
,
'merchant_id'
=>
$mer_id
])
->
first
();
$mgsObj
=
MerchantGoodSku
::
where
([
'goods_id'
=>
$gid
,
'attr_id'
=>
$attr_id
,
'merchant_id'
=>
$mer_id
])
->
first
();
if
(
$mer_id
&&
$mgsObj
)
{
if
(
$mer_id
&&
$mgsObj
)
{
$changeStock
=
(
$mgsObj
->
stock
>=
$
attr_stock
)
?
$mgsObj
->
stock
-
$attr_stock
:
0
;
$changeStock
=
(
$mgsObj
->
stock
>=
$
goods_number
)
?
$mgsObj
->
stock
-
$goods_number
:
0
;
$mgsObj
->
stock
=
$changeStock
;
$mgsObj
->
stock
=
$changeStock
;
$mgsObj
->
save
();
$mgsObj
->
save
();
}
}
...
...
app/Models/User.php
View file @
54d948a1
...
@@ -12,40 +12,7 @@ class User extends Authenticatable
...
@@ -12,40 +12,7 @@ class User extends Authenticatable
{
{
use
HasApiTokens
,
HasFactory
,
Notifiable
;
use
HasApiTokens
,
HasFactory
,
Notifiable
;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected
$fillable
=
[
'name'
,
'email'
,
'password'
,
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected
$hidden
=
[
'password'
,
'remember_token'
,
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected
$casts
=
[
'email_verified_at'
=>
'datetime'
,
];
public
const
USER_ROLE
=
[
1
=>
'客户'
,
2
=>
'代理商'
,
];
public
const
USER_STATUS
=
[
public
const
USER_STATUS
=
[
0
=>
'审核中'
,
0
=>
'审核中'
,
...
...
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