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
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
57 additions
and
82 deletions
+57
-82
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
+21
-20
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()
$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
(
'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
->
disableEditingCheck
();
...
...
@@ -117,6 +104,16 @@ protected function form()
$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
(
function
(
Form
$form
,
$result
)
{
$merchant_gid
=
$form
->
getKey
();
...
...
app/Admin/Controllers/OrderInfoController.php
View file @
54d948a1
...
...
@@ -58,9 +58,8 @@ protected function grid()
});
$grid
->
column
(
'address_id'
,
'送货上门'
)
->
display
(
function
(
$val
)
{
$res
=
''
;
if
(
$val
)
{
$obj
=
UserAddress
::
where
(
'id'
,
$val
)
->
first
();
$res
=
$obj
->
area
;
if
(
$this
->
area
)
{
$res
=
$this
->
area
.
"("
.
$this
->
address
.
")"
;
}
return
$res
;
});
...
...
app/Admin/Controllers/ShareController.php
View file @
54d948a1
...
...
@@ -26,7 +26,7 @@ protected function grid()
$uid
=
request
()
->
get
(
'id'
);
return
Grid
::
make
(
User
::
with
([
'shuser'
]),
function
(
Grid
$grid
)
use
(
$uid
)
{
$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
(
'name'
,
'昵称'
);
$grid
->
column
(
'phone'
,
'手机号'
);
...
...
@@ -48,7 +48,15 @@ protected function grid()
$filter
->
panel
();
$filter
->
like
(
'name'
,
'昵称'
)
->
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);
});
});
...
...
app/Admin/Forms/MerchantStoreForms.php
View file @
54d948a1
...
...
@@ -47,28 +47,29 @@ public function handle(array $input)
$merStock
=
MerchantGoodSku
::
where
([
'goods_id'
=>
$goods_id
,
'attr_id'
=>
$vv
])
->
sum
(
'stock'
);
$surplusStock
=
$gskuObj
->
stock
-
$merStock
;
//可供库存数量
$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
();
if
(
$skuObj
)
{
$skuObj
->
stock
+=
$stockNum
;
$skuObj
->
save
();
}
else
{
$skuObj
=
new
MerchantGoodSku
();
$skuObj
->
mgs_id
=
$mgs_id
;
$skuObj
->
merchant_id
=
$merchant_id
;
$skuObj
->
goods_id
=
$goods_id
;
$skuObj
->
attr_id
=
$vv
;
$skuObj
->
stock
=
$stockNum
;
$skuObj
->
save
();
}
//查下库存记录是否存在
$skuObj
=
MerchantGoodSku
::
where
([
'mgs_id'
=>
$mgs_id
,
'goods_id'
=>
$goods_id
,
'attr_id'
=>
$vv
])
->
first
();
if
(
$skuObj
)
{
$skuObj
->
stock
+=
$stockNum
;
$skuObj
->
save
();
}
else
{
$skuObj
=
new
MerchantGoodSku
();
$skuObj
->
mgs_id
=
$mgs_id
;
$skuObj
->
merchant_id
=
$merchant_id
;
$skuObj
->
goods_id
=
$goods_id
;
$skuObj
->
attr_id
=
$vv
;
$skuObj
->
stock
=
$stockNum
;
$skuObj
->
save
();
//记录操作日志
$logData
[
$kk
][
'mgs_id'
]
=
$mgs_id
;
$logData
[
$kk
][
'goods_id'
]
=
$goods_id
;
$logData
[
$kk
][
'attr_id'
]
=
$gskuObj
->
id
;
$logData
[
$kk
][
'change'
]
=
$stockNum
;
$logData
[
$kk
][
'created_at'
]
=
date
(
'Y-m-d H:i:s'
);
}
//记录操作日志
$logData
[
$kk
][
'mgs_id'
]
=
$mgs_id
;
$logData
[
$kk
][
'goods_id'
]
=
$goods_id
;
$logData
[
$kk
][
'attr_id'
]
=
$gskuObj
->
id
;
$logData
[
$kk
][
'change'
]
=
$stockNum
;
$logData
[
$kk
][
'created_at'
]
=
date
(
'Y-m-d H:i:s'
);
}
$this
->
addStoreLog
(
$logData
);
...
...
app/Admin/Renderable/MerchantStoreSkuList.php
View file @
54d948a1
...
...
@@ -22,8 +22,8 @@ public function grid(): Grid
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
model
()
->
where
(
'mgs_id'
,
$mgs_id
);
$grid
->
column
(
'attr.attr_val'
,
'规格'
);
//
$grid->column('attr.market_price', '零售价');
//
$grid->column('attr.cg_price', '代购价');
$grid
->
column
(
'attr.market_price'
,
'零售价'
);
$grid
->
column
(
'attr.cg_price'
,
'代购价'
);
$grid
->
column
(
'stock'
,
'剩余库存'
);
$grid
->
disableCreateButton
();
...
...
app/Http/Controllers/Api/CommentController.php
View file @
54d948a1
...
...
@@ -47,9 +47,10 @@ public function add(Request $request)
DB
::
commit
();
//2分钟执行订单分佣
$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
)
{
$this
->
dispatch
(
new
AutoCompleteOrder
(
$orderObj
,
120
));
Log
::
add
(
'调用分佣'
,
$orderObj
->
toArray
());
$this
->
dispatch
(
new
AutoCompleteOrder
(
$orderObj
,
10
));
}
return
$this
->
JsonResponse
(
''
);
}
catch
(
\Exception
$exception
)
{
...
...
app/Http/Controllers/Api/GoodController.php
View file @
54d948a1
...
...
@@ -262,7 +262,7 @@ public function getDetail(Request $request)
$data
=
[
'id'
=>
$goods
->
id
,
'goods_img'
=>
$cover
,
'
dg_price'
=>
$dg
_price
,
'
goods_price'
=>
$mer_id
?
$dg_price
:
$market
_price
,
'market_price'
=>
$market_price
,
'stock'
=>
$stock
,
'goods_name'
=>
$goods
->
goods_name
,
...
...
app/Http/Controllers/Api/MerchantController.php
View file @
54d948a1
...
...
@@ -13,9 +13,9 @@ class MerchantController extends BaseController
//绑定直购码用户列表
public
function
getUserList
(
Request
$request
)
{
$mer_id
=
$request
->
user
()
->
id
;
$mer_id
=
$request
->
user
()
->
merchant_
id
;
$merObj
=
Merchant
::
where
(
'id'
,
$mer_id
)
->
first
();
$buycode
=
$merObj
->
buycode
;
$buycode
=
$merObj
->
buycode
??
''
;
if
(
!
$buycode
)
{
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
}
...
...
app/Http/Controllers/Api/StoreAdminUsersController.php
View file @
54d948a1
...
...
@@ -68,6 +68,7 @@ public function info(Request $request)
if
(
$merchant_id
)
{
$merObj
=
Merchant
::
where
(
'id'
,
$merchant_id
)
->
first
();
$buycode
=
$merObj
->
buycode
;
$phone
=
$merObj
->
phone
;
$total_revenue
=
$merObj
->
total_revenue
??
0
;
$balance
=
$merObj
->
balance
??
0
;
$cashout
=
$total_revenue
-
$balance
;
...
...
@@ -75,12 +76,13 @@ public function info(Request $request)
if
(
$store_id
)
{
$storeObj
=
Store
::
where
(
'id'
,
$store_id
)
->
first
();
$store_name
=
$storeObj
->
title
;
$phone
=
$storeObj
->
phone
;
}
return
$this
->
JsonResponse
([
'user_id'
=>
$muser
->
id
,
'username'
=>
$muser
->
username
,
'merchant_name'
=>
$muser
->
name
,
'phone'
=>
$
muser
->
phone
,
'phone'
=>
$phone
,
'avatar'
=>
$muser
->
avatar
?
env
(
'IMAGE_URL'
)
.
$muser
->
avatar
:
env
(
'NO_AVATAR_IMAGE_URL'
),
'merchant_id'
=>
$muser
->
merchant_id
,
'buycode'
=>
$buycode
,
...
...
app/Models/OrderDivideRecord.php
View file @
54d948a1
...
...
@@ -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
->
order_id
=
$order_id
;
...
...
app/Models/Pay.php
View file @
54d948a1
...
...
@@ -103,7 +103,7 @@ public static function payNotify($fields = [])
//商户规格库存
$mgsObj
=
MerchantGoodSku
::
where
([
'goods_id'
=>
$gid
,
'attr_id'
=>
$attr_id
,
'merchant_id'
=>
$mer_id
])
->
first
();
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
->
save
();
}
...
...
app/Models/User.php
View file @
54d948a1
...
...
@@ -12,40 +12,7 @@ class User extends Authenticatable
{
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
=
[
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